diff --git a/AuroraRecordGenerator/App.xaml.cs b/AuroraRecordGenerator/App.xaml.cs index 4f57d35..1f8bb50 100644 --- a/AuroraRecordGenerator/App.xaml.cs +++ b/AuroraRecordGenerator/App.xaml.cs @@ -8,10 +8,10 @@ using System.Windows; namespace AuroraRecordGenerator { - /// - /// Interaction logic for App.xaml - /// - public partial class App : Application - { - } + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } } diff --git a/AuroraRecordGenerator/GeneratedResultWindow.xaml.cs b/AuroraRecordGenerator/GeneratedResultWindow.xaml.cs index 6581d4a..87516a9 100644 --- a/AuroraRecordGenerator/GeneratedResultWindow.xaml.cs +++ b/AuroraRecordGenerator/GeneratedResultWindow.xaml.cs @@ -1,18 +1,18 @@ namespace AuroraRecordGenerator { - public partial class GeneratedResultWindow - { - public GeneratedResultWindow() - { - InitializeComponent(); - } + public partial class GeneratedResultWindow + { + public GeneratedResultWindow() + { + InitializeComponent(); + } - public GeneratedResultWindow(Record record) : this() - { - var formatter = new RecordFormatter(record); - EmploymentBox.Text = formatter.EmploymentRecords; - MedicalBox.Text = formatter.MedicalRecords; - SecurityBox.Text = formatter.SecurityRecords; - } - } + public GeneratedResultWindow(Record record) : this() + { + var formatter = new RecordFormatter(record); + EmploymentBox.Text = formatter.EmploymentRecords; + MedicalBox.Text = formatter.MedicalRecords; + SecurityBox.Text = formatter.SecurityRecords; + } + } } diff --git a/AuroraRecordGenerator/Properties/AssemblyInfo.cs b/AuroraRecordGenerator/Properties/AssemblyInfo.cs index 2972932..e74465b 100644 --- a/AuroraRecordGenerator/Properties/AssemblyInfo.cs +++ b/AuroraRecordGenerator/Properties/AssemblyInfo.cs @@ -30,12 +30,12 @@ using System.Windows; [assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) )] diff --git a/AuroraRecordGenerator/Record.cs b/AuroraRecordGenerator/Record.cs index 8d0b461..bcb6ba4 100644 --- a/AuroraRecordGenerator/Record.cs +++ b/AuroraRecordGenerator/Record.cs @@ -3,118 +3,115 @@ using ProtoBuf; namespace AuroraRecordGenerator { - [ProtoContract] - public class Record - { - // Defaults defined here will automatically populate the form on program load - [ProtoMember(1)] - public string FirstName { get; set; } = string.Empty; + [ProtoContract] + public class Record + { + // Defaults defined here will automatically populate the form on program load + [ProtoMember(1)] + public string FirstName { get; set; } = string.Empty; - [ProtoMember(2)] - public string MiddleName { get; set; } = string.Empty; + [ProtoMember(2)] + public string MiddleName { get; set; } = string.Empty; - [ProtoMember(3)] - public string LastName { get; set; } = string.Empty; + [ProtoMember(3)] + public string LastName { get; set; } = string.Empty; - [ProtoMember(4)] - public string NameSuffix { get; set; } = string.Empty; + [ProtoMember(4)] + public string NameSuffix { get; set; } = string.Empty; - [ProtoMember(5, IsRequired = true)] - public SpeciesType Species { get; set; } = SpeciesType.Human; + [ProtoMember(5, IsRequired = true)] + public SpeciesType Species { get; set; } = SpeciesType.Human; - [ProtoMember(16)] - public SpeciesSubType Subspecies { get; set; } = SpeciesSubType.None; + [ProtoMember(16)] + public SpeciesSubType Subspecies { get; set; } = SpeciesSubType.None; - [ProtoMember(6, IsRequired = true)] - public GenderType Gender { get; set; } + [ProtoMember(6, IsRequired = true)] + public GenderType Gender { get; set; } - [ProtoMember(7)] - public DateTime BirthDate { get; set; } = Info.IcDate; + [ProtoMember(7)] + public DateTime BirthDate { get; set; } = Info.IcDate; - [ProtoMember(8)] - public double? CharHeight { get; set; } = 170; + [ProtoMember(8)] + public double? CharHeight { get; set; } = 170; - [ProtoMember(9)] - public double? Weight { get; set; } = 70; + [ProtoMember(9)] + public double? Weight { get; set; } = 70; - [ProtoMember(10)] - public string SkinColor { get; set; } = string.Empty; + [ProtoMember(10)] + public string SkinColor { get; set; } = string.Empty; - [ProtoMember(11)] - public string EyeColor { get; set; } = string.Empty; + [ProtoMember(11)] + public string EyeColor { get; set; } = string.Empty; - [ProtoMember(12)] - public string DistinguishingFeatures { get; set; } = string.Empty; + [ProtoMember(12)] + public string DistinguishingFeatures { get; set; } = string.Empty; - [ProtoMember(13)] - public string HairColor { get; set; } = string.Empty; + [ProtoMember(13)] + public string HairColor { get; set; } = string.Empty; - [ProtoMember(14)] - public string EmployedAs { get; set; } = string.Empty; + [ProtoMember(14)] + public string EmployedAs { get; set; } = string.Empty; - [ProtoMember(15)] - public string Citizenship { get; set; } = string.Empty; + [ProtoMember(15)] + public string Citizenship { get; set; } = string.Empty; - // 16 & 17 used to be PictureUrl and PictureCredit, now unused. + // 16 & 17 used to be PictureUrl and PictureCredit, now unused. - [ProtoMember(18)] - public string Clearance { get; set; } = string.Empty; + [ProtoMember(18)] + public string Clearance { get; set; } = string.Empty; - [ProtoMember(19)] - public string MedicalPublicRecord { get; set; } = string.Empty; + [ProtoMember(19)] + public string MedicalPublicRecord { get; set; } = string.Empty; - [ProtoMember(20)] - public string MedicalHistory { get; set; } = string.Empty; + [ProtoMember(20)] + public string MedicalHistory { get; set; } = string.Empty; - [ProtoMember(21)] - public string MedicalNotes { get; set; } = string.Empty; + [ProtoMember(21)] + public string MedicalNotes { get; set; } = string.Empty; - [ProtoMember(22)] - public string MedicalPsychHistory { get; set; } = string.Empty; + [ProtoMember(22)] + public string MedicalPsychHistory { get; set; } = string.Empty; - [ProtoMember(23)] - public string MedicalPsychNotes { get; set; } = string.Empty; + [ProtoMember(23)] + public string MedicalPsychNotes { get; set; } = string.Empty; - [ProtoMember(24)] - public bool NoBorg { get; set; } = false; + [ProtoMember(24)] + public bool NoBorg { get; set; } = false; - [ProtoMember(25)] - public bool NoClone { get; set; } = false; + [ProtoMember(26)] + public bool NoRevive { get; set; } = false; - [ProtoMember(26)] - public bool NoRevive { get; set; } = false; + [ProtoMember(27)] + public bool NoProsthetic { get; set; } = false; - [ProtoMember(27)] - public bool NoProsthetic { get; set; } = false; + [ProtoMember(28)] + public string MedicalPrescriptions { get; set; } = string.Empty; - [ProtoMember(28)] - public string MedicalPrescriptions { get; set; } = string.Empty; + [ProtoMember(29)] + public string SecurityPublicRecord { get; set; } = string.Empty; - [ProtoMember(29)] - public string SecurityPublicRecord { get; set; } = string.Empty; + [ProtoMember(30)] + public string SecurityRecords { get; set; } = string.Empty; - [ProtoMember(30)] - public string SecurityRecords { get; set; } = string.Empty; + [ProtoMember(31)] + public string SecurityNotes { get; set; } = string.Empty; - [ProtoMember(31)] - public string SecurityNotes { get; set; } = string.Empty; + [ProtoMember(32)] + public string EmploymentPublicRecord { get; set; } = string.Empty; - [ProtoMember(32)] - public string EmploymentPublicRecord { get; set; } = string.Empty; + [ProtoMember(33)] + public string EmploymentExperience { get; set; } = string.Empty; - [ProtoMember(33)] - public string EmploymentExperience { get; set; } = string.Empty; + [ProtoMember(34)] + public string EmploymentPreNtEmployment { get; set; } = string.Empty; - [ProtoMember(34)] - public string EmploymentPreNtEmployment { get; set; } = string.Empty; + [ProtoMember(35)] + public string EmploymentFormalEducation { get; set; } = string.Empty; - [ProtoMember(35)] - public string EmploymentFormalEducation { get; set; } = string.Empty; + [ProtoMember(36)] + public string EmploymentNtEmploymentHistory { get; set; } = string.Empty; - [ProtoMember(36)] - public string EmploymentNtEmploymentHistory { get; set; } = string.Empty; - - [ProtoMember(37)] - public string EmploymentSkills { get; set; } = string.Empty; - } + [ProtoMember(37)] + public string EmploymentSkills { get; set; } = string.Empty; + } } \ No newline at end of file diff --git a/AuroraRecordGenerator/RecordEditor.xaml b/AuroraRecordGenerator/RecordEditor.xaml index f73bfc0..ae9dfe0 100644 --- a/AuroraRecordGenerator/RecordEditor.xaml +++ b/AuroraRecordGenerator/RecordEditor.xaml @@ -248,7 +248,7 @@ - + @@ -260,21 +260,29 @@ - - - + + + + + + + + + HorizontalAlignment="Left" + Margin="-10,10,0,0" + ToolTip="If the character should not be revived." TabIndex="2" Grid.Column="1" /> + + VerticalAlignment="Bottom" Height="10" /> - - - /// Interaction logic for RecordEditor.xaml - /// - public partial class RecordEditor - { - public RecordEditor() - { - // Initialize the record object used for storage and generation - Data = new Record(); - DataContext = Data; - ProtoBuf.Serializer.PrepareSerializer(); - ProtoBuf.Serializer.PrepareSerializer(); - ProtoBuf.Serializer.PrepareSerializer(); - ProtoBuf.Serializer.PrepareSerializer(); - InitializeComponent(); - SubSpeciesCombo.ItemsSource = GetSpeciesOptions(); - VersionLabel.Content = $"v{Utility.GetVersion()}"; - } + /// + /// Interaction logic for RecordEditor.xaml + /// + public partial class RecordEditor + { + public RecordEditor() + { + // Initialize the record object used for storage and generation + Data = new Record(); + DataContext = Data; + ProtoBuf.Serializer.PrepareSerializer(); + ProtoBuf.Serializer.PrepareSerializer(); + ProtoBuf.Serializer.PrepareSerializer(); + ProtoBuf.Serializer.PrepareSerializer(); + InitializeComponent(); + SubSpeciesCombo.ItemsSource = GetSpeciesOptions(); + VersionLabel.Content = $"v{Utility.GetVersion()}"; + } - private Record Data { get; set; } - private string _currentFilePath; + private Record Data { get; set; } + private string _currentFilePath; - private void SpeciesSelectChanged(object sender, SelectionChangedEventArgs e) - { - if (SpeciesCombo.SelectionBoxItem == null) - return; + private void SpeciesSelectChanged(object sender, SelectionChangedEventArgs e) + { + if (SpeciesCombo.SelectionBoxItem == null) + return; - var type = (SpeciesType)SpeciesCombo.SelectedValue; + var type = (SpeciesType)SpeciesCombo.SelectedValue; - switch (type) - { - // non-gendered species - case SpeciesType.Diona: - case SpeciesType.IPC: - case SpeciesType.Vaurca: - Debug.WriteLine("Disabled GenderCombo, type is " + type); - GenderCombo.IsEnabled = false; - GenderCombo.Text = "N/A"; - break; - // gendered species - case SpeciesType.Human: - case SpeciesType.Skrell: - case SpeciesType.Tajara: - case SpeciesType.Unathi: - Debug.WriteLine("Enabled GenderCombo, type is " + type); - GenderCombo.IsEnabled = true; - break; + switch (type) + { + // non-gendered species + case SpeciesType.Diona: + case SpeciesType.IPC: + case SpeciesType.Vaurca: + Debug.WriteLine("Disabled GenderCombo, type is " + type); + GenderCombo.IsEnabled = false; + GenderCombo.Text = "N/A"; + break; + // gendered species + case SpeciesType.Human: + case SpeciesType.Skrell: + case SpeciesType.Tajara: + case SpeciesType.Unathi: + Debug.WriteLine("Enabled GenderCombo, type is " + type); + GenderCombo.IsEnabled = true; + break; - case SpeciesType.None: - break; + case SpeciesType.None: + break; - default: - throw new ArgumentOutOfRangeException(); - } + default: + throw new ArgumentOutOfRangeException(); + } - Debug.WriteLine("Updating subspecies types."); - var types = GetSpeciesOptions(type); - var itemsSource = types as IList ?? types.ToList(); - SubSpeciesCombo.ItemsSource = itemsSource; - Debug.WriteLine($"New types: {string.Join(",", itemsSource)}"); - } + Debug.WriteLine("Updating subspecies types."); + var types = GetSpeciesOptions(type); + var itemsSource = types as IList ?? types.ToList(); + SubSpeciesCombo.ItemsSource = itemsSource; + Debug.WriteLine($"New types: {string.Join(",", itemsSource)}"); + } - private void WindowLoaded(object sender, RoutedEventArgs e) - { - SpeciesCombo.SelectedIndex = 0; - } + private void WindowLoaded(object sender, RoutedEventArgs e) + { + SpeciesCombo.SelectedIndex = 0; + } - private void GenerateRecord(object sender, RoutedEventArgs e) - { - // Update medical checkboxes. - Data.NoClone = NoClone.IsChecked ?? false; - Data.NoBorg = NoBorg.IsChecked ?? false; - Data.NoProsthetic = NoProsthetic.IsChecked ?? false; - Data.NoRevive = NoRevive.IsChecked ?? false; + private void GenerateRecord(object sender, RoutedEventArgs e) + { + // Update medical checkboxes. + Data.NoBorg = NoBorg.IsChecked ?? false; + Data.NoProsthetic = NoProsthetic.IsChecked ?? false; + Data.NoRevive = NoRevive.IsChecked ?? false; - // Figure out what subspecies we've got. - var subspecies = SubSpeciesCombo.SelectedItem as string; - Data.Subspecies = subspecies != null ? Utility.SubspeciesNiceNameToEnum(subspecies) : SpeciesSubType.None; + // Figure out what subspecies we've got. + var subspecies = SubSpeciesCombo.SelectedItem as string; + Data.Subspecies = subspecies != null ? Utility.SubspeciesNiceNameToEnum(subspecies) : SpeciesSubType.None; - // Figure out their species too. - Data.Species = (SpeciesType)SpeciesCombo.SelectedValue; + // Figure out their species too. + Data.Species = (SpeciesType)SpeciesCombo.SelectedValue; - // Finally, gender. - switch ((string)GenderCombo.SelectionBoxItem) - { - case "Male": - Data.Gender = GenderType.Male; - break; - case "Female": - Data.Gender = GenderType.Female; - break; - default: - Data.Gender = GenderType.NotApplicable; - break; - } + // Finally, gender. + switch ((string)GenderCombo.SelectionBoxItem) + { + case "Male": + Data.Gender = GenderType.Male; + break; + case "Female": + Data.Gender = GenderType.Female; + break; + default: + Data.Gender = GenderType.NotApplicable; + break; + } - var wnd = new GeneratedResultWindow(Data); - wnd.Show(); - } + var wnd = new GeneratedResultWindow(Data); + wnd.Show(); + } - private async void SaveContent(object sender, RoutedEventArgs e) - { - if (string.IsNullOrWhiteSpace(_currentFilePath)) - SaveContentAs(null, null); - else - { - // have a path, attempt to save to it - if (!File.Exists(_currentFilePath)) - { - switch ( - await - this.ShowMessageAsync("File Error", - "Current file missing, renamed, or deleted. Do you want to save as another name?", - MessageDialogStyle.AffirmativeAndNegative)) - { - case MessageDialogResult.Negative: - _currentFilePath = null; - return; + private async void SaveContent(object sender, RoutedEventArgs e) + { + if (string.IsNullOrWhiteSpace(_currentFilePath)) + SaveContentAs(null, null); + else + { + // have a path, attempt to save to it + if (!File.Exists(_currentFilePath)) + { + switch ( + await + this.ShowMessageAsync("File Error", + "Current file missing, renamed, or deleted. Do you want to save as another name?", + MessageDialogStyle.AffirmativeAndNegative)) + { + case MessageDialogResult.Negative: + _currentFilePath = null; + return; - case MessageDialogResult.Affirmative: - SaveContentAs(null, null); - return; + case MessageDialogResult.Affirmative: + SaveContentAs(null, null); + return; - default: - throw new ArgumentOutOfRangeException(); - } - } + default: + throw new ArgumentOutOfRangeException(); + } + } - var fs = File.Open(_currentFilePath, FileMode.Truncate); - ProtoBuf.Serializer.Serialize(fs, Data); - } - } + var fs = File.Open(_currentFilePath, FileMode.Truncate); + ProtoBuf.Serializer.Serialize(fs, Data); + } + } - private async void OpenContent(object sender, RoutedEventArgs e) - { - var dialog = new Microsoft.Win32.OpenFileDialog - { - AddExtension = true, - CheckFileExists = true, - CheckPathExists = true, - Filter = "Character Profiles (*.ss13prof)|*.ss13prof|All Files (*.*)|*.*" - }; + private async void OpenContent(object sender, RoutedEventArgs e) + { + var dialog = new Microsoft.Win32.OpenFileDialog + { + AddExtension = true, + CheckFileExists = true, + CheckPathExists = true, + Filter = "Character Profiles (*.ss13prof)|*.ss13prof|All Files (*.*)|*.*" + }; - if (!(dialog.ShowDialog() ?? false)) return; + if (!(dialog.ShowDialog() ?? false)) return; - var fs = File.Open(dialog.FileName, FileMode.Open); - try - { - Data = ProtoBuf.Serializer.Deserialize(fs); - _currentFilePath = dialog.FileName; - // So WPF updates bindings - DataContext = Data; - } - catch (ProtoBuf.ProtoException) - { - await this.ShowMessageAsync("Profile Error", "An error occurred during loading of your profile. You may have selected a file that is not a profile file, or the profile is corrupted."); - } - - } + var fs = File.Open(dialog.FileName, FileMode.Open); + try + { + Data = ProtoBuf.Serializer.Deserialize(fs); + _currentFilePath = dialog.FileName; + // So WPF updates bindings + DataContext = Data; + } + catch (ProtoBuf.ProtoException) + { + await this.ShowMessageAsync("Profile Error", "An error occurred during loading of your profile. You may have selected a file that is not a profile file, or the profile is corrupted."); + } - private void SaveContentAs(object sender, RoutedEventArgs e) - { - var dialog = new Microsoft.Win32.SaveFileDialog - { - AddExtension = true, - CheckPathExists = true, - Filter = "Character Profiles (*.ss13prof)|*.ss13prof|All Files (*.*)|*.*" - }; - if (!(dialog.ShowDialog() ?? false)) return; - var fs = File.Open(dialog.FileName, FileMode.Create); - ProtoBuf.Serializer.Serialize(fs, Data); - _currentFilePath = dialog.FileName; - } + } - private static IEnumerable GetSpeciesOptions() => Enum.GetValues(typeof(SpeciesSubType)).Cast().Select(Utility.SubspeciesNiceName); + private void SaveContentAs(object sender, RoutedEventArgs e) + { + var dialog = new Microsoft.Win32.SaveFileDialog + { + AddExtension = true, + CheckPathExists = true, + Filter = "Character Profiles (*.ss13prof)|*.ss13prof|All Files (*.*)|*.*" + }; + if (!(dialog.ShowDialog() ?? false)) return; + var fs = File.Open(dialog.FileName, FileMode.Create); + ProtoBuf.Serializer.Serialize(fs, Data); + _currentFilePath = dialog.FileName; + } - private static IEnumerable GetSpeciesOptions(SpeciesType limitTo) => from item in Enum.GetValues(typeof(SpeciesSubType)).Cast() - let attr = item.GetAttributeOfType() - where attr != null && (attr.AssociatedSpecies == limitTo || attr.AssociatedSpecies == SpeciesType.None) - select Utility.SubspeciesNiceName(item); - } + private static IEnumerable GetSpeciesOptions() => Enum.GetValues(typeof(SpeciesSubType)).Cast().Select(Utility.SubspeciesNiceName); + + private static IEnumerable GetSpeciesOptions(SpeciesType limitTo) => from item in Enum.GetValues(typeof(SpeciesSubType)).Cast() + let attr = item.GetAttributeOfType() + where attr != null && (attr.AssociatedSpecies == limitTo || attr.AssociatedSpecies == SpeciesType.None) + select Utility.SubspeciesNiceName(item); + } } \ No newline at end of file diff --git a/AuroraRecordGenerator/RecordFormatter.cs b/AuroraRecordGenerator/RecordFormatter.cs index c6c728b..50bc1e1 100644 --- a/AuroraRecordGenerator/RecordFormatter.cs +++ b/AuroraRecordGenerator/RecordFormatter.cs @@ -4,98 +4,98 @@ using System.Text; namespace AuroraRecordGenerator { - internal partial class RecordFormatter - { - private Record _targetRecord; + internal partial class RecordFormatter + { + private Record _targetRecord; - public RecordFormatter(Record r) - { - _targetRecord = r; - UpdateSplitRecords(); - MakeCommonRecords(); - } + public RecordFormatter(Record r) + { + _targetRecord = r; + UpdateSplitRecords(); + MakeCommonRecords(); + } - private IList _medicalPublicRecord; - private IList _medicalHistory; - private IList _medicalNotes; - private IList _medicalPsychHistory; - private IList _medicalPsychNotes; - private IList _medicalPrescriptions; + private IList _medicalPublicRecord; + private IList _medicalHistory; + private IList _medicalNotes; + private IList _medicalPsychHistory; + private IList _medicalPsychNotes; + private IList _medicalPrescriptions; - private IList _securityPublicRecord; - private IList _securityRecords; - private IList _securityNotes; + private IList _securityPublicRecord; + private IList _securityRecords; + private IList _securityNotes; - private IList _employmentPublicRecord; - private IList _employmentExperience; - private IList _employmentPreNtEmployment; - private IList _employmentFormalEducation; - private IList _employmentNtEmployment; - private IList _employmentSkills; + private IList _employmentPublicRecord; + private IList _employmentExperience; + private IList _employmentPreNtEmployment; + private IList _employmentFormalEducation; + private IList _employmentNtEmployment; + private IList _employmentSkills; - private void UpdateSplitRecords() - { - if (_targetRecord == null) - { - _targetRecord = new Record(); - } + private void UpdateSplitRecords() + { + if (_targetRecord == null) + { + _targetRecord = new Record(); + } - // Medical - _medicalPublicRecord = _targetRecord.MedicalPublicRecord?.LineSplit(); - _medicalHistory = _targetRecord.MedicalHistory?.LineSplit(); - _medicalNotes = _targetRecord.MedicalNotes?.LineSplit(); - _medicalPsychHistory = _targetRecord.MedicalPsychHistory?.LineSplit(); - _medicalPsychNotes = _targetRecord.MedicalPsychNotes?.LineSplit(); - _medicalPrescriptions = _targetRecord.MedicalPrescriptions?.LineSplit(); + // Medical + _medicalPublicRecord = _targetRecord.MedicalPublicRecord?.LineSplit(); + _medicalHistory = _targetRecord.MedicalHistory?.LineSplit(); + _medicalNotes = _targetRecord.MedicalNotes?.LineSplit(); + _medicalPsychHistory = _targetRecord.MedicalPsychHistory?.LineSplit(); + _medicalPsychNotes = _targetRecord.MedicalPsychNotes?.LineSplit(); + _medicalPrescriptions = _targetRecord.MedicalPrescriptions?.LineSplit(); - // security - _securityPublicRecord = _targetRecord.SecurityPublicRecord?.LineSplit(); - _securityRecords = _targetRecord.SecurityRecords?.LineSplit(); - _securityNotes = _targetRecord.SecurityNotes?.LineSplit(); + // security + _securityPublicRecord = _targetRecord.SecurityPublicRecord?.LineSplit(); + _securityRecords = _targetRecord.SecurityRecords?.LineSplit(); + _securityNotes = _targetRecord.SecurityNotes?.LineSplit(); - // employment - _employmentPublicRecord = _targetRecord.EmploymentPublicRecord?.LineSplit(); - _employmentExperience = _targetRecord.EmploymentExperience?.LineSplit(); - _employmentPreNtEmployment = _targetRecord.EmploymentPreNtEmployment?.LineSplit(); - _employmentFormalEducation = _targetRecord.EmploymentFormalEducation?.LineSplit(); - _employmentNtEmployment = _targetRecord.EmploymentNtEmploymentHistory?.LineSplit(); - _employmentSkills = _targetRecord.EmploymentSkills?.LineSplit(); + // employment + _employmentPublicRecord = _targetRecord.EmploymentPublicRecord?.LineSplit(); + _employmentExperience = _targetRecord.EmploymentExperience?.LineSplit(); + _employmentPreNtEmployment = _targetRecord.EmploymentPreNtEmployment?.LineSplit(); + _employmentFormalEducation = _targetRecord.EmploymentFormalEducation?.LineSplit(); + _employmentNtEmployment = _targetRecord.EmploymentNtEmploymentHistory?.LineSplit(); + _employmentSkills = _targetRecord.EmploymentSkills?.LineSplit(); - // flush the record cache so they're regenerated - _commonRecords = null; - } + // flush the record cache so they're regenerated + _commonRecords = null; + } - public string EmploymentRecords => MakeEmploymentRecords(); - public string MedicalRecords => MakeMedicalRecords(); - public string SecurityRecords => MakeSecurityRecords(); + public string EmploymentRecords => MakeEmploymentRecords(); + public string MedicalRecords => MakeMedicalRecords(); + public string SecurityRecords => MakeSecurityRecords(); - private string _commonRecords; - - /// - /// Writes the form of a record section to the specified , as long as there's entries to write. - /// - /// The to write to. - /// The title for the section. - /// The entries of this section. - private static void WriteSectionIfAny(ref StringBuilder builder, string header, IList entries) - { - if (entries == null || !entries.Any() || entries[0].Trim().Length == 0) - return; - builder.AppendLine(header); - builder.AppendLine(entries.FormatAsList()); - } + private string _commonRecords; - private string MakeNameLine() - { - var builder = new StringBuilder("Name: "); - builder.Append(_targetRecord.FirstName); - builder.Append(_targetRecord.MiddleName.SpaceIfValue()); - builder.Append($" {_targetRecord.LastName}"); - builder.Append(_targetRecord.NameSuffix.SpaceIfValue()); - return builder.ToString(); - } + /// + /// Writes the form of a record section to the specified , as long as there's entries to write. + /// + /// The to write to. + /// The title for the section. + /// The entries of this section. + private static void WriteSectionIfAny(ref StringBuilder builder, string header, IList entries) + { + if (entries == null || !entries.Any() || entries[0].Trim().Length == 0) + return; + builder.AppendLine(header); + builder.AppendLine(entries.FormatAsList()); + } - private static void MakeMedicalNote(ref StringBuilder b, string s) => - b.AppendLine($" - {s}"); - } + private string MakeNameLine() + { + var builder = new StringBuilder("Name: "); + builder.Append(_targetRecord.FirstName); + builder.Append(_targetRecord.MiddleName.SpaceIfValue()); + builder.Append($" {_targetRecord.LastName}"); + builder.Append(_targetRecord.NameSuffix.SpaceIfValue()); + return builder.ToString(); + } + + private static void MakeMedicalNote(ref StringBuilder b, string s) => + b.AppendLine($" - {s}"); + } } diff --git a/AuroraRecordGenerator/RecordFormatterGenerationMethods.cs b/AuroraRecordGenerator/RecordFormatterGenerationMethods.cs index a0d7576..86cc71f 100644 --- a/AuroraRecordGenerator/RecordFormatterGenerationMethods.cs +++ b/AuroraRecordGenerator/RecordFormatterGenerationMethods.cs @@ -4,209 +4,205 @@ using System.Text; namespace AuroraRecordGenerator { - internal partial class RecordFormatter - { - private void MakeCommonRecords() - { - var record = new StringBuilder(); - record.AppendLine("/// PUBLIC RECORD ///"); - record.AppendLine(MakeNameLine()); - record.AppendLine($"Date of Birth: {_targetRecord.BirthDate.ToString("MMMM")} {_targetRecord.BirthDate.Day.Ordinalize()}, {_targetRecord.BirthDate.Year}"); - record.AppendLine($"Species: {_targetRecord.Species.Humanize()}");// might fuck up the names - if (_targetRecord.Subspecies != SpeciesSubType.None) - { - record.AppendLine($"{_targetRecord.Subspecies.GetAttributeOfType()?.FieldName ?? "Subspecies"}: {Utility.SubspeciesNiceName(_targetRecord.Subspecies)}"); - } - record.AppendLine(_targetRecord.Species.HasGender() - ? $"Gender: {_targetRecord.Gender.Humanize()}" - : "Gender: Not Applicable."); - record.AppendLine($"Citizenship: {_targetRecord.Citizenship.IfEmpty("Not Specified.")}"); - record.AppendLine($"Clearance Level: {_targetRecord.Clearance.IfEmpty("Not Specified")}"); - record.AppendLine($"Employed As: {_targetRecord.EmployedAs.IfEmpty("Assistant")}"); - if (_targetRecord.CharHeight != null) - record.AppendLine($"Height: {_targetRecord.CharHeight} cm ({Utility.CmToFeet(_targetRecord.CharHeight.Value)})"); + internal partial class RecordFormatter + { + private void MakeCommonRecords() + { + var record = new StringBuilder(); + record.AppendLine("/// PUBLIC RECORD ///"); + record.AppendLine(MakeNameLine()); + record.AppendLine($"Date of Birth: {_targetRecord.BirthDate.ToString("MMMM")} {_targetRecord.BirthDate.Day.Ordinalize()}, {_targetRecord.BirthDate.Year}"); + record.AppendLine($"Species: {_targetRecord.Species.Humanize()}");// might fuck up the names + if (_targetRecord.Subspecies != SpeciesSubType.None) + { + record.AppendLine($"{_targetRecord.Subspecies.GetAttributeOfType()?.FieldName ?? "Subspecies"}: {Utility.SubspeciesNiceName(_targetRecord.Subspecies)}"); + } + record.AppendLine(_targetRecord.Species.HasGender() + ? $"Gender: {_targetRecord.Gender.Humanize()}" + : "Gender: Not Applicable."); + record.AppendLine($"Citizenship: {_targetRecord.Citizenship.IfEmpty("Not Specified.")}"); + record.AppendLine($"Clearance Level: {_targetRecord.Clearance.IfEmpty("Not Specified")}"); + record.AppendLine($"Employed As: {_targetRecord.EmployedAs.IfEmpty("Assistant")}"); + if (_targetRecord.CharHeight != null) + record.AppendLine($"Height: {_targetRecord.CharHeight} cm ({Utility.CmToFeet(_targetRecord.CharHeight.Value)})"); - if (_targetRecord.Weight != null) - record.AppendLine($"Weight: {_targetRecord.Weight} kg ({Utility.KgToLb(_targetRecord.Weight ?? 0)} lb)"); + if (_targetRecord.Weight != null) + record.AppendLine($"Weight: {_targetRecord.Weight} kg ({Utility.KgToLb(_targetRecord.Weight ?? 0)} lb)"); - // Eye color - var trimmedEye = _targetRecord.EyeColor.Trim(); - record.AppendFormat("Eye Color: {0}\n", trimmedEye.Length > 0 ? trimmedEye : "Not Specified."); + // Eye color + var trimmedEye = _targetRecord.EyeColor.Trim(); + record.AppendFormat("Eye Color: {0}\n", trimmedEye.Length > 0 ? trimmedEye : "Not Specified."); - var bodyColor = _targetRecord.SkinColor.Trim(); - record.AppendFormat("Skin/Body Color: {0}\n", bodyColor.Length > 0 ? bodyColor : "Not Specified."); + var bodyColor = _targetRecord.SkinColor.Trim(); + record.AppendFormat("Skin/Body Color: {0}\n", bodyColor.Length > 0 ? bodyColor : "Not Specified."); - var hairColor = _targetRecord.HairColor.Trim(); - record.AppendFormat("Hair Color: {0}\n", hairColor.Length > 0 ? hairColor : "Not Specified."); + var hairColor = _targetRecord.HairColor.Trim(); + record.AppendFormat("Hair Color: {0}\n", hairColor.Length > 0 ? hairColor : "Not Specified."); - // identifying features - var trimmedFeatures = _targetRecord.DistinguishingFeatures.Trim(); - record.Append("Distinguishing Features: "); - record.AppendLine(trimmedFeatures.Length > 0 ? trimmedFeatures : "None noted."); + // identifying features + var trimmedFeatures = _targetRecord.DistinguishingFeatures.Trim(); + record.Append("Distinguishing Features: "); + record.AppendLine(trimmedFeatures.Length > 0 ? trimmedFeatures : "None noted."); - record.AppendLine(); + record.AppendLine(); - // general notes - WriteSectionIfAny(ref record, - "General Notes:", - _employmentPublicRecord); + // general notes + WriteSectionIfAny(ref record, + "General Notes:", + _employmentPublicRecord); - WriteSectionIfAny(ref record, - "Medical Notes:", - _medicalPublicRecord); + WriteSectionIfAny(ref record, + "Medical Notes:", + _medicalPublicRecord); - WriteSectionIfAny(ref record, - "Security Notes:", - _securityPublicRecord); + WriteSectionIfAny(ref record, + "Security Notes:", + _securityPublicRecord); - _commonRecords = record.ToString(); - } + _commonRecords = record.ToString(); + } - private string MakeEmploymentRecords() - { - var recordText = new StringBuilder(); - if (_commonRecords.IsEmpty()) - MakeCommonRecords(); + private string MakeEmploymentRecords() + { + var recordText = new StringBuilder(); + if (_commonRecords.IsEmpty()) + MakeCommonRecords(); - recordText.Append(_commonRecords); + recordText.Append(_commonRecords); - if (!_employmentExperience.Any() && - !_employmentFormalEducation.Any() && - !_employmentNtEmployment.Any() && - !_employmentPreNtEmployment.Any() && - !_employmentPublicRecord.Any() && - !_employmentSkills.Any()) - { - recordText.AppendLine("/// NO EMPLOYMENT RECORD FOUND ///"); - } - else - { - recordText.AppendLine("/// EMPLOYMENT RECORD ///"); - recordText.AppendLine(); + if (!_employmentExperience.Any() && + !_employmentFormalEducation.Any() && + !_employmentNtEmployment.Any() && + !_employmentPreNtEmployment.Any() && + !_employmentPublicRecord.Any() && + !_employmentSkills.Any()) + { + recordText.AppendLine("/// NO EMPLOYMENT RECORD FOUND ///"); + } + else + { + recordText.AppendLine("/// EMPLOYMENT RECORD ///"); + recordText.AppendLine(); - WriteSectionIfAny(ref recordText, - "Experience:", - _employmentExperience); + WriteSectionIfAny(ref recordText, + "Experience:", + _employmentExperience); - WriteSectionIfAny(ref recordText, - "Formal Education History:", - _employmentFormalEducation); + WriteSectionIfAny(ref recordText, + "Formal Education History:", + _employmentFormalEducation); - WriteSectionIfAny(ref recordText, - "Pre-NanoTrasen Employment History:", - _employmentPreNtEmployment); + WriteSectionIfAny(ref recordText, + "Pre-NanoTrasen Employment History:", + _employmentPreNtEmployment); - WriteSectionIfAny(ref recordText, - "NanoTrasen Employment History:", - _employmentNtEmployment); + WriteSectionIfAny(ref recordText, + "NanoTrasen Employment History:", + _employmentNtEmployment); - WriteSectionIfAny(ref recordText, - "Trained in the following:", - _employmentSkills); - } + WriteSectionIfAny(ref recordText, + "Trained in the following:", + _employmentSkills); + } - return recordText.ToString(); - } + return recordText.ToString(); + } - private string MakeMedicalRecords() - { - var recordText = new StringBuilder(); - if (_commonRecords.IsEmpty()) - MakeCommonRecords(); + private string MakeMedicalRecords() + { + var recordText = new StringBuilder(); + if (_commonRecords.IsEmpty()) + MakeCommonRecords(); - recordText.Append(_commonRecords); + recordText.Append(_commonRecords); - // TODO: make this less horrible - if (!_medicalHistory.Any() && - !_medicalNotes.Any() && - !_medicalPsychHistory.Any() && - !_medicalPsychNotes.Any() && - !_medicalPrescriptions.Any() && - !_targetRecord.NoBorg && - !_targetRecord.NoClone && - !_targetRecord.NoProsthetic && - !_targetRecord.NoRevive) - { - recordText.AppendLine("/// NO MEDICAL RECORD FOUND ///"); - } - else - { - recordText.AppendLine("/// MEDICAL RECORD ///"); - recordText.AppendLine(); + // TODO: make this less horrible + if (!_medicalHistory.Any() && + !_medicalNotes.Any() && + !_medicalPsychHistory.Any() && + !_medicalPsychNotes.Any() && + !_medicalPrescriptions.Any() && + !_targetRecord.NoBorg && + !_targetRecord.NoProsthetic && + !_targetRecord.NoRevive) + { + recordText.AppendLine("/// NO MEDICAL RECORD FOUND ///"); + } + else + { + recordText.AppendLine("/// MEDICAL RECORD ///"); + recordText.AppendLine(); - recordText.AppendLine( - " The following information is protected by doctor-patient confidentiality laws. Do not release without patient's consent.\n"); + recordText.AppendLine( + " The following information is protected by doctor-patient confidentiality laws. Do not release without patient's consent.\n"); - if (_targetRecord.NoBorg || _targetRecord.NoClone || _targetRecord.NoProsthetic || _targetRecord.NoRevive) - { - recordText.AppendLine("IMPORTANT NOTES:"); + if (_targetRecord.NoBorg || _targetRecord.NoProsthetic || _targetRecord.NoRevive) + { + recordText.AppendLine("IMPORTANT NOTES:"); - if (_targetRecord.NoBorg) - MakeMedicalNote(ref recordText, "DO NOT BORGIFY"); + if (_targetRecord.NoBorg) + MakeMedicalNote(ref recordText, "DO NOT BORGIFY"); - if (_targetRecord.NoClone) - MakeMedicalNote(ref recordText, "DO NOT CLONE"); + if (_targetRecord.NoProsthetic) + MakeMedicalNote(ref recordText, "DO NOT INSTALL PROSTHETICS"); - if (_targetRecord.NoProsthetic) - MakeMedicalNote(ref recordText, "DO NOT INSTALL PROSTHETICS"); + if (_targetRecord.NoRevive) + MakeMedicalNote(ref recordText, "DO NOT REVIVE"); - if (_targetRecord.NoRevive) - MakeMedicalNote(ref recordText, "DO NOT REVIVE"); + recordText.AppendLine(); + } - recordText.AppendLine(); - } + WriteSectionIfAny(ref recordText, + "Notes:", + _medicalNotes); - WriteSectionIfAny(ref recordText, - "Notes:", - _medicalNotes); + WriteSectionIfAny(ref recordText, + "Medical History:", + _medicalHistory); - WriteSectionIfAny(ref recordText, - "Medical History:", - _medicalHistory); + WriteSectionIfAny(ref recordText, + "Psychiatric Notes:", + _medicalPsychNotes); - WriteSectionIfAny(ref recordText, - "Psychiatric Notes:", - _medicalPsychNotes); + WriteSectionIfAny(ref recordText, + "Psychiatric History:", + _medicalPsychHistory); - WriteSectionIfAny(ref recordText, - "Psychiatric History:", - _medicalPsychHistory); + WriteSectionIfAny(ref recordText, + "Prescriptions:", + _medicalPrescriptions); + } - WriteSectionIfAny(ref recordText, - "Prescriptions:", - _medicalPrescriptions); - } + return recordText.ToString(); + } - return recordText.ToString(); - } + private string MakeSecurityRecords() + { + var recordText = new StringBuilder(); + if (_commonRecords.IsEmpty()) + MakeCommonRecords(); - private string MakeSecurityRecords() - { - var recordText = new StringBuilder(); - if (_commonRecords.IsEmpty()) - MakeCommonRecords(); + recordText.Append(_commonRecords); - recordText.Append(_commonRecords); + if (!_securityRecords.Any() && !_securityNotes.Any()) + { + recordText.AppendLine("/// NO SECURITY RECORD FOUND ///"); + } + else + { + recordText.AppendLine("/// SECURITY RECORD ///"); + recordText.AppendLine(); - if (!_securityRecords.Any() && !_securityNotes.Any()) - { - recordText.AppendLine("/// NO SECURITY RECORD FOUND ///"); - } - else - { - recordText.AppendLine("/// SECURITY RECORD ///"); - recordText.AppendLine(); + WriteSectionIfAny(ref recordText, + "Notes:", + _securityNotes); - WriteSectionIfAny(ref recordText, - "Notes:", - _securityNotes); + WriteSectionIfAny(ref recordText, + "Record:", + _securityRecords); + } - WriteSectionIfAny(ref recordText, - "Record:", - _securityRecords); - } - - return recordText.ToString(); - } - } + return recordText.ToString(); + } + } } diff --git a/AuroraRecordGenerator/Types.cs b/AuroraRecordGenerator/Types.cs index e6cf9a7..f888cd0 100644 --- a/AuroraRecordGenerator/Types.cs +++ b/AuroraRecordGenerator/Types.cs @@ -3,114 +3,127 @@ using System; namespace AuroraRecordGenerator { - [ProtoContract] - public enum SpeciesType - { - [ProtoEnum] - None = 0, + [ProtoContract] + public enum SpeciesType + { + [ProtoEnum] + None = 0, - [ProtoEnum] - Human, + [ProtoEnum] + Human, - [ProtoEnum] - Skrell, + [ProtoEnum] + Skrell, - [ProtoEnum] - Tajara, + [ProtoEnum] + Tajara, - [ProtoEnum] - Unathi, + [ProtoEnum] + Unathi, - [ProtoEnum] - Vaurca, + [ProtoEnum] + Vaurca, - [ProtoEnum] - Diona, + [ProtoEnum] + Diona, - [ProtoEnum] - IPC - } + [ProtoEnum] + IPC + } - [ProtoContract] - public enum SpeciesSubType - { - [ProtoEnum, SubspeciesMeta(SpeciesType.None, "N/A")] - None = 0, + [ProtoContract] + public enum SpeciesSubType + { + [ProtoEnum, SubspeciesMeta(SpeciesType.None, "N/A")] + None = 0, - [ProtoEnum, SubspeciesMeta(SpeciesType.Tajara, "M'sai", "Ethnicity")] - MsaiTajara, + // SKRELL VARIANTS + [ProtoEnum, SubspeciesMeta(SpeciesType.Skrell, "Axiori", "Ethnicity")] + SkrellAxiori, + [ProtoEnum, SubspeciesMeta(SpeciesType.Skrell, "Xiialt", "Ethnicity")] + SkrellXiialt, + [ProtoEnum, SubspeciesMeta(SpeciesType.Skrell, "Xiiori", "Ethnicity")] + SkrellXiiori, - [ProtoEnum, SubspeciesMeta(SpeciesType.Tajara, "Zhan-Khazan", "Ethnicity")] - ZhanTajara, + // TAJARA VARIANTS + [ProtoEnum, SubspeciesMeta(SpeciesType.Tajara, "Hharar", "Ethnicity")] + TajaraHharar, + [ProtoEnum, SubspeciesMeta(SpeciesType.Tajara, "Zhan-Khazan", "Ethnicity")] + TajaraZhan, + [ProtoEnum, SubspeciesMeta(SpeciesType.Tajara, "Njarir'Akhran", "Ethnicity")] + TajaraNjarir, + [ProtoEnum, SubspeciesMeta(SpeciesType.Tajara, "M'sai", "Ethnicity")] + TajaraMsai, - [ProtoEnum, SubspeciesMeta(SpeciesType.Vaurca, "Type A (Worker)", "Classification")] - VaurcaWorker, - - [ProtoEnum, SubspeciesMeta(SpeciesType.Vaurca, "Type B (Warrior)", "Classification")] - VaurcaWarrior, - - [ProtoEnum, SubspeciesMeta(SpeciesType.IPC, "Shell", "Model")] - IpcShell, - - [ProtoEnum, SubspeciesMeta(SpeciesType.IPC, "Hephaestus G1 Heavy", "Model")] - IpcG1Industrial, - - [ProtoEnum, SubspeciesMeta(SpeciesType.IPC, "Hephaestus G2 Heavy", "Model")] - IpcG2Industrial, - - [ProtoEnum, SubspeciesMeta(SpeciesType.IPC, "Bishop Accessory", "Model")] - IpcFancy, - - [ProtoEnum, SubspeciesMeta(SpeciesType.IPC, "Zeng-Hu Mobility", "Model")] - IpcMedsci, + // VAURCA VARIANTS + [ProtoEnum, SubspeciesMeta(SpeciesType.Vaurca, "Type A (Worker)", "Classification")] + VaurcaWorker, + [ProtoEnum, SubspeciesMeta(SpeciesType.Vaurca, "Type B (Warrior)", "Classification")] + VaurcaWarrior, + [ProtoEnum, SubspeciesMeta(SpeciesType.Vaurca, "Type C (Breeder)", "Classification")] + VaurcaBreeder, + [ProtoEnum, SubspeciesMeta(SpeciesType.Vaurca, "Type E (Bulwark)", "Classification")] + VaurcaBulwark, + // IPC VARIANTS + [ProtoEnum, SubspeciesMeta(SpeciesType.IPC, "Baseline", "Model")] + IpcBaseline, [ProtoEnum, SubspeciesMeta(SpeciesType.IPC, "Shell", "Model")] - IpcHumanoid, - + IpcShell, + [ProtoEnum, SubspeciesMeta(SpeciesType.IPC, "Hephaestus G1 Industrial", "Model")] + IpcG1, + [ProtoEnum, SubspeciesMeta(SpeciesType.IPC, "Hephaestus G2 Industrial", "Model")] + IpcG2, [ProtoEnum, SubspeciesMeta(SpeciesType.IPC, "Xion Industrial", "Model")] - IpcHeavy, + IpcXion, + [ProtoEnum, SubspeciesMeta(SpeciesType.IPC, "Zeng-Hu Mobility", "Model")] + IpcZengHu, + [ProtoEnum, SubspeciesMeta(SpeciesType.IPC, "Bishop Accessory", "Model")] + IpcBishop, + // UNATHI VARIANTS [ProtoEnum, SubspeciesMeta(SpeciesType.Unathi, "Aut'akh", "Variant")] - UnathiRobot, + UnathiAutakh, + // HUMAN VARIANTS [ProtoEnum, SubspeciesMeta(SpeciesType.Human, "Offworlder", "Variant")] HumanOffworld - } + } - [ProtoContract] - public enum GenderType - { - [ProtoEnum] - NotApplicable = 0, + [ProtoContract] + public enum GenderType + { + [ProtoEnum] + NotApplicable = 0, - [ProtoEnum] - Male, + [ProtoEnum] + Male, - [ProtoEnum] - Female - } + [ProtoEnum] + Female + } - public static class Info - { - /// - /// The current in-character date. - /// - public static DateTime IcDate => new DateTime(DateTime.Now.Year + 442, - DateTime.Now.Month, - DateTime.Now.Day); - } + public static class Info + { + /// + /// The current in-character date. + /// + public static DateTime IcDate => new DateTime(DateTime.Now.Year + 442, + DateTime.Now.Month, + DateTime.Now.Day); + } - [AttributeUsage(AttributeTargets.Field)] - public class SubspeciesMetaAttribute : Attribute - { - public SpeciesType AssociatedSpecies {get; private set;} - public string NiceName { get; private set; } - public string FieldName { get; private set; } - public SubspeciesMetaAttribute(SpeciesType associatedType, string nicename, string fieldname = "Subspecies") - { - AssociatedSpecies = associatedType; - NiceName = nicename; - FieldName = fieldname; - } - } + [AttributeUsage(AttributeTargets.Field)] + public class SubspeciesMetaAttribute : Attribute + { + public SpeciesType AssociatedSpecies { get; private set; } + public string NiceName { get; private set; } + public string FieldName { get; private set; } + public SubspeciesMetaAttribute(SpeciesType associatedType, string nicename, string fieldname = "Subspecies") + { + AssociatedSpecies = associatedType; + NiceName = nicename; + FieldName = fieldname; + } + } } \ No newline at end of file diff --git a/AuroraRecordGenerator/Utility.cs b/AuroraRecordGenerator/Utility.cs index 2503d1d..b976736 100644 --- a/AuroraRecordGenerator/Utility.cs +++ b/AuroraRecordGenerator/Utility.cs @@ -6,91 +6,91 @@ using System.Text; namespace AuroraRecordGenerator { - public static class Utility - { - public static IList LineSplit(this string source) => - source.Split('\n').Where(item => item.Trim().Length != 0).ToList(); + public static class Utility + { + public static IList LineSplit(this string source) => + source.Split('\n').Where(item => item.Trim().Length != 0).ToList(); - public static string CmToFeet(double cm) - { - var feet = Math.Floor(cm * 0.0328084); - var inches = Math.Floor(cm * 0.39370079); // Isn't imperial a lovely system? - inches -= feet * 12; - return $"{feet}'{inches}\""; - } + public static string CmToFeet(double cm) + { + var feet = Math.Floor(cm * 0.0328084); + var inches = Math.Floor(cm * 0.39370079); // Isn't imperial a lovely system? + inches -= feet * 12; + return $"{feet}'{inches}\""; + } - /// - /// Converts a weight in Kilograms to Pounds. - /// - /// The weight in kilograms. - /// The weight converted to pounds. - public static double KgToLb(double kg) => Math.Round(kg * 2.2046, 2); + /// + /// Converts a weight in Kilograms to Pounds. + /// + /// The weight in kilograms. + /// The weight converted to pounds. + public static double KgToLb(double kg) => Math.Round(kg * 2.2046, 2); - /// - /// Returns and a trailing space if val is not whitespace, otherwise. - /// - /// - /// - public static string SpaceIfValue(this string val) => string.IsNullOrWhiteSpace(val) ? string.Empty : $" {val} "; + /// + /// Returns and a trailing space if val is not whitespace, otherwise. + /// + /// + /// + public static string SpaceIfValue(this string val) => string.IsNullOrWhiteSpace(val) ? string.Empty : $" {val} "; - public static string IfEmpty(this string target, string fallback) => - target.IsEmpty() ? fallback : target; + public static string IfEmpty(this string target, string fallback) => + target.IsEmpty() ? fallback : target; - public static bool IsEmpty(this string val) => string.IsNullOrWhiteSpace(val); + public static bool IsEmpty(this string val) => string.IsNullOrWhiteSpace(val); - public static string FormatAsList(this IEnumerable target) => - target.Aggregate(new StringBuilder(), (b, s) => b.AppendLine($" - {s.Trim()}")).ToString(); + public static string FormatAsList(this IEnumerable target) => + target.Aggregate(new StringBuilder(), (b, s) => b.AppendLine($" - {s.Trim()}")).ToString(); - public static string Repeat(this string target, int repeatNum) - { - var builder = new StringBuilder(target.Length * repeatNum); - for (var i = 0; i < repeatNum; i++) - builder.Append(target); + public static string Repeat(this string target, int repeatNum) + { + var builder = new StringBuilder(target.Length * repeatNum); + for (var i = 0; i < repeatNum; i++) + builder.Append(target); - return builder.ToString(); - } + 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); + /// + /// 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(); - return attr?.NiceName ?? Enum.GetName(typeof(SpeciesSubType), species); - } + public static string SubspeciesNiceName(SpeciesSubType species) + { + var attr = species.GetAttributeOfType(); + return attr?.NiceName ?? Enum.GetName(typeof(SpeciesSubType), species); + } - public static SpeciesSubType SubspeciesNiceNameToEnum(string nicename) - { - return (from item in Enum.GetValues(typeof(SpeciesSubType)).Cast() - let attr = item.GetAttributeOfType() - where attr != null && attr.NiceName == nicename - select item).FirstOrDefault(); - } + public static SpeciesSubType SubspeciesNiceNameToEnum(string nicename) + { + return (from item in Enum.GetValues(typeof(SpeciesSubType)).Cast() + let attr = item.GetAttributeOfType() + where attr != null && attr.NiceName == nicename + select item).FirstOrDefault(); + } - public static Version GetVersion() => Assembly.GetExecutingAssembly().GetName().Version; - } + public static Version GetVersion() => Assembly.GetExecutingAssembly().GetName().Version; + } - // From https://stackoverflow.com/questions/1799370/getting-attributes-of-enums-value - public static class EnumHelper - { - /// - /// Gets an attribute on an enum field value - /// - /// The type of the attribute you want to retrieve - /// The enum value - /// The attribute of type T that exists on the enum value - /// string desc = myEnumVariable.GetAttributeOfType().Description; - public static T GetAttributeOfType(this Enum enumVal) where T : Attribute - { - var type = enumVal.GetType(); - var memInfo = type.GetMember(enumVal.ToString()); - var attributes = memInfo[0].GetCustomAttributes(typeof(T), false); - return attributes.Length > 0 ? (T)attributes[0] : null; - } - } + // From https://stackoverflow.com/questions/1799370/getting-attributes-of-enums-value + public static class EnumHelper + { + /// + /// Gets an attribute on an enum field value + /// + /// The type of the attribute you want to retrieve + /// The enum value + /// The attribute of type T that exists on the enum value + /// string desc = myEnumVariable.GetAttributeOfType().Description; + public static T GetAttributeOfType(this Enum enumVal) where T : Attribute + { + var type = enumVal.GetType(); + var memInfo = type.GetMember(enumVal.ToString()); + var attributes = memInfo[0].GetCustomAttributes(typeof(T), false); + return attributes.Length > 0 ? (T)attributes[0] : null; + } + } } \ No newline at end of file