Files
SabreTools/SabreTools.Library/DatItems/Machine.cs

228 lines
6.3 KiB
C#
Raw Normal View History

2017-01-27 16:42:24 -08:00
using System;
using System.Collections.Generic;
2020-06-11 11:44:46 -07:00
2017-05-04 02:41:11 -07:00
using SabreTools.Library.Data;
2020-06-15 21:00:09 -07:00
using Newtonsoft.Json;
namespace SabreTools.Library.DatItems
{
/// <summary>
/// Represents the information specific to a set/game/machine
/// </summary>
2020-07-26 22:52:24 -07:00
/// TODO: Can this be rewritten as a Dictionary?
public class Machine : ICloneable
{
#region Publicly facing variables
/// <summary>
/// Name of the machine
/// </summary>
2020-06-15 21:00:09 -07:00
[JsonProperty("name")]
public string Name { get; set; }
/// <summary>
/// Additional notes
/// </summary>
2020-06-15 21:00:09 -07:00
[JsonProperty("comment")]
public string Comment { get; set; }
/// <summary>
/// Extended description
/// </summary>
2020-06-15 21:00:09 -07:00
[JsonProperty("description")]
public string Description { get; set; }
/// <summary>
/// Year(s) of release/manufacture
/// </summary>
2020-06-15 21:00:09 -07:00
[JsonProperty("year")]
public string Year { get; set; }
/// <summary>
/// Manufacturer, if available
/// </summary>
2020-06-15 21:00:09 -07:00
[JsonProperty("manufacturer")]
public string Manufacturer { get; set; }
/// <summary>
/// Publisher, if available
/// </summary>
2020-06-15 21:00:09 -07:00
[JsonProperty("publisher")]
public string Publisher { get; set; }
/// <summary>
/// Category, if available
/// </summary>
[JsonProperty("category")]
public string Category { get; set; }
/// <summary>
/// fomof parent
/// </summary>
2020-06-15 21:00:09 -07:00
[JsonProperty("romof")]
public string RomOf { get; set; }
/// <summary>
/// cloneof parent
/// </summary>
2020-06-15 21:00:09 -07:00
[JsonProperty("cloneof")]
public string CloneOf { get; set; }
/// <summary>
/// sampleof parent
/// </summary>
2020-06-15 21:00:09 -07:00
[JsonProperty("sampleof")]
public string SampleOf { get; set; }
/// <summary>
/// Support status
/// </summary>
/// <remarks>yes = true, partial = null, no = false</remarks>
2020-06-15 21:00:09 -07:00
[JsonProperty("supported")]
public bool? Supported { get; set; }
/// <summary>
/// Emulator source file related to the machine
/// </summary>
2020-06-15 21:00:09 -07:00
[JsonProperty("sourcefile")]
public string SourceFile { get; set; }
/// <summary>
/// Machine runnable status
/// </summary>
/// <remarks>yes = true, partial = null, no = false</remarks>
2020-06-15 21:00:09 -07:00
[JsonProperty("runnable")]
public bool? Runnable { get; set; }
/// <summary>
/// Machine board name
/// </summary>
2020-06-15 21:00:09 -07:00
[JsonProperty("board")]
public string Board { get; set; }
/// <summary>
/// Rebuild location if different than machine name
/// </summary>
2020-06-15 21:00:09 -07:00
[JsonProperty("rebuildto")]
public string RebuildTo { get; set; }
/// <summary>
/// List of associated device names
/// </summary>
2020-06-15 21:00:09 -07:00
[JsonProperty("devices")]
public List<string> Devices { get; set; }
/// <summary>
/// List of slot options
/// </summary>
2020-06-15 21:00:09 -07:00
[JsonProperty("slotoptions")]
public List<string> SlotOptions { get; set; }
/// <summary>
/// List of info items
/// </summary>
2020-06-15 21:00:09 -07:00
[JsonProperty("infos")]
2020-06-14 23:07:31 -07:00
public List<KeyValuePair<string, string>> Infos { get; set; }
/// <summary>
/// Type of the machine
/// </summary>
2020-06-15 21:00:09 -07:00
[JsonProperty("type")]
public MachineType MachineType { get; set; }
#endregion
#region Constructors
/// <summary>
/// Create a new Machine object
/// </summary>
public Machine()
{
Name = null;
Comment = null;
Description = null;
Year = null;
Manufacturer = null;
Publisher = null;
Category = 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;
}
/// <summary>
/// Create a new Machine object with the included information
/// </summary>
/// <param name="name">Name of the machine</param>
/// <param name="description">Description of the machine</param>
public Machine(string name, string description)
{
Name = name;
Comment = null;
Description = description;
Year = null;
Manufacturer = null;
Publisher = null;
Category = 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
/// <summary>
/// Create a clone of the current machine
/// </summary>
/// <returns>New machine with the same values as the current one</returns>
public object Clone()
{
return new Machine()
{
Name = this.Name,
Comment = this.Comment,
Description = this.Description,
Year = this.Year,
Manufacturer = this.Manufacturer,
Publisher = this.Publisher,
Category = this.Category,
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
}
}