using System; using System.Collections.Generic; using SabreTools.Library.Data; using Newtonsoft.Json; namespace SabreTools.Library.DatItems { /// /// Represents the information specific to a set/game/machine /// public class Machine : ICloneable { #region Publicly facing variables /// /// Name of the machine /// [JsonProperty("name")] public string Name { get; set; } /// /// Additional notes /// [JsonProperty("comment")] public string Comment { get; set; } /// /// Extended description /// [JsonProperty("description")] public string Description { get; set; } /// /// Year(s) of release/manufacture /// [JsonProperty("year")] public string Year { get; set; } /// /// Manufacturer, if available /// [JsonProperty("manufacturer")] public string Manufacturer { get; set; } /// /// Publisher, if available /// [JsonProperty("publisher")] public string Publisher { get; set; } /// /// fomof parent /// [JsonProperty("romof")] public string RomOf { get; set; } /// /// cloneof parent /// [JsonProperty("cloneof")] public string CloneOf { get; set; } /// /// sampleof parent /// [JsonProperty("sampleof")] public string SampleOf { get; set; } /// /// Support status /// /// yes = true, partial = null, no = false [JsonProperty("supported")] public bool? Supported { get; set; } /// /// Emulator source file related to the machine /// [JsonProperty("sourcefile")] public string SourceFile { get; set; } /// /// Machine runnable status /// /// yes = true, partial = null, no = false [JsonProperty("runnable")] public bool? Runnable { get; set; } /// /// Machine board name /// [JsonProperty("board")] public string Board { get; set; } /// /// Rebuild location if different than machine name /// [JsonProperty("rebuildto")] public string RebuildTo { get; set; } /// /// List of associated device names /// [JsonProperty("devices")] public List Devices { get; set; } /// /// List of slot options /// [JsonProperty("slotoptions")] public List SlotOptions { get; set; } /// /// List of info items /// [JsonProperty("infos")] public List> Infos { get; set; } /// /// Type of the machine /// [JsonProperty("type")] public MachineType MachineType { get; set; } #endregion #region Constructors /// /// Create a new Machine object /// public Machine() { Name = null; Comment = null; Description = null; Year = null; Manufacturer = null; Publisher = null; RomOf = null; CloneOf = null; SampleOf = null; Supported = true; SourceFile = null; Runnable = null; Board = null; RebuildTo = null; Devices = null; SlotOptions = null; Infos = null; MachineType = MachineType.NULL; } /// /// Create a new Machine object with the included information /// /// Name of the machine /// Description of the machine public Machine(string name, string description) { Name = name; Comment = null; Description = description; Year = null; Manufacturer = null; Publisher = null; RomOf = null; CloneOf = null; SampleOf = null; Supported = true; SourceFile = null; Runnable = null; Board = null; RebuildTo = null; Devices = null; SlotOptions = null; Infos = null; MachineType = MachineType.NULL; } #endregion #region Cloning methods /// /// Create a clone of the current machine /// /// New machine with the same values as the current one public object Clone() { return new Machine() { Name = this.Name, Comment = this.Comment, Description = this.Description, Year = this.Year, Manufacturer = this.Manufacturer, Publisher = this.Publisher, RomOf = this.RomOf, CloneOf = this.CloneOf, SampleOf = this.SampleOf, Supported = this.Supported, SourceFile = this.SourceFile, Runnable = this.Runnable, Board = this.Board, RebuildTo = this.RebuildTo, Devices = this.Devices, SlotOptions = this.SlotOptions, Infos = this.Infos, MachineType = this.MachineType, }; } #endregion } }