From f553afdb73b4d1c36dae2b996f49209373351cc7 Mon Sep 17 00:00:00 2001 From: Llywelwyn Date: Wed, 17 Aug 2022 11:53:28 +0100 Subject: [PATCH 1/2] 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 --- .../RecordEditor.xaml.cs | 26 ++++++++++++++++--- CharacterRecordsGenerator/Utility.cs | 10 +------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/CharacterRecordsGenerator/RecordEditor.xaml.cs b/CharacterRecordsGenerator/RecordEditor.xaml.cs index 5fea787..93e2939 100644 --- a/CharacterRecordsGenerator/RecordEditor.xaml.cs +++ b/CharacterRecordsGenerator/RecordEditor.xaml.cs @@ -1,4 +1,4 @@ -using MahApps.Metro.Controls.Dialogs; +using MahApps.Metro.Controls.Dialogs; using System; using System.Collections.Generic; using System.Diagnostics; @@ -94,6 +94,24 @@ namespace CharacterRecordsGenerator 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); ProtoBuf.Serializer.Serialize(fs, Data); @@ -107,7 +125,8 @@ namespace CharacterRecordsGenerator AddExtension = true, CheckFileExists = true, CheckPathExists = true, - Filter = "Character Profiles (*.ss13prof)|*.ss13prof|All Files (*.*)|*.*" + Filter = "Character Profiles (*.ss13records, *.ss13prof)|*.ss13records;*.ss13prof|" + + "All Files (*.*)|*.*" }; if (!(dialog.ShowDialog() ?? false)) return; @@ -133,7 +152,8 @@ namespace CharacterRecordsGenerator { AddExtension = true, CheckPathExists = true, - Filter = "Character Profiles (*.ss13prof)|*.ss13prof|All Files (*.*)|*.*" + Filter = "Character Profiles (*.ss13records)|*.ss13records|" + + "All Files (*.*)|*.*" }; if (!(dialog.ShowDialog() ?? false)) return; var fs = File.Open(dialog.FileName, FileMode.Create); diff --git a/CharacterRecordsGenerator/Utility.cs b/CharacterRecordsGenerator/Utility.cs index 1ca1c22..ce35588 100644 --- a/CharacterRecordsGenerator/Utility.cs +++ b/CharacterRecordsGenerator/Utility.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -53,14 +53,6 @@ namespace CharacterRecordsGenerator return builder.ToString(); } - /// - /// Returns true if the specified species has gender. - /// - /// - /// - public static bool HasGender(this SpeciesType species) => - !(species == SpeciesType.Diona || species == SpeciesType.IPC || species == SpeciesType.Vaurca); - public static string SubspeciesNiceName(SpeciesSubType species) { var attr = species.GetAttributeOfType(); From 26437fa1c7aa297e95fb947e0b3a2d1ef379c471 Mon Sep 17 00:00:00 2001 From: Llywelwyn Date: Wed, 17 Aug 2022 11:54:05 +0100 Subject: [PATCH 2/2] bumps assemblyver 2.1.* --- CharacterRecordsGenerator/Properties/AssemblyInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CharacterRecordsGenerator/Properties/AssemblyInfo.cs b/CharacterRecordsGenerator/Properties/AssemblyInfo.cs index b5f2239..ecb6441 100644 --- a/CharacterRecordsGenerator/Properties/AssemblyInfo.cs +++ b/CharacterRecordsGenerator/Properties/AssemblyInfo.cs @@ -50,5 +50,5 @@ using System.Windows; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.0.*")] +[assembly: AssemblyVersion("2.1.*")] [assembly: AssemblyFileVersion("1.1.0.0")]