2017-01-27 16:42:24 -08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2017-01-09 15:58:29 -08:00
|
|
|
|
|
2017-05-04 02:41:11 -07:00
|
|
|
|
using SabreTools.Library.Data;
|
2017-01-08 22:48:19 -08:00
|
|
|
|
|
2017-05-04 02:41:11 -07:00
|
|
|
|
namespace SabreTools.Library.Dats
|
2016-10-24 12:58:57 -07:00
|
|
|
|
{
|
2017-06-16 16:24:26 -07:00
|
|
|
|
public struct Machine
|
2016-10-24 12:58:57 -07:00
|
|
|
|
{
|
|
|
|
|
|
#region Protected instance variables
|
|
|
|
|
|
|
2017-06-16 16:24:26 -07:00
|
|
|
|
private Guid _guid;
|
2016-10-24 12:58:57 -07:00
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Publicly facing variables
|
|
|
|
|
|
|
|
|
|
|
|
// Machine information
|
2017-06-16 17:09:34 -07:00
|
|
|
|
public string Name;
|
|
|
|
|
|
public string Comment;
|
|
|
|
|
|
public string Description;
|
|
|
|
|
|
public string Year;
|
|
|
|
|
|
public string Manufacturer;
|
|
|
|
|
|
public string RomOf;
|
|
|
|
|
|
public string CloneOf;
|
|
|
|
|
|
public string SampleOf;
|
|
|
|
|
|
public string SourceFile;
|
|
|
|
|
|
public bool? Runnable;
|
|
|
|
|
|
public string Board;
|
|
|
|
|
|
public string RebuildTo;
|
|
|
|
|
|
public List<string> Devices;
|
|
|
|
|
|
public MachineType MachineType;
|
2016-10-24 12:58:57 -07:00
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Constructors
|
|
|
|
|
|
|
|
|
|
|
|
/// <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)
|
|
|
|
|
|
{
|
2017-06-16 17:09:34 -07:00
|
|
|
|
Name = name;
|
|
|
|
|
|
Comment = null;
|
|
|
|
|
|
Description = description;
|
|
|
|
|
|
Year = null;
|
|
|
|
|
|
Manufacturer = null;
|
|
|
|
|
|
RomOf = null;
|
|
|
|
|
|
CloneOf = null;
|
|
|
|
|
|
SampleOf = null;
|
|
|
|
|
|
SourceFile = null;
|
|
|
|
|
|
Runnable = null;
|
|
|
|
|
|
Board = null;
|
|
|
|
|
|
RebuildTo = null;
|
|
|
|
|
|
Devices = null;
|
|
|
|
|
|
MachineType = MachineType.NULL;
|
2017-06-16 16:24:26 -07:00
|
|
|
|
_guid = new Guid();
|
2016-10-24 12:58:57 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
2017-03-16 23:34:14 -07:00
|
|
|
|
|
2017-06-16 16:24:26 -07:00
|
|
|
|
#region Equality comparerers
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Override the equality comparer
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public static bool operator ==(Machine a, Machine b)
|
|
|
|
|
|
{
|
|
|
|
|
|
return (a.Name == b.Name
|
|
|
|
|
|
&& a.Comment == b.Comment
|
|
|
|
|
|
&& a.Description == b.Description
|
|
|
|
|
|
&& a.Year == b.Year
|
|
|
|
|
|
&& a.Manufacturer == b.Manufacturer
|
|
|
|
|
|
&& a.RomOf == b.RomOf
|
|
|
|
|
|
&& a.CloneOf == b.CloneOf
|
|
|
|
|
|
&& a.SampleOf == b.SampleOf
|
|
|
|
|
|
&& a.SourceFile == b.SourceFile
|
|
|
|
|
|
&& a.Runnable == b.Runnable
|
|
|
|
|
|
&& a.Board == b.Board
|
|
|
|
|
|
&& a.RebuildTo == b.RebuildTo
|
|
|
|
|
|
&& a.Devices == b.Devices
|
|
|
|
|
|
&& a.MachineType == b.MachineType);
|
|
|
|
|
|
}
|
2017-03-16 23:34:14 -07:00
|
|
|
|
|
2017-06-16 16:24:26 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Override the inequality comparer
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public static bool operator !=(Machine a, Machine b)
|
2017-03-16 23:34:14 -07:00
|
|
|
|
{
|
2017-06-16 16:24:26 -07:00
|
|
|
|
return !(a == b);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Override the Equals method
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public override bool Equals(object o)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (o.GetType() != typeof(Machine))
|
2017-03-16 23:34:14 -07:00
|
|
|
|
{
|
2017-06-16 16:24:26 -07:00
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return this == (Machine)o;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Override the GetHashCode method
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
|
{
|
|
|
|
|
|
return OCRC.OptimizedCRC.Compute(_guid.ToByteArray());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
2016-10-24 12:58:57 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|