Merge pull request #7 from Aurorastation/dev

New file extension (.ss13records), bumps version to 2.1.*
This commit is contained in:
Llywelwyn 2022-08-17 11:57:54 +01:00 committed by GitHub
commit af30126621
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 13 deletions

View file

@ -50,5 +50,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.*")] [assembly: AssemblyVersion("2.1.*")]
[assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyFileVersion("1.1.0.0")]

View file

@ -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);

View file

@ -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>();