Remove unnecessary Field exclusion

This commit is contained in:
Matt Nadareski
2020-08-23 22:23:55 -07:00
parent a1d81a8e5f
commit f8fae70231
27 changed files with 618 additions and 958 deletions

View File

@@ -11,6 +11,7 @@ namespace SabreTools.Library.DatItems
/// <summary>
/// Represents the information specific to a set/game/machine
/// </summary>
[JsonObject("machine")]
public class Machine : ICloneable
{
#region Fields
@@ -330,185 +331,6 @@ namespace SabreTools.Library.DatItems
#region Accessors
/// <summary>
/// Get the value of that field as a string, if possible
/// </summary>
public string GetField(Field field, List<Field> excludeFields)
{
// If the field is to be excluded, return empty string
if (excludeFields.Contains(field))
return string.Empty;
string fieldValue = null;
switch (field)
{
#region Common
case Field.MachineName:
fieldValue = Name;
break;
case Field.Comment:
fieldValue = Comment;
break;
case Field.Description:
fieldValue = Description;
break;
case Field.Year:
fieldValue = Year;
break;
case Field.Manufacturer:
fieldValue = Manufacturer;
break;
case Field.Publisher:
fieldValue = Publisher;
break;
case Field.Category:
fieldValue = Category;
break;
case Field.RomOf:
fieldValue = RomOf;
break;
case Field.CloneOf:
fieldValue = CloneOf;
break;
case Field.SampleOf:
fieldValue = SampleOf;
break;
case Field.MachineType:
fieldValue = MachineType.ToString();
break;
#endregion
#region AttractMode
case Field.Players:
fieldValue = Players;
break;
case Field.Rotation:
fieldValue = Rotation;
break;
case Field.Control:
fieldValue = Control;
break;
case Field.SupportStatus:
fieldValue = Status;
break;
case Field.DisplayCount:
fieldValue = DisplayCount;
break;
case Field.DisplayType:
fieldValue = DisplayType;
break;
case Field.Buttons:
fieldValue = Buttons;
break;
#endregion
#region ListXML
case Field.SourceFile:
fieldValue = SourceFile;
break;
case Field.Runnable:
fieldValue = Runnable.ToString();
break;
case Field.DeviceReferences:
fieldValue = string.Join(";", DeviceReferences ?? new List<ListXmlDeviceReference>());
break;
case Field.Slots:
fieldValue = string.Join(";", Slots ?? new List<ListXmlSlot>());
break;
case Field.Infos:
fieldValue = string.Join(";", (Infos ?? new List<ListXmlInfo>()).Select(i => $"{i.Name}={i.Value}"));
break;
#endregion
#region Logiqx
case Field.Board:
fieldValue = Board;
break;
case Field.RebuildTo:
fieldValue = RebuildTo;
break;
#endregion
#region Logiqx EmuArc
case Field.TitleID:
fieldValue = TitleID;
break;
case Field.Developer:
fieldValue = Developer;
break;
case Field.Genre:
fieldValue = Genre;
break;
case Field.Subgenre:
fieldValue = Subgenre;
break;
case Field.Ratings:
fieldValue = Ratings;
break;
case Field.Score:
fieldValue = Score;
break;
case Field.Enabled:
fieldValue = Enabled;
break;
case Field.HasCrc:
fieldValue = HasCrc.ToString();
break;
case Field.RelatedTo:
fieldValue = RelatedTo;
break;
#endregion
#region OpenMSX
case Field.GenMSXID:
fieldValue = GenMSXID;
break;
case Field.System:
fieldValue = System;
break;
case Field.Country:
fieldValue = Country;
break;
#endregion
#region SoftwareList
case Field.Supported:
fieldValue = Supported.ToString();
break;
case Field.SharedFeatures:
fieldValue = string.Join(";", (SharedFeatures ?? new List<SoftwareListSharedFeature>()).Select(i => $"{i.Name}={i.Value}"));
break;
case Field.DipSwitches:
// TODO: There is no possible way this will work... use placeholder for now
fieldValue = "dipswitches";
break;
#endregion
default:
return null;
}
// Make sure we don't return null
if (string.IsNullOrEmpty(fieldValue))
fieldValue = string.Empty;
return fieldValue;
}
/// <summary>
/// Set fields with given values
/// </summary>