using System.Collections.Generic;
namespace SabreTools.Models.Internal
{
///
/// Format-agnostic representation of item data
///
public class Machine : Dictionary
{
#region Keys
/// Adjuster[]
public const string AdjusterKey = "adjuster";
/// Archive[]
public const string ArchiveKey = "archive";
/// BiosSet[]
public const string BiosSetKey = "biosset";
/// string
public const string BoardKey = "board";
/// string
public const string ButtonsKey = "buttons";
/// string, string[]
public const string CategoryKey = "category";
/// Chip[]
public const string ChipKey = "chip";
/// string
public const string CloneOfKey = "cloneof";
/// string
public const string CloneOfIdKey = "cloneofid";
/// string, string[]
public const string CommentKey = "comment";
/// string
public const string CompanyKey = "company";
/// Configuration[]
public const string ConfigurationKey = "configuration";
/// string
public const string ControlKey = "control";
/// string
public const string CountryKey = "country";
/// string
public const string DescriptionKey = "description";
/// DeviceRef[]
public const string DeviceRefKey = "device_ref";
/// DipSwitch[]
public const string DipSwitchKey = "dipswitch";
/// Disk[]
public const string DiskKey = "disk";
/// string
public const string DisplayCountKey = "displaycount";
/// Display[]
public const string DisplayKey = "display";
/// string
public const string DisplayTypeKey = "displaytype";
/// Driver, Driver[]
public const string DriverKey = "driver";
/// Dump[]
public const string DumpKey = "dump";
/// string
public const string DuplicateIDKey = "duplicateID";
/// string
public const string ExtraKey = "extra";
/// string
public const string FavoriteKey = "favorite";
/// string
public const string GenMSXIDKey = "genmsxid";
/// string
public const string HistoryKey = "history";
/// string
public const string IdKey = "id";
/// string
public const string Im1CRCKey = "im1CRC";
/// string
public const string Im2CRCKey = "im2CRC";
/// string
public const string ImageNumberKey = "imageNumber";
/// Info[]
public const string InfoKey = "info";
/// Input
public const string InputKey = "input";
/// (yes|no) "no"
public const string IsBiosKey = "isbios";
/// (yes|no) "no"
public const string IsDeviceKey = "isdevice";
/// (yes|no) "no"
public const string IsMechanicalKey = "ismechanical";
/// string
public const string LanguageKey = "language";
/// string
public const string LocationKey = "location";
/// string
public const string ManufacturerKey = "manufacturer";
/// Media[]
public const string MediaKey = "media";
/// string
public const string NotesKey = "notes";
/// Part[]
public const string PartKey = "part";
/// string
public const string PlayedCountKey = "playedcount";
/// string
public const string PlayedTimeKey = "playedtime";
/// string
public const string PlayersKey = "players";
/// Port[]
public const string PortKey = "port";
/// string
public const string PublisherKey = "publisher";
/// RamOption[]
public const string RamOptionKey = "ramoption";
/// string
public const string RebuildToKey = "rebuildto";
/// Release[]
public const string ReleaseKey = "release";
/// string
public const string ReleaseNumberKey = "releaseNumber";
/// Rom[]
public const string RomKey = "rom";
/// string
public const string RomOfKey = "romof";
/// string
public const string RotationKey = "rotation";
/// (yes|no) "no"
public const string RunnableKey = "runnable";
/// Sample[]
public const string SampleKey = "sample";
/// string
public const string SampleOfKey = "sampleof";
/// string
public const string SaveTypeKey = "saveType";
/// SharedFeat[]
public const string SharedFeatKey = "sharedfeat";
/// Slot[]
public const string SlotKey = "slot";
/// SoftwareList[]
public const string SoftwareListKey = "softwarelist";
/// Sound
public const string SoundKey = "sound";
/// string
public const string SourceFileKey = "sourcefile";
/// string
public const string SourceRomKey = "sourceRom";
/// string
public const string StatusKey = "status";
/// (yes|partial|no) "yes"
public const string SupportedKey = "supported";
/// string
public const string SystemKey = "system";
/// string
public const string TagsKey = "tags";
/// Trurip
public const string TruripKey = "trurip";
/// Video, Video[]
public const string VideoKey = "video";
/// string
public const string YearKey = "year";
#endregion
#region Reading Helpers
///
/// Read a key as a bool, returning null on error
///
public bool? ReadBool(string key)
{
if (string.IsNullOrWhiteSpace(key))
return null;
if (!ContainsKey(key))
return null;
return this[key] as bool?;
}
///
/// Read a key as a double, returning null on error
///
public double? ReadDouble(string key)
{
if (string.IsNullOrWhiteSpace(key))
return null;
if (!ContainsKey(key))
return null;
return this[key] as double?;
}
///
/// Read a key as a long, returning null on error
///
public long? ReadLong(string key)
{
if (string.IsNullOrWhiteSpace(key))
return null;
if (!ContainsKey(key))
return null;
return this[key] as long?;
}
///
/// Read a key as a string, returning null on error
///
public string? ReadString(string key)
{
if (string.IsNullOrWhiteSpace(key))
return null;
if (!ContainsKey(key))
return null;
return this[key] as string;
}
#endregion
}
}