whitespace, comments, broad subtypes
- changes some whitespace stuff - adds some comments for ease of reading player facing stuff - adds hharar, njarir to tajara - adds axiori, xiialt, xiori to skrell - adds breeders, bulwarks to vaurca - adds baseline, bishop to ipc models - renames g1, g2 heavy frames to industrial - fixes shells being listed twice - removes 'do not clone' option
This commit is contained in:
parent
11f108b5f8
commit
9b85a836fb
10 changed files with 696 additions and 683 deletions
|
|
@ -8,10 +8,10 @@ using System.Windows;
|
|||
|
||||
namespace AuroraRecordGenerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
)]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -248,7 +248,7 @@
|
|||
<ScrollViewer>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="60" />
|
||||
<RowDefinition Height="50" />
|
||||
<!-- Checkboxes -->
|
||||
<RowDefinition Height="122" MinHeight="60" />
|
||||
<RowDefinition Height="122" MinHeight="60" />
|
||||
|
|
@ -260,21 +260,29 @@
|
|||
</Grid.RowDefinitions>
|
||||
<!-- Opt-Outs -->
|
||||
<Grid Grid.Row="0" ToolTip="If the character wishes to not be cloned.">
|
||||
<CheckBox x:Name="NoClone" Content="Do Not Clone" HorizontalAlignment="Left"
|
||||
Margin="10,10,0,0" VerticalAlignment="Top" TabIndex="1" />
|
||||
<CheckBox x:Name="NoProsthetic" Content="No Prosthetics"
|
||||
HorizontalAlignment="Left" Margin="10,33,0,0" VerticalAlignment="Top"
|
||||
ToolTip="If the character should not be fitted with prosthetics." TabIndex="3" />
|
||||
<CheckBox x:Name="NoBorg" Content="Do Not Borgify" HorizontalAlignment="Left"
|
||||
Margin="136,10,0,0" VerticalAlignment="Top"
|
||||
ToolTip="If the character should not be borged." TabIndex="2" />
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="163*"/>
|
||||
<ColumnDefinition Width="163*"/>
|
||||
<ColumnDefinition Width="163*"/>
|
||||
<ColumnDefinition Width="163*"/>
|
||||
<ColumnDefinition Width="163*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox x:Name="NoBorg" Content="Do Not Borgify"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0,10,0,0"
|
||||
ToolTip="If the character should not be borged." TabIndex="1" Grid.Column="0" />
|
||||
<CheckBox x:Name="NoRevive" Content="Do Not Resuscitate"
|
||||
HorizontalAlignment="Left" Margin="136,33,0,0" VerticalAlignment="Top"
|
||||
ToolTip="If the character should not be revived." TabIndex="4" />
|
||||
HorizontalAlignment="Left"
|
||||
Margin="-10,10,0,0"
|
||||
ToolTip="If the character should not be revived." TabIndex="2" Grid.Column="1" />
|
||||
<CheckBox x:Name="NoProsthetic" Content="No Prosthetics"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0,10,0,0"
|
||||
ToolTip="If the character should not be fitted with prosthetics." TabIndex="3" Grid.Column="2" />
|
||||
</Grid>
|
||||
<!-- user-resizable stuff is fun! Not. -->
|
||||
<GridSplitter Grid.Row="1" Grid.ColumnSpan="1" HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Bottom" Margin="0" Height="10" />
|
||||
VerticalAlignment="Bottom" Height="10" />
|
||||
<GridSplitter Grid.Row="2" Grid.ColumnSpan="1" HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Bottom" Margin="0" Height="10" />
|
||||
<GridSplitter Grid.Row="3" Grid.ColumnSpan="1" HorizontalAlignment="Stretch"
|
||||
|
|
@ -286,14 +294,14 @@
|
|||
<GridSplitter Grid.Row="6" Grid.ColumnSpan="1" HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Bottom" Margin="0" Height="10" />
|
||||
|
||||
<TextBox Margin="0,10,0,10" AcceptsReturn="True"
|
||||
<TextBox Margin="0,10" AcceptsReturn="True"
|
||||
TextWrapping="Wrap" controls:TextBoxHelper.Watermark="Public Record"
|
||||
controls:TextBoxHelper.UseFloatingWatermark="True"
|
||||
controls:TextBoxHelper.IsSpellCheckContextMenuEnabled="True"
|
||||
ToolTip="Public medical notes posted on employment and security records. One per line."
|
||||
Grid.Row="1" VerticalScrollBarVisibility="Auto"
|
||||
Text="{Binding Path=MedicalPublicRecord}" TabIndex="5" />
|
||||
<TextBox Margin="0,10,0,10" AcceptsReturn="True" TextWrapping="Wrap"
|
||||
<TextBox Margin="0,10" AcceptsReturn="True" TextWrapping="Wrap"
|
||||
controls:TextBoxHelper.Watermark="Medical History"
|
||||
controls:TextBoxHelper.UseFloatingWatermark="True"
|
||||
controls:TextBoxHelper.IsSpellCheckContextMenuEnabled="True"
|
||||
|
|
|
|||
|
|
@ -9,185 +9,184 @@ using System.Windows.Controls;
|
|||
|
||||
namespace AuroraRecordGenerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for RecordEditor.xaml
|
||||
/// </summary>
|
||||
public partial class RecordEditor
|
||||
{
|
||||
public RecordEditor()
|
||||
{
|
||||
// Initialize the record object used for storage and generation
|
||||
Data = new Record();
|
||||
DataContext = Data;
|
||||
ProtoBuf.Serializer.PrepareSerializer<GenderType>();
|
||||
ProtoBuf.Serializer.PrepareSerializer<SpeciesType>();
|
||||
ProtoBuf.Serializer.PrepareSerializer<SpeciesSubType>();
|
||||
ProtoBuf.Serializer.PrepareSerializer<Record>();
|
||||
InitializeComponent();
|
||||
SubSpeciesCombo.ItemsSource = GetSpeciesOptions();
|
||||
VersionLabel.Content = $"v{Utility.GetVersion()}";
|
||||
}
|
||||
/// <summary>
|
||||
/// Interaction logic for RecordEditor.xaml
|
||||
/// </summary>
|
||||
public partial class RecordEditor
|
||||
{
|
||||
public RecordEditor()
|
||||
{
|
||||
// Initialize the record object used for storage and generation
|
||||
Data = new Record();
|
||||
DataContext = Data;
|
||||
ProtoBuf.Serializer.PrepareSerializer<GenderType>();
|
||||
ProtoBuf.Serializer.PrepareSerializer<SpeciesType>();
|
||||
ProtoBuf.Serializer.PrepareSerializer<SpeciesSubType>();
|
||||
ProtoBuf.Serializer.PrepareSerializer<Record>();
|
||||
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<string> ?? 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<string> ?? 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<Record>(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<Record>(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<string> GetSpeciesOptions() => Enum.GetValues(typeof(SpeciesSubType)).Cast<SpeciesSubType>().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<string> GetSpeciesOptions(SpeciesType limitTo) => from item in Enum.GetValues(typeof(SpeciesSubType)).Cast<SpeciesSubType>()
|
||||
let attr = item.GetAttributeOfType<SubspeciesMetaAttribute>()
|
||||
where attr != null && (attr.AssociatedSpecies == limitTo || attr.AssociatedSpecies == SpeciesType.None)
|
||||
select Utility.SubspeciesNiceName(item);
|
||||
}
|
||||
private static IEnumerable<string> GetSpeciesOptions() => Enum.GetValues(typeof(SpeciesSubType)).Cast<SpeciesSubType>().Select(Utility.SubspeciesNiceName);
|
||||
|
||||
private static IEnumerable<string> GetSpeciesOptions(SpeciesType limitTo) => from item in Enum.GetValues(typeof(SpeciesSubType)).Cast<SpeciesSubType>()
|
||||
let attr = item.GetAttributeOfType<SubspeciesMetaAttribute>()
|
||||
where attr != null && (attr.AssociatedSpecies == limitTo || attr.AssociatedSpecies == SpeciesType.None)
|
||||
select Utility.SubspeciesNiceName(item);
|
||||
}
|
||||
}
|
||||
|
|
@ -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<string> _medicalPublicRecord;
|
||||
private IList<string> _medicalHistory;
|
||||
private IList<string> _medicalNotes;
|
||||
private IList<string> _medicalPsychHistory;
|
||||
private IList<string> _medicalPsychNotes;
|
||||
private IList<string> _medicalPrescriptions;
|
||||
private IList<string> _medicalPublicRecord;
|
||||
private IList<string> _medicalHistory;
|
||||
private IList<string> _medicalNotes;
|
||||
private IList<string> _medicalPsychHistory;
|
||||
private IList<string> _medicalPsychNotes;
|
||||
private IList<string> _medicalPrescriptions;
|
||||
|
||||
private IList<string> _securityPublicRecord;
|
||||
private IList<string> _securityRecords;
|
||||
private IList<string> _securityNotes;
|
||||
private IList<string> _securityPublicRecord;
|
||||
private IList<string> _securityRecords;
|
||||
private IList<string> _securityNotes;
|
||||
|
||||
private IList<string> _employmentPublicRecord;
|
||||
private IList<string> _employmentExperience;
|
||||
private IList<string> _employmentPreNtEmployment;
|
||||
private IList<string> _employmentFormalEducation;
|
||||
private IList<string> _employmentNtEmployment;
|
||||
private IList<string> _employmentSkills;
|
||||
private IList<string> _employmentPublicRecord;
|
||||
private IList<string> _employmentExperience;
|
||||
private IList<string> _employmentPreNtEmployment;
|
||||
private IList<string> _employmentFormalEducation;
|
||||
private IList<string> _employmentNtEmployment;
|
||||
private IList<string> _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;
|
||||
|
||||
/// <summary>
|
||||
/// Writes the <see cref="string"/> form of a record section to the specified <see cref="StringBuilder"/>, as long as there's entries to write.
|
||||
/// </summary>
|
||||
/// <param name="builder">The <see cref="StringBuilder"/> to write to.</param>
|
||||
/// <param name="header">The title for the section.</param>
|
||||
/// <param name="entries">The entries of this section.</param>
|
||||
private static void WriteSectionIfAny(ref StringBuilder builder, string header, IList<string> 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();
|
||||
}
|
||||
/// <summary>
|
||||
/// Writes the <see cref="string"/> form of a record section to the specified <see cref="StringBuilder"/>, as long as there's entries to write.
|
||||
/// </summary>
|
||||
/// <param name="builder">The <see cref="StringBuilder"/> to write to.</param>
|
||||
/// <param name="header">The title for the section.</param>
|
||||
/// <param name="entries">The entries of this section.</param>
|
||||
private static void WriteSectionIfAny(ref StringBuilder builder, string header, IList<string> 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}");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<SubspeciesMetaAttribute>()?.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<SubspeciesMetaAttribute>()?.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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// The current in-character date.
|
||||
/// </summary>
|
||||
public static DateTime IcDate => new DateTime(DateTime.Now.Year + 442,
|
||||
DateTime.Now.Month,
|
||||
DateTime.Now.Day);
|
||||
}
|
||||
public static class Info
|
||||
{
|
||||
/// <summary>
|
||||
/// The current in-character date.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6,91 +6,91 @@ using System.Text;
|
|||
|
||||
namespace AuroraRecordGenerator
|
||||
{
|
||||
public static class Utility
|
||||
{
|
||||
public static IList<string> LineSplit(this string source) =>
|
||||
source.Split('\n').Where(item => item.Trim().Length != 0).ToList();
|
||||
public static class Utility
|
||||
{
|
||||
public static IList<string> 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}\"";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a weight in Kilograms to Pounds.
|
||||
/// </summary>
|
||||
/// <param name="kg">The weight in kilograms.</param>
|
||||
/// <returns>The weight converted to pounds.</returns>
|
||||
public static double KgToLb(double kg) => Math.Round(kg * 2.2046, 2);
|
||||
/// <summary>
|
||||
/// Converts a weight in Kilograms to Pounds.
|
||||
/// </summary>
|
||||
/// <param name="kg">The weight in kilograms.</param>
|
||||
/// <returns>The weight converted to pounds.</returns>
|
||||
public static double KgToLb(double kg) => Math.Round(kg * 2.2046, 2);
|
||||
|
||||
/// <summary>
|
||||
/// Returns <paramref name="val"/> and a trailing space if val is not whitespace, <see cref="string.Empty"/> otherwise.
|
||||
/// </summary>
|
||||
/// <param name="val"></param>
|
||||
/// <returns></returns>
|
||||
public static string SpaceIfValue(this string val) => string.IsNullOrWhiteSpace(val) ? string.Empty : $" {val} ";
|
||||
/// <summary>
|
||||
/// Returns <paramref name="val"/> and a trailing space if val is not whitespace, <see cref="string.Empty"/> otherwise.
|
||||
/// </summary>
|
||||
/// <param name="val"></param>
|
||||
/// <returns></returns>
|
||||
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<string> target) =>
|
||||
target.Aggregate(new StringBuilder(), (b, s) => b.AppendLine($" - {s.Trim()}")).ToString();
|
||||
public static string FormatAsList(this IEnumerable<string> 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();
|
||||
}
|
||||
|
||||
/// <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);
|
||||
/// <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>();
|
||||
return attr?.NiceName ?? Enum.GetName(typeof(SpeciesSubType), species);
|
||||
}
|
||||
public static string SubspeciesNiceName(SpeciesSubType species)
|
||||
{
|
||||
var attr = species.GetAttributeOfType<SubspeciesMetaAttribute>();
|
||||
return attr?.NiceName ?? Enum.GetName(typeof(SpeciesSubType), species);
|
||||
}
|
||||
|
||||
public static SpeciesSubType SubspeciesNiceNameToEnum(string nicename)
|
||||
{
|
||||
return (from item in Enum.GetValues(typeof(SpeciesSubType)).Cast<SpeciesSubType>()
|
||||
let attr = item.GetAttributeOfType<SubspeciesMetaAttribute>()
|
||||
where attr != null && attr.NiceName == nicename
|
||||
select item).FirstOrDefault();
|
||||
}
|
||||
public static SpeciesSubType SubspeciesNiceNameToEnum(string nicename)
|
||||
{
|
||||
return (from item in Enum.GetValues(typeof(SpeciesSubType)).Cast<SpeciesSubType>()
|
||||
let attr = item.GetAttributeOfType<SubspeciesMetaAttribute>()
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets an attribute on an enum field value
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the attribute you want to retrieve</typeparam>
|
||||
/// <param name="enumVal">The enum value</param>
|
||||
/// <returns>The attribute of type T that exists on the enum value</returns>
|
||||
/// <example>string desc = myEnumVariable.GetAttributeOfType<DescriptionAttribute>().Description;</example>
|
||||
public static T GetAttributeOfType<T>(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
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets an attribute on an enum field value
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the attribute you want to retrieve</typeparam>
|
||||
/// <param name="enumVal">The enum value</param>
|
||||
/// <returns>The attribute of type T that exists on the enum value</returns>
|
||||
/// <example>string desc = myEnumVariable.GetAttributeOfType<DescriptionAttribute>().Description;</example>
|
||||
public static T GetAttributeOfType<T>(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue