2016-09-19 20:52:55 -07:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Linq;
|
2020-07-15 09:41:59 -07:00
|
|
|
|
using System.Net;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
|
2017-05-04 02:41:11 -07:00
|
|
|
|
using SabreTools.Library.Data;
|
2020-08-01 21:42:28 -07:00
|
|
|
|
using SabreTools.Library.DatFiles;
|
2020-07-15 09:41:59 -07:00
|
|
|
|
using SabreTools.Library.FileTypes;
|
2020-08-17 23:09:35 -07:00
|
|
|
|
using SabreTools.Library.Filtering;
|
2017-05-04 02:41:11 -07:00
|
|
|
|
using SabreTools.Library.Tools;
|
2016-10-24 12:58:57 -07:00
|
|
|
|
using NaturalSort;
|
2020-06-15 21:00:09 -07:00
|
|
|
|
using Newtonsoft.Json;
|
2016-09-19 20:52:55 -07:00
|
|
|
|
|
2017-11-02 15:44:15 -07:00
|
|
|
|
namespace SabreTools.Library.DatItems
|
2016-09-19 20:52:55 -07:00
|
|
|
|
{
|
2019-01-08 12:11:55 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Base class for all items included in a set
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public abstract class DatItem : IEquatable<DatItem>, IComparable<DatItem>, ICloneable
|
|
|
|
|
|
{
|
2020-07-30 21:07:25 -07:00
|
|
|
|
// TODO: Can internal fields be mapped to Field in a more reasonable way?
|
2019-01-08 12:11:55 -08:00
|
|
|
|
#region Protected instance variables
|
|
|
|
|
|
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
protected Machine _machine = new Machine();
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Publicly facing variables
|
|
|
|
|
|
|
|
|
|
|
|
#region Standard item information
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Name of the item
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonProperty("name")]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Item type for outputting
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public ItemType ItemType { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Duplicate type when compared to another item
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public DupeType DupeType { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Machine information
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Name of the machine associated with the item
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public string MachineName
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return _machine.Name;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_machine.Name = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Additional notes on the machine
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public string Comment
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return _machine.Comment;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_machine.Comment = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Extended description of the machine
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public string MachineDescription
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return _machine.Description;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_machine.Description = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Machine year(s) of release/manufacture
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public string Year
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return _machine.Year;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_machine.Year = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Machine manufacturer, if available
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public string Manufacturer
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return _machine.Manufacturer;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_machine.Manufacturer = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Machine publisher, if available
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public string Publisher
|
|
|
|
|
|
{
|
2019-09-20 10:30:16 -07:00
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return _machine.Publisher;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_machine.Publisher = value;
|
|
|
|
|
|
}
|
2019-01-08 12:11:55 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-18 21:35:17 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Machine category, if available
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public string Category
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return _machine.Category;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_machine.Category = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-01-08 12:11:55 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Machine romof parent
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public string RomOf
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return _machine.RomOf;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_machine.RomOf = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Machine cloneof parent
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public string CloneOf
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return _machine.CloneOf;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_machine.CloneOf = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Machine sampleof parent
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public string SampleOf
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return _machine.SampleOf;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_machine.SampleOf = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Machine support status
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>yes = true, partial = null, no = false</remarks>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public bool? Supported
|
|
|
|
|
|
{
|
2019-09-20 10:30:16 -07:00
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return _machine.Supported;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_machine.Supported = value;
|
|
|
|
|
|
}
|
2019-01-08 12:11:55 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Emulator source file related to the machine
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public string SourceFile
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return _machine.SourceFile;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_machine.SourceFile = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Machine runnable status
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>yes = true, partial = null, no = false</remarks>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public bool? Runnable
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return _machine.Runnable;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_machine.Runnable = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Machine board name
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public string Board
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return _machine.Board;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_machine.Board = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Rebuild location if different than machine name
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public string RebuildTo
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return _machine.RebuildTo;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_machine.RebuildTo = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// List of associated device names
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public List<string> Devices
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return _machine.Devices;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_machine.Devices = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// List of slot options
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public List<string> SlotOptions
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return _machine.SlotOptions;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_machine.SlotOptions = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// List of info items
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2020-06-14 23:07:31 -07:00
|
|
|
|
public List<KeyValuePair<string, string>> Infos
|
2019-01-08 12:11:55 -08:00
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return _machine.Infos;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_machine.Infos = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Type of the associated machine
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public MachineType MachineType
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return _machine.MachineType;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_machine == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = new Machine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_machine.MachineType = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Software list information
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Original hardware part associated with the item
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonProperty("partname")]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public string PartName { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Original hardware interface associated with the item
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonProperty("partinterface")]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public string PartInterface { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Features provided to/by the item
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonProperty("features")]
|
2020-06-14 23:07:31 -07:00
|
|
|
|
public List<KeyValuePair<string, string>> Features { get; set; }
|
2019-01-08 12:11:55 -08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Original hardware part name within an item
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonProperty("areaname")]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public string AreaName { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Original hardware size within the part
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonProperty("areasize")]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public long? AreaSize { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Source metadata information
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2020-07-15 09:41:59 -07:00
|
|
|
|
/// Internal DatFile index for organization
|
2019-01-08 12:11:55 -08:00
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2020-07-15 09:41:59 -07:00
|
|
|
|
public int IndexId { get; set; }
|
2019-01-08 12:11:55 -08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2020-07-15 09:41:59 -07:00
|
|
|
|
/// Internal DatFile name for organization
|
2019-01-08 12:11:55 -08:00
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2020-07-15 09:41:59 -07:00
|
|
|
|
public string IndexSource { get; set; }
|
2019-01-08 12:11:55 -08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Flag if item should be removed
|
|
|
|
|
|
/// </summary>
|
2020-06-15 21:00:09 -07:00
|
|
|
|
[JsonIgnore]
|
2019-01-08 12:11:55 -08:00
|
|
|
|
public bool Remove { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2020-08-19 13:12:42 -07:00
|
|
|
|
#region Static Values
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Fields unique to a DatItem
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public static readonly List<Field> DatItemFields = new List<Field>()
|
|
|
|
|
|
{
|
|
|
|
|
|
Field.Name,
|
|
|
|
|
|
Field.PartName,
|
|
|
|
|
|
Field.PartInterface,
|
|
|
|
|
|
Field.Features,
|
|
|
|
|
|
Field.AreaName,
|
|
|
|
|
|
Field.AreaSize,
|
|
|
|
|
|
Field.BiosDescription,
|
|
|
|
|
|
Field.Default,
|
|
|
|
|
|
Field.Language,
|
|
|
|
|
|
Field.Date,
|
|
|
|
|
|
Field.Bios,
|
|
|
|
|
|
Field.Size,
|
|
|
|
|
|
Field.Offset,
|
|
|
|
|
|
Field.Merge,
|
|
|
|
|
|
Field.Region,
|
|
|
|
|
|
Field.Index,
|
|
|
|
|
|
Field.Writable,
|
|
|
|
|
|
Field.Optional,
|
|
|
|
|
|
Field.Status,
|
|
|
|
|
|
Field.Inverted,
|
|
|
|
|
|
|
|
|
|
|
|
Field.CRC,
|
|
|
|
|
|
Field.MD5,
|
|
|
|
|
|
#if NET_FRAMEWORK
|
|
|
|
|
|
Field.RIPEMD160,
|
|
|
|
|
|
#endif
|
|
|
|
|
|
Field.SHA1,
|
|
|
|
|
|
Field.SHA256,
|
|
|
|
|
|
Field.SHA384,
|
|
|
|
|
|
Field.SHA512,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Fields unique to a Machine
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public static readonly List<Field> MachineFields = new List<Field>()
|
|
|
|
|
|
{
|
|
|
|
|
|
Field.MachineName,
|
|
|
|
|
|
Field.Comment,
|
|
|
|
|
|
Field.Description,
|
|
|
|
|
|
Field.Year,
|
|
|
|
|
|
Field.Manufacturer,
|
|
|
|
|
|
Field.Publisher,
|
|
|
|
|
|
Field.RomOf,
|
|
|
|
|
|
Field.CloneOf,
|
|
|
|
|
|
Field.SampleOf,
|
|
|
|
|
|
Field.Supported,
|
|
|
|
|
|
Field.SourceFile,
|
|
|
|
|
|
Field.Runnable,
|
|
|
|
|
|
Field.Board,
|
|
|
|
|
|
Field.RebuildTo,
|
|
|
|
|
|
Field.Devices,
|
|
|
|
|
|
Field.SlotOptions,
|
|
|
|
|
|
Field.Infos,
|
|
|
|
|
|
Field.MachineType,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2019-01-08 12:11:55 -08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Instance Methods
|
|
|
|
|
|
|
2020-06-10 22:37:19 -07:00
|
|
|
|
#region Accessors
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Get the value of that field as a string, if possible
|
|
|
|
|
|
/// </summary>
|
2020-08-17 17:28:32 -07:00
|
|
|
|
public virtual string GetField(Field field, List<Field> excludeFields)
|
2020-06-10 22:37:19 -07:00
|
|
|
|
{
|
|
|
|
|
|
// If the field is to be excluded, return empty string
|
2020-07-27 15:21:59 -07:00
|
|
|
|
if (excludeFields.Contains(field))
|
2020-06-10 22:37:19 -07:00
|
|
|
|
return string.Empty;
|
|
|
|
|
|
|
2020-06-13 22:15:21 -07:00
|
|
|
|
string fieldValue = null;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
switch (field)
|
|
|
|
|
|
{
|
|
|
|
|
|
case Field.Name:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = Name;
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
case Field.PartName:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = PartName;
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
case Field.PartInterface:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = PartInterface;
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
case Field.Features:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = string.Join(";", (Features ?? new List<KeyValuePair<string, string>>()).Select(f => $"{f.Key}={f.Value}"));
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
case Field.AreaName:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = AreaName;
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
case Field.AreaSize:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = AreaSize?.ToString();
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
|
|
|
|
|
|
case Field.MachineName:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = MachineName;
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
case Field.Comment:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = Comment;
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
case Field.Description:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = MachineDescription;
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
case Field.Year:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = Year;
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
case Field.Manufacturer:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = Manufacturer;
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
case Field.Publisher:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = Publisher;
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-07-18 21:35:17 -07:00
|
|
|
|
case Field.Category:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = Category;
|
2020-07-18 21:35:17 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
case Field.RomOf:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = RomOf;
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
case Field.CloneOf:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = CloneOf;
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
case Field.SampleOf:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = SampleOf;
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
case Field.Supported:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = Supported?.ToString();
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
case Field.SourceFile:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = SourceFile;
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
case Field.Runnable:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = Runnable?.ToString();
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
case Field.Board:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = Board;
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
case Field.RebuildTo:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = RebuildTo;
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
case Field.Devices:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = string.Join(";", Devices ?? new List<string>());
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
case Field.SlotOptions:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = string.Join(";", SlotOptions ?? new List<string>());
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
case Field.Infos:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = string.Join(";", (Infos ?? new List<KeyValuePair<string, string>>()).Select(i => $"{i.Key}={i.Value}"));
|
2020-06-13 22:15:21 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
case Field.MachineType:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
fieldValue = MachineType.ToString();
|
2020-07-28 17:00:19 -07:00
|
|
|
|
break;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
|
|
|
|
|
|
case Field.NULL:
|
|
|
|
|
|
default:
|
|
|
|
|
|
return string.Empty;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-06-13 22:15:21 -07:00
|
|
|
|
// Make sure we don't return null
|
|
|
|
|
|
if (string.IsNullOrEmpty(fieldValue))
|
|
|
|
|
|
fieldValue = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
return fieldValue;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2020-07-15 09:41:59 -07:00
|
|
|
|
#region Constructors
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Create a specific type of DatItem to be used based on an ItemType
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="itemType">Type of the DatItem to be created</param>
|
|
|
|
|
|
/// <returns>DatItem of the specific internal type that corresponds to the inputs</returns>
|
|
|
|
|
|
public static DatItem Create(ItemType itemType)
|
|
|
|
|
|
{
|
|
|
|
|
|
#if NET_FRAMEWORK
|
|
|
|
|
|
switch (itemType)
|
|
|
|
|
|
{
|
|
|
|
|
|
case ItemType.Archive:
|
|
|
|
|
|
return new Archive();
|
|
|
|
|
|
|
|
|
|
|
|
case ItemType.BiosSet:
|
|
|
|
|
|
return new BiosSet();
|
|
|
|
|
|
|
|
|
|
|
|
case ItemType.Blank:
|
|
|
|
|
|
return new Blank();
|
|
|
|
|
|
|
|
|
|
|
|
case ItemType.Disk:
|
|
|
|
|
|
return new Disk();
|
|
|
|
|
|
|
|
|
|
|
|
case ItemType.Release:
|
|
|
|
|
|
return new Release();
|
|
|
|
|
|
|
|
|
|
|
|
case ItemType.Rom:
|
|
|
|
|
|
return new Rom();
|
|
|
|
|
|
|
|
|
|
|
|
case ItemType.Sample:
|
|
|
|
|
|
return new Sample();
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
return new Rom();
|
|
|
|
|
|
}
|
|
|
|
|
|
#else
|
|
|
|
|
|
return itemType switch
|
|
|
|
|
|
{
|
|
|
|
|
|
ItemType.Archive => new Archive(),
|
|
|
|
|
|
ItemType.BiosSet => new BiosSet(),
|
|
|
|
|
|
ItemType.Blank => new Blank(),
|
|
|
|
|
|
ItemType.Disk => new Disk(),
|
|
|
|
|
|
ItemType.Release => new Release(),
|
|
|
|
|
|
ItemType.Rom => new Rom(),
|
|
|
|
|
|
ItemType.Sample => new Sample(),
|
|
|
|
|
|
_ => new Rom(),
|
|
|
|
|
|
};
|
|
|
|
|
|
#endif
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Create a specific type of DatItem to be used based on a BaseFile
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="baseFile">BaseFile containing information to be created</param>
|
|
|
|
|
|
/// <returns>DatItem of the specific internal type that corresponds to the inputs</returns>
|
|
|
|
|
|
public static DatItem Create(BaseFile baseFile)
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (baseFile.Type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case FileType.CHD:
|
|
|
|
|
|
return new Disk(baseFile);
|
|
|
|
|
|
|
|
|
|
|
|
case FileType.GZipArchive:
|
|
|
|
|
|
case FileType.LRZipArchive:
|
|
|
|
|
|
case FileType.LZ4Archive:
|
|
|
|
|
|
case FileType.None:
|
|
|
|
|
|
case FileType.RarArchive:
|
|
|
|
|
|
case FileType.SevenZipArchive:
|
|
|
|
|
|
case FileType.TapeArchive:
|
|
|
|
|
|
case FileType.XZArchive:
|
|
|
|
|
|
case FileType.ZipArchive:
|
|
|
|
|
|
case FileType.ZPAQArchive:
|
|
|
|
|
|
case FileType.ZstdArchive:
|
|
|
|
|
|
return new Rom(baseFile);
|
|
|
|
|
|
|
|
|
|
|
|
case FileType.Folder:
|
|
|
|
|
|
default:
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2019-01-08 12:11:55 -08:00
|
|
|
|
#region Cloning Methods
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Clone the DatItem
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns>Clone of the DatItem</returns>
|
|
|
|
|
|
public abstract object Clone();
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Copy all machine information over in one shot
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="item">Existing item to copy information from</param>
|
|
|
|
|
|
public void CopyMachineInformation(DatItem item)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = (Machine)item._machine.Clone();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Copy all machine information over in one shot
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="machine">Existing machine to copy information from</param>
|
|
|
|
|
|
public void CopyMachineInformation(Machine machine)
|
|
|
|
|
|
{
|
|
|
|
|
|
_machine = (Machine)machine.Clone();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Comparision Methods
|
|
|
|
|
|
|
|
|
|
|
|
public int CompareTo(DatItem other)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2020-08-17 17:28:32 -07:00
|
|
|
|
if (Name == other.Name)
|
|
|
|
|
|
return Equals(other) ? 0 : 1;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
|
2020-08-17 17:28:32 -07:00
|
|
|
|
return string.Compare(Name, other.Name);
|
2019-01-08 12:11:55 -08:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
2020-07-15 09:41:59 -07:00
|
|
|
|
return 1;
|
2019-01-08 12:11:55 -08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Determine if an item is a duplicate using partial matching logic
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="other">DatItem to use as a baseline</param>
|
|
|
|
|
|
/// <returns>True if the roms are duplicates, false otherwise</returns>
|
|
|
|
|
|
public abstract bool Equals(DatItem other);
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Return the duplicate status of two items
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="lastItem">DatItem to check against</param>
|
|
|
|
|
|
/// <returns>The DupeType corresponding to the relationship between the two</returns>
|
|
|
|
|
|
public DupeType GetDuplicateStatus(DatItem lastItem)
|
|
|
|
|
|
{
|
|
|
|
|
|
DupeType output = 0x00;
|
|
|
|
|
|
|
|
|
|
|
|
// If we don't have a duplicate at all, return none
|
2020-08-17 17:28:32 -07:00
|
|
|
|
if (!Equals(lastItem))
|
2019-01-08 12:11:55 -08:00
|
|
|
|
return output;
|
|
|
|
|
|
|
|
|
|
|
|
// If the duplicate is external already or should be, set it
|
2020-08-17 17:28:32 -07:00
|
|
|
|
if (lastItem.DupeType.HasFlag(DupeType.External) || lastItem.IndexId != IndexId)
|
2019-01-08 12:11:55 -08:00
|
|
|
|
{
|
2020-08-17 17:28:32 -07:00
|
|
|
|
if (lastItem.MachineName == MachineName && lastItem.Name == Name)
|
2019-01-08 12:11:55 -08:00
|
|
|
|
output = DupeType.External | DupeType.All;
|
|
|
|
|
|
else
|
|
|
|
|
|
output = DupeType.External | DupeType.Hash;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Otherwise, it's considered an internal dupe
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2020-08-17 17:28:32 -07:00
|
|
|
|
if (lastItem.MachineName == MachineName && lastItem.Name == Name)
|
2019-01-08 12:11:55 -08:00
|
|
|
|
output = DupeType.Internal | DupeType.All;
|
|
|
|
|
|
else
|
|
|
|
|
|
output = DupeType.Internal | DupeType.Hash;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return output;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2020-08-17 23:09:35 -07:00
|
|
|
|
#region Filtering
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Check to see if a DatItem passes the filter
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="filter">Filter to check against</param>
|
|
|
|
|
|
/// <returns>True if the item passed the filter, false otherwise</returns>
|
|
|
|
|
|
public virtual bool PassesFilter(Filter filter)
|
|
|
|
|
|
{
|
|
|
|
|
|
#region Machine Filters
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on machine name
|
|
|
|
|
|
bool? machineNameFound = filter.MachineName.MatchesPositiveSet(MachineName);
|
|
|
|
|
|
if (filter.IncludeOfInGame)
|
|
|
|
|
|
{
|
|
|
|
|
|
machineNameFound |= (filter.MachineName.MatchesPositiveSet(CloneOf) == true);
|
|
|
|
|
|
machineNameFound |= (filter.MachineName.MatchesPositiveSet(RomOf) == true);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (machineNameFound == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
machineNameFound = filter.MachineName.MatchesNegativeSet(MachineName);
|
|
|
|
|
|
if (filter.IncludeOfInGame)
|
|
|
|
|
|
{
|
|
|
|
|
|
machineNameFound |= (filter.MachineName.MatchesNegativeSet(CloneOf) == true);
|
|
|
|
|
|
machineNameFound |= (filter.MachineName.MatchesNegativeSet(RomOf) == true);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (machineNameFound == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on comment
|
|
|
|
|
|
if (filter.Comment.MatchesPositiveSet(Comment) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
if (filter.Comment.MatchesNegativeSet(Comment) == true)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on machine description
|
|
|
|
|
|
if (filter.MachineDescription.MatchesPositiveSet(MachineDescription) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
if (filter.MachineDescription.MatchesNegativeSet(MachineDescription) == true)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on year
|
|
|
|
|
|
if (filter.Year.MatchesPositiveSet(Year) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
if (filter.Year.MatchesNegativeSet(Year) == true)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on manufacturer
|
|
|
|
|
|
if (filter.Manufacturer.MatchesPositiveSet(Manufacturer) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
if (filter.Manufacturer.MatchesNegativeSet(Manufacturer) == true)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on publisher
|
|
|
|
|
|
if (filter.Publisher.MatchesPositiveSet(Publisher) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
if (filter.Publisher.MatchesNegativeSet(Publisher) == true)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on category
|
|
|
|
|
|
if (filter.Category.MatchesPositiveSet(Category) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
if (filter.Category.MatchesNegativeSet(Category) == true)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on romof
|
|
|
|
|
|
if (filter.RomOf.MatchesPositiveSet(RomOf) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
if (filter.RomOf.MatchesNegativeSet(RomOf) == true)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on cloneof
|
|
|
|
|
|
if (filter.CloneOf.MatchesPositiveSet(CloneOf) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
if (filter.CloneOf.MatchesNegativeSet(CloneOf) == true)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on sampleof
|
|
|
|
|
|
if (filter.SampleOf.MatchesPositiveSet(SampleOf) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
if (filter.SampleOf.MatchesNegativeSet(SampleOf) == true)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on supported
|
|
|
|
|
|
if (filter.Supported.MatchesNeutral(null, Supported) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on source file
|
|
|
|
|
|
if (filter.SourceFile.MatchesPositiveSet(SourceFile) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
if (filter.SourceFile.MatchesNegativeSet(SourceFile) == true)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on runnable
|
|
|
|
|
|
if (filter.Runnable.MatchesNeutral(null, Runnable) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on board
|
|
|
|
|
|
if (filter.Board.MatchesPositiveSet(Board) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
if (filter.Board.MatchesNegativeSet(Board) == true)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on rebuildto
|
|
|
|
|
|
if (filter.RebuildTo.MatchesPositiveSet(RebuildTo) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
if (filter.RebuildTo.MatchesNegativeSet(RebuildTo) == true)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on devices
|
|
|
|
|
|
if (Devices != null && Devices.Any())
|
|
|
|
|
|
{
|
|
|
|
|
|
bool anyPositiveDevice = false;
|
|
|
|
|
|
bool anyNegativeDevice = false;
|
|
|
|
|
|
foreach (string device in Devices)
|
|
|
|
|
|
{
|
|
|
|
|
|
anyPositiveDevice |= filter.Devices.MatchesPositiveSet(device) != false;
|
|
|
|
|
|
anyNegativeDevice |= filter.Devices.MatchesNegativeSet(device) == false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!anyPositiveDevice || anyNegativeDevice)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on slot options
|
|
|
|
|
|
if (SlotOptions != null && SlotOptions.Any())
|
|
|
|
|
|
{
|
|
|
|
|
|
bool anyPositiveSlotOption = false;
|
|
|
|
|
|
bool anyNegativeSlotOption = false;
|
|
|
|
|
|
foreach (string slotOption in SlotOptions)
|
|
|
|
|
|
{
|
|
|
|
|
|
anyPositiveSlotOption |= filter.SlotOptions.MatchesPositiveSet(slotOption) != false;
|
|
|
|
|
|
anyNegativeSlotOption |= filter.SlotOptions.MatchesNegativeSet(slotOption) == false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!anyPositiveSlotOption || anyNegativeSlotOption)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on machine type
|
|
|
|
|
|
if (filter.MachineTypes.MatchesPositive(MachineType.NULL, MachineType) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
if (filter.MachineTypes.MatchesNegative(MachineType.NULL, MachineType) == true)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region DatItem Filters
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on item type
|
|
|
|
|
|
if (filter.ItemTypes.MatchesPositiveSet(ItemType.ToString()) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
if (filter.ItemTypes.MatchesNegativeSet(ItemType.ToString()) == true)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on item name
|
|
|
|
|
|
if (filter.ItemName.MatchesPositiveSet(Name) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
if (filter.ItemName.MatchesNegativeSet(Name) == true)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on part name
|
|
|
|
|
|
if (filter.PartName.MatchesPositiveSet(PartName) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
if (filter.PartName.MatchesNegativeSet(PartName) == true)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on part interface
|
|
|
|
|
|
if (filter.PartInterface.MatchesPositiveSet(PartInterface) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
if (filter.PartInterface.MatchesNegativeSet(PartInterface) == true)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on area name
|
|
|
|
|
|
if (filter.AreaName.MatchesPositiveSet(AreaName) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
if (filter.AreaName.MatchesNegativeSet(AreaName) == true)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Filter on area size
|
|
|
|
|
|
if (filter.AreaSize.MatchesNeutral(null, AreaSize) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
else if (filter.AreaSize.MatchesPositive(null, AreaSize) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
else if (filter.AreaSize.MatchesNegative(null, AreaSize) == false)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Remove fields from the DatItem
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="fields">List of Fields to remove</param>
|
|
|
|
|
|
public virtual void RemoveFields(List<Field> fields)
|
|
|
|
|
|
{
|
|
|
|
|
|
#region Machine Fields
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.MachineName))
|
|
|
|
|
|
MachineName = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.Comment))
|
|
|
|
|
|
Comment = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.Description))
|
|
|
|
|
|
MachineDescription = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.Year))
|
|
|
|
|
|
Year = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.Manufacturer))
|
|
|
|
|
|
Manufacturer = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.Publisher))
|
|
|
|
|
|
Publisher = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.Category))
|
|
|
|
|
|
Category = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.RomOf))
|
|
|
|
|
|
RomOf = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.CloneOf))
|
|
|
|
|
|
CloneOf = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.SampleOf))
|
|
|
|
|
|
SampleOf = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.Supported))
|
|
|
|
|
|
Supported = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.SourceFile))
|
|
|
|
|
|
SourceFile = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.Runnable))
|
|
|
|
|
|
Runnable = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.Board))
|
|
|
|
|
|
Board = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.RebuildTo))
|
|
|
|
|
|
RebuildTo = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.Devices))
|
|
|
|
|
|
Devices = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.SlotOptions))
|
|
|
|
|
|
SlotOptions = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.Infos))
|
|
|
|
|
|
Infos = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.MachineType))
|
|
|
|
|
|
MachineType = MachineType.NULL;
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Item Fields
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.Name))
|
|
|
|
|
|
Name = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.PartName))
|
|
|
|
|
|
PartName = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.PartInterface))
|
|
|
|
|
|
PartInterface = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.Features))
|
|
|
|
|
|
Features = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.AreaName))
|
|
|
|
|
|
AreaName = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (fields.Contains(Field.AreaSize))
|
|
|
|
|
|
AreaSize = null;
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-08-17 23:09:35 -07:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
2019-01-08 12:11:55 -08:00
|
|
|
|
#region Sorting and Merging
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2020-07-15 10:47:13 -07:00
|
|
|
|
/// Get the dictionary key that should be used for a given item and bucketing type
|
2019-01-08 12:11:55 -08:00
|
|
|
|
/// </summary>
|
2020-07-15 10:47:13 -07:00
|
|
|
|
/// <param name="bucketedBy">BucketedBy enum representing what key to get</param>
|
2020-07-15 09:41:59 -07:00
|
|
|
|
/// <param name="lower">True if the key should be lowercased (default), false otherwise</param>
|
|
|
|
|
|
/// <param name="norename">True if games should only be compared on game and file name, false if system and source are counted</param>
|
|
|
|
|
|
/// <returns>String representing the key to be used for the DatItem</returns>
|
2020-08-17 17:28:32 -07:00
|
|
|
|
public virtual string GetKey(BucketedBy bucketedBy, bool lower = true, bool norename = true)
|
2019-01-08 12:11:55 -08:00
|
|
|
|
{
|
2020-07-15 09:41:59 -07:00
|
|
|
|
// Set the output key as the default blank string
|
|
|
|
|
|
string key = string.Empty;
|
2019-01-08 12:11:55 -08:00
|
|
|
|
|
2020-07-15 10:47:13 -07:00
|
|
|
|
// Now determine what the key should be based on the bucketedBy value
|
|
|
|
|
|
switch (bucketedBy)
|
2020-07-15 09:41:59 -07:00
|
|
|
|
{
|
|
|
|
|
|
case BucketedBy.CRC:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
key = Constants.CRCZero;
|
2020-07-15 09:41:59 -07:00
|
|
|
|
break;
|
2019-01-08 12:11:55 -08:00
|
|
|
|
|
2020-07-15 09:41:59 -07:00
|
|
|
|
case BucketedBy.Game:
|
|
|
|
|
|
key = (norename ? string.Empty
|
2020-08-17 17:28:32 -07:00
|
|
|
|
: IndexId.ToString().PadLeft(10, '0')
|
2020-07-15 09:41:59 -07:00
|
|
|
|
+ "-")
|
2020-08-17 17:28:32 -07:00
|
|
|
|
+ (string.IsNullOrWhiteSpace(MachineName)
|
2020-07-15 09:41:59 -07:00
|
|
|
|
? "Default"
|
2020-08-17 17:28:32 -07:00
|
|
|
|
: MachineName);
|
2020-07-15 09:41:59 -07:00
|
|
|
|
if (lower)
|
|
|
|
|
|
key = key.ToLowerInvariant();
|
2019-01-08 12:11:55 -08:00
|
|
|
|
|
2020-07-15 09:41:59 -07:00
|
|
|
|
if (key == null)
|
|
|
|
|
|
key = "null";
|
2019-01-08 12:11:55 -08:00
|
|
|
|
|
2020-07-15 09:41:59 -07:00
|
|
|
|
key = WebUtility.HtmlEncode(key);
|
|
|
|
|
|
break;
|
2019-01-08 12:11:55 -08:00
|
|
|
|
|
2020-07-15 09:41:59 -07:00
|
|
|
|
case BucketedBy.MD5:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
key = Constants.MD5Zero;
|
2020-07-15 09:41:59 -07:00
|
|
|
|
break;
|
2019-01-08 12:11:55 -08:00
|
|
|
|
|
2020-07-15 09:41:59 -07:00
|
|
|
|
#if NET_FRAMEWORK
|
|
|
|
|
|
case BucketedBy.RIPEMD160:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
key = Constants.RIPEMD160Zero;
|
2020-07-15 09:41:59 -07:00
|
|
|
|
break;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
case BucketedBy.SHA1:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
key = Constants.SHA1Zero;
|
2020-07-15 09:41:59 -07:00
|
|
|
|
break;
|
2019-01-08 12:11:55 -08:00
|
|
|
|
|
2020-07-15 09:41:59 -07:00
|
|
|
|
case BucketedBy.SHA256:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
key = Constants.SHA256Zero;
|
2020-07-15 09:41:59 -07:00
|
|
|
|
break;
|
2019-01-08 12:11:55 -08:00
|
|
|
|
|
2020-07-15 09:41:59 -07:00
|
|
|
|
case BucketedBy.SHA384:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
key = Constants.SHA384Zero;
|
2020-07-15 09:41:59 -07:00
|
|
|
|
break;
|
2019-01-08 12:11:55 -08:00
|
|
|
|
|
2020-07-15 09:41:59 -07:00
|
|
|
|
case BucketedBy.SHA512:
|
2020-08-17 17:28:32 -07:00
|
|
|
|
key = Constants.SHA512Zero;
|
2020-07-15 09:41:59 -07:00
|
|
|
|
break;
|
2019-01-08 12:11:55 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-15 09:41:59 -07:00
|
|
|
|
// Double and triple check the key for corner cases
|
|
|
|
|
|
if (key == null)
|
|
|
|
|
|
key = string.Empty;
|
2019-01-08 12:11:55 -08:00
|
|
|
|
|
2020-07-15 09:41:59 -07:00
|
|
|
|
return key;
|
2019-01-08 12:11:55 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-08-17 22:35:17 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Replace fields from another item
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="item">DatItem to pull new information from</param>
|
2020-08-17 23:45:23 -07:00
|
|
|
|
/// <param name="fields">List of Fields representing what should be updated</param>
|
|
|
|
|
|
public virtual void ReplaceFields(DatItem item, List<Field> fields)
|
2020-08-17 22:35:17 -07:00
|
|
|
|
{
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.Name))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
Name = item.Name;
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.PartName))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
PartName = item.PartName;
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.PartInterface))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
PartInterface = item.PartInterface;
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.Features))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
Features = item.Features;
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.AreaName))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
AreaName = item.AreaName;
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.AreaSize))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
AreaSize = item.AreaSize;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Replace machine fields from another item
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="item">DatItem to pull new information from</param>
|
2020-08-17 23:45:23 -07:00
|
|
|
|
/// <param name="fields">List of Fields representing what should be updated</param>
|
2020-08-17 22:35:17 -07:00
|
|
|
|
/// <param name="onlySame">True if descriptions should only be replaced if the game name is the same, false otherwise</param>
|
2020-08-17 23:45:23 -07:00
|
|
|
|
public void ReplaceMachineFields(DatItem item, List<Field> fields, bool onlySame)
|
2020-08-17 22:35:17 -07:00
|
|
|
|
{
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.MachineName))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
MachineName = item.MachineName;
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.Comment))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
Comment = item.Comment;
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.Description))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
{
|
|
|
|
|
|
if (!onlySame || (onlySame && MachineName == MachineDescription))
|
|
|
|
|
|
MachineDescription = item.MachineDescription;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.Year))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
Year = item.Year;
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.Manufacturer))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
Manufacturer = item.Manufacturer;
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.Publisher))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
Publisher = item.Publisher;
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.Category))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
Category = item.Category;
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.RomOf))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
RomOf = item.RomOf;
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.CloneOf))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
CloneOf = item.CloneOf;
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.SampleOf))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
SampleOf = item.SampleOf;
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.Supported))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
Supported = item.Supported;
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.SourceFile))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
SourceFile = item.SourceFile;
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.Runnable))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
Runnable = item.Runnable;
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.Board))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
Board = item.Board;
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.RebuildTo))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
RebuildTo = item.RebuildTo;
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.Devices))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
Devices = item.Devices;
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.SlotOptions))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
SlotOptions = item.SlotOptions;
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.Infos))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
Infos = item.Infos;
|
|
|
|
|
|
|
2020-08-17 23:45:23 -07:00
|
|
|
|
if (fields.Contains(Field.MachineType))
|
2020-08-17 22:35:17 -07:00
|
|
|
|
MachineType = item.MachineType;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-01-08 12:11:55 -08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#endregion // Instance Methods
|
|
|
|
|
|
|
|
|
|
|
|
#region Static Methods
|
|
|
|
|
|
|
|
|
|
|
|
#region Sorting and Merging
|
|
|
|
|
|
|
2020-08-17 14:57:54 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Determine if two hashes are equal for the purposes of merging
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="firstHash">First hash to compare</param>
|
|
|
|
|
|
/// <param name="secondHash">Second hash to compare</param>
|
|
|
|
|
|
/// <returns>True if either is empty OR the hashes exactly match, false otherwise</returns>
|
|
|
|
|
|
public static bool ConditionalHashEquals(byte[] firstHash, byte[] secondHash)
|
|
|
|
|
|
{
|
|
|
|
|
|
// If either hash is empty, we say they're equal for merging
|
|
|
|
|
|
if (firstHash.IsNullOrEmpty() || secondHash.IsNullOrEmpty())
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
// If they're different sizes, they can't match
|
|
|
|
|
|
if (firstHash.Length != secondHash.Length)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Otherwise, they need to match exactly
|
|
|
|
|
|
return Enumerable.SequenceEqual(firstHash, secondHash);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-01-08 12:11:55 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Merge an arbitrary set of ROMs based on the supplied information
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="infiles">List of File objects representing the roms to be merged</param>
|
|
|
|
|
|
/// <returns>A List of DatItem objects representing the merged roms</returns>
|
|
|
|
|
|
public static List<DatItem> Merge(List<DatItem> infiles)
|
|
|
|
|
|
{
|
|
|
|
|
|
// Check for null or blank roms first
|
|
|
|
|
|
if (infiles == null || infiles.Count == 0)
|
|
|
|
|
|
return new List<DatItem>();
|
|
|
|
|
|
|
|
|
|
|
|
// Create output list
|
|
|
|
|
|
List<DatItem> outfiles = new List<DatItem>();
|
|
|
|
|
|
|
|
|
|
|
|
// Then deduplicate them by checking to see if data matches previous saved roms
|
|
|
|
|
|
int nodumpCount = 0;
|
2020-07-19 13:42:07 -07:00
|
|
|
|
for (int f = 0; f < infiles.Count; f++)
|
2019-01-08 12:11:55 -08:00
|
|
|
|
{
|
2020-07-19 13:42:07 -07:00
|
|
|
|
DatItem file = infiles[f];
|
|
|
|
|
|
|
2019-01-08 12:11:55 -08:00
|
|
|
|
// If we don't have a Rom or a Disk, we skip checking for duplicates
|
|
|
|
|
|
if (file.ItemType != ItemType.Rom && file.ItemType != ItemType.Disk)
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
// If it's a nodump, add and skip
|
2020-08-17 17:28:32 -07:00
|
|
|
|
if (file.ItemType == ItemType.Rom && (file as Rom).ItemStatus == ItemStatus.Nodump)
|
2019-01-08 12:11:55 -08:00
|
|
|
|
{
|
|
|
|
|
|
outfiles.Add(file);
|
|
|
|
|
|
nodumpCount++;
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2020-08-17 17:28:32 -07:00
|
|
|
|
else if (file.ItemType == ItemType.Disk && (file as Disk).ItemStatus == ItemStatus.Nodump)
|
2019-01-08 12:11:55 -08:00
|
|
|
|
{
|
|
|
|
|
|
outfiles.Add(file);
|
|
|
|
|
|
nodumpCount++;
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
// If it's the first non-nodump rom in the list, don't touch it
|
|
|
|
|
|
else if (outfiles.Count == 0 || outfiles.Count == nodumpCount)
|
|
|
|
|
|
{
|
|
|
|
|
|
outfiles.Add(file);
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Check if the rom is a duplicate
|
|
|
|
|
|
DupeType dupetype = 0x00;
|
2020-08-17 17:28:32 -07:00
|
|
|
|
DatItem saveditem = new Blank();
|
2019-01-08 12:11:55 -08:00
|
|
|
|
int pos = -1;
|
|
|
|
|
|
for (int i = 0; i < outfiles.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
DatItem lastrom = outfiles[i];
|
|
|
|
|
|
|
|
|
|
|
|
// Get the duplicate status
|
|
|
|
|
|
dupetype = file.GetDuplicateStatus(lastrom);
|
|
|
|
|
|
|
|
|
|
|
|
// If it's a duplicate, skip adding it to the output but add any missing information
|
|
|
|
|
|
if (dupetype != 0x00)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveditem = lastrom;
|
|
|
|
|
|
pos = i;
|
|
|
|
|
|
|
2020-08-17 17:28:32 -07:00
|
|
|
|
// Disks and Roms have more information to fill
|
|
|
|
|
|
if (file.ItemType == ItemType.Disk)
|
|
|
|
|
|
(saveditem as Disk).FillMissingInformation(file as Disk);
|
|
|
|
|
|
else if (file.ItemType == ItemType.Rom)
|
|
|
|
|
|
(saveditem as Rom).FillMissingInformation(file as Rom);
|
2019-01-08 12:11:55 -08:00
|
|
|
|
|
|
|
|
|
|
saveditem.DupeType = dupetype;
|
|
|
|
|
|
|
|
|
|
|
|
// If the current system has a lower ID than the previous, set the system accordingly
|
2020-07-15 09:41:59 -07:00
|
|
|
|
if (file.IndexId < saveditem.IndexId)
|
2019-01-08 12:11:55 -08:00
|
|
|
|
{
|
2020-07-15 09:41:59 -07:00
|
|
|
|
saveditem.IndexId = file.IndexId;
|
|
|
|
|
|
saveditem.IndexSource = file.IndexSource;
|
2019-01-08 12:11:55 -08:00
|
|
|
|
saveditem.CopyMachineInformation(file);
|
|
|
|
|
|
saveditem.Name = file.Name;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// If the current machine is a child of the new machine, use the new machine instead
|
|
|
|
|
|
if (saveditem.CloneOf == file.MachineName || saveditem.RomOf == file.MachineName)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveditem.CopyMachineInformation(file);
|
|
|
|
|
|
saveditem.Name = file.Name;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// If no duplicate is found, add it to the list
|
|
|
|
|
|
if (dupetype == 0x00)
|
|
|
|
|
|
{
|
|
|
|
|
|
outfiles.Add(file);
|
|
|
|
|
|
}
|
|
|
|
|
|
// Otherwise, if a new rom information is found, add that
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
outfiles.RemoveAt(pos);
|
|
|
|
|
|
outfiles.Insert(pos, saveditem);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Then return the result
|
|
|
|
|
|
return outfiles;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Resolve name duplicates in an arbitrary set of ROMs based on the supplied information
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="infiles">List of File objects representing the roms to be merged</param>
|
|
|
|
|
|
/// <returns>A List of DatItem objects representing the renamed roms</returns>
|
|
|
|
|
|
public static List<DatItem> ResolveNames(List<DatItem> infiles)
|
|
|
|
|
|
{
|
|
|
|
|
|
// Create the output list
|
|
|
|
|
|
List<DatItem> output = new List<DatItem>();
|
|
|
|
|
|
|
|
|
|
|
|
// First we want to make sure the list is in alphabetical order
|
|
|
|
|
|
Sort(ref infiles, true);
|
|
|
|
|
|
|
|
|
|
|
|
// Now we want to loop through and check names
|
|
|
|
|
|
DatItem lastItem = null;
|
|
|
|
|
|
string lastrenamed = null;
|
|
|
|
|
|
int lastid = 0;
|
|
|
|
|
|
for (int i = 0; i < infiles.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
DatItem datItem = infiles[i];
|
|
|
|
|
|
|
|
|
|
|
|
// If we have the first item, we automatically add it
|
|
|
|
|
|
if (lastItem == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
output.Add(datItem);
|
|
|
|
|
|
lastItem = datItem;
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// If the current item exactly matches the last item, then we don't add it
|
2020-07-15 09:41:59 -07:00
|
|
|
|
if (datItem.GetDuplicateStatus(lastItem).HasFlag(DupeType.All))
|
2019-01-08 12:11:55 -08:00
|
|
|
|
{
|
2020-06-10 22:37:19 -07:00
|
|
|
|
Globals.Logger.Verbose($"Exact duplicate found for '{datItem.Name}'");
|
2019-01-08 12:11:55 -08:00
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// If the current name matches the previous name, rename the current item
|
|
|
|
|
|
else if (datItem.Name == lastItem.Name)
|
|
|
|
|
|
{
|
2020-06-10 22:37:19 -07:00
|
|
|
|
Globals.Logger.Verbose($"Name duplicate found for '{datItem.Name}'");
|
2019-01-08 12:11:55 -08:00
|
|
|
|
|
2020-06-10 22:37:19 -07:00
|
|
|
|
if (datItem.ItemType == ItemType.Disk || datItem.ItemType == ItemType.Rom)
|
2019-01-08 12:11:55 -08:00
|
|
|
|
{
|
2020-06-10 22:37:19 -07:00
|
|
|
|
datItem.Name += GetDuplicateSuffix(datItem);
|
2020-07-15 09:41:59 -07:00
|
|
|
|
#if NET_FRAMEWORK
|
2019-01-08 12:11:55 -08:00
|
|
|
|
lastrenamed = lastrenamed ?? datItem.Name;
|
2020-07-15 09:41:59 -07:00
|
|
|
|
#else
|
|
|
|
|
|
lastrenamed ??= datItem.Name;
|
|
|
|
|
|
#endif
|
2019-01-08 12:11:55 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// If we have a conflict with the last renamed item, do the right thing
|
|
|
|
|
|
if (datItem.Name == lastrenamed)
|
|
|
|
|
|
{
|
|
|
|
|
|
lastrenamed = datItem.Name;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
datItem.Name += (lastid == 0 ? string.Empty : "_" + lastid);
|
2019-01-08 12:11:55 -08:00
|
|
|
|
lastid++;
|
|
|
|
|
|
}
|
|
|
|
|
|
// If we have no conflict, then we want to reset the lastrenamed and id
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
lastrenamed = null;
|
|
|
|
|
|
lastid = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
output.Add(datItem);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Otherwise, we say that we have a valid named file
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
output.Add(datItem);
|
|
|
|
|
|
lastItem = datItem;
|
|
|
|
|
|
lastrenamed = null;
|
|
|
|
|
|
lastid = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// One last sort to make sure this is ordered
|
|
|
|
|
|
Sort(ref output, true);
|
|
|
|
|
|
|
|
|
|
|
|
return output;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-06-10 22:37:19 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Get duplicate suffix based on the item type
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private static string GetDuplicateSuffix(DatItem datItem)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (datItem.ItemType == ItemType.Disk)
|
2020-08-17 17:28:32 -07:00
|
|
|
|
return (datItem as Disk).GetDuplicateSuffix();
|
2020-06-10 22:37:19 -07:00
|
|
|
|
else if (datItem.ItemType == ItemType.Rom)
|
2020-08-17 17:28:32 -07:00
|
|
|
|
return (datItem as Rom).GetDuplicateSuffix();
|
2020-06-10 22:37:19 -07:00
|
|
|
|
|
|
|
|
|
|
return "_1";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-01-08 12:11:55 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Sort a list of File objects by SystemID, SourceID, Game, and Name (in order)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="roms">List of File objects representing the roms to be sorted</param>
|
|
|
|
|
|
/// <param name="norename">True if files are not renamed, false otherwise</param>
|
|
|
|
|
|
/// <returns>True if it sorted correctly, false otherwise</returns>
|
|
|
|
|
|
public static bool Sort(ref List<DatItem> roms, bool norename)
|
|
|
|
|
|
{
|
|
|
|
|
|
roms.Sort(delegate (DatItem x, DatItem y)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
NaturalComparer nc = new NaturalComparer();
|
2020-07-15 09:41:59 -07:00
|
|
|
|
if (x.IndexId == y.IndexId)
|
2019-01-08 12:11:55 -08:00
|
|
|
|
{
|
2020-07-15 09:41:59 -07:00
|
|
|
|
if (x.MachineName == y.MachineName)
|
2019-01-08 12:11:55 -08:00
|
|
|
|
{
|
2020-08-17 17:28:32 -07:00
|
|
|
|
// Special case for comparing a Disk or Rom to another item type
|
|
|
|
|
|
if ((x.ItemType == ItemType.Disk || x.ItemType == ItemType.Rom) ^ (y.ItemType == ItemType.Disk || y.ItemType == ItemType.Rom))
|
2020-07-15 09:41:59 -07:00
|
|
|
|
{
|
2020-08-17 17:28:32 -07:00
|
|
|
|
if (x.ItemType == ItemType.Disk || x.ItemType == ItemType.Rom)
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
else
|
|
|
|
|
|
return 1;
|
2020-07-15 09:41:59 -07:00
|
|
|
|
}
|
2020-08-17 17:28:32 -07:00
|
|
|
|
|
|
|
|
|
|
// Otherwise, we compare names naturally
|
2020-07-15 09:41:59 -07:00
|
|
|
|
else
|
|
|
|
|
|
{
|
2020-08-17 17:28:32 -07:00
|
|
|
|
if (Path.GetDirectoryName(Sanitizer.RemovePathUnsafeCharacters(x.Name)) == Path.GetDirectoryName(Sanitizer.RemovePathUnsafeCharacters(y.Name)))
|
|
|
|
|
|
return nc.Compare(Path.GetFileName(Sanitizer.RemovePathUnsafeCharacters(x.Name)), Path.GetFileName(Sanitizer.RemovePathUnsafeCharacters(y.Name)));
|
2020-06-10 22:37:19 -07:00
|
|
|
|
|
2020-08-17 17:28:32 -07:00
|
|
|
|
return nc.Compare(Path.GetDirectoryName(Sanitizer.RemovePathUnsafeCharacters(x.Name)), Path.GetDirectoryName(Sanitizer.RemovePathUnsafeCharacters(y.Name)));
|
2019-01-08 12:11:55 -08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-06-10 22:37:19 -07:00
|
|
|
|
|
2020-07-15 09:41:59 -07:00
|
|
|
|
return nc.Compare(x.MachineName, y.MachineName);
|
2019-01-08 12:11:55 -08:00
|
|
|
|
}
|
2020-06-10 22:37:19 -07:00
|
|
|
|
|
2020-07-15 09:41:59 -07:00
|
|
|
|
return (norename ? nc.Compare(x.MachineName, y.MachineName) : x.IndexId - y.IndexId);
|
2019-01-08 12:11:55 -08:00
|
|
|
|
}
|
|
|
|
|
|
catch (Exception)
|
|
|
|
|
|
{
|
|
|
|
|
|
// Absorb the error
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2019-09-20 10:30:16 -07:00
|
|
|
|
|
2019-01-08 12:11:55 -08:00
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#endregion // Static Methods
|
|
|
|
|
|
}
|
2016-09-19 20:52:55 -07:00
|
|
|
|
}
|