mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add DeviceReference type, cleanup TODOs
This commit is contained in:
@@ -641,6 +641,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
cmpw.WriteEndElement();
|
cmpw.WriteEndElement();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ItemType.DeviceReference:
|
||||||
|
cmpw.WriteStartElement("device_ref");
|
||||||
|
cmpw.WriteRequiredAttributeString("name", datItem.Name);
|
||||||
|
cmpw.WriteEndElement();
|
||||||
|
break;
|
||||||
|
|
||||||
case ItemType.Disk:
|
case ItemType.Disk:
|
||||||
var disk = datItem as Disk;
|
var disk = datItem as Disk;
|
||||||
cmpw.WriteStartElement("disk");
|
cmpw.WriteStartElement("disk");
|
||||||
|
|||||||
@@ -1389,8 +1389,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
|
|
||||||
// If the game has no devices, mark it
|
// If the game has no devices, mark it
|
||||||
bool devices = true;
|
bool devices = true;
|
||||||
if (Items[game][0].Machine.DeviceReferences == null
|
if (Items[game].Count(i => i.ItemType == ItemType.DeviceReference) == 0)
|
||||||
|| Items[game][0].Machine.DeviceReferences.Count == 0)
|
|
||||||
{
|
{
|
||||||
devices = false;
|
devices = false;
|
||||||
}
|
}
|
||||||
@@ -1399,7 +1398,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
if (devices)
|
if (devices)
|
||||||
{
|
{
|
||||||
// Determine if the game has any devices or not
|
// Determine if the game has any devices or not
|
||||||
List<string> deviceReferences = Items[game][0].Machine.DeviceReferences.Select(d => d.Name).ToList();
|
List<string> deviceReferences = Items[game]
|
||||||
|
.Where(i => i.ItemType == ItemType.DeviceReference)
|
||||||
|
.Select(i => i.Name)
|
||||||
|
.ToList();
|
||||||
List<string> newdevs = new List<string>();
|
List<string> newdevs = new List<string>();
|
||||||
foreach (string deviceReference in deviceReferences)
|
foreach (string deviceReference in deviceReferences)
|
||||||
{
|
{
|
||||||
@@ -1410,10 +1412,13 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// Otherwise, copy the items from the device to the current game
|
// Otherwise, copy the items from the device to the current game
|
||||||
DatItem copyFrom = Items[game][0];
|
DatItem copyFrom = Items[game][0];
|
||||||
List<DatItem> devItems = Items[deviceReference];
|
List<DatItem> devItems = Items[deviceReference];
|
||||||
|
newdevs.AddRange((Items[deviceReference] ?? new List<DatItem>())
|
||||||
|
.Where(i => i.ItemType == ItemType.DeviceReference)
|
||||||
|
.Select(i => i.Name));
|
||||||
|
|
||||||
foreach (DatItem item in devItems)
|
foreach (DatItem item in devItems)
|
||||||
{
|
{
|
||||||
DatItem datItem = (DatItem)item.Clone();
|
DatItem datItem = (DatItem)item.Clone();
|
||||||
newdevs.AddRange((datItem.Machine.DeviceReferences ?? new List<ListXmlDeviceReference>()).Select(d => d.Name).ToList());
|
|
||||||
datItem.CopyMachineInformation(copyFrom);
|
datItem.CopyMachineInformation(copyFrom);
|
||||||
if (Items[game].Where(i => i.ItemType == datItem.ItemType && i.Name == datItem.Name).Count() == 0)
|
if (Items[game].Where(i => i.ItemType == datItem.ItemType && i.Name == datItem.Name).Count() == 0)
|
||||||
{
|
{
|
||||||
@@ -1427,7 +1432,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
foreach (string device in newdevs)
|
foreach (string device in newdevs)
|
||||||
{
|
{
|
||||||
if (!deviceReferences.Contains(device))
|
if (!deviceReferences.Contains(device))
|
||||||
Items[game][0].Machine.DeviceReferences.Add(new ListXmlDeviceReference() { Name = device });
|
Items[game].Add(new DeviceReference() { Name = device });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public long ChipCount { get; private set; } = 0;
|
public long ChipCount { get; private set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of Device Reference items
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public long DeviceReferenceCount { get; private set; } = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of Disk items
|
/// Number of Disk items
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -461,6 +467,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case ItemType.Chip:
|
case ItemType.Chip:
|
||||||
ChipCount++;
|
ChipCount++;
|
||||||
break;
|
break;
|
||||||
|
case ItemType.DeviceReference:
|
||||||
|
DeviceReferenceCount++;
|
||||||
|
break;
|
||||||
case ItemType.Disk:
|
case ItemType.Disk:
|
||||||
DiskCount++;
|
DiskCount++;
|
||||||
if ((item as Disk).ItemStatus != ItemStatus.Nodump)
|
if ((item as Disk).ItemStatus != ItemStatus.Nodump)
|
||||||
@@ -590,6 +599,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case ItemType.Chip:
|
case ItemType.Chip:
|
||||||
ChipCount--;
|
ChipCount--;
|
||||||
break;
|
break;
|
||||||
|
case ItemType.DeviceReference:
|
||||||
|
DeviceReferenceCount--;
|
||||||
|
break;
|
||||||
case ItemType.Disk:
|
case ItemType.Disk:
|
||||||
DiskCount--;
|
DiskCount--;
|
||||||
if ((item as Disk).ItemStatus != ItemStatus.Nodump)
|
if ((item as Disk).ItemStatus != ItemStatus.Nodump)
|
||||||
|
|||||||
@@ -220,6 +220,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case ItemType.Chip:
|
case ItemType.Chip:
|
||||||
datItem = datItemObj.ToObject<Chip>();
|
datItem = datItemObj.ToObject<Chip>();
|
||||||
break;
|
break;
|
||||||
|
case ItemType.DeviceReference:
|
||||||
|
datItem = datItemObj.ToObject<DeviceReference>();
|
||||||
|
break;
|
||||||
case ItemType.Disk:
|
case ItemType.Disk:
|
||||||
datItem = datItemObj.ToObject<Disk>();
|
datItem = datItemObj.ToObject<Disk>();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -238,14 +238,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "device_ref":
|
case "device_ref":
|
||||||
var deviceReference = new ListXmlDeviceReference();
|
datItems.Add(new DeviceReference
|
||||||
deviceReference.Name = reader.GetAttribute("name");
|
{
|
||||||
|
Name = reader.GetAttribute("name"),
|
||||||
// Ensure the list exists
|
});
|
||||||
if (machine.DeviceReferences == null)
|
|
||||||
machine.DeviceReferences = new List<ListXmlDeviceReference>();
|
|
||||||
|
|
||||||
machine.DeviceReferences.Add(deviceReference);
|
|
||||||
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
break;
|
break;
|
||||||
@@ -503,7 +499,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case "softwarelist":
|
case "softwarelist":
|
||||||
var softwareList = new ListXmlSoftwareList();
|
var softwareList = new ListXmlSoftwareList();
|
||||||
softwareList.Name = reader.GetAttribute("name");
|
softwareList.Name = reader.GetAttribute("name");
|
||||||
softwareList.Status = reader.GetAttribute("status");
|
softwareList.Status = reader.GetAttribute("status").AsSoftwareListStatus();
|
||||||
softwareList.Filter = reader.GetAttribute("filter");
|
softwareList.Filter = reader.GetAttribute("filter");
|
||||||
|
|
||||||
// Ensure the list exists
|
// Ensure the list exists
|
||||||
@@ -1080,18 +1076,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteOptionalElementString("manufacturer", datItem.Machine.Manufacturer);
|
xtw.WriteOptionalElementString("manufacturer", datItem.Machine.Manufacturer);
|
||||||
|
|
||||||
// TODO: These should go *after* the datitems
|
// TODO: These should go *after* the datitems
|
||||||
if (datItem.Machine.DeviceReferences != null)
|
|
||||||
{
|
|
||||||
foreach (var deviceReference in datItem.Machine.DeviceReferences)
|
|
||||||
{
|
|
||||||
xtw.WriteStartElement("device_ref");
|
|
||||||
|
|
||||||
xtw.WriteOptionalAttributeString("name", deviceReference.Name);
|
|
||||||
|
|
||||||
// End device_ref
|
|
||||||
xtw.WriteEndElement();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (datItem.Machine.Displays != null)
|
if (datItem.Machine.Displays != null)
|
||||||
{
|
{
|
||||||
foreach (var display in datItem.Machine.Displays)
|
foreach (var display in datItem.Machine.Displays)
|
||||||
@@ -1428,7 +1412,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteStartElement("softwarelist");
|
xtw.WriteStartElement("softwarelist");
|
||||||
|
|
||||||
xtw.WriteOptionalAttributeString("name", softwarelist.Name);
|
xtw.WriteOptionalAttributeString("name", softwarelist.Name);
|
||||||
xtw.WriteOptionalAttributeString("status", softwarelist.Status);
|
xtw.WriteOptionalAttributeString("status", softwarelist.Status.FromSoftwareListStatus());
|
||||||
xtw.WriteOptionalAttributeString("filter", softwarelist.Filter);
|
xtw.WriteOptionalAttributeString("filter", softwarelist.Filter);
|
||||||
|
|
||||||
// End softwarelist
|
// End softwarelist
|
||||||
@@ -1518,6 +1502,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ItemType.DeviceReference:
|
||||||
|
xtw.WriteStartElement("device_ref");
|
||||||
|
xtw.WriteRequiredAttributeString("name", datItem.Name);
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
break;
|
||||||
|
|
||||||
case ItemType.Disk:
|
case ItemType.Disk:
|
||||||
var disk = datItem as Disk;
|
var disk = datItem as Disk;
|
||||||
xtw.WriteStartElement("disk");
|
xtw.WriteStartElement("disk");
|
||||||
|
|||||||
@@ -988,6 +988,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ItemType.DeviceReference:
|
||||||
|
xtw.WriteStartElement("device_ref");
|
||||||
|
xtw.WriteRequiredAttributeString("name", datItem.Name);
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
break;
|
||||||
|
|
||||||
case ItemType.Disk:
|
case ItemType.Disk:
|
||||||
var disk = datItem as Disk;
|
var disk = datItem as Disk;
|
||||||
xtw.WriteStartElement("disk");
|
xtw.WriteStartElement("disk");
|
||||||
|
|||||||
@@ -867,6 +867,13 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ItemType.DeviceReference:
|
||||||
|
xtw.WriteStartElement("file");
|
||||||
|
xtw.WriteAttributeString("type", "device_ref");
|
||||||
|
xtw.WriteRequiredAttributeString("name", datItem.Name);
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
break;
|
||||||
|
|
||||||
case ItemType.Disk:
|
case ItemType.Disk:
|
||||||
var disk = datItem as Disk;
|
var disk = datItem as Disk;
|
||||||
xtw.WriteStartElement("file");
|
xtw.WriteStartElement("file");
|
||||||
|
|||||||
@@ -181,17 +181,6 @@ namespace SabreTools.Library.DatItems
|
|||||||
public List<ListXmlExtension> Extensions { get; set; }
|
public List<ListXmlExtension> Extensions { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents one ListXML deviceref
|
|
||||||
/// </summary>
|
|
||||||
/// TODO: Promote this to the same level as Sample
|
|
||||||
[JsonObject("deviceref")]
|
|
||||||
public class ListXmlDeviceReference
|
|
||||||
{
|
|
||||||
[JsonProperty("name")]
|
|
||||||
public string Name { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML display
|
/// Represents one ListXML display
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -440,7 +429,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
[JsonProperty("status")]
|
[JsonProperty("status")]
|
||||||
public string Status { get; set; } // TODO: (original|compatible)
|
public SoftwareListStatus Status { get; set; }
|
||||||
|
|
||||||
[JsonProperty("filter")]
|
[JsonProperty("filter")]
|
||||||
public string Filter { get; set; }
|
public string Filter { get; set; }
|
||||||
|
|||||||
@@ -234,45 +234,51 @@ namespace SabreTools.Library.DatItems
|
|||||||
|
|
||||||
#region Item-Specific
|
#region Item-Specific
|
||||||
|
|
||||||
|
#region Actionable
|
||||||
|
|
||||||
|
// Rom
|
||||||
|
Field.DatItem_Bios,
|
||||||
|
Field.DatItem_Size,
|
||||||
|
Field.DatItem_CRC,
|
||||||
|
Field.DatItem_MD5,
|
||||||
|
#if NET_FRAMEWORK
|
||||||
|
Field.DatItem_RIPEMD160,
|
||||||
|
#endif
|
||||||
|
Field.DatItem_SHA1,
|
||||||
|
Field.DatItem_SHA256,
|
||||||
|
Field.DatItem_SHA384,
|
||||||
|
Field.DatItem_SHA512,
|
||||||
|
Field.DatItem_Merge,
|
||||||
|
Field.DatItem_Region,
|
||||||
|
Field.DatItem_Offset,
|
||||||
|
Field.DatItem_Date,
|
||||||
|
Field.DatItem_Status,
|
||||||
|
Field.DatItem_Optional,
|
||||||
|
Field.DatItem_Inverted,
|
||||||
|
|
||||||
|
// Disk
|
||||||
|
Field.DatItem_Index,
|
||||||
|
Field.DatItem_Writable,
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Auxiliary
|
||||||
|
|
||||||
// BiosSet
|
// BiosSet
|
||||||
Field.DatItem_Default,
|
|
||||||
Field.DatItem_Description,
|
Field.DatItem_Description,
|
||||||
|
Field.DatItem_Default,
|
||||||
|
|
||||||
// Chip
|
// Chip
|
||||||
Field.DatItem_Tag,
|
Field.DatItem_Tag,
|
||||||
Field.DatItem_ChipType,
|
Field.DatItem_ChipType,
|
||||||
Field.DatItem_Clock,
|
Field.DatItem_Clock,
|
||||||
|
|
||||||
// Disk
|
|
||||||
Field.DatItem_MD5,
|
|
||||||
Field.DatItem_SHA1,
|
|
||||||
Field.DatItem_Merge,
|
|
||||||
Field.DatItem_Region,
|
|
||||||
Field.DatItem_Index,
|
|
||||||
Field.DatItem_Writable,
|
|
||||||
Field.DatItem_Status,
|
|
||||||
Field.DatItem_Optional,
|
|
||||||
|
|
||||||
// Media
|
|
||||||
Field.DatItem_SHA256,
|
|
||||||
|
|
||||||
// Release
|
// Release
|
||||||
Field.DatItem_Language,
|
Field.DatItem_Language,
|
||||||
Field.DatItem_Date,
|
|
||||||
|
|
||||||
// Rom
|
|
||||||
Field.DatItem_Bios,
|
|
||||||
Field.DatItem_Size,
|
|
||||||
Field.DatItem_CRC,
|
|
||||||
#if NET_FRAMEWORK
|
|
||||||
Field.DatItem_RIPEMD160,
|
|
||||||
#endif
|
|
||||||
Field.DatItem_SHA384,
|
|
||||||
Field.DatItem_SHA512,
|
|
||||||
Field.DatItem_Offset,
|
|
||||||
Field.DatItem_Inverted,
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#endregion // Item-Specific
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -305,7 +311,6 @@ namespace SabreTools.Library.DatItems
|
|||||||
// ListXML
|
// ListXML
|
||||||
Field.Machine_SourceFile,
|
Field.Machine_SourceFile,
|
||||||
Field.Machine_Runnable,
|
Field.Machine_Runnable,
|
||||||
Field.Machine_DeviceReference_Name,
|
|
||||||
Field.Machine_Slots,
|
Field.Machine_Slots,
|
||||||
Field.Machine_Infos,
|
Field.Machine_Infos,
|
||||||
|
|
||||||
@@ -447,6 +452,9 @@ namespace SabreTools.Library.DatItems
|
|||||||
case ItemType.Chip:
|
case ItemType.Chip:
|
||||||
return new Chip();
|
return new Chip();
|
||||||
|
|
||||||
|
case ItemType.DeviceReference:
|
||||||
|
return new DeviceReference();
|
||||||
|
|
||||||
case ItemType.Disk:
|
case ItemType.Disk:
|
||||||
return new Disk();
|
return new Disk();
|
||||||
|
|
||||||
|
|||||||
77
SabreTools.Library/DatItems/DeviceReference.cs
Normal file
77
SabreTools.Library/DatItems/DeviceReference.cs
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace SabreTools.Library.DatItems
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents which Device Reference(s) is associated with a set
|
||||||
|
/// </summary>
|
||||||
|
[JsonObject("device_ref")]
|
||||||
|
public class DeviceReference : DatItem
|
||||||
|
{
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a default, empty DeviceReference object
|
||||||
|
/// </summary>
|
||||||
|
public DeviceReference()
|
||||||
|
{
|
||||||
|
Name = string.Empty;
|
||||||
|
ItemType = ItemType.DeviceReference;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Cloning Methods
|
||||||
|
|
||||||
|
public override object Clone()
|
||||||
|
{
|
||||||
|
return new DeviceReference()
|
||||||
|
{
|
||||||
|
Name = this.Name,
|
||||||
|
ItemType = this.ItemType,
|
||||||
|
DupeType = this.DupeType,
|
||||||
|
|
||||||
|
AltName = this.AltName,
|
||||||
|
AltTitle = this.AltTitle,
|
||||||
|
|
||||||
|
Original = this.Original,
|
||||||
|
OpenMSXSubType = this.OpenMSXSubType,
|
||||||
|
OpenMSXType = this.OpenMSXType,
|
||||||
|
Remark = this.Remark,
|
||||||
|
Boot = this.Boot,
|
||||||
|
|
||||||
|
Part = this.Part,
|
||||||
|
Features = this.Features,
|
||||||
|
AreaName = this.AreaName,
|
||||||
|
AreaSize = this.AreaSize,
|
||||||
|
AreaWidth = this.AreaWidth,
|
||||||
|
AreaEndianness = this.AreaEndianness,
|
||||||
|
Value = this.Value,
|
||||||
|
LoadFlag = this.LoadFlag,
|
||||||
|
|
||||||
|
Machine = this.Machine.Clone() as Machine,
|
||||||
|
Source = this.Source.Clone() as Source,
|
||||||
|
Remove = this.Remove,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Comparision Methods
|
||||||
|
|
||||||
|
public override bool Equals(DatItem other)
|
||||||
|
{
|
||||||
|
// If we don't have a device reference, return false
|
||||||
|
if (ItemType != other.ItemType)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Otherwise, treat it as a device reference
|
||||||
|
DeviceReference newOther = other as DeviceReference;
|
||||||
|
|
||||||
|
// If the device reference information matches
|
||||||
|
return (Name == newOther.Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -129,12 +129,8 @@ namespace SabreTools.Library.DatItems
|
|||||||
Machine_SourceFile,
|
Machine_SourceFile,
|
||||||
Machine_Runnable,
|
Machine_Runnable,
|
||||||
|
|
||||||
// DeviceReferences
|
|
||||||
Machine_DeviceReferences, // TODO: Double-check DeviceReferences usage
|
|
||||||
Machine_DeviceReference_Name,
|
|
||||||
|
|
||||||
// Displays
|
// Displays
|
||||||
Machine_Displays, // TODO: Implement Displays usage
|
Machine_Displays,
|
||||||
Machine_Display_Tag,
|
Machine_Display_Tag,
|
||||||
Machine_Display_Type,
|
Machine_Display_Type,
|
||||||
Machine_Display_Rotate,
|
Machine_Display_Rotate,
|
||||||
@@ -151,18 +147,18 @@ namespace SabreTools.Library.DatItems
|
|||||||
Machine_Display_VBStart,
|
Machine_Display_VBStart,
|
||||||
|
|
||||||
// Sounds
|
// Sounds
|
||||||
Machine_Sounds, // TODO: Implement Sounds usage
|
Machine_Sounds,
|
||||||
Machine_Sound_Channels,
|
Machine_Sound_Channels,
|
||||||
|
|
||||||
// Conditions
|
// Conditions
|
||||||
Machine_Conditions, // TODO: Implement Conditions usage
|
Machine_Conditions,
|
||||||
Machine_Condition_Tag,
|
Machine_Condition_Tag,
|
||||||
Machine_Condition_Mask,
|
Machine_Condition_Mask,
|
||||||
Machine_Condition_Relation,
|
Machine_Condition_Relation,
|
||||||
Machine_Condition_Value,
|
Machine_Condition_Value,
|
||||||
|
|
||||||
// Inputs
|
// Inputs
|
||||||
Machine_Inputs, // TODO: Implement Inputs usage
|
Machine_Inputs,
|
||||||
Machine_Input_Service,
|
Machine_Input_Service,
|
||||||
Machine_Input_Tilt,
|
Machine_Input_Tilt,
|
||||||
Machine_Input_Players,
|
Machine_Input_Players,
|
||||||
@@ -184,7 +180,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
Machine_Input_Control_Ways3,
|
Machine_Input_Control_Ways3,
|
||||||
|
|
||||||
// DipSwitches
|
// DipSwitches
|
||||||
Machine_DipSwitches, // TODO: Implement DipSwitches usage
|
Machine_DipSwitches,
|
||||||
Machine_DipSwitch_Name,
|
Machine_DipSwitch_Name,
|
||||||
Machine_DipSwitch_Tag,
|
Machine_DipSwitch_Tag,
|
||||||
Machine_DipSwitch_Mask,
|
Machine_DipSwitch_Mask,
|
||||||
@@ -202,7 +198,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
Machine_DipSwitch_Value_Default,
|
Machine_DipSwitch_Value_Default,
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
Machine_Configurations, // TODO: Implement Configurations usage
|
Machine_Configurations,
|
||||||
Machine_Configuration_Name,
|
Machine_Configuration_Name,
|
||||||
Machine_Configuration_Tag,
|
Machine_Configuration_Tag,
|
||||||
Machine_Configuration_Mask,
|
Machine_Configuration_Mask,
|
||||||
@@ -220,7 +216,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
Machine_Configuration_Setting_Default,
|
Machine_Configuration_Setting_Default,
|
||||||
|
|
||||||
// Ports
|
// Ports
|
||||||
Machine_Ports, // TODO: Implement Ports usage
|
Machine_Ports,
|
||||||
Machine_Port_Tag,
|
Machine_Port_Tag,
|
||||||
|
|
||||||
// Ports.Analogs
|
// Ports.Analogs
|
||||||
@@ -228,7 +224,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
Machine_Port_Analog_Mask,
|
Machine_Port_Analog_Mask,
|
||||||
|
|
||||||
// Adjusters
|
// Adjusters
|
||||||
Machine_Adjusters, // TODO: Implement Adjusters usage
|
Machine_Adjusters,
|
||||||
Machine_Adjuster_Name,
|
Machine_Adjuster_Name,
|
||||||
Machine_Adjuster_Default,
|
Machine_Adjuster_Default,
|
||||||
|
|
||||||
@@ -240,20 +236,20 @@ namespace SabreTools.Library.DatItems
|
|||||||
Machine_Adjuster_Condition_Value,
|
Machine_Adjuster_Condition_Value,
|
||||||
|
|
||||||
// Drivers
|
// Drivers
|
||||||
Machine_Drivers, // TODO: Implement Drivers usage
|
Machine_Drivers,
|
||||||
Machine_Driver_Status,
|
Machine_Driver_Status,
|
||||||
Machine_Driver_Emulation,
|
Machine_Driver_Emulation,
|
||||||
Machine_Driver_Cocktail,
|
Machine_Driver_Cocktail,
|
||||||
Machine_Driver_SaveState,
|
Machine_Driver_SaveState,
|
||||||
|
|
||||||
// Features
|
// Features
|
||||||
Machine_Features, // TODO: Implement Features usage
|
Machine_Features,
|
||||||
Machine_Feature_Type,
|
Machine_Feature_Type,
|
||||||
Machine_Feature_Status,
|
Machine_Feature_Status,
|
||||||
Machine_Feature_Overall,
|
Machine_Feature_Overall,
|
||||||
|
|
||||||
// Devices
|
// Devices
|
||||||
Machine_Devices, // TODO: Implement Devices usage
|
Machine_Devices,
|
||||||
Machine_Device_Type,
|
Machine_Device_Type,
|
||||||
Machine_Device_Tag,
|
Machine_Device_Tag,
|
||||||
Machine_Device_FixedImage,
|
Machine_Device_FixedImage,
|
||||||
@@ -270,7 +266,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
Machine_Device_Extension_Name,
|
Machine_Device_Extension_Name,
|
||||||
|
|
||||||
// Slots
|
// Slots
|
||||||
Machine_Slots, // TODO: Fix Slots usage
|
Machine_Slots,
|
||||||
Machine_Slot_Name,
|
Machine_Slot_Name,
|
||||||
|
|
||||||
// Slots.SlotOptions
|
// Slots.SlotOptions
|
||||||
@@ -280,13 +276,13 @@ namespace SabreTools.Library.DatItems
|
|||||||
Machine_Slot_SlotOption_Default,
|
Machine_Slot_SlotOption_Default,
|
||||||
|
|
||||||
// SoftwareLists
|
// SoftwareLists
|
||||||
Machine_SoftwareLists, // TODO: Implement SoftwareLists usage
|
Machine_SoftwareLists,
|
||||||
Machine_SoftwareList_Name,
|
Machine_SoftwareList_Name,
|
||||||
Machine_SoftwareList_Status,
|
Machine_SoftwareList_Status,
|
||||||
Machine_SoftwareList_Filter,
|
Machine_SoftwareList_Filter,
|
||||||
|
|
||||||
// RamOptions
|
// RamOptions
|
||||||
Machine_RamOptions, // TODO: Implement RamOptions usage
|
Machine_RamOptions,
|
||||||
Machine_RamOption_Default,
|
Machine_RamOption_Default,
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -367,12 +363,12 @@ namespace SabreTools.Library.DatItems
|
|||||||
#region SoftwareList
|
#region SoftwareList
|
||||||
|
|
||||||
// Part
|
// Part
|
||||||
DatItem_Part, // TODO: Fully implement Part
|
DatItem_Part,
|
||||||
DatItem_Part_Name,
|
DatItem_Part_Name,
|
||||||
DatItem_Part_Interface,
|
DatItem_Part_Interface,
|
||||||
|
|
||||||
// Feature
|
// Feature
|
||||||
DatItem_Features, // TODO: Fully implement Feature
|
DatItem_Features,
|
||||||
DatItem_Feature_Name,
|
DatItem_Feature_Name,
|
||||||
DatItem_Feature_Value,
|
DatItem_Feature_Value,
|
||||||
|
|
||||||
@@ -387,46 +383,52 @@ namespace SabreTools.Library.DatItems
|
|||||||
|
|
||||||
#region Item-Specific
|
#region Item-Specific
|
||||||
|
|
||||||
|
#region Actionable
|
||||||
|
|
||||||
|
// Rom
|
||||||
|
DatItem_Bios,
|
||||||
|
DatItem_Size,
|
||||||
|
DatItem_CRC,
|
||||||
|
DatItem_MD5,
|
||||||
|
#if NET_FRAMEWORK
|
||||||
|
DatItem_RIPEMD160,
|
||||||
|
#endif
|
||||||
|
DatItem_SHA1,
|
||||||
|
DatItem_SHA256,
|
||||||
|
DatItem_SHA384,
|
||||||
|
DatItem_SHA512,
|
||||||
|
DatItem_Merge,
|
||||||
|
DatItem_Region,
|
||||||
|
DatItem_Offset,
|
||||||
|
DatItem_Date,
|
||||||
|
DatItem_Status,
|
||||||
|
DatItem_Optional,
|
||||||
|
DatItem_Inverted,
|
||||||
|
|
||||||
|
// Disk
|
||||||
|
DatItem_Index,
|
||||||
|
DatItem_Writable,
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Auxiliary
|
||||||
|
|
||||||
// BiosSet
|
// BiosSet
|
||||||
DatItem_Default,
|
|
||||||
DatItem_Description,
|
DatItem_Description,
|
||||||
|
DatItem_Default,
|
||||||
|
|
||||||
// Chip
|
// Chip
|
||||||
DatItem_Tag,
|
DatItem_Tag,
|
||||||
DatItem_ChipType,
|
DatItem_ChipType,
|
||||||
DatItem_Clock,
|
DatItem_Clock,
|
||||||
|
|
||||||
// Disk
|
|
||||||
DatItem_MD5,
|
|
||||||
DatItem_SHA1,
|
|
||||||
DatItem_Merge,
|
|
||||||
DatItem_Region,
|
|
||||||
DatItem_Index,
|
|
||||||
DatItem_Writable,
|
|
||||||
DatItem_Status,
|
|
||||||
DatItem_Optional,
|
|
||||||
|
|
||||||
// Media
|
|
||||||
DatItem_SHA256,
|
|
||||||
|
|
||||||
// Release
|
// Release
|
||||||
DatItem_Language,
|
DatItem_Language,
|
||||||
DatItem_Date,
|
|
||||||
|
|
||||||
// Rom
|
|
||||||
DatItem_Bios,
|
|
||||||
DatItem_Size,
|
|
||||||
DatItem_CRC,
|
|
||||||
#if NET_FRAMEWORK
|
|
||||||
DatItem_RIPEMD160,
|
|
||||||
#endif
|
|
||||||
DatItem_SHA384,
|
|
||||||
DatItem_SHA512,
|
|
||||||
DatItem_Offset,
|
|
||||||
DatItem_Inverted,
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#endregion // Item-Specific
|
||||||
|
|
||||||
#endregion // DatItem
|
#endregion // DatItem
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,16 +456,17 @@ namespace SabreTools.Library.DatItems
|
|||||||
public enum ItemType
|
public enum ItemType
|
||||||
{
|
{
|
||||||
// "Actionable" item types
|
// "Actionable" item types
|
||||||
Rom = 0,
|
Rom,
|
||||||
Disk = 1,
|
Disk,
|
||||||
Media = 2,
|
Media,
|
||||||
|
|
||||||
// "Auxiliary" item types
|
// "Auxiliary" item types
|
||||||
Archive = 3,
|
Archive,
|
||||||
BiosSet = 4,
|
BiosSet,
|
||||||
Chip = 5,
|
Chip,
|
||||||
Release = 6,
|
DeviceReference,
|
||||||
Sample = 7,
|
Release,
|
||||||
|
Sample,
|
||||||
|
|
||||||
Blank = 99, // This is not a real type, only used internally
|
Blank = 99, // This is not a real type, only used internally
|
||||||
}
|
}
|
||||||
@@ -516,6 +519,21 @@ namespace SabreTools.Library.DatItems
|
|||||||
Yes = 1 << 2,
|
Yes = 1 << 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determine software list status
|
||||||
|
/// </summary>
|
||||||
|
[Flags]
|
||||||
|
public enum SoftwareListStatus
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This is a fake flag that is used for filter only
|
||||||
|
/// </summary>
|
||||||
|
NULL = 0,
|
||||||
|
|
||||||
|
Original = 1 << 0,
|
||||||
|
Compatible = 1 << 1,
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determine machine support status
|
/// Determine machine support status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -152,12 +152,6 @@ namespace SabreTools.Library.DatItems
|
|||||||
[JsonProperty("runnable", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
[JsonProperty("runnable", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public Runnable Runnable { get; set; } = Runnable.NULL;
|
public Runnable Runnable { get; set; } = Runnable.NULL;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// List of associated device names
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("devicereferences", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
|
||||||
public List<ListXmlDeviceReference> DeviceReferences { get; set; } = null;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of associated displays
|
/// List of associated displays
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -596,7 +590,6 @@ namespace SabreTools.Library.DatItems
|
|||||||
|
|
||||||
SourceFile = this.SourceFile,
|
SourceFile = this.SourceFile,
|
||||||
Runnable = this.Runnable,
|
Runnable = this.Runnable,
|
||||||
DeviceReferences = this.DeviceReferences,
|
|
||||||
Displays = this.Displays,
|
Displays = this.Displays,
|
||||||
Sounds = this.Sounds,
|
Sounds = this.Sounds,
|
||||||
Conditions = this.Conditions,
|
Conditions = this.Conditions,
|
||||||
@@ -807,34 +800,6 @@ namespace SabreTools.Library.DatItems
|
|||||||
if (filter.Machine_Runnable.MatchesNegative(Runnable.NULL, Runnable) == true)
|
if (filter.Machine_Runnable.MatchesNegative(Runnable.NULL, Runnable) == true)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#region DeviceReferences
|
|
||||||
|
|
||||||
// Machine_DeviceReferences
|
|
||||||
if (filter.Machine_DeviceReferences.MatchesNeutral(null, DeviceReferences?.Any() ?? null) == false)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Machine_DeviceReference_Name
|
|
||||||
if (DeviceReferences?.Any() == true)
|
|
||||||
{
|
|
||||||
bool anyPositive = false;
|
|
||||||
bool anyNegative = false;
|
|
||||||
|
|
||||||
foreach (var deviceReference in DeviceReferences)
|
|
||||||
{
|
|
||||||
if (filter.Machine_DeviceReference_Name.MatchesPositiveSet(deviceReference?.Name) != false)
|
|
||||||
anyPositive = true;
|
|
||||||
if (filter.Machine_DeviceReference_Name.MatchesNegativeSet(deviceReference?.Name) == true)
|
|
||||||
anyNegative = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!anyPositive)
|
|
||||||
return false;
|
|
||||||
if (anyNegative)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Displays
|
#region Displays
|
||||||
|
|
||||||
// Machine_Displays
|
// Machine_Displays
|
||||||
@@ -1132,9 +1097,9 @@ namespace SabreTools.Library.DatItems
|
|||||||
|
|
||||||
foreach (var sound in Sounds)
|
foreach (var sound in Sounds)
|
||||||
{
|
{
|
||||||
if (filter.Machine_DeviceReference_Name.MatchesPositiveSet(sound?.Channels) != false)
|
if (filter.Machine_Sound_Channels.MatchesPositiveSet(sound?.Channels) != false)
|
||||||
anyPositive = true;
|
anyPositive = true;
|
||||||
if (filter.Machine_DeviceReference_Name.MatchesNegativeSet(sound?.Channels) == true)
|
if (filter.Machine_Sound_Channels.MatchesNegativeSet(sound?.Channels) == true)
|
||||||
anyNegative = true;
|
anyNegative = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1538,9 +1503,6 @@ namespace SabreTools.Library.DatItems
|
|||||||
if (fields.Contains(Field.Machine_Runnable))
|
if (fields.Contains(Field.Machine_Runnable))
|
||||||
Runnable = Runnable.NULL;
|
Runnable = Runnable.NULL;
|
||||||
|
|
||||||
if (fields.Contains(Field.Machine_DeviceReferences))
|
|
||||||
DeviceReferences = null;
|
|
||||||
|
|
||||||
if (fields.Contains(Field.Machine_Slots))
|
if (fields.Contains(Field.Machine_Slots))
|
||||||
Slots = null;
|
Slots = null;
|
||||||
|
|
||||||
@@ -1703,9 +1665,6 @@ namespace SabreTools.Library.DatItems
|
|||||||
if (fields.Contains(Field.Machine_Runnable))
|
if (fields.Contains(Field.Machine_Runnable))
|
||||||
Runnable = machine.Runnable;
|
Runnable = machine.Runnable;
|
||||||
|
|
||||||
if (fields.Contains(Field.Machine_DeviceReferences))
|
|
||||||
DeviceReferences = machine.DeviceReferences;
|
|
||||||
|
|
||||||
if (fields.Contains(Field.Machine_Slots))
|
if (fields.Contains(Field.Machine_Slots))
|
||||||
Slots = machine.Slots;
|
Slots = machine.Slots;
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ namespace SabreTools.Library.Data
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current toolset version to be used by all child applications
|
/// The current toolset version to be used by all child applications
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly static string Version = $"v1.0.3";
|
//public readonly static string Version = $"v1.0.3";
|
||||||
//public readonly static string Version = $"v1.0.3-{File.GetCreationTime(Assembly.GetExecutingAssembly().Location):yyyy-MM-dd HH:mm:ss}";
|
public readonly static string Version = $"v1.0.3-{File.GetCreationTime(Assembly.GetExecutingAssembly().Location):yyyy-MM-dd HH:mm:ss}";
|
||||||
public const int HeaderHeight = 3;
|
public const int HeaderHeight = 3;
|
||||||
|
|
||||||
#region 0-byte file constants
|
#region 0-byte file constants
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if the name is the right length
|
// Check if the name is the right length
|
||||||
if (!Regex.IsMatch(datum, @"^[0-9a-f]{" + Constants.SHA1Length + @"}\.gz")) // TODO: When updating to SHA-256, this needs to update to Constants.SHA256Length
|
if (!Regex.IsMatch(datum, @"^[0-9a-f]{" + Constants.SHA1Length + @"}\.gz"))
|
||||||
{
|
{
|
||||||
Globals.Logger.Warning($"Non SHA-1 filename found, skipping: '{Path.GetFullPath(this.Filename)}'");
|
Globals.Logger.Warning($"Non SHA-1 filename found, skipping: '{Path.GetFullPath(this.Filename)}'");
|
||||||
return false;
|
return false;
|
||||||
@@ -342,7 +342,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if the name is the right length
|
// Check if the name is the right length
|
||||||
if (!Regex.IsMatch(datum, @"^[0-9a-f]{" + Constants.SHA1Length + @"}\.gz")) // TODO: When updating to SHA-256, this needs to update to Constants.SHA256Length
|
if (!Regex.IsMatch(datum, @"^[0-9a-f]{" + Constants.SHA1Length + @"}\.gz"))
|
||||||
{
|
{
|
||||||
Globals.Logger.Warning($"Non SHA-1 filename found, skipping: '{Path.GetFullPath(this.Filename)}'");
|
Globals.Logger.Warning($"Non SHA-1 filename found, skipping: '{Path.GetFullPath(this.Filename)}'");
|
||||||
return null;
|
return null;
|
||||||
@@ -392,7 +392,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
Size = extractedsize,
|
Size = extractedsize,
|
||||||
CRC = headercrc,
|
CRC = headercrc,
|
||||||
MD5 = headermd5,
|
MD5 = headermd5,
|
||||||
SHA1 = Utilities.StringToByteArray(Path.GetFileNameWithoutExtension(this.Filename)), // TODO: When updating to SHA-256, this needs to update to SHA256
|
SHA1 = Utilities.StringToByteArray(Path.GetFileNameWithoutExtension(this.Filename)),
|
||||||
|
|
||||||
Parent = Path.GetFileNameWithoutExtension(this.Filename).ToLowerInvariant(),
|
Parent = Path.GetFileNameWithoutExtension(this.Filename).ToLowerInvariant(),
|
||||||
};
|
};
|
||||||
@@ -457,7 +457,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
rom = new Rom(inputStream.GetInfo(keepReadOpen: true));
|
rom = new Rom(inputStream.GetInfo(keepReadOpen: true));
|
||||||
|
|
||||||
// Get the output file name
|
// Get the output file name
|
||||||
string outfile = Path.Combine(outDir, PathExtensions.GetDepotPath(rom.SHA1, depth)); // TODO: When updating to SHA-256, this needs to update to SHA256
|
string outfile = Path.Combine(outDir, PathExtensions.GetDepotPath(rom.SHA1, depth));
|
||||||
|
|
||||||
// Check to see if the folder needs to be created
|
// Check to see if the folder needs to be created
|
||||||
if (!Directory.Exists(Path.GetDirectoryName(outfile)))
|
if (!Directory.Exists(Path.GetDirectoryName(outfile)))
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
string datum = Path.GetFileName(this.Filename).ToLowerInvariant();
|
string datum = Path.GetFileName(this.Filename).ToLowerInvariant();
|
||||||
|
|
||||||
// Check if the name is the right length
|
// Check if the name is the right length
|
||||||
if (!Regex.IsMatch(datum, @"^[0-9a-f]{" + Constants.SHA1Length + @"}\.xz")) // TODO: When updating to SHA-256, this needs to update to Constants.SHA256Length
|
if (!Regex.IsMatch(datum, @"^[0-9a-f]{" + Constants.SHA1Length + @"}\.xz"))
|
||||||
{
|
{
|
||||||
Globals.Logger.Warning($"Non SHA-1 filename found, skipping: '{Path.GetFullPath(this.Filename)}'");
|
Globals.Logger.Warning($"Non SHA-1 filename found, skipping: '{Path.GetFullPath(this.Filename)}'");
|
||||||
return false;
|
return false;
|
||||||
@@ -284,7 +284,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
string datum = Path.GetFileName(this.Filename).ToLowerInvariant();
|
string datum = Path.GetFileName(this.Filename).ToLowerInvariant();
|
||||||
|
|
||||||
// Check if the name is the right length
|
// Check if the name is the right length
|
||||||
if (!Regex.IsMatch(datum, @"^[0-9a-f]{" + Constants.SHA1Length + @"}\.xz")) // TODO: When updating to SHA-256, this needs to update to Constants.SHA256Length
|
if (!Regex.IsMatch(datum, @"^[0-9a-f]{" + Constants.SHA1Length + @"}\.xz"))
|
||||||
{
|
{
|
||||||
Globals.Logger.Warning($"Non SHA-1 filename found, skipping: '{Path.GetFullPath(this.Filename)}'");
|
Globals.Logger.Warning($"Non SHA-1 filename found, skipping: '{Path.GetFullPath(this.Filename)}'");
|
||||||
return null;
|
return null;
|
||||||
@@ -293,7 +293,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
BaseFile baseFile = new BaseFile
|
BaseFile baseFile = new BaseFile
|
||||||
{
|
{
|
||||||
Filename = Path.GetFileNameWithoutExtension(this.Filename).ToLowerInvariant(),
|
Filename = Path.GetFileNameWithoutExtension(this.Filename).ToLowerInvariant(),
|
||||||
SHA1 = Utilities.StringToByteArray(Path.GetFileNameWithoutExtension(this.Filename)), // TODO: When updating to SHA-256, this needs to update to SHA256
|
SHA1 = Utilities.StringToByteArray(Path.GetFileNameWithoutExtension(this.Filename)),
|
||||||
|
|
||||||
Parent = Path.GetFileNameWithoutExtension(this.Filename).ToLowerInvariant(),
|
Parent = Path.GetFileNameWithoutExtension(this.Filename).ToLowerInvariant(),
|
||||||
};
|
};
|
||||||
@@ -357,7 +357,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
rom = new Rom(inputStream.GetInfo(keepReadOpen: true));
|
rom = new Rom(inputStream.GetInfo(keepReadOpen: true));
|
||||||
|
|
||||||
// Get the output file name
|
// Get the output file name
|
||||||
string outfile = Path.Combine(outDir, PathExtensions.GetDepotPath(rom.SHA1, depth)); // TODO: When updating to SHA-256, this needs to update to SHA256
|
string outfile = Path.Combine(outDir, PathExtensions.GetDepotPath(rom.SHA1, depth));
|
||||||
outfile = outfile.Replace(".gz", ".xz");
|
outfile = outfile.Replace(".gz", ".xz");
|
||||||
|
|
||||||
// Check to see if the folder needs to be created
|
// Check to see if the folder needs to be created
|
||||||
|
|||||||
@@ -50,10 +50,6 @@ namespace SabreTools.Library.Filtering
|
|||||||
|
|
||||||
public FilterItem<string> Machine_SourceFile { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> Machine_SourceFile { get; private set; } = new FilterItem<string>();
|
||||||
public FilterItem<Runnable> Machine_Runnable { get; private set; } = new FilterItem<Runnable>() { Positive = Runnable.NULL, Negative = Runnable.NULL };
|
public FilterItem<Runnable> Machine_Runnable { get; private set; } = new FilterItem<Runnable>() { Positive = Runnable.NULL, Negative = Runnable.NULL };
|
||||||
|
|
||||||
// DeviceReferences
|
|
||||||
public FilterItem<bool?> Machine_DeviceReferences { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
|
||||||
public FilterItem<string> Machine_DeviceReference_Name { get; private set; } = new FilterItem<string>();
|
|
||||||
|
|
||||||
// Displays
|
// Displays
|
||||||
public FilterItem<bool?> Machine_Displays { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
public FilterItem<bool?> Machine_Displays { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||||
@@ -309,46 +305,52 @@ namespace SabreTools.Library.Filtering
|
|||||||
|
|
||||||
#region Item-Specific
|
#region Item-Specific
|
||||||
|
|
||||||
|
#region Actionable
|
||||||
|
|
||||||
|
// Rom
|
||||||
|
public FilterItem<string> DatItem_Bios { get; private set; } = new FilterItem<string>();
|
||||||
|
public FilterItem<long> DatItem_Size { get; private set; } = new FilterItem<long>() { Positive = -1, Negative = -1, Neutral = -1 };
|
||||||
|
public FilterItem<string> DatItem_CRC { get; private set; } = new FilterItem<string>();
|
||||||
|
public FilterItem<string> DatItem_MD5 { get; private set; } = new FilterItem<string>();
|
||||||
|
#if NET_FRAMEWORK
|
||||||
|
public FilterItem<string> DatItem_RIPEMD160 { get; private set; } = new FilterItem<string>();
|
||||||
|
#endif
|
||||||
|
public FilterItem<string> DatItem_SHA1 { get; private set; } = new FilterItem<string>();
|
||||||
|
public FilterItem<string> DatItem_SHA256 { get; private set; } = new FilterItem<string>();
|
||||||
|
public FilterItem<string> DatItem_SHA384 { get; private set; } = new FilterItem<string>();
|
||||||
|
public FilterItem<string> DatItem_SHA512 { get; private set; } = new FilterItem<string>();
|
||||||
|
public FilterItem<string> DatItem_Merge { get; private set; } = new FilterItem<string>();
|
||||||
|
public FilterItem<string> DatItem_Region { get; private set; } = new FilterItem<string>();
|
||||||
|
public FilterItem<string> DatItem_Offset { get; private set; } = new FilterItem<string>();
|
||||||
|
public FilterItem<string> DatItem_Date { get; private set; } = new FilterItem<string>();
|
||||||
|
public FilterItem<ItemStatus> DatItem_Status { get; private set; } = new FilterItem<ItemStatus>() { Positive = ItemStatus.NULL, Negative = ItemStatus.NULL };
|
||||||
|
public FilterItem<bool?> DatItem_Optional { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||||
|
public FilterItem<bool?> DatItem_Inverted { get; private set; } = new FilterItem<bool?>();
|
||||||
|
|
||||||
|
// Disk
|
||||||
|
public FilterItem<string> DatItem_Index { get; private set; } = new FilterItem<string>();
|
||||||
|
public FilterItem<bool?> DatItem_Writable { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Auxiliary
|
||||||
|
|
||||||
// BiosSet
|
// BiosSet
|
||||||
public FilterItem<bool?> DatItem_Default { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
|
||||||
public FilterItem<string> DatItem_Description { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> DatItem_Description { get; private set; } = new FilterItem<string>();
|
||||||
|
public FilterItem<bool?> DatItem_Default { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||||
|
|
||||||
// Chip
|
// Chip
|
||||||
public FilterItem<string> DatItem_Tag { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> DatItem_Tag { get; private set; } = new FilterItem<string>();
|
||||||
public FilterItem<string> DatItem_ChipType { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> DatItem_ChipType { get; private set; } = new FilterItem<string>();
|
||||||
public FilterItem<string> DatItem_Clock { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> DatItem_Clock { get; private set; } = new FilterItem<string>();
|
||||||
|
|
||||||
// Disk
|
|
||||||
public FilterItem<string> DatItem_MD5 { get; private set; } = new FilterItem<string>();
|
|
||||||
public FilterItem<string> DatItem_SHA1 { get; private set; } = new FilterItem<string>();
|
|
||||||
public FilterItem<string> DatItem_Merge { get; private set; } = new FilterItem<string>();
|
|
||||||
public FilterItem<string> DatItem_Region { get; private set; } = new FilterItem<string>();
|
|
||||||
public FilterItem<string> DatItem_Index { get; private set; } = new FilterItem<string>();
|
|
||||||
public FilterItem<bool?> DatItem_Writable { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
|
||||||
public FilterItem<bool?> DatItem_Optional { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
|
||||||
public FilterItem<ItemStatus> DatItem_Status { get; private set; } = new FilterItem<ItemStatus>() { Positive = ItemStatus.NULL, Negative = ItemStatus.NULL };
|
|
||||||
|
|
||||||
// Media
|
|
||||||
public FilterItem<string> DatItem_SHA256 { get; private set; } = new FilterItem<string>();
|
|
||||||
|
|
||||||
// Release
|
// Release
|
||||||
public FilterItem<string> DatItem_Language { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> DatItem_Language { get; private set; } = new FilterItem<string>();
|
||||||
public FilterItem<string> DatItem_Date { get; private set; } = new FilterItem<string>();
|
|
||||||
|
|
||||||
// Rom
|
|
||||||
public FilterItem<string> DatItem_Bios { get; private set; } = new FilterItem<string>();
|
|
||||||
public FilterItem<long> DatItem_Size { get; private set; } = new FilterItem<long>() { Positive = -1, Negative = -1, Neutral = -1 };
|
|
||||||
public FilterItem<string> DatItem_CRC { get; private set; } = new FilterItem<string>();
|
|
||||||
#if NET_FRAMEWORK
|
|
||||||
public FilterItem<string> DatItem_RIPEMD160 { get; private set; } = new FilterItem<string>();
|
|
||||||
#endif
|
|
||||||
public FilterItem<string> DatItem_SHA384 { get; private set; } = new FilterItem<string>();
|
|
||||||
public FilterItem<string> DatItem_SHA512 { get; private set; } = new FilterItem<string>();
|
|
||||||
public FilterItem<string> DatItem_Offset { get; private set; } = new FilterItem<string>();
|
|
||||||
public FilterItem<bool?> DatItem_Inverted { get; private set; } = new FilterItem<bool?>();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#endregion // Item-Specific
|
||||||
|
|
||||||
#endregion // DatItem Filters
|
#endregion // DatItem Filters
|
||||||
|
|
||||||
#region Additional Flags
|
#region Additional Flags
|
||||||
@@ -572,21 +574,6 @@ namespace SabreTools.Library.Filtering
|
|||||||
Machine_Runnable.Positive |= value.AsRunnable();
|
Machine_Runnable.Positive |= value.AsRunnable();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// DeviceReferences
|
|
||||||
case Field.Machine_DeviceReferences:
|
|
||||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
|
||||||
Machine_DeviceReferences.Neutral = false;
|
|
||||||
else
|
|
||||||
Machine_DeviceReferences.Neutral = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.Machine_DeviceReference_Name:
|
|
||||||
if (negate)
|
|
||||||
Machine_DeviceReference_Name.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
Machine_DeviceReference_Name.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Displays
|
// Displays
|
||||||
case Field.Machine_Displays:
|
case Field.Machine_Displays:
|
||||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||||
@@ -1753,122 +1740,7 @@ namespace SabreTools.Library.Filtering
|
|||||||
|
|
||||||
#region Item-Specific
|
#region Item-Specific
|
||||||
|
|
||||||
// BiosSet
|
#region Actionable
|
||||||
case Field.DatItem_Default:
|
|
||||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
|
||||||
DatItem_Default.Neutral = false;
|
|
||||||
else
|
|
||||||
DatItem_Default.Neutral = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.DatItem_Description:
|
|
||||||
if (negate)
|
|
||||||
DatItem_Description.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
DatItem_Description.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Chip
|
|
||||||
case Field.DatItem_Tag:
|
|
||||||
if (negate)
|
|
||||||
DatItem_Tag.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
DatItem_Tag.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.DatItem_ChipType:
|
|
||||||
if (negate)
|
|
||||||
DatItem_ChipType.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
DatItem_ChipType.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.DatItem_Clock:
|
|
||||||
if (negate)
|
|
||||||
DatItem_Clock.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
DatItem_Clock.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Disk
|
|
||||||
case Field.DatItem_MD5:
|
|
||||||
if (negate)
|
|
||||||
DatItem_MD5.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
DatItem_MD5.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.DatItem_SHA1:
|
|
||||||
if (negate)
|
|
||||||
DatItem_SHA1.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
DatItem_SHA1.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.DatItem_Merge:
|
|
||||||
if (negate)
|
|
||||||
DatItem_Merge.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
DatItem_Merge.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.DatItem_Region:
|
|
||||||
if (negate)
|
|
||||||
DatItem_Region.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
DatItem_Region.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.DatItem_Index:
|
|
||||||
if (negate)
|
|
||||||
DatItem_Index.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
DatItem_Index.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.DatItem_Writable:
|
|
||||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
|
||||||
DatItem_Writable.Neutral = false;
|
|
||||||
else
|
|
||||||
DatItem_Writable.Neutral = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.DatItem_Optional:
|
|
||||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
|
||||||
DatItem_Optional.Neutral = false;
|
|
||||||
else
|
|
||||||
DatItem_Optional.Neutral = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.DatItem_Status:
|
|
||||||
if (negate)
|
|
||||||
DatItem_Status.Negative |= value.AsItemStatus();
|
|
||||||
else
|
|
||||||
DatItem_Status.Positive |= value.AsItemStatus();
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Media
|
|
||||||
case Field.DatItem_SHA256:
|
|
||||||
if (negate)
|
|
||||||
DatItem_SHA256.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
DatItem_SHA256.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Release
|
|
||||||
case Field.DatItem_Language:
|
|
||||||
if (negate)
|
|
||||||
DatItem_Language.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
DatItem_Language.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.DatItem_Date:
|
|
||||||
if (negate)
|
|
||||||
DatItem_Date.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
DatItem_Date.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Rom
|
// Rom
|
||||||
case Field.DatItem_Bios:
|
case Field.DatItem_Bios:
|
||||||
@@ -1937,6 +1809,13 @@ namespace SabreTools.Library.Filtering
|
|||||||
DatItem_CRC.PositiveSet.Add(value);
|
DatItem_CRC.PositiveSet.Add(value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Field.DatItem_MD5:
|
||||||
|
if (negate)
|
||||||
|
DatItem_MD5.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
DatItem_MD5.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
#if NET_FRAMEWORK
|
#if NET_FRAMEWORK
|
||||||
case Field.DatItem_RIPEMD160:
|
case Field.DatItem_RIPEMD160:
|
||||||
if (negate)
|
if (negate)
|
||||||
@@ -1946,6 +1825,20 @@ namespace SabreTools.Library.Filtering
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
case Field.DatItem_SHA1:
|
||||||
|
if (negate)
|
||||||
|
DatItem_SHA1.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
DatItem_SHA1.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Field.DatItem_SHA256:
|
||||||
|
if (negate)
|
||||||
|
DatItem_SHA256.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
DatItem_SHA256.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
case Field.DatItem_SHA384:
|
case Field.DatItem_SHA384:
|
||||||
if (negate)
|
if (negate)
|
||||||
DatItem_SHA384.NegativeSet.Add(value);
|
DatItem_SHA384.NegativeSet.Add(value);
|
||||||
@@ -1960,6 +1853,20 @@ namespace SabreTools.Library.Filtering
|
|||||||
DatItem_SHA512.PositiveSet.Add(value);
|
DatItem_SHA512.PositiveSet.Add(value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Field.DatItem_Merge:
|
||||||
|
if (negate)
|
||||||
|
DatItem_Merge.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
DatItem_Merge.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Field.DatItem_Region:
|
||||||
|
if (negate)
|
||||||
|
DatItem_Region.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
DatItem_Region.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
case Field.DatItem_Offset:
|
case Field.DatItem_Offset:
|
||||||
if (negate)
|
if (negate)
|
||||||
DatItem_Offset.NegativeSet.Add(value);
|
DatItem_Offset.NegativeSet.Add(value);
|
||||||
@@ -1967,6 +1874,27 @@ namespace SabreTools.Library.Filtering
|
|||||||
DatItem_Offset.PositiveSet.Add(value);
|
DatItem_Offset.PositiveSet.Add(value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Field.DatItem_Date:
|
||||||
|
if (negate)
|
||||||
|
DatItem_Date.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
DatItem_Date.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Field.DatItem_Status:
|
||||||
|
if (negate)
|
||||||
|
DatItem_Status.Negative |= value.AsItemStatus();
|
||||||
|
else
|
||||||
|
DatItem_Status.Positive |= value.AsItemStatus();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Field.DatItem_Optional:
|
||||||
|
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||||
|
DatItem_Optional.Neutral = false;
|
||||||
|
else
|
||||||
|
DatItem_Optional.Neutral = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case Field.DatItem_Inverted:
|
case Field.DatItem_Inverted:
|
||||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||||
DatItem_Inverted.Neutral = false;
|
DatItem_Inverted.Neutral = false;
|
||||||
@@ -1974,8 +1902,74 @@ namespace SabreTools.Library.Filtering
|
|||||||
DatItem_Inverted.Neutral = true;
|
DatItem_Inverted.Neutral = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Disk
|
||||||
|
case Field.DatItem_Index:
|
||||||
|
if (negate)
|
||||||
|
DatItem_Index.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
DatItem_Index.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Field.DatItem_Writable:
|
||||||
|
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||||
|
DatItem_Writable.Neutral = false;
|
||||||
|
else
|
||||||
|
DatItem_Writable.Neutral = true;
|
||||||
|
break;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Auxiliary
|
||||||
|
|
||||||
|
// BiosSet
|
||||||
|
case Field.DatItem_Description:
|
||||||
|
if (negate)
|
||||||
|
DatItem_Description.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
DatItem_Description.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Field.DatItem_Default:
|
||||||
|
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||||
|
DatItem_Default.Neutral = false;
|
||||||
|
else
|
||||||
|
DatItem_Default.Neutral = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Chip
|
||||||
|
case Field.DatItem_Tag:
|
||||||
|
if (negate)
|
||||||
|
DatItem_Tag.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
DatItem_Tag.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Field.DatItem_ChipType:
|
||||||
|
if (negate)
|
||||||
|
DatItem_ChipType.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
DatItem_ChipType.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Field.DatItem_Clock:
|
||||||
|
if (negate)
|
||||||
|
DatItem_Clock.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
DatItem_Clock.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Release
|
||||||
|
case Field.DatItem_Language:
|
||||||
|
if (negate)
|
||||||
|
DatItem_Language.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
DatItem_Language.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion // Item-Specific
|
||||||
|
|
||||||
#endregion // DatItem Filters
|
#endregion // DatItem Filters
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace SabreTools.Library.IO
|
|||||||
public static string GetDepotPath(string hash, int depth)
|
public static string GetDepotPath(string hash, int depth)
|
||||||
{
|
{
|
||||||
// If the hash isn't the right size, then we return null
|
// If the hash isn't the right size, then we return null
|
||||||
if (hash.Length != Constants.SHA1Length) // TODO: When updating to SHA-256, this needs to update to Constants.SHA256Length
|
if (hash.Length != Constants.SHA1Length)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// Cap the depth between 0 and 20, for now
|
// Cap the depth between 0 and 20, for now
|
||||||
|
|||||||
@@ -151,7 +151,6 @@ namespace SabreTools.Library.Tools
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input">String to get value from</param>
|
/// <param name="input">String to get value from</param>
|
||||||
/// <returns>Field value corresponding to the string</returns>
|
/// <returns>Field value corresponding to the string</returns>
|
||||||
/// TODO: Needs to be SEVERELY overhauled. Start using dot notation for fields... (where possible)
|
|
||||||
public static Field AsField(this string input)
|
public static Field AsField(this string input)
|
||||||
{
|
{
|
||||||
// If the input is null, we return null
|
// If the input is null, we return null
|
||||||
@@ -457,14 +456,6 @@ namespace SabreTools.Library.Tools
|
|||||||
case "runnable":
|
case "runnable":
|
||||||
return Field.Machine_Runnable;
|
return Field.Machine_Runnable;
|
||||||
|
|
||||||
case "devreferences":
|
|
||||||
case "devicereferences":
|
|
||||||
return Field.Machine_DeviceReferences;
|
|
||||||
|
|
||||||
case "devreference_name":
|
|
||||||
case "devicereference_name":
|
|
||||||
return Field.Machine_DeviceReference_Name;
|
|
||||||
|
|
||||||
case "displays":
|
case "displays":
|
||||||
return Field.Machine_Displays;
|
return Field.Machine_Displays;
|
||||||
|
|
||||||
@@ -996,27 +987,19 @@ namespace SabreTools.Library.Tools
|
|||||||
|
|
||||||
#region Item-Specific
|
#region Item-Specific
|
||||||
|
|
||||||
// BiosSet
|
#region Actionable
|
||||||
case "default":
|
|
||||||
return Field.DatItem_Default;
|
|
||||||
|
|
||||||
case "description":
|
// Rom
|
||||||
case "biosdescription":
|
case "bios":
|
||||||
case "bios_description":
|
return Field.DatItem_Bios;
|
||||||
return Field.DatItem_Description;
|
|
||||||
|
|
||||||
// Chip
|
case "size":
|
||||||
case "tag":
|
return Field.DatItem_Size;
|
||||||
return Field.DatItem_Tag;
|
|
||||||
|
|
||||||
case "chiptype":
|
case "crc":
|
||||||
case "chip_type":
|
case "crc32":
|
||||||
return Field.DatItem_ChipType;
|
return Field.DatItem_CRC;
|
||||||
|
|
||||||
case "clock":
|
|
||||||
return Field.DatItem_Clock;
|
|
||||||
|
|
||||||
// Disk
|
|
||||||
case "md5":
|
case "md5":
|
||||||
case "md5_hash":
|
case "md5_hash":
|
||||||
return Field.DatItem_MD5;
|
return Field.DatItem_MD5;
|
||||||
@@ -1067,11 +1050,11 @@ namespace SabreTools.Library.Tools
|
|||||||
case "region":
|
case "region":
|
||||||
return Field.DatItem_Region;
|
return Field.DatItem_Region;
|
||||||
|
|
||||||
case "index":
|
case "offset":
|
||||||
return Field.DatItem_Index;
|
return Field.DatItem_Offset;
|
||||||
|
|
||||||
case "writable":
|
case "date":
|
||||||
return Field.DatItem_Writable;
|
return Field.DatItem_Date;
|
||||||
|
|
||||||
case "status":
|
case "status":
|
||||||
return Field.DatItem_Status;
|
return Field.DatItem_Status;
|
||||||
@@ -1079,36 +1062,53 @@ namespace SabreTools.Library.Tools
|
|||||||
case "optional":
|
case "optional":
|
||||||
return Field.DatItem_Optional;
|
return Field.DatItem_Optional;
|
||||||
|
|
||||||
|
case "inverted":
|
||||||
|
return Field.DatItem_Inverted;
|
||||||
|
|
||||||
|
// Disk
|
||||||
|
case "index":
|
||||||
|
return Field.DatItem_Index;
|
||||||
|
|
||||||
|
case "writable":
|
||||||
|
return Field.DatItem_Writable;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Auxiliary
|
||||||
|
|
||||||
|
// BiosSet
|
||||||
|
case "description":
|
||||||
|
case "biosdescription":
|
||||||
|
case "bios_description":
|
||||||
|
return Field.DatItem_Description;
|
||||||
|
|
||||||
|
case "default":
|
||||||
|
return Field.DatItem_Default;
|
||||||
|
|
||||||
|
// Chip
|
||||||
|
case "tag":
|
||||||
|
return Field.DatItem_Tag;
|
||||||
|
|
||||||
|
case "chiptype":
|
||||||
|
case "chip_type":
|
||||||
|
return Field.DatItem_ChipType;
|
||||||
|
|
||||||
|
case "clock":
|
||||||
|
return Field.DatItem_Clock;
|
||||||
|
|
||||||
// Release
|
// Release
|
||||||
case "language":
|
case "language":
|
||||||
return Field.DatItem_Language;
|
return Field.DatItem_Language;
|
||||||
|
|
||||||
case "date":
|
|
||||||
return Field.DatItem_Date;
|
|
||||||
|
|
||||||
// Rom
|
|
||||||
case "bios":
|
|
||||||
return Field.DatItem_Bios;
|
|
||||||
|
|
||||||
case "size":
|
|
||||||
return Field.DatItem_Size;
|
|
||||||
|
|
||||||
case "crc":
|
|
||||||
return Field.DatItem_CRC;
|
|
||||||
|
|
||||||
case "offset":
|
|
||||||
return Field.DatItem_Offset;
|
|
||||||
|
|
||||||
case "inverted":
|
|
||||||
return Field.DatItem_Inverted;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#endregion // Item-Specific
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Else, we fall back on the old matching
|
// Else, we fall back on the old matching
|
||||||
// TODO: Remove this entirely
|
// TODO: Remove this entirely
|
||||||
switch (input)
|
switch (input.Replace(' ', '_').Replace('-', '_').Replace('.', '_'))
|
||||||
{
|
{
|
||||||
#region Machine
|
#region Machine
|
||||||
|
|
||||||
@@ -1218,9 +1218,6 @@ namespace SabreTools.Library.Tools
|
|||||||
case "runnable":
|
case "runnable":
|
||||||
return Field.Machine_Runnable;
|
return Field.Machine_Runnable;
|
||||||
|
|
||||||
case "devices":
|
|
||||||
return Field.Machine_DeviceReference_Name;
|
|
||||||
|
|
||||||
case "slotoptions":
|
case "slotoptions":
|
||||||
case "slot options":
|
case "slot options":
|
||||||
case "slot-options":
|
case "slot-options":
|
||||||
@@ -1415,8 +1412,103 @@ namespace SabreTools.Library.Tools
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Item-Specific
|
||||||
|
|
||||||
|
#region Actionable
|
||||||
|
|
||||||
|
// Rom
|
||||||
case "bios":
|
case "bios":
|
||||||
return Field.DatItem_Bios;
|
return Field.DatItem_Bios;
|
||||||
|
|
||||||
|
case "equal":
|
||||||
|
case "greater":
|
||||||
|
case "less":
|
||||||
|
case "size":
|
||||||
|
return Field.DatItem_Size;
|
||||||
|
|
||||||
|
case "crc":
|
||||||
|
case "crc32":
|
||||||
|
return Field.DatItem_CRC;
|
||||||
|
|
||||||
|
case "md5":
|
||||||
|
case "md5_hash":
|
||||||
|
return Field.DatItem_MD5;
|
||||||
|
|
||||||
|
#if NET_FRAMEWORK
|
||||||
|
case "ripemd160":
|
||||||
|
case "ripemd160_hash":
|
||||||
|
return Field.DatItem_RIPEMD160;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
case "sha1":
|
||||||
|
case "sha_1":
|
||||||
|
case "sha1hash":
|
||||||
|
case "sha1_hash":
|
||||||
|
case "sha_1hash":
|
||||||
|
case "sha_1_hash":
|
||||||
|
return Field.DatItem_SHA1;
|
||||||
|
|
||||||
|
case "sha256":
|
||||||
|
case "sha_256":
|
||||||
|
case "sha256hash":
|
||||||
|
case "sha256_hash":
|
||||||
|
case "sha_256hash":
|
||||||
|
case "sha_256_hash":
|
||||||
|
return Field.DatItem_SHA256;
|
||||||
|
|
||||||
|
case "sha384":
|
||||||
|
case "sha_384":
|
||||||
|
case "sha384hash":
|
||||||
|
case "sha384_hash":
|
||||||
|
case "sha_384hash":
|
||||||
|
case "sha_384_hash":
|
||||||
|
return Field.DatItem_SHA384;
|
||||||
|
|
||||||
|
case "sha512":
|
||||||
|
case "sha_512":
|
||||||
|
case "sha512hash":
|
||||||
|
case "sha512_hash":
|
||||||
|
case "sha_512hash":
|
||||||
|
case "sha_512_hash":
|
||||||
|
return Field.DatItem_SHA512;
|
||||||
|
|
||||||
|
case "merge":
|
||||||
|
case "mergetag":
|
||||||
|
case "merge_tag":
|
||||||
|
return Field.DatItem_Merge;
|
||||||
|
|
||||||
|
case "region":
|
||||||
|
return Field.DatItem_Region;
|
||||||
|
|
||||||
|
case "offset":
|
||||||
|
return Field.DatItem_Offset;
|
||||||
|
|
||||||
|
case "date":
|
||||||
|
return Field.DatItem_Date;
|
||||||
|
|
||||||
|
case "itemtatus":
|
||||||
|
case "item-status":
|
||||||
|
case "status":
|
||||||
|
return Field.DatItem_Status;
|
||||||
|
|
||||||
|
case "optional":
|
||||||
|
return Field.DatItem_Optional;
|
||||||
|
|
||||||
|
case "inverted":
|
||||||
|
return Field.DatItem_Inverted;
|
||||||
|
|
||||||
|
// Disk
|
||||||
|
case "index":
|
||||||
|
return Field.DatItem_Index;
|
||||||
|
|
||||||
|
case "writable":
|
||||||
|
return Field.DatItem_Writable;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Auxiliary
|
||||||
|
|
||||||
|
// BiosSet
|
||||||
case "biosdescription":
|
case "biosdescription":
|
||||||
case "bios-description":
|
case "bios-description":
|
||||||
case "biossetdescription":
|
case "biossetdescription":
|
||||||
@@ -1424,6 +1516,10 @@ namespace SabreTools.Library.Tools
|
|||||||
case "bios-set-description":
|
case "bios-set-description":
|
||||||
return Field.DatItem_Description;
|
return Field.DatItem_Description;
|
||||||
|
|
||||||
|
case "default":
|
||||||
|
return Field.DatItem_Default;
|
||||||
|
|
||||||
|
// Chip
|
||||||
case "tag":
|
case "tag":
|
||||||
return Field.DatItem_Tag;
|
return Field.DatItem_Tag;
|
||||||
|
|
||||||
@@ -1433,59 +1529,14 @@ namespace SabreTools.Library.Tools
|
|||||||
|
|
||||||
case "clock":
|
case "clock":
|
||||||
return Field.DatItem_Clock;
|
return Field.DatItem_Clock;
|
||||||
|
|
||||||
case "crc":
|
// Release
|
||||||
case "crc32":
|
|
||||||
return Field.DatItem_CRC;
|
|
||||||
case "default":
|
|
||||||
return Field.DatItem_Default;
|
|
||||||
case "date":
|
|
||||||
return Field.DatItem_Date;
|
|
||||||
case "equal":
|
|
||||||
case "greater":
|
|
||||||
case "less":
|
|
||||||
case "size":
|
|
||||||
return Field.DatItem_Size;
|
|
||||||
case "index":
|
|
||||||
return Field.DatItem_Index;
|
|
||||||
case "inverted":
|
|
||||||
return Field.DatItem_Inverted;
|
|
||||||
case "itemtatus":
|
|
||||||
case "item-status":
|
|
||||||
case "status":
|
|
||||||
return Field.DatItem_Status;
|
|
||||||
case "language":
|
case "language":
|
||||||
return Field.DatItem_Language;
|
return Field.DatItem_Language;
|
||||||
case "md5":
|
|
||||||
return Field.DatItem_MD5;
|
#endregion
|
||||||
case "merge":
|
|
||||||
case "mergetag":
|
#endregion // Item-Specific
|
||||||
case "merge-tag":
|
|
||||||
return Field.DatItem_Merge;
|
|
||||||
case "offset":
|
|
||||||
return Field.DatItem_Offset;
|
|
||||||
case "optional":
|
|
||||||
return Field.DatItem_Optional;
|
|
||||||
case "region":
|
|
||||||
return Field.DatItem_Region;
|
|
||||||
#if NET_FRAMEWORK
|
|
||||||
case "ripemd160":
|
|
||||||
return Field.DatItem_RIPEMD160;
|
|
||||||
#endif
|
|
||||||
case "sha1":
|
|
||||||
case "sha-1":
|
|
||||||
return Field.DatItem_SHA1;
|
|
||||||
case "sha256":
|
|
||||||
case "sha-256":
|
|
||||||
return Field.DatItem_SHA256;
|
|
||||||
case "sha384":
|
|
||||||
case "sha-384":
|
|
||||||
return Field.DatItem_SHA384;
|
|
||||||
case "sha512":
|
|
||||||
case "sha-512":
|
|
||||||
return Field.DatItem_SHA512;
|
|
||||||
case "writable":
|
|
||||||
return Field.DatItem_Writable;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -1551,6 +1602,8 @@ namespace SabreTools.Library.Tools
|
|||||||
return ItemType.Blank;
|
return ItemType.Blank;
|
||||||
case "chip":
|
case "chip":
|
||||||
return ItemType.Chip;
|
return ItemType.Chip;
|
||||||
|
case "device_ref":
|
||||||
|
return ItemType.DeviceReference;
|
||||||
case "disk":
|
case "disk":
|
||||||
return ItemType.Disk;
|
return ItemType.Disk;
|
||||||
case "media":
|
case "media":
|
||||||
@@ -1571,6 +1624,7 @@ namespace SabreTools.Library.Tools
|
|||||||
"biosset" => ItemType.BiosSet,
|
"biosset" => ItemType.BiosSet,
|
||||||
"blank" => ItemType.Blank,
|
"blank" => ItemType.Blank,
|
||||||
"chip" => ItemType.Chip,
|
"chip" => ItemType.Chip,
|
||||||
|
"device_ref" => ItemType.DeviceReference,
|
||||||
"disk" => ItemType.Disk,
|
"disk" => ItemType.Disk,
|
||||||
"media" => ItemType.Media,
|
"media" => ItemType.Media,
|
||||||
"release" => ItemType.Release,
|
"release" => ItemType.Release,
|
||||||
@@ -1787,6 +1841,35 @@ namespace SabreTools.Library.Tools
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get SoftwareListStatus value from input string
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="status">String to get value from</param>
|
||||||
|
/// <returns>SoftwareListStatus value corresponding to the string</returns>
|
||||||
|
public static SoftwareListStatus AsSoftwareListStatus(this string status)
|
||||||
|
{
|
||||||
|
#if NET_FRAMEWORK
|
||||||
|
switch (status?.ToLowerInvariant())
|
||||||
|
{
|
||||||
|
case "original":
|
||||||
|
return SoftwareListStatus.Original;
|
||||||
|
case "compatible":
|
||||||
|
return SoftwareListStatus.Compatible;
|
||||||
|
case "none":
|
||||||
|
default:
|
||||||
|
return SoftwareListStatus.NULL;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return status?.ToLowerInvariant() switch
|
||||||
|
{
|
||||||
|
"original" => SoftwareListStatus.Original,
|
||||||
|
"compatible" => SoftwareListStatus.Compatible,
|
||||||
|
"none" => SoftwareListStatus.NULL,
|
||||||
|
_ => SoftwareListStatus.NULL,
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get StatReportFormat value from input string
|
/// Get StatReportFormat value from input string
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1946,6 +2029,8 @@ namespace SabreTools.Library.Tools
|
|||||||
return "blank";
|
return "blank";
|
||||||
case ItemType.Chip:
|
case ItemType.Chip:
|
||||||
return "chip";
|
return "chip";
|
||||||
|
case ItemType.DeviceReference:
|
||||||
|
return "device_ref";
|
||||||
case ItemType.Disk:
|
case ItemType.Disk:
|
||||||
return "disk";
|
return "disk";
|
||||||
case ItemType.Media:
|
case ItemType.Media:
|
||||||
@@ -1966,6 +2051,7 @@ namespace SabreTools.Library.Tools
|
|||||||
ItemType.BiosSet => "biosset",
|
ItemType.BiosSet => "biosset",
|
||||||
ItemType.Blank => "blank",
|
ItemType.Blank => "blank",
|
||||||
ItemType.Chip => "chip",
|
ItemType.Chip => "chip",
|
||||||
|
ItemType.DeviceReference => "device_ref",
|
||||||
ItemType.Disk => "disk",
|
ItemType.Disk => "disk",
|
||||||
ItemType.Media => "media",
|
ItemType.Media => "media",
|
||||||
ItemType.Release => "release",
|
ItemType.Release => "release",
|
||||||
@@ -2219,6 +2305,33 @@ namespace SabreTools.Library.Tools
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get string value from input SoftwareListStatus
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="status">SoftwareListStatus to get value from</param>
|
||||||
|
/// <returns>String value corresponding to the SoftwareListStatus</returns>
|
||||||
|
public static string FromSoftwareListStatus(this SoftwareListStatus status)
|
||||||
|
{
|
||||||
|
#if NET_FRAMEWORK
|
||||||
|
switch (status)
|
||||||
|
{
|
||||||
|
case SoftwareListStatus.Original:
|
||||||
|
return "original";
|
||||||
|
case SoftwareListStatus.Compatible:
|
||||||
|
return "compatible";
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return status switch
|
||||||
|
{
|
||||||
|
SoftwareListStatus.Original => "original",
|
||||||
|
SoftwareListStatus.Compatible => "compatible",
|
||||||
|
_ => null,
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get string value from input StatReportFormat
|
/// Get string value from input StatReportFormat
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user