defaults to new extension (.ss13records)
- able to open new and outdated filetypes - defaults to saving as new filetype - attempting to save using outdated filetype will prompt to convert
This commit is contained in:
parent
18fe41b09f
commit
f553afdb73
2 changed files with 24 additions and 12 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
using MahApps.Metro.Controls.Dialogs;
|
using MahApps.Metro.Controls.Dialogs;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|
@ -94,6 +94,24 @@ namespace CharacterRecordsGenerator
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// have a path, outdated extension
|
||||||
|
if (Path.GetExtension(_currentFilePath) != ".ss13records")
|
||||||
|
{
|
||||||
|
switch (
|
||||||
|
await
|
||||||
|
this.ShowMessageAsync("Outdated File Extension",
|
||||||
|
"This profile is using an outdated extension from an older version of the CRG. Press \"OK\" to convert to the new file extension (.ss13records).",
|
||||||
|
MessageDialogStyle.AffirmativeAndNegative))
|
||||||
|
{
|
||||||
|
case MessageDialogResult.Affirmative:
|
||||||
|
SaveContentAs(null, null);
|
||||||
|
return;
|
||||||
|
case MessageDialogResult.Negative:
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var fs = File.Open(_currentFilePath, FileMode.Truncate);
|
var fs = File.Open(_currentFilePath, FileMode.Truncate);
|
||||||
ProtoBuf.Serializer.Serialize(fs, Data);
|
ProtoBuf.Serializer.Serialize(fs, Data);
|
||||||
|
|
@ -107,7 +125,8 @@ namespace CharacterRecordsGenerator
|
||||||
AddExtension = true,
|
AddExtension = true,
|
||||||
CheckFileExists = true,
|
CheckFileExists = true,
|
||||||
CheckPathExists = true,
|
CheckPathExists = true,
|
||||||
Filter = "Character Profiles (*.ss13prof)|*.ss13prof|All Files (*.*)|*.*"
|
Filter = "Character Profiles (*.ss13records, *.ss13prof)|*.ss13records;*.ss13prof|"
|
||||||
|
+ "All Files (*.*)|*.*"
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!(dialog.ShowDialog() ?? false)) return;
|
if (!(dialog.ShowDialog() ?? false)) return;
|
||||||
|
|
@ -133,7 +152,8 @@ namespace CharacterRecordsGenerator
|
||||||
{
|
{
|
||||||
AddExtension = true,
|
AddExtension = true,
|
||||||
CheckPathExists = true,
|
CheckPathExists = true,
|
||||||
Filter = "Character Profiles (*.ss13prof)|*.ss13prof|All Files (*.*)|*.*"
|
Filter = "Character Profiles (*.ss13records)|*.ss13records|"
|
||||||
|
+ "All Files (*.*)|*.*"
|
||||||
};
|
};
|
||||||
if (!(dialog.ShowDialog() ?? false)) return;
|
if (!(dialog.ShowDialog() ?? false)) return;
|
||||||
var fs = File.Open(dialog.FileName, FileMode.Create);
|
var fs = File.Open(dialog.FileName, FileMode.Create);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
@ -53,14 +53,6 @@ namespace CharacterRecordsGenerator
|
||||||
return builder.ToString();
|
return builder.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns true if the specified species has gender.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="species"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool HasGender(this SpeciesType species) =>
|
|
||||||
!(species == SpeciesType.Diona || species == SpeciesType.IPC || species == SpeciesType.Vaurca);
|
|
||||||
|
|
||||||
public static string SubspeciesNiceName(SpeciesSubType species)
|
public static string SubspeciesNiceName(SpeciesSubType species)
|
||||||
{
|
{
|
||||||
var attr = species.GetAttributeOfType<SubspeciesMetaAttribute>();
|
var attr = species.GetAttributeOfType<SubspeciesMetaAttribute>();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue