mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Promote Adjuster, RamOption
This commit is contained in:
@@ -616,12 +616,6 @@ namespace SabreTools.Library.DatFiles
|
||||
cmpw.WriteEndElement();
|
||||
break;
|
||||
|
||||
case ItemType.DeviceReference:
|
||||
cmpw.WriteStartElement("device_ref");
|
||||
cmpw.WriteRequiredAttributeString("name", datItem.Name);
|
||||
cmpw.WriteEndElement();
|
||||
break;
|
||||
|
||||
case ItemType.Disk:
|
||||
var disk = datItem as Disk;
|
||||
cmpw.WriteStartElement("disk");
|
||||
|
||||
@@ -77,6 +77,12 @@ namespace SabreTools.Library.DatFiles
|
||||
[JsonIgnore]
|
||||
public long TotalCount { get; private set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Number of Adjuster items
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public long AdjusterCount { get; private set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Number of Archive items
|
||||
/// </summary>
|
||||
@@ -113,6 +119,12 @@ namespace SabreTools.Library.DatFiles
|
||||
[JsonIgnore]
|
||||
public long MediaCount { get; private set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Number of RamOption items
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public long RamOptionCount { get; private set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Number of Release items
|
||||
/// </summary>
|
||||
@@ -464,6 +476,9 @@ namespace SabreTools.Library.DatFiles
|
||||
// Now we do different things for each item type
|
||||
switch (item.ItemType)
|
||||
{
|
||||
case ItemType.Adjuster:
|
||||
AdjusterCount++;
|
||||
break;
|
||||
case ItemType.Archive:
|
||||
ArchiveCount++;
|
||||
break;
|
||||
@@ -495,6 +510,9 @@ namespace SabreTools.Library.DatFiles
|
||||
SHA1Count += (string.IsNullOrWhiteSpace((item as Media).SHA1) ? 0 : 1);
|
||||
SHA256Count += (string.IsNullOrWhiteSpace((item as Media).SHA256) ? 0 : 1);
|
||||
break;
|
||||
case ItemType.RamOption:
|
||||
RamOptionCount++;
|
||||
break;
|
||||
case ItemType.Release:
|
||||
ReleaseCount++;
|
||||
break;
|
||||
@@ -599,6 +617,9 @@ namespace SabreTools.Library.DatFiles
|
||||
// Now we do different things for each item type
|
||||
switch (item.ItemType)
|
||||
{
|
||||
case ItemType.Adjuster:
|
||||
AdjusterCount--;
|
||||
break;
|
||||
case ItemType.Archive:
|
||||
ArchiveCount--;
|
||||
break;
|
||||
@@ -630,6 +651,9 @@ namespace SabreTools.Library.DatFiles
|
||||
SHA1Count -= (string.IsNullOrWhiteSpace((item as Media).SHA1) ? 0 : 1);
|
||||
SHA256Count -= (string.IsNullOrWhiteSpace((item as Media).SHA256) ? 0 : 1);
|
||||
break;
|
||||
case ItemType.RamOption:
|
||||
RamOptionCount--;
|
||||
break;
|
||||
case ItemType.Release:
|
||||
ReleaseCount--;
|
||||
break;
|
||||
|
||||
@@ -208,6 +208,9 @@ namespace SabreTools.Library.DatFiles
|
||||
JToken datItemObj = itemObj["datitem"];
|
||||
switch (datItemObj.Value<string>("type").AsItemType())
|
||||
{
|
||||
case ItemType.Adjuster:
|
||||
datItem = datItemObj.ToObject<Adjuster>();
|
||||
break;
|
||||
case ItemType.Archive:
|
||||
datItem = datItemObj.ToObject<Archive>();
|
||||
break;
|
||||
@@ -229,6 +232,9 @@ namespace SabreTools.Library.DatFiles
|
||||
case ItemType.Media:
|
||||
datItem = datItemObj.ToObject<Media>();
|
||||
break;
|
||||
case ItemType.RamOption:
|
||||
datItem = datItemObj.ToObject<RamOption>();
|
||||
break;
|
||||
case ItemType.Release:
|
||||
datItem = datItemObj.ToObject<Release>();
|
||||
break;
|
||||
|
||||
@@ -166,6 +166,23 @@ namespace SabreTools.Library.DatFiles
|
||||
machine.Manufacturer = reader.ReadElementContentAsString();
|
||||
break;
|
||||
|
||||
case "adjuster":
|
||||
var adjuster = new Adjuster
|
||||
{
|
||||
Name = reader.GetAttribute("name"),
|
||||
Default = reader.GetAttribute("default").AsYesNo(),
|
||||
Conditions = new List<ListXmlCondition>(),
|
||||
};
|
||||
|
||||
// Now read the internal tags
|
||||
ReadAdjuster(reader.ReadSubtree(), adjuster);
|
||||
|
||||
datItems.Add(adjuster);
|
||||
|
||||
// Skip the adjuster now that we've processed it
|
||||
reader.Skip();
|
||||
break;
|
||||
|
||||
case "biosset":
|
||||
datItems.Add(new BiosSet
|
||||
{
|
||||
@@ -183,84 +200,6 @@ namespace SabreTools.Library.DatFiles
|
||||
reader.Read();
|
||||
break;
|
||||
|
||||
case "rom":
|
||||
datItems.Add(new Rom
|
||||
{
|
||||
Name = reader.GetAttribute("name"),
|
||||
Bios = reader.GetAttribute("bios"),
|
||||
Size = Sanitizer.CleanSize(reader.GetAttribute("size")),
|
||||
CRC = reader.GetAttribute("crc"),
|
||||
MD5 = reader.GetAttribute("md5"),
|
||||
#if NET_FRAMEWORK
|
||||
RIPEMD160 = reader.GetAttribute("ripemd160"),
|
||||
#endif
|
||||
SHA1 = reader.GetAttribute("sha1"),
|
||||
SHA256 = reader.GetAttribute("sha256"),
|
||||
SHA384 = reader.GetAttribute("sha384"),
|
||||
SHA512 = reader.GetAttribute("sha512"),
|
||||
MergeTag = reader.GetAttribute("merge"),
|
||||
Region = reader.GetAttribute("region"),
|
||||
Offset = reader.GetAttribute("offset"),
|
||||
ItemStatus = reader.GetAttribute("status").AsItemStatus(),
|
||||
Optional = reader.GetAttribute("optional").AsYesNo(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
});
|
||||
|
||||
reader.Read();
|
||||
break;
|
||||
|
||||
case "disk":
|
||||
datItems.Add(new Disk
|
||||
{
|
||||
Name = reader.GetAttribute("name"),
|
||||
MD5 = reader.GetAttribute("md5"),
|
||||
SHA1 = reader.GetAttribute("sha1"),
|
||||
MergeTag = reader.GetAttribute("merge"),
|
||||
Region = reader.GetAttribute("region"),
|
||||
Index = reader.GetAttribute("index"),
|
||||
Writable = reader.GetAttribute("writable").AsYesNo(),
|
||||
ItemStatus = reader.GetAttribute("status").AsItemStatus(),
|
||||
Optional = reader.GetAttribute("optional").AsYesNo(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
});
|
||||
|
||||
reader.Read();
|
||||
break;
|
||||
|
||||
case "device_ref":
|
||||
datItems.Add(new DeviceReference
|
||||
{
|
||||
Name = reader.GetAttribute("name"),
|
||||
});
|
||||
|
||||
reader.Read();
|
||||
break;
|
||||
|
||||
case "sample":
|
||||
datItems.Add(new Sample
|
||||
{
|
||||
Name = reader.GetAttribute("name"),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
});
|
||||
|
||||
reader.Read();
|
||||
break;
|
||||
|
||||
case "chip":
|
||||
datItems.Add(new Chip
|
||||
{
|
||||
@@ -279,6 +218,104 @@ namespace SabreTools.Library.DatFiles
|
||||
reader.Read();
|
||||
break;
|
||||
|
||||
case "device_ref":
|
||||
datItems.Add(new DeviceReference
|
||||
{
|
||||
Name = reader.GetAttribute("name"),
|
||||
});
|
||||
|
||||
reader.Read();
|
||||
break;
|
||||
|
||||
case "disk":
|
||||
datItems.Add(new Disk
|
||||
{
|
||||
Name = reader.GetAttribute("name"),
|
||||
SHA1 = reader.GetAttribute("sha1"),
|
||||
MergeTag = reader.GetAttribute("merge"),
|
||||
Region = reader.GetAttribute("region"),
|
||||
Index = reader.GetAttribute("index"),
|
||||
Writable = reader.GetAttribute("writable").AsYesNo(),
|
||||
ItemStatus = reader.GetAttribute("status").AsItemStatus(),
|
||||
Optional = reader.GetAttribute("optional").AsYesNo(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
});
|
||||
|
||||
reader.Read();
|
||||
break;
|
||||
|
||||
case "rom":
|
||||
datItems.Add(new Rom
|
||||
{
|
||||
Name = reader.GetAttribute("name"),
|
||||
Bios = reader.GetAttribute("bios"),
|
||||
Size = Sanitizer.CleanSize(reader.GetAttribute("size")),
|
||||
CRC = reader.GetAttribute("crc"),
|
||||
SHA1 = reader.GetAttribute("sha1"),
|
||||
MergeTag = reader.GetAttribute("merge"),
|
||||
Region = reader.GetAttribute("region"),
|
||||
Offset = reader.GetAttribute("offset"),
|
||||
ItemStatus = reader.GetAttribute("status").AsItemStatus(),
|
||||
Optional = reader.GetAttribute("optional").AsYesNo(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
});
|
||||
|
||||
reader.Read();
|
||||
break;
|
||||
|
||||
case "ramoption":
|
||||
datItems.Add(new RamOption
|
||||
{
|
||||
Name = reader.GetAttribute("name"),
|
||||
Default = reader.GetAttribute("default").AsYesNo(),
|
||||
Content = reader.ReadElementContentAsString(),
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case "sample":
|
||||
datItems.Add(new Sample
|
||||
{
|
||||
Name = reader.GetAttribute("name"),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
});
|
||||
|
||||
reader.Read();
|
||||
break;
|
||||
|
||||
case "softwarelist":
|
||||
datItems.Add(new DatItems.SoftwareList
|
||||
{
|
||||
Name = reader.GetAttribute("name"),
|
||||
Status = reader.GetAttribute("status").AsSoftwareListStatus(),
|
||||
Filter = reader.GetAttribute("filter"),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
});
|
||||
|
||||
reader.Read();
|
||||
|
||||
break;
|
||||
|
||||
case "display":
|
||||
var display = new ListXmlDisplay();
|
||||
display.Tag = reader.GetAttribute("tag");
|
||||
@@ -409,24 +446,6 @@ namespace SabreTools.Library.DatFiles
|
||||
reader.Skip();
|
||||
break;
|
||||
|
||||
case "adjuster":
|
||||
var adjuster = new ListXmlAdjuster();
|
||||
adjuster.Name = reader.GetAttribute("name");
|
||||
adjuster.Default = reader.GetAttribute("default").AsYesNo();
|
||||
|
||||
// Now read the internal tags
|
||||
ReadAdjuster(reader.ReadSubtree(), adjuster);
|
||||
|
||||
// Ensure the list exists
|
||||
if (machine.Adjusters == null)
|
||||
machine.Adjusters = new List<ListXmlAdjuster>();
|
||||
|
||||
machine.Adjusters.Add(adjuster);
|
||||
|
||||
// Skip the adjuster now that we've processed it
|
||||
reader.Skip();
|
||||
break;
|
||||
|
||||
case "driver":
|
||||
var driver = new ListXmlDriver();
|
||||
driver.Status = reader.GetAttribute("status");
|
||||
@@ -496,37 +515,6 @@ namespace SabreTools.Library.DatFiles
|
||||
reader.Skip();
|
||||
break;
|
||||
|
||||
case "softwarelist":
|
||||
datItems.Add(new DatItems.SoftwareList
|
||||
{
|
||||
Name = reader.GetAttribute("name"),
|
||||
Status = reader.GetAttribute("status").AsSoftwareListStatus(),
|
||||
Filter = reader.GetAttribute("filter"),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
});
|
||||
|
||||
reader.Read();
|
||||
|
||||
break;
|
||||
|
||||
case "ramoption":
|
||||
var ramOption = new ListXmlRamOption();
|
||||
ramOption.Default = reader.GetAttribute("default").AsYesNo();
|
||||
|
||||
// Ensure the list exists
|
||||
if (machine.RamOptions == null)
|
||||
machine.RamOptions = new List<ListXmlRamOption>();
|
||||
|
||||
machine.RamOptions.Add(ramOption);
|
||||
|
||||
reader.Read();
|
||||
break;
|
||||
|
||||
default:
|
||||
reader.Read();
|
||||
break;
|
||||
@@ -677,6 +665,7 @@ namespace SabreTools.Library.DatFiles
|
||||
return;
|
||||
|
||||
// Get lists ready
|
||||
dipSwitch.Conditions = new List<ListXmlCondition>();
|
||||
dipSwitch.Locations = new List<ListXmlDipLocation>();
|
||||
dipSwitch.Values = new List<ListXmlDipValue>();
|
||||
|
||||
@@ -695,6 +684,18 @@ namespace SabreTools.Library.DatFiles
|
||||
// Get the information from the dipswitch
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "condition":
|
||||
var condition = new ListXmlCondition();
|
||||
condition.Tag = reader.GetAttribute("tag");
|
||||
condition.Mask = reader.GetAttribute("mask");
|
||||
condition.Relation = reader.GetAttribute("relation");
|
||||
condition.Value = reader.GetAttribute("value");
|
||||
|
||||
dipSwitch.Conditions.Add(condition);
|
||||
|
||||
reader.Read();
|
||||
break;
|
||||
|
||||
case "diplocation":
|
||||
var dipLocation = new ListXmlDipLocation();
|
||||
dipLocation.Name = reader.GetAttribute("name");
|
||||
@@ -712,8 +713,60 @@ namespace SabreTools.Library.DatFiles
|
||||
dipValue.Value = reader.GetAttribute("value");
|
||||
dipValue.Default = reader.GetAttribute("default").AsYesNo();
|
||||
|
||||
// Now read the internal tags
|
||||
ReadDipValue(reader, dipValue);
|
||||
|
||||
dipSwitch.Values.Add(dipValue);
|
||||
|
||||
// Skip the dipvalue now that we've processed it
|
||||
reader.Read();
|
||||
break;
|
||||
|
||||
default:
|
||||
reader.Read();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read DipValue information
|
||||
/// </summary>
|
||||
/// <param name="reader">XmlReader representing a diskarea block</param>
|
||||
/// <param name="dipValue">ListXmlDipValue to populate</param>
|
||||
private void ReadDipValue(XmlReader reader, ListXmlDipValue dipValue)
|
||||
{
|
||||
// If we have an empty dipvalue, skip it
|
||||
if (reader == null)
|
||||
return;
|
||||
|
||||
// Get list ready
|
||||
dipValue.Conditions = new List<ListXmlCondition>();
|
||||
|
||||
// Otherwise, add what is possible
|
||||
reader.MoveToContent();
|
||||
|
||||
while (!reader.EOF)
|
||||
{
|
||||
// We only want elements
|
||||
if (reader.NodeType != XmlNodeType.Element)
|
||||
{
|
||||
reader.Read();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get the information from the dipvalue
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "condition":
|
||||
var condition = new ListXmlCondition();
|
||||
condition.Tag = reader.GetAttribute("tag");
|
||||
condition.Mask = reader.GetAttribute("mask");
|
||||
condition.Relation = reader.GetAttribute("relation");
|
||||
condition.Value = reader.GetAttribute("value");
|
||||
|
||||
dipValue.Conditions.Add(condition);
|
||||
|
||||
reader.Read();
|
||||
break;
|
||||
|
||||
@@ -736,6 +789,7 @@ namespace SabreTools.Library.DatFiles
|
||||
return;
|
||||
|
||||
// Get lists ready
|
||||
configuration.Conditions = new List<ListXmlCondition>();
|
||||
configuration.Locations = new List<ListXmlConfLocation>();
|
||||
configuration.Settings = new List<ListXmlConfSetting>();
|
||||
|
||||
@@ -754,6 +808,18 @@ namespace SabreTools.Library.DatFiles
|
||||
// Get the information from the dipswitch
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "condition":
|
||||
var condition = new ListXmlCondition();
|
||||
condition.Tag = reader.GetAttribute("tag");
|
||||
condition.Mask = reader.GetAttribute("mask");
|
||||
condition.Relation = reader.GetAttribute("relation");
|
||||
condition.Value = reader.GetAttribute("value");
|
||||
|
||||
configuration.Conditions.Add(condition);
|
||||
|
||||
reader.Read();
|
||||
break;
|
||||
|
||||
case "conflocation":
|
||||
var confLocation = new ListXmlConfLocation();
|
||||
confLocation.Name = reader.GetAttribute("name");
|
||||
@@ -771,8 +837,60 @@ namespace SabreTools.Library.DatFiles
|
||||
confSetting.Value = reader.GetAttribute("value");
|
||||
confSetting.Default = reader.GetAttribute("default").AsYesNo();
|
||||
|
||||
// Now read the internal tags
|
||||
ReadConfSetting(reader, confSetting);
|
||||
|
||||
configuration.Settings.Add(confSetting);
|
||||
|
||||
// Skip the dipvalue now that we've processed it
|
||||
reader.Read();
|
||||
break;
|
||||
|
||||
default:
|
||||
reader.Read();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read ConfSetting information
|
||||
/// </summary>
|
||||
/// <param name="reader">XmlReader representing a diskarea block</param>
|
||||
/// <param name="confSetting">ListXmlConfSetting to populate</param>
|
||||
private void ReadConfSetting(XmlReader reader, ListXmlConfSetting confSetting)
|
||||
{
|
||||
// If we have an empty confsetting, skip it
|
||||
if (reader == null)
|
||||
return;
|
||||
|
||||
// Get list ready
|
||||
confSetting.Conditions = new List<ListXmlCondition>();
|
||||
|
||||
// Otherwise, add what is possible
|
||||
reader.MoveToContent();
|
||||
|
||||
while (!reader.EOF)
|
||||
{
|
||||
// We only want elements
|
||||
if (reader.NodeType != XmlNodeType.Element)
|
||||
{
|
||||
reader.Read();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get the information from the confsetting
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "condition":
|
||||
var condition = new ListXmlCondition();
|
||||
condition.Tag = reader.GetAttribute("tag");
|
||||
condition.Mask = reader.GetAttribute("mask");
|
||||
condition.Relation = reader.GetAttribute("relation");
|
||||
condition.Value = reader.GetAttribute("value");
|
||||
|
||||
confSetting.Conditions.Add(condition);
|
||||
|
||||
reader.Read();
|
||||
break;
|
||||
|
||||
@@ -832,8 +950,8 @@ namespace SabreTools.Library.DatFiles
|
||||
/// Read Adjuster information
|
||||
/// </summary>
|
||||
/// <param name="reader">XmlReader representing a diskarea block</param>
|
||||
/// <param name="adjuster">ListXmlAdjuster to populate</param>
|
||||
private void ReadAdjuster(XmlReader reader, ListXmlAdjuster adjuster)
|
||||
/// <param name="adjuster">Adjuster to populate</param>
|
||||
private void ReadAdjuster(XmlReader reader, Adjuster adjuster)
|
||||
{
|
||||
// If we have an empty port, skip it
|
||||
if (reader == null)
|
||||
@@ -979,7 +1097,7 @@ namespace SabreTools.Library.DatFiles
|
||||
|
||||
// If we have a different game and we're not at the start of the list, output the end of last item
|
||||
if (lastgame != null && lastgame.ToLowerInvariant() != datItem.Machine.Name.ToLowerInvariant())
|
||||
WriteEndGame(xtw, datItem);
|
||||
WriteEndGame(xtw);
|
||||
|
||||
// If we have a new game, output the beginning of the new item
|
||||
if (lastgame == null || lastgame.ToLowerInvariant() != datItem.Machine.Name.ToLowerInvariant())
|
||||
@@ -1180,6 +1298,21 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteOptionalAttributeString("tag", dipSwitch.Tag);
|
||||
xtw.WriteOptionalAttributeString("mask", dipSwitch.Mask);
|
||||
|
||||
if (dipSwitch.Conditions != null)
|
||||
{
|
||||
foreach (var condition in dipSwitch.Conditions)
|
||||
{
|
||||
xtw.WriteStartElement("condition");
|
||||
|
||||
xtw.WriteOptionalAttributeString("tag", condition.Tag);
|
||||
xtw.WriteOptionalAttributeString("mask", condition.Mask);
|
||||
xtw.WriteOptionalAttributeString("relation", condition.Relation);
|
||||
xtw.WriteOptionalAttributeString("value", condition.Value);
|
||||
|
||||
// End condition
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
if (dipSwitch.Locations != null)
|
||||
{
|
||||
foreach (var location in dipSwitch.Locations)
|
||||
@@ -1204,6 +1337,22 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteOptionalAttributeString("value", value.Value);
|
||||
xtw.WriteOptionalAttributeString("default", value.Default.FromYesNo());
|
||||
|
||||
if (value.Conditions != null)
|
||||
{
|
||||
foreach (var condition in value.Conditions)
|
||||
{
|
||||
xtw.WriteStartElement("condition");
|
||||
|
||||
xtw.WriteOptionalAttributeString("tag", condition.Tag);
|
||||
xtw.WriteOptionalAttributeString("mask", condition.Mask);
|
||||
xtw.WriteOptionalAttributeString("relation", condition.Relation);
|
||||
xtw.WriteOptionalAttributeString("value", condition.Value);
|
||||
|
||||
// End condition
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
|
||||
// End dipvalue
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
@@ -1223,6 +1372,21 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteOptionalAttributeString("tag", configuration.Tag);
|
||||
xtw.WriteOptionalAttributeString("mask", configuration.Mask);
|
||||
|
||||
if (configuration.Conditions != null)
|
||||
{
|
||||
foreach (var condition in configuration.Conditions)
|
||||
{
|
||||
xtw.WriteStartElement("condition");
|
||||
|
||||
xtw.WriteOptionalAttributeString("tag", condition.Tag);
|
||||
xtw.WriteOptionalAttributeString("mask", condition.Mask);
|
||||
xtw.WriteOptionalAttributeString("relation", condition.Relation);
|
||||
xtw.WriteOptionalAttributeString("value", condition.Value);
|
||||
|
||||
// End condition
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
if (configuration.Locations != null)
|
||||
{
|
||||
foreach (var location in configuration.Locations)
|
||||
@@ -1281,35 +1445,6 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
if (datItem.Machine.Adjusters != null)
|
||||
{
|
||||
foreach (var adjuster in datItem.Machine.Adjusters)
|
||||
{
|
||||
xtw.WriteStartElement("adjuster");
|
||||
|
||||
xtw.WriteOptionalAttributeString("name", adjuster.Name);
|
||||
xtw.WriteOptionalAttributeString("default", adjuster.Default.FromYesNo());
|
||||
|
||||
if (adjuster.Conditions != null)
|
||||
{
|
||||
foreach (var condition in adjuster.Conditions)
|
||||
{
|
||||
xtw.WriteStartElement("condition");
|
||||
|
||||
xtw.WriteOptionalAttributeString("tag", condition.Tag);
|
||||
xtw.WriteOptionalAttributeString("mask", condition.Mask);
|
||||
xtw.WriteOptionalAttributeString("relation", condition.Relation);
|
||||
xtw.WriteOptionalAttributeString("value", condition.Value);
|
||||
|
||||
// End condition
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
|
||||
// End adjuster
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
if (datItem.Machine.Drivers != null)
|
||||
{
|
||||
foreach (var driver in datItem.Machine.Drivers)
|
||||
@@ -1408,18 +1543,6 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
if (datItem.Machine.RamOptions != null)
|
||||
{
|
||||
foreach (var ramOption in datItem.Machine.RamOptions)
|
||||
{
|
||||
xtw.WriteStartElement("ramoption");
|
||||
|
||||
xtw.WriteOptionalAttributeString("default", ramOption.Default.FromYesNo());
|
||||
|
||||
// End softwarelist
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
|
||||
xtw.Flush();
|
||||
}
|
||||
@@ -1436,9 +1559,8 @@ namespace SabreTools.Library.DatFiles
|
||||
/// Write out Game start using the supplied StreamWriter
|
||||
/// </summary>
|
||||
/// <param name="xtw">XmlTextWriter to output to</param>
|
||||
/// <param name="datItem">DatItem object to be output</param>
|
||||
/// <returns>True if the data was written, false on error</returns>
|
||||
private bool WriteEndGame(XmlTextWriter xtw, DatItem datItem)
|
||||
private bool WriteEndGame(XmlTextWriter xtw)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1472,6 +1594,26 @@ namespace SabreTools.Library.DatFiles
|
||||
// Build the state
|
||||
switch (datItem.ItemType)
|
||||
{
|
||||
case ItemType.Adjuster:
|
||||
var adjuster = datItem as Adjuster;
|
||||
xtw.WriteStartElement("adjuster");
|
||||
xtw.WriteRequiredAttributeString("name", datItem.Name);
|
||||
xtw.WriteOptionalAttributeString("default", adjuster.Default.FromYesNo());
|
||||
if (adjuster.Conditions != null)
|
||||
{
|
||||
foreach (var condition in adjuster.Conditions)
|
||||
{
|
||||
xtw.WriteStartElement("condition");
|
||||
xtw.WriteOptionalAttributeString("tag", condition.Tag);
|
||||
xtw.WriteOptionalAttributeString("mask", condition.Mask);
|
||||
xtw.WriteOptionalAttributeString("relation", condition.Relation);
|
||||
xtw.WriteOptionalAttributeString("value", condition.Value);
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
|
||||
case ItemType.BiosSet:
|
||||
var biosSet = datItem as BiosSet;
|
||||
xtw.WriteStartElement("biosset");
|
||||
@@ -1501,7 +1643,6 @@ namespace SabreTools.Library.DatFiles
|
||||
var disk = datItem as Disk;
|
||||
xtw.WriteStartElement("disk");
|
||||
xtw.WriteRequiredAttributeString("name", disk.Name);
|
||||
xtw.WriteOptionalAttributeString("md5", disk.MD5?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha1", disk.SHA1?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("merge", disk.MergeTag);
|
||||
xtw.WriteOptionalAttributeString("region", disk.Region);
|
||||
@@ -1512,20 +1653,22 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
|
||||
case ItemType.RamOption:
|
||||
var ramOption = datItem as RamOption;
|
||||
xtw.WriteStartElement("ramoption");
|
||||
xtw.WriteRequiredAttributeString("name", ramOption.Name);
|
||||
xtw.WriteOptionalAttributeString("default", ramOption.Default.FromYesNo());
|
||||
xtw.WriteRaw(ramOption.Content ?? string.Empty);
|
||||
xtw.WriteFullEndElement();
|
||||
break;
|
||||
|
||||
case ItemType.Rom:
|
||||
var rom = datItem as Rom;
|
||||
xtw.WriteStartElement("rom");
|
||||
xtw.WriteRequiredAttributeString("name", rom.Name);
|
||||
if (rom.Size != -1) xtw.WriteAttributeString("size", rom.Size.ToString());
|
||||
xtw.WriteOptionalAttributeString("crc", rom.CRC?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("md5", rom.MD5?.ToLowerInvariant());
|
||||
#if NET_FRAMEWORK
|
||||
xtw.WriteOptionalAttributeString("ripemd160", rom?.RIPEMD160?.ToLowerInvariant());
|
||||
#endif
|
||||
xtw.WriteOptionalAttributeString("sha1", rom.SHA1?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha256", rom.SHA256?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha384", rom.SHA384?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha512", rom.SHA512?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("bios", rom.Bios);
|
||||
xtw.WriteOptionalAttributeString("merge", rom.MergeTag);
|
||||
xtw.WriteOptionalAttributeString("region", rom.Region);
|
||||
@@ -1546,7 +1689,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteStartElement("softwarelist");
|
||||
xtw.WriteRequiredAttributeString("name", datItem.Name);
|
||||
xtw.WriteOptionalAttributeString("status", softwareList.Status.FromSoftwareListStatus());
|
||||
xtw.WriteOptionalAttributeString("sha512", softwareList.Filter);
|
||||
xtw.WriteOptionalAttributeString("filter", softwareList.Filter);
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -953,12 +953,6 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
|
||||
case ItemType.DeviceReference:
|
||||
xtw.WriteStartElement("device_ref");
|
||||
xtw.WriteRequiredAttributeString("name", datItem.Name);
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
|
||||
case ItemType.Disk:
|
||||
var disk = datItem as Disk;
|
||||
xtw.WriteStartElement("disk");
|
||||
|
||||
@@ -839,6 +839,27 @@ namespace SabreTools.Library.DatFiles
|
||||
// Build the state
|
||||
switch (datItem.ItemType)
|
||||
{
|
||||
case ItemType.Adjuster:
|
||||
var adjuster = datItem as Adjuster;
|
||||
xtw.WriteStartElement("file");
|
||||
xtw.WriteAttributeString("type", "adjuster");
|
||||
xtw.WriteRequiredAttributeString("name", datItem.Name);
|
||||
xtw.WriteOptionalAttributeString("default", adjuster.Default.FromYesNo());
|
||||
if (adjuster.Conditions != null)
|
||||
{
|
||||
foreach (var condition in adjuster.Conditions)
|
||||
{
|
||||
xtw.WriteStartElement("condition");
|
||||
xtw.WriteOptionalAttributeString("tag", condition.Tag);
|
||||
xtw.WriteOptionalAttributeString("mask", condition.Mask);
|
||||
xtw.WriteOptionalAttributeString("relation", condition.Relation);
|
||||
xtw.WriteOptionalAttributeString("value", condition.Value);
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
|
||||
case ItemType.Archive:
|
||||
xtw.WriteStartElement("file");
|
||||
xtw.WriteAttributeString("type", "archive");
|
||||
@@ -907,6 +928,16 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
|
||||
case ItemType.RamOption:
|
||||
var ramOption = datItem as RamOption;
|
||||
xtw.WriteStartElement("file");
|
||||
xtw.WriteAttributeString("type", "ramoption");
|
||||
xtw.WriteRequiredAttributeString("name", ramOption.Name);
|
||||
xtw.WriteOptionalAttributeString("default", ramOption.Default.FromYesNo());
|
||||
xtw.WriteRaw(ramOption.Content ?? string.Empty);
|
||||
xtw.WriteFullEndElement();
|
||||
break;
|
||||
|
||||
case ItemType.Release:
|
||||
var release = datItem as Release;
|
||||
xtw.WriteStartElement("file");
|
||||
|
||||
195
SabreTools.Library/DatItems/Adjuster.cs
Normal file
195
SabreTools.Library/DatItems/Adjuster.cs
Normal file
@@ -0,0 +1,195 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using SabreTools.Library.Filtering;
|
||||
using SabreTools.Library.Tools;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SabreTools.Library.DatItems
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents which Adjuster(s) is associated with a set
|
||||
/// </summary>
|
||||
[JsonObject("adjuster")]
|
||||
public class Adjuster : DatItem
|
||||
{
|
||||
#region Fields
|
||||
|
||||
/// <summary>
|
||||
/// Determine whether the value is default
|
||||
/// </summary>
|
||||
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public bool? Default { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Conditions associated with the adjustment
|
||||
/// </summary>
|
||||
[JsonProperty("conditions")]
|
||||
public List<ListXmlCondition> Conditions { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Accessors
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="mappings">Mappings dictionary</param>
|
||||
public override void SetFields(Dictionary<Field, string> mappings)
|
||||
{
|
||||
// Set base fields
|
||||
base.SetFields(mappings);
|
||||
|
||||
// Handle Adjuster-specific fields
|
||||
if (mappings.Keys.Contains(Field.DatItem_Default))
|
||||
Default = mappings[Field.DatItem_Default].AsYesNo();
|
||||
|
||||
// TODO: Handle DatItem_Condition*
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Create a default, empty Adjuster object
|
||||
/// </summary>
|
||||
public Adjuster()
|
||||
{
|
||||
Name = string.Empty;
|
||||
ItemType = ItemType.Adjuster;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Cloning Methods
|
||||
|
||||
public override object Clone()
|
||||
{
|
||||
return new Adjuster()
|
||||
{
|
||||
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,
|
||||
|
||||
Default = this.Default,
|
||||
Conditions = this.Conditions,
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Comparision Methods
|
||||
|
||||
public override bool Equals(DatItem other)
|
||||
{
|
||||
// If we don't have a BiosSet, return false
|
||||
if (ItemType != other.ItemType)
|
||||
return false;
|
||||
|
||||
// Otherwise, treat it as a Adjuster
|
||||
Adjuster newOther = other as Adjuster;
|
||||
|
||||
// If the Adjuster information matches
|
||||
return (Name == newOther.Name && Default == newOther.Default); // TODO: Handle DatItem_Condition*
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#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 override bool PassesFilter(Filter filter)
|
||||
{
|
||||
// Check common fields first
|
||||
if (!base.PassesFilter(filter))
|
||||
return false;
|
||||
|
||||
// Filter on default
|
||||
if (filter.DatItem_Default.MatchesNeutral(null, Default) == false)
|
||||
return false;
|
||||
|
||||
// TODO: Handle DatItem_Condition*
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove fields from the DatItem
|
||||
/// </summary>
|
||||
/// <param name="fields">List of Fields to remove</param>
|
||||
public override void RemoveFields(List<Field> fields)
|
||||
{
|
||||
// Remove common fields first
|
||||
base.RemoveFields(fields);
|
||||
|
||||
// Remove the fields
|
||||
if (fields.Contains(Field.DatItem_Default))
|
||||
Default = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Conditions))
|
||||
Conditions = null;
|
||||
|
||||
// TODO: Handle DatItem_Condition*
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sorting and Merging
|
||||
|
||||
/// <summary>
|
||||
/// Replace fields from another item
|
||||
/// </summary>
|
||||
/// <param name="item">DatItem to pull new information from</param>
|
||||
/// <param name="fields">List of Fields representing what should be updated</param>
|
||||
public override void ReplaceFields(DatItem item, List<Field> fields)
|
||||
{
|
||||
// Replace common fields first
|
||||
base.ReplaceFields(item, fields);
|
||||
|
||||
// If we don't have a Adjuster to replace from, ignore specific fields
|
||||
if (item.ItemType != ItemType.Adjuster)
|
||||
return;
|
||||
|
||||
// Cast for easier access
|
||||
Adjuster newItem = item as Adjuster;
|
||||
|
||||
// Replace the fields
|
||||
if (fields.Contains(Field.DatItem_Default))
|
||||
Default = newItem.Default;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Conditions))
|
||||
Conditions = newItem.Conditions;
|
||||
|
||||
// TODO: Handle DatItem_Condition*
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -11,23 +11,6 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
#region ListXML
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML adjuster
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level
|
||||
[JsonObject("adjuster")]
|
||||
public class ListXmlAdjuster
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("default")]
|
||||
public bool? Default { get; set; }
|
||||
|
||||
[JsonProperty("conditions")]
|
||||
public List<ListXmlCondition> Conditions { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML analog
|
||||
/// </summary>
|
||||
@@ -41,6 +24,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Represents one ListXML condition
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level? (Both used at ListXML level AND under a lot of stuff)
|
||||
[JsonObject("condition")]
|
||||
public class ListXmlCondition
|
||||
{
|
||||
@@ -60,7 +44,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Represents one ListXML configuration
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level
|
||||
/// TODO: Promote to DatItem level (contains lists)
|
||||
[JsonObject("configuration")]
|
||||
public class ListXmlConfiguration
|
||||
{
|
||||
@@ -73,6 +57,9 @@ namespace SabreTools.Library.DatItems
|
||||
[JsonProperty("mask")]
|
||||
public string Mask { get; set; }
|
||||
|
||||
[JsonProperty("conditions")]
|
||||
public List<ListXmlCondition> Conditions { get; set; }
|
||||
|
||||
[JsonProperty("locations")]
|
||||
public List<ListXmlConfLocation> Locations { get; set; }
|
||||
|
||||
@@ -110,6 +97,9 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
[JsonProperty("default")]
|
||||
public bool? Default { get; set; }
|
||||
|
||||
[JsonProperty("conditions")]
|
||||
public List<ListXmlCondition> Conditions { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -158,7 +148,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Represents one ListXML device
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level (doesn't have "name" field?)
|
||||
/// TODO: Promote to DatItem level (doesn't have "name" field?) (contains list)
|
||||
[JsonObject("device")]
|
||||
public class ListXmlDevice
|
||||
{
|
||||
@@ -238,7 +228,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// Represents one ListXML dipswitch
|
||||
/// </summary>
|
||||
/// <remarks>Also used by SoftwareList</remarks>
|
||||
/// TODO: Promote to DatItem level
|
||||
/// TODO: Promote to DatItem level (contains list)
|
||||
[JsonObject("dipswitch")]
|
||||
public class ListXmlDipSwitch
|
||||
{
|
||||
@@ -251,6 +241,9 @@ namespace SabreTools.Library.DatItems
|
||||
[JsonProperty("mask")]
|
||||
public string Mask { get; set; }
|
||||
|
||||
[JsonProperty("conditions")]
|
||||
public List<ListXmlCondition> Conditions { get; set; }
|
||||
|
||||
[JsonProperty("locations")]
|
||||
public List<ListXmlDipLocation> Locations { get; set; }
|
||||
|
||||
@@ -289,6 +282,9 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
[JsonProperty("default")]
|
||||
public bool? Default { get; set; }
|
||||
|
||||
[JsonProperty("conditions")]
|
||||
public List<ListXmlCondition> Conditions { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -341,7 +337,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Represents one ListXML input
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level (doesn't have "name" field?)
|
||||
/// TODO: Promote to DatItem level (doesn't have "name" field?) (contains list)
|
||||
[JsonObject("input")]
|
||||
public class ListXmlInput
|
||||
{
|
||||
@@ -377,7 +373,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Represents one ListXML port
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level (doesn't have "name" field?)
|
||||
/// TODO: Promote to DatItem level (doesn't have "name" field?) (contains list)
|
||||
[JsonObject("port")]
|
||||
public class ListXmlPort
|
||||
{
|
||||
@@ -388,21 +384,10 @@ namespace SabreTools.Library.DatItems
|
||||
public List<ListXmlAnalog> Analogs { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML ramoption
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level (doesn't have "name" field?)
|
||||
[JsonObject("ramoption")]
|
||||
public class ListXmlRamOption
|
||||
{
|
||||
[JsonProperty("default")]
|
||||
public bool? Default { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML slot
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level
|
||||
/// TODO: Promote to DatItem level (contains list)
|
||||
[JsonObject("slot")]
|
||||
public class ListXmlSlot
|
||||
{
|
||||
|
||||
@@ -264,15 +264,25 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
#region Auxiliary
|
||||
|
||||
// Adjuster
|
||||
Field.DatItem_Default,
|
||||
Field.DatItem_Conditions,
|
||||
Field.DatItem_Condition_Tag,
|
||||
Field.DatItem_Condition_Mask,
|
||||
Field.DatItem_Condition_Relation,
|
||||
Field.DatItem_Condition_Value,
|
||||
|
||||
// BiosSet
|
||||
Field.DatItem_Description,
|
||||
Field.DatItem_Default,
|
||||
|
||||
// Chip
|
||||
Field.DatItem_Tag,
|
||||
Field.DatItem_ChipType,
|
||||
Field.DatItem_Clock,
|
||||
|
||||
// Ram Option
|
||||
Field.DatItem_Content,
|
||||
|
||||
// Release
|
||||
Field.DatItem_Language,
|
||||
|
||||
@@ -440,6 +450,9 @@ namespace SabreTools.Library.DatItems
|
||||
#if NET_FRAMEWORK
|
||||
switch (itemType)
|
||||
{
|
||||
case ItemType.Adjuster:
|
||||
return new Adjuster();
|
||||
|
||||
case ItemType.Archive:
|
||||
return new Archive();
|
||||
|
||||
@@ -461,6 +474,9 @@ namespace SabreTools.Library.DatItems
|
||||
case ItemType.Media:
|
||||
return new Media();
|
||||
|
||||
case ItemType.RamOption:
|
||||
return new RamOption();
|
||||
|
||||
case ItemType.Release:
|
||||
return new Release();
|
||||
|
||||
|
||||
@@ -223,18 +223,6 @@ namespace SabreTools.Library.DatItems
|
||||
Machine_Port_Analogs,
|
||||
Machine_Port_Analog_Mask,
|
||||
|
||||
// Adjusters
|
||||
Machine_Adjusters,
|
||||
Machine_Adjuster_Name,
|
||||
Machine_Adjuster_Default,
|
||||
|
||||
// Adjusters.Conditions
|
||||
Machine_Adjuster_Conditions,
|
||||
Machine_Adjuster_Condition_Tag,
|
||||
Machine_Adjuster_Condition_Mask,
|
||||
Machine_Adjuster_Condition_Relation,
|
||||
Machine_Adjuster_Condition_Value,
|
||||
|
||||
// Drivers
|
||||
Machine_Drivers,
|
||||
Machine_Driver_Status,
|
||||
@@ -275,10 +263,6 @@ namespace SabreTools.Library.DatItems
|
||||
Machine_Slot_SlotOption_DeviceName,
|
||||
Machine_Slot_SlotOption_Default,
|
||||
|
||||
// RamOptions
|
||||
Machine_RamOptions,
|
||||
Machine_RamOption_Default,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logiqx
|
||||
@@ -407,15 +391,25 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
#region Auxiliary
|
||||
|
||||
// Adjuster
|
||||
DatItem_Default,
|
||||
DatItem_Conditions,
|
||||
DatItem_Condition_Tag,
|
||||
DatItem_Condition_Mask,
|
||||
DatItem_Condition_Relation,
|
||||
DatItem_Condition_Value,
|
||||
|
||||
// BiosSet
|
||||
DatItem_Description,
|
||||
DatItem_Default,
|
||||
|
||||
// Chip
|
||||
DatItem_Tag,
|
||||
DatItem_ChipType,
|
||||
DatItem_Clock,
|
||||
|
||||
// Ram Option
|
||||
DatItem_Content,
|
||||
|
||||
// Release
|
||||
DatItem_Language,
|
||||
|
||||
@@ -459,10 +453,12 @@ namespace SabreTools.Library.DatItems
|
||||
Media,
|
||||
|
||||
// "Auxiliary" item types
|
||||
Adjuster,
|
||||
Archive,
|
||||
BiosSet,
|
||||
Chip,
|
||||
DeviceReference,
|
||||
RamOption,
|
||||
Release,
|
||||
Sample,
|
||||
SoftwareList,
|
||||
|
||||
@@ -196,12 +196,6 @@ namespace SabreTools.Library.DatItems
|
||||
[JsonProperty("ports", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlPort> Ports { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated adjusters
|
||||
/// </summary>
|
||||
[JsonProperty("adjusters", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlAdjuster> Adjusters { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated drivers
|
||||
/// </summary>
|
||||
@@ -226,12 +220,6 @@ namespace SabreTools.Library.DatItems
|
||||
[JsonProperty("slots", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlSlot> Slots { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of ramoptions
|
||||
/// </summary>
|
||||
[JsonProperty("ramoptions", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlRamOption> RamOptions { get; set; } = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logiqx Fields
|
||||
@@ -591,12 +579,10 @@ namespace SabreTools.Library.DatItems
|
||||
DipSwitches = this.DipSwitches,
|
||||
Configurations = this.Configurations,
|
||||
Ports = this.Ports,
|
||||
Adjusters = this.Adjusters,
|
||||
Drivers = this.Drivers,
|
||||
Features = this.Features,
|
||||
Devices = this.Devices,
|
||||
Slots = this.Slots,
|
||||
RamOptions = this.RamOptions,
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
196
SabreTools.Library/DatItems/RamOption.cs
Normal file
196
SabreTools.Library/DatItems/RamOption.cs
Normal file
@@ -0,0 +1,196 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using SabreTools.Library.Filtering;
|
||||
using SabreTools.Library.Tools;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SabreTools.Library.DatItems
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents which RAM option(s) is associated with a set
|
||||
/// </summary>
|
||||
[JsonObject("ramoption")]
|
||||
public class RamOption : DatItem
|
||||
{
|
||||
#region Fields
|
||||
|
||||
/// <summary>
|
||||
/// Determine whether the RamOption is default
|
||||
/// </summary>
|
||||
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public bool? Default { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines the content of the RamOption
|
||||
/// </summary>
|
||||
[JsonProperty("content", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Content { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Accessors
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="mappings">Mappings dictionary</param>
|
||||
public override void SetFields(Dictionary<Field, string> mappings)
|
||||
{
|
||||
// Set base fields
|
||||
base.SetFields(mappings);
|
||||
|
||||
// Handle BiosSet-specific fields
|
||||
if (mappings.Keys.Contains(Field.DatItem_Default))
|
||||
Default = mappings[Field.DatItem_Default].AsYesNo();
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Content))
|
||||
Content = mappings[Field.DatItem_Content];
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Create a default, empty RamOption object
|
||||
/// </summary>
|
||||
public RamOption()
|
||||
{
|
||||
Name = string.Empty;
|
||||
ItemType = ItemType.RamOption;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Cloning Methods
|
||||
|
||||
public override object Clone()
|
||||
{
|
||||
return new RamOption()
|
||||
{
|
||||
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,
|
||||
|
||||
Default = this.Default,
|
||||
Content = this.Content,
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Comparision Methods
|
||||
|
||||
public override bool Equals(DatItem other)
|
||||
{
|
||||
// If we don't have a RamOption, return false
|
||||
if (ItemType != other.ItemType)
|
||||
return false;
|
||||
|
||||
// Otherwise, treat it as a RamOption
|
||||
RamOption newOther = other as RamOption;
|
||||
|
||||
// If the BiosSet information matches
|
||||
return (Name == newOther.Name && Default == newOther.Default && Content == newOther.Content);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#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 override bool PassesFilter(Filter filter)
|
||||
{
|
||||
// Check common fields first
|
||||
if (!base.PassesFilter(filter))
|
||||
return false;
|
||||
|
||||
// Filter on default
|
||||
if (filter.DatItem_Default.MatchesNeutral(null, Default) == false)
|
||||
return false;
|
||||
|
||||
// Filter on content
|
||||
if (filter.DatItem_Content.MatchesPositiveSet(Content) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Content.MatchesNegativeSet(Content) == true)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove fields from the DatItem
|
||||
/// </summary>
|
||||
/// <param name="fields">List of Fields to remove</param>
|
||||
public override void RemoveFields(List<Field> fields)
|
||||
{
|
||||
// Remove common fields first
|
||||
base.RemoveFields(fields);
|
||||
|
||||
// Remove the fields
|
||||
if (fields.Contains(Field.DatItem_Default))
|
||||
Default = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Content))
|
||||
Content = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sorting and Merging
|
||||
|
||||
/// <summary>
|
||||
/// Replace fields from another item
|
||||
/// </summary>
|
||||
/// <param name="item">DatItem to pull new information from</param>
|
||||
/// <param name="fields">List of Fields representing what should be updated</param>
|
||||
public override void ReplaceFields(DatItem item, List<Field> fields)
|
||||
{
|
||||
// Replace common fields first
|
||||
base.ReplaceFields(item, fields);
|
||||
|
||||
// If we don't have a BiosSet to replace from, ignore specific fields
|
||||
if (item.ItemType != ItemType.RamOption)
|
||||
return;
|
||||
|
||||
// Cast for easier access
|
||||
RamOption newItem = item as RamOption;
|
||||
|
||||
// Replace the fields
|
||||
if (fields.Contains(Field.DatItem_Default))
|
||||
Default = newItem.Default;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Content))
|
||||
Content = newItem.Content;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -145,18 +145,6 @@ namespace SabreTools.Library.Filtering
|
||||
public FilterItem<bool?> Machine_Port_Analogs { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
public FilterItem<string> Machine_Port_Analog_Mask { get; private set; } = new FilterItem<string>();
|
||||
|
||||
// Adjusters
|
||||
public FilterItem<bool?> Machine_Adjusters { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
public FilterItem<string> Machine_Adjuster_Name { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<bool?> Machine_Adjuster_Default { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
|
||||
// Adjusters.Conditions
|
||||
public FilterItem<bool?> Machine_Adjuster_Conditions { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
public FilterItem<string> Machine_Adjuster_Condition_Tag { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> Machine_Adjuster_Condition_Mask { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> Machine_Adjuster_Condition_Relation { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> Machine_Adjuster_Condition_Value { get; private set; } = new FilterItem<string>();
|
||||
|
||||
// Drivers
|
||||
public FilterItem<bool?> Machine_Drivers { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
public FilterItem<string> Machine_Driver_Status { get; private set; } = new FilterItem<string>();
|
||||
@@ -197,10 +185,6 @@ namespace SabreTools.Library.Filtering
|
||||
public FilterItem<string> Machine_Slot_SlotOption_DeviceName { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<bool?> Machine_Slot_SlotOption_Default { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
|
||||
// RamOptions
|
||||
public FilterItem<bool?> Machine_RamOptions { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
public FilterItem<bool?> Machine_RamOption_Default { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logiqx
|
||||
@@ -329,6 +313,13 @@ namespace SabreTools.Library.Filtering
|
||||
|
||||
#region Auxiliary
|
||||
|
||||
// Adjuster
|
||||
public FilterItem<bool?> DatItem_Conditions { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
public FilterItem<string> DatItem_Condition_Tag { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> DatItem_Condition_Mask { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> DatItem_Condition_Relation { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> DatItem_Condition_Value { get; private set; } = new FilterItem<string>();
|
||||
|
||||
// BiosSet
|
||||
public FilterItem<string> DatItem_Description { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<bool?> DatItem_Default { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
@@ -338,6 +329,9 @@ namespace SabreTools.Library.Filtering
|
||||
public FilterItem<string> DatItem_ChipType { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> DatItem_Clock { get; private set; } = new FilterItem<string>();
|
||||
|
||||
// Ram Option
|
||||
public FilterItem<string> DatItem_Content { get; private set; } = new FilterItem<string>();
|
||||
|
||||
// Release
|
||||
public FilterItem<string> DatItem_Language { get; private set; } = new FilterItem<string>();
|
||||
|
||||
@@ -1061,64 +1055,6 @@ namespace SabreTools.Library.Filtering
|
||||
Machine_Port_Analog_Mask.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
// Adjusters
|
||||
case Field.Machine_Adjusters:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
Machine_Adjusters.Neutral = false;
|
||||
else
|
||||
Machine_Adjusters.Neutral = true;
|
||||
break;
|
||||
|
||||
case Field.Machine_Adjuster_Name:
|
||||
if (negate)
|
||||
Machine_Adjuster_Name.NegativeSet.Add(value);
|
||||
else
|
||||
Machine_Adjuster_Name.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.Machine_Adjuster_Default:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
Machine_Adjuster_Default.Neutral = false;
|
||||
else
|
||||
Machine_Adjuster_Default.Neutral = true;
|
||||
break;
|
||||
|
||||
// Adjusters.Conditions
|
||||
case Field.Machine_Adjuster_Conditions:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
Machine_Adjuster_Conditions.Neutral = false;
|
||||
else
|
||||
Machine_Adjuster_Conditions.Neutral = true;
|
||||
break;
|
||||
|
||||
case Field.Machine_Adjuster_Condition_Tag:
|
||||
if (negate)
|
||||
Machine_Adjuster_Condition_Tag.NegativeSet.Add(value);
|
||||
else
|
||||
Machine_Adjuster_Condition_Tag.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.Machine_Adjuster_Condition_Mask:
|
||||
if (negate)
|
||||
Machine_Adjuster_Condition_Mask.NegativeSet.Add(value);
|
||||
else
|
||||
Machine_Adjuster_Condition_Mask.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.Machine_Adjuster_Condition_Relation:
|
||||
if (negate)
|
||||
Machine_Adjuster_Condition_Relation.NegativeSet.Add(value);
|
||||
else
|
||||
Machine_Adjuster_Condition_Relation.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.Machine_Adjuster_Condition_Value:
|
||||
if (negate)
|
||||
Machine_Adjuster_Condition_Value.NegativeSet.Add(value);
|
||||
else
|
||||
Machine_Adjuster_Condition_Value.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
// Drivers
|
||||
case Field.Machine_Drivers:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
@@ -1308,21 +1244,6 @@ namespace SabreTools.Library.Filtering
|
||||
Machine_Slot_SlotOption_Default.Neutral = true;
|
||||
break;
|
||||
|
||||
// RamOptions
|
||||
case Field.Machine_RamOptions:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
Machine_RamOptions.Neutral = false;
|
||||
else
|
||||
Machine_RamOptions.Neutral = true;
|
||||
break;
|
||||
|
||||
case Field.Machine_RamOption_Default:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
Machine_RamOption_Default.Neutral = false;
|
||||
else
|
||||
Machine_RamOption_Default.Neutral = true;
|
||||
break;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logiqx
|
||||
@@ -1890,6 +1811,49 @@ namespace SabreTools.Library.Filtering
|
||||
|
||||
#region Auxiliary
|
||||
|
||||
// Adjuster
|
||||
case Field.DatItem_Default:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
DatItem_Default.Neutral = false;
|
||||
else
|
||||
DatItem_Default.Neutral = true;
|
||||
break;
|
||||
|
||||
case Field.DatItem_Conditions:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
DatItem_Conditions.Neutral = false;
|
||||
else
|
||||
DatItem_Conditions.Neutral = true;
|
||||
break;
|
||||
|
||||
case Field.DatItem_Condition_Tag:
|
||||
if (negate)
|
||||
DatItem_Condition_Tag.NegativeSet.Add(value);
|
||||
else
|
||||
DatItem_Condition_Tag.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.DatItem_Condition_Mask:
|
||||
if (negate)
|
||||
DatItem_Condition_Mask.NegativeSet.Add(value);
|
||||
else
|
||||
DatItem_Condition_Mask.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.DatItem_Condition_Relation:
|
||||
if (negate)
|
||||
DatItem_Condition_Relation.NegativeSet.Add(value);
|
||||
else
|
||||
DatItem_Condition_Relation.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.DatItem_Condition_Value:
|
||||
if (negate)
|
||||
DatItem_Condition_Value.NegativeSet.Add(value);
|
||||
else
|
||||
DatItem_Condition_Value.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
// BiosSet
|
||||
case Field.DatItem_Description:
|
||||
if (negate)
|
||||
@@ -1898,13 +1862,6 @@ namespace SabreTools.Library.Filtering
|
||||
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)
|
||||
@@ -1927,6 +1884,14 @@ namespace SabreTools.Library.Filtering
|
||||
DatItem_Clock.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
// Ram Option
|
||||
case Field.DatItem_Content:
|
||||
if (negate)
|
||||
DatItem_Content.NegativeSet.Add(value);
|
||||
else
|
||||
DatItem_Content.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
// Release
|
||||
case Field.DatItem_Language:
|
||||
if (negate)
|
||||
@@ -1950,11 +1915,11 @@ namespace SabreTools.Library.Filtering
|
||||
DatItem_Filter.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#endregion // Item-Specific
|
||||
#endregion // Item-Specifics
|
||||
|
||||
#endregion // DatItem Filters
|
||||
#endregion // DatItem Filters
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -660,30 +660,6 @@ namespace SabreTools.Library.Tools
|
||||
case "port_analog_mask":
|
||||
return Field.Machine_Port_Analog_Mask;
|
||||
|
||||
case "adjusters":
|
||||
return Field.Machine_Adjusters;
|
||||
|
||||
case "adjuster_name":
|
||||
return Field.Machine_Adjuster_Name;
|
||||
|
||||
case "adjuster_default":
|
||||
return Field.Machine_Adjuster_Default;
|
||||
|
||||
case "adjuster_conditions":
|
||||
return Field.Machine_Adjuster_Conditions;
|
||||
|
||||
case "adjuster_condition_tag":
|
||||
return Field.Machine_Adjuster_Condition_Tag;
|
||||
|
||||
case "adjuster_condition_mask":
|
||||
return Field.Machine_Adjuster_Condition_Mask;
|
||||
|
||||
case "adjuster_condition_relation":
|
||||
return Field.Machine_Adjuster_Condition_Relation;
|
||||
|
||||
case "adjuster_condition_value":
|
||||
return Field.Machine_Adjuster_Condition_Value;
|
||||
|
||||
case "drivers":
|
||||
return Field.Machine_Drivers;
|
||||
|
||||
@@ -762,12 +738,6 @@ namespace SabreTools.Library.Tools
|
||||
case "slot_slotoption_default":
|
||||
return Field.Machine_Slot_SlotOption_Default;
|
||||
|
||||
case "ramoptions":
|
||||
return Field.Machine_RamOptions;
|
||||
|
||||
case "ramoption_default":
|
||||
return Field.Machine_RamOption_Default;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logiqx
|
||||
@@ -1064,15 +1034,31 @@ namespace SabreTools.Library.Tools
|
||||
|
||||
#region Auxiliary
|
||||
|
||||
// Adjuster
|
||||
case "default":
|
||||
return Field.DatItem_Default;
|
||||
|
||||
case "conditions":
|
||||
return Field.DatItem_Conditions;
|
||||
|
||||
case "condition_tag":
|
||||
return Field.DatItem_Condition_Tag;
|
||||
|
||||
case "condition_mask":
|
||||
return Field.DatItem_Condition_Mask;
|
||||
|
||||
case "condition_relation":
|
||||
return Field.DatItem_Condition_Relation;
|
||||
|
||||
case "condition_value":
|
||||
return Field.DatItem_Condition_Value;
|
||||
|
||||
// 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;
|
||||
@@ -1084,6 +1070,10 @@ namespace SabreTools.Library.Tools
|
||||
case "clock":
|
||||
return Field.DatItem_Clock;
|
||||
|
||||
// Ram Option
|
||||
case "content":
|
||||
return Field.DatItem_Content;
|
||||
|
||||
// Release
|
||||
case "language":
|
||||
return Field.DatItem_Language;
|
||||
@@ -1504,6 +1494,25 @@ namespace SabreTools.Library.Tools
|
||||
|
||||
#region Auxiliary
|
||||
|
||||
// Adjuster
|
||||
case "default":
|
||||
return Field.DatItem_Default;
|
||||
|
||||
case "conditions":
|
||||
return Field.DatItem_Conditions;
|
||||
|
||||
case "condition_tag":
|
||||
return Field.DatItem_Condition_Tag;
|
||||
|
||||
case "condition_mask":
|
||||
return Field.DatItem_Condition_Mask;
|
||||
|
||||
case "condition_relation":
|
||||
return Field.DatItem_Condition_Relation;
|
||||
|
||||
case "condition_value":
|
||||
return Field.DatItem_Condition_Value;
|
||||
|
||||
// BiosSet
|
||||
case "biosdescription":
|
||||
case "bios-description":
|
||||
@@ -1512,9 +1521,6 @@ namespace SabreTools.Library.Tools
|
||||
case "bios-set-description":
|
||||
return Field.DatItem_Description;
|
||||
|
||||
case "default":
|
||||
return Field.DatItem_Default;
|
||||
|
||||
// Chip
|
||||
case "tag":
|
||||
return Field.DatItem_Tag;
|
||||
@@ -1525,6 +1531,10 @@ namespace SabreTools.Library.Tools
|
||||
|
||||
case "clock":
|
||||
return Field.DatItem_Clock;
|
||||
|
||||
// Ram Option
|
||||
case "content":
|
||||
return Field.DatItem_Content;
|
||||
|
||||
// Release
|
||||
case "language":
|
||||
@@ -1590,6 +1600,8 @@ namespace SabreTools.Library.Tools
|
||||
#if NET_FRAMEWORK
|
||||
switch (itemType?.ToLowerInvariant())
|
||||
{
|
||||
case "adjuster":
|
||||
return ItemType.Adjuster;
|
||||
case "archive":
|
||||
return ItemType.Archive;
|
||||
case "biosset":
|
||||
@@ -1604,6 +1616,8 @@ namespace SabreTools.Library.Tools
|
||||
return ItemType.Disk;
|
||||
case "media":
|
||||
return ItemType.Media;
|
||||
case "ramoption":
|
||||
return ItemType.RamOption;
|
||||
case "release":
|
||||
return ItemType.Release;
|
||||
case "rom":
|
||||
@@ -1618,6 +1632,7 @@ namespace SabreTools.Library.Tools
|
||||
#else
|
||||
return itemType?.ToLowerInvariant() switch
|
||||
{
|
||||
"adjuster" => ItemType.Adjuster,
|
||||
"archive" => ItemType.Archive,
|
||||
"biosset" => ItemType.BiosSet,
|
||||
"blank" => ItemType.Blank,
|
||||
@@ -1625,6 +1640,7 @@ namespace SabreTools.Library.Tools
|
||||
"device_ref" => ItemType.DeviceReference,
|
||||
"disk" => ItemType.Disk,
|
||||
"media" => ItemType.Media,
|
||||
"ramoption" => ItemType.RamOption,
|
||||
"release" => ItemType.Release,
|
||||
"rom" => ItemType.Rom,
|
||||
"sample" => ItemType.Sample,
|
||||
@@ -2020,6 +2036,8 @@ namespace SabreTools.Library.Tools
|
||||
#if NET_FRAMEWORK
|
||||
switch (itemType)
|
||||
{
|
||||
case ItemType.Adjuster:
|
||||
return "adjuster";
|
||||
case ItemType.Archive:
|
||||
return "archive";
|
||||
case ItemType.BiosSet:
|
||||
@@ -2034,6 +2052,8 @@ namespace SabreTools.Library.Tools
|
||||
return "disk";
|
||||
case ItemType.Media:
|
||||
return "media";
|
||||
case ItemType.RamOption:
|
||||
return "ramoption";
|
||||
case ItemType.Release:
|
||||
return "release";
|
||||
case ItemType.Rom:
|
||||
@@ -2048,6 +2068,7 @@ namespace SabreTools.Library.Tools
|
||||
#else
|
||||
return itemType switch
|
||||
{
|
||||
ItemType.Adjuster => "adjuster",
|
||||
ItemType.Archive => "archive",
|
||||
ItemType.BiosSet => "biosset",
|
||||
ItemType.Blank => "blank",
|
||||
@@ -2055,6 +2076,7 @@ namespace SabreTools.Library.Tools
|
||||
ItemType.DeviceReference => "device_ref",
|
||||
ItemType.Disk => "disk",
|
||||
ItemType.Media => "media",
|
||||
ItemType.RamOption => "ramoption",
|
||||
ItemType.Release => "release",
|
||||
ItemType.Rom => "rom",
|
||||
ItemType.Sample => "sample",
|
||||
|
||||
Reference in New Issue
Block a user