diff --git a/AuroraRecordGenerator/GeneratedResultWindow.xaml.cs b/AuroraRecordGenerator/GeneratedResultWindow.xaml.cs deleted file mode 100644 index 6581d4a..0000000 --- a/AuroraRecordGenerator/GeneratedResultWindow.xaml.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace AuroraRecordGenerator -{ - 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; - } - } -} diff --git a/AuroraRecordGenerator/Properties/Resources.Designer.cs b/AuroraRecordGenerator/Properties/Resources.Designer.cs deleted file mode 100644 index b385641..0000000 --- a/AuroraRecordGenerator/Properties/Resources.Designer.cs +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace AuroraRecordGenerator.Properties -{ - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AuroraRecordGenerator.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { - return resourceCulture; - } - set - { - resourceCulture = value; - } - } - } -} diff --git a/AuroraRecordGenerator/Properties/Settings.Designer.cs b/AuroraRecordGenerator/Properties/Settings.Designer.cs deleted file mode 100644 index 5ea6d6e..0000000 --- a/AuroraRecordGenerator/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace AuroraRecordGenerator.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/AuroraRecordGenerator/Record.cs b/AuroraRecordGenerator/Record.cs deleted file mode 100644 index 8d0b461..0000000 --- a/AuroraRecordGenerator/Record.cs +++ /dev/null @@ -1,120 +0,0 @@ -using System; -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; - - [ProtoMember(2)] - public string MiddleName { get; set; } = string.Empty; - - [ProtoMember(3)] - public string LastName { 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(16)] - public SpeciesSubType Subspecies { get; set; } = SpeciesSubType.None; - - [ProtoMember(6, IsRequired = true)] - public GenderType Gender { get; set; } - - [ProtoMember(7)] - public DateTime BirthDate { get; set; } = Info.IcDate; - - [ProtoMember(8)] - public double? CharHeight { get; set; } = 170; - - [ProtoMember(9)] - public double? Weight { get; set; } = 70; - - [ProtoMember(10)] - public string SkinColor { get; set; } = string.Empty; - - [ProtoMember(11)] - public string EyeColor { get; set; } = string.Empty; - - [ProtoMember(12)] - public string DistinguishingFeatures { get; set; } = string.Empty; - - [ProtoMember(13)] - public string HairColor { get; set; } = string.Empty; - - [ProtoMember(14)] - public string EmployedAs { get; set; } = string.Empty; - - [ProtoMember(15)] - public string Citizenship { get; set; } = string.Empty; - - // 16 & 17 used to be PictureUrl and PictureCredit, now unused. - - [ProtoMember(18)] - public string Clearance { get; set; } = string.Empty; - - [ProtoMember(19)] - public string MedicalPublicRecord { get; set; } = string.Empty; - - [ProtoMember(20)] - public string MedicalHistory { get; set; } = string.Empty; - - [ProtoMember(21)] - public string MedicalNotes { get; set; } = string.Empty; - - [ProtoMember(22)] - public string MedicalPsychHistory { get; set; } = string.Empty; - - [ProtoMember(23)] - public string MedicalPsychNotes { get; set; } = string.Empty; - - [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(27)] - public bool NoProsthetic { get; set; } = false; - - [ProtoMember(28)] - public string MedicalPrescriptions { get; set; } = string.Empty; - - [ProtoMember(29)] - public string SecurityPublicRecord { get; set; } = string.Empty; - - [ProtoMember(30)] - public string SecurityRecords { get; set; } = string.Empty; - - [ProtoMember(31)] - public string SecurityNotes { get; set; } = string.Empty; - - [ProtoMember(32)] - public string EmploymentPublicRecord { get; set; } = string.Empty; - - [ProtoMember(33)] - public string EmploymentExperience { get; set; } = string.Empty; - - [ProtoMember(34)] - public string EmploymentPreNtEmployment { get; set; } = string.Empty; - - [ProtoMember(35)] - public string EmploymentFormalEducation { get; set; } = string.Empty; - - [ProtoMember(36)] - public string EmploymentNtEmploymentHistory { 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.cs b/AuroraRecordGenerator/RecordEditor.xaml.cs deleted file mode 100644 index d77188a..0000000 --- a/AuroraRecordGenerator/RecordEditor.xaml.cs +++ /dev/null @@ -1,193 +0,0 @@ -using MahApps.Metro.Controls.Dialogs; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Windows; -using System.Windows.Controls; - -namespace AuroraRecordGenerator -{ - /// - /// 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 void SpeciesSelectChanged(object sender, SelectionChangedEventArgs e) - { - if (SpeciesCombo.SelectionBoxItem == null) - return; - - 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; - - case SpeciesType.None: - break; - - 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)}"); - } - - 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; - - // 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; - - // 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(); - } - - 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; - - default: - throw new ArgumentOutOfRangeException(); - } - } - - 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 (*.*)|*.*" - }; - - 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."); - } - - } - - 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 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 deleted file mode 100644 index c6c728b..0000000 --- a/AuroraRecordGenerator/RecordFormatter.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace AuroraRecordGenerator -{ - internal partial class RecordFormatter - { - private Record _targetRecord; - - 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 _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 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(); - - // 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(); - - // flush the record cache so they're regenerated - _commonRecords = null; - } - - 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 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 deleted file mode 100644 index a0d7576..0000000 --- a/AuroraRecordGenerator/RecordFormatterGenerationMethods.cs +++ /dev/null @@ -1,212 +0,0 @@ -using Humanizer; -using System.Linq; -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)})"); - - 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."); - - 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."); - - // identifying features - var trimmedFeatures = _targetRecord.DistinguishingFeatures.Trim(); - record.Append("Distinguishing Features: "); - record.AppendLine(trimmedFeatures.Length > 0 ? trimmedFeatures : "None noted."); - - record.AppendLine(); - - // general notes - WriteSectionIfAny(ref record, - "General Notes:", - _employmentPublicRecord); - - WriteSectionIfAny(ref record, - "Medical Notes:", - _medicalPublicRecord); - - WriteSectionIfAny(ref record, - "Security Notes:", - _securityPublicRecord); - - _commonRecords = record.ToString(); - } - - private string MakeEmploymentRecords() - { - var recordText = new StringBuilder(); - if (_commonRecords.IsEmpty()) - MakeCommonRecords(); - - 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(); - - WriteSectionIfAny(ref recordText, - "Experience:", - _employmentExperience); - - WriteSectionIfAny(ref recordText, - "Formal Education History:", - _employmentFormalEducation); - - WriteSectionIfAny(ref recordText, - "Pre-NanoTrasen Employment History:", - _employmentPreNtEmployment); - - WriteSectionIfAny(ref recordText, - "NanoTrasen Employment History:", - _employmentNtEmployment); - - WriteSectionIfAny(ref recordText, - "Trained in the following:", - _employmentSkills); - } - - return recordText.ToString(); - } - - private string MakeMedicalRecords() - { - var recordText = new StringBuilder(); - if (_commonRecords.IsEmpty()) - MakeCommonRecords(); - - 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(); - - 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) - 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.NoRevive) - MakeMedicalNote(ref recordText, "DO NOT REVIVE"); - - recordText.AppendLine(); - } - - WriteSectionIfAny(ref recordText, - "Notes:", - _medicalNotes); - - WriteSectionIfAny(ref recordText, - "Medical History:", - _medicalHistory); - - WriteSectionIfAny(ref recordText, - "Psychiatric Notes:", - _medicalPsychNotes); - - WriteSectionIfAny(ref recordText, - "Psychiatric History:", - _medicalPsychHistory); - - WriteSectionIfAny(ref recordText, - "Prescriptions:", - _medicalPrescriptions); - } - - return recordText.ToString(); - } - - private string MakeSecurityRecords() - { - var recordText = new StringBuilder(); - if (_commonRecords.IsEmpty()) - MakeCommonRecords(); - - recordText.Append(_commonRecords); - - 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, - "Record:", - _securityRecords); - } - - return recordText.ToString(); - } - } -} diff --git a/AuroraRecordGenerator/Types.cs b/AuroraRecordGenerator/Types.cs deleted file mode 100644 index e6cf9a7..0000000 --- a/AuroraRecordGenerator/Types.cs +++ /dev/null @@ -1,116 +0,0 @@ -using ProtoBuf; -using System; - -namespace AuroraRecordGenerator -{ - [ProtoContract] - public enum SpeciesType - { - [ProtoEnum] - None = 0, - - [ProtoEnum] - Human, - - [ProtoEnum] - Skrell, - - [ProtoEnum] - Tajara, - - [ProtoEnum] - Unathi, - - [ProtoEnum] - Vaurca, - - [ProtoEnum] - Diona, - - [ProtoEnum] - IPC - } - - [ProtoContract] - public enum SpeciesSubType - { - [ProtoEnum, SubspeciesMeta(SpeciesType.None, "N/A")] - None = 0, - - [ProtoEnum, SubspeciesMeta(SpeciesType.Tajara, "M'sai", "Ethnicity")] - MsaiTajara, - - [ProtoEnum, SubspeciesMeta(SpeciesType.Tajara, "Zhan-Khazan", "Ethnicity")] - ZhanTajara, - - [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, - - [ProtoEnum, SubspeciesMeta(SpeciesType.IPC, "Shell", "Model")] - IpcHumanoid, - - [ProtoEnum, SubspeciesMeta(SpeciesType.IPC, "Xion Industrial", "Model")] - IpcHeavy, - - [ProtoEnum, SubspeciesMeta(SpeciesType.Unathi, "Aut'akh", "Variant")] - UnathiRobot, - - [ProtoEnum, SubspeciesMeta(SpeciesType.Human, "Offworlder", "Variant")] - HumanOffworld - } - - [ProtoContract] - public enum GenderType - { - [ProtoEnum] - NotApplicable = 0, - - [ProtoEnum] - Male, - - [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); - } - - [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 deleted file mode 100644 index 2503d1d..0000000 --- a/AuroraRecordGenerator/Utility.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -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 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); - - /// - /// 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 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 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(); - } - - /// - /// 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 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; - } - - // 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 diff --git a/AuroraRecordGenerator.sln b/CharacterRecordsGenerator.sln similarity index 83% rename from AuroraRecordGenerator.sln rename to CharacterRecordsGenerator.sln index d3428c0..9a8724e 100644 --- a/AuroraRecordGenerator.sln +++ b/CharacterRecordsGenerator.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.421 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31702.278 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuroraRecordGenerator", "AuroraRecordGenerator\AuroraRecordGenerator.csproj", "{2E1295C2-7BD9-454E-B13E-8A22448DD5F6}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CharacterRecordsGenerator", "CharacterRecordsGenerator\CharacterRecordsGenerator.csproj", "{2E1295C2-7BD9-454E-B13E-8A22448DD5F6}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/AuroraRecordGenerator/App.config b/CharacterRecordsGenerator/App.config similarity index 100% rename from AuroraRecordGenerator/App.config rename to CharacterRecordsGenerator/App.config diff --git a/AuroraRecordGenerator/App.xaml b/CharacterRecordsGenerator/App.xaml similarity index 91% rename from AuroraRecordGenerator/App.xaml rename to CharacterRecordsGenerator/App.xaml index 120aad2..186554e 100644 --- a/AuroraRecordGenerator/App.xaml +++ b/CharacterRecordsGenerator/App.xaml @@ -1,7 +1,7 @@ - diff --git a/AuroraRecordGenerator/App.xaml.cs b/CharacterRecordsGenerator/App.xaml.cs similarity index 51% rename from AuroraRecordGenerator/App.xaml.cs rename to CharacterRecordsGenerator/App.xaml.cs index 4f57d35..f03a881 100644 --- a/AuroraRecordGenerator/App.xaml.cs +++ b/CharacterRecordsGenerator/App.xaml.cs @@ -6,12 +6,12 @@ using System.Linq; using System.Threading.Tasks; using System.Windows; -namespace AuroraRecordGenerator +namespace CharacterRecordsGenerator { - /// - /// Interaction logic for App.xaml - /// - public partial class App : Application - { - } + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } } diff --git a/AuroraRecordGenerator/AuroraRecordGenerator.csproj b/CharacterRecordsGenerator/CharacterRecordsGenerator.csproj similarity index 86% rename from AuroraRecordGenerator/AuroraRecordGenerator.csproj rename to CharacterRecordsGenerator/CharacterRecordsGenerator.csproj index 83ebbbd..b530186 100644 --- a/AuroraRecordGenerator/AuroraRecordGenerator.csproj +++ b/CharacterRecordsGenerator/CharacterRecordsGenerator.csproj @@ -7,13 +7,28 @@ {2E1295C2-7BD9-454E-B13E-8A22448DD5F6} WinExe Properties - AuroraRecordGenerator - AuroraRecordGenerator + CharacterRecordsGenerator + Character Records Generator v4.5.2 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 true + false + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 2.0.0.%2a + false + true AnyCPU @@ -157,6 +172,18 @@ + + + False + Microsoft .NET Framework 4.5.2 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + + Height="200"> - + + Text="{Binding Path=FirstName}" controls:TextBoxHelper.Watermark="John" TabIndex="1" /> + Text="{Binding Path=LastName}" controls:TextBoxHelper.Watermark="Doe" TabIndex="3" /> + Text="{Binding Path=Citizenship}" + controls:TextBoxHelper.Watermark="Coalition of Colonies" TabIndex="4" /> - - - - - + - - - - + - + - - + + + + + + + + + + + + @@ -183,10 +220,6 @@ - - - - @@ -194,52 +227,26 @@ VerticalAlignment="Bottom" Margin="0" Height="10" /> - - - - - - + ToolTip="Any other skills of note, or training being undertaken currently. e.g. First Aid training Chemistry student at Mendell University" /> @@ -248,7 +255,7 @@ - + @@ -259,22 +266,30 @@ - - - - + + + + + + + + + + HorizontalAlignment="Left" + Margin="-10,10,0,0" + ToolTip="If the character should not be revived." TabIndex="2" Grid.Column="1" /> + + VerticalAlignment="Bottom" Height="10" /> - - - - + Grid.Row="1" Text="{Binding Path=MedicalHistory}" TabIndex="6" /> @@ -341,26 +346,39 @@ + + + + + + + + + - - +