Skip to content

Commit

Permalink
Merge pull request #7 from Aurorastation/dev
Browse files Browse the repository at this point in the history
New file extension (.ss13records), bumps version to 2.1.*
  • Loading branch information
Llywelwyn authored Aug 17, 2022
2 parents 18fe41b + cfa0792 commit af30126
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CharacterRecordsGenerator/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@
// 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")]
26 changes: 23 additions & 3 deletions CharacterRecordsGenerator/RecordEditor.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using MahApps.Metro.Controls.Dialogs;
using MahApps.Metro.Controls.Dialogs;
using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand Down Expand Up @@ -94,6 +94,24 @@ private async void SaveContent(object sender, RoutedEventArgs e)
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);
Expand All @@ -107,7 +125,8 @@ private async void OpenContent(object sender, RoutedEventArgs e)
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;
Expand All @@ -133,7 +152,8 @@ private void SaveContentAs(object sender, RoutedEventArgs e)
{
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);
Expand Down
10 changes: 1 addition & 9 deletions CharacterRecordsGenerator/Utility.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
Expand Down Expand Up @@ -53,14 +53,6 @@ public static string Repeat(this string target, int repeatNum)
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)
{
var attr = species.GetAttributeOfType<SubspeciesMetaAttribute>();
Expand Down

0 comments on commit af30126

Please sign in to comment.