mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Wire up remaining OpenMSX DatItem fields
This commit is contained in:
@@ -790,6 +790,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
string name = null,
|
string name = null,
|
||||||
altName = null,
|
altName = null,
|
||||||
altTitle = null,
|
altTitle = null,
|
||||||
|
original = null,
|
||||||
|
msxType = null,
|
||||||
|
remark = null,
|
||||||
|
boot = null,
|
||||||
partName = null,
|
partName = null,
|
||||||
partInterface = null,
|
partInterface = null,
|
||||||
areaName = null,
|
areaName = null,
|
||||||
@@ -814,6 +818,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
bios = null;
|
bios = null;
|
||||||
ItemStatus? itemStatus = null;
|
ItemStatus? itemStatus = null;
|
||||||
ItemType? itemType = null;
|
ItemType? itemType = null;
|
||||||
|
OpenMSXSubType subType = OpenMSXSubType.NULL;
|
||||||
List<SoftwareListFeature> features = null;
|
List<SoftwareListFeature> features = null;
|
||||||
|
|
||||||
jtr.Read();
|
jtr.Read();
|
||||||
@@ -831,8 +836,16 @@ namespace SabreTools.Library.DatFiles
|
|||||||
datItem.Source = new Source { Index = indexId, Name = filename };
|
datItem.Source = new Source { Index = indexId, Name = filename };
|
||||||
|
|
||||||
datItem.Name = name;
|
datItem.Name = name;
|
||||||
|
|
||||||
datItem.AltName = altName;
|
datItem.AltName = altName;
|
||||||
datItem.AltTitle = altTitle;
|
datItem.AltTitle = altTitle;
|
||||||
|
|
||||||
|
datItem.Original = new OpenMSXOriginal(original, null);
|
||||||
|
datItem.OpenMSXSubType = subType;
|
||||||
|
datItem.OpenMSXType = msxType;
|
||||||
|
datItem.Remark = remark;
|
||||||
|
datItem.Boot = boot;
|
||||||
|
|
||||||
datItem.PartName = partName;
|
datItem.PartName = partName;
|
||||||
datItem.PartInterface = partInterface;
|
datItem.PartInterface = partInterface;
|
||||||
datItem.Features = features;
|
datItem.Features = features;
|
||||||
@@ -908,6 +921,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
|
|
||||||
switch (jtr.Value)
|
switch (jtr.Value)
|
||||||
{
|
{
|
||||||
|
#region Common
|
||||||
|
|
||||||
case "type":
|
case "type":
|
||||||
itemType = jtr.ReadAsString().AsItemType();
|
itemType = jtr.ReadAsString().AsItemType();
|
||||||
break;
|
break;
|
||||||
@@ -916,6 +931,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
name = jtr.ReadAsString();
|
name = jtr.ReadAsString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region AttractMode
|
||||||
|
|
||||||
case "alt_romname":
|
case "alt_romname":
|
||||||
altName = jtr.ReadAsString();
|
altName = jtr.ReadAsString();
|
||||||
break;
|
break;
|
||||||
@@ -924,6 +943,34 @@ namespace SabreTools.Library.DatFiles
|
|||||||
altTitle = jtr.ReadAsString();
|
altTitle = jtr.ReadAsString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region OpenMSX
|
||||||
|
|
||||||
|
case "original":
|
||||||
|
original = jtr.ReadAsString();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "openmsx_subtype":
|
||||||
|
subType = jtr.ReadAsString().AsOpenMSXSubType();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "openmsx_type":
|
||||||
|
msxType = jtr.ReadAsString();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "remark":
|
||||||
|
remark = jtr.ReadAsString();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "boot":
|
||||||
|
boot = jtr.ReadAsString();
|
||||||
|
break;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region SoftwareList
|
||||||
|
|
||||||
case "partname":
|
case "partname":
|
||||||
partName = jtr.ReadAsString();
|
partName = jtr.ReadAsString();
|
||||||
break;
|
break;
|
||||||
@@ -979,6 +1026,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
loadFlag = jtr.ReadAsString();
|
loadFlag = jtr.ReadAsString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
case "description":
|
case "description":
|
||||||
biosDescription = jtr.ReadAsString();
|
biosDescription = jtr.ReadAsString();
|
||||||
break;
|
break;
|
||||||
@@ -2142,6 +2191,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region AttractMode
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.AltName, Header.ExcludeFields)))
|
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.AltName, Header.ExcludeFields)))
|
||||||
{
|
{
|
||||||
jtw.WritePropertyName("alt_romname");
|
jtw.WritePropertyName("alt_romname");
|
||||||
@@ -2152,6 +2203,41 @@ namespace SabreTools.Library.DatFiles
|
|||||||
jtw.WritePropertyName("alt_title");
|
jtw.WritePropertyName("alt_title");
|
||||||
jtw.WriteValue(datItem.AltTitle);
|
jtw.WriteValue(datItem.AltTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region OpenMSX
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Original, Header.ExcludeFields)))
|
||||||
|
{
|
||||||
|
jtw.WritePropertyName("original");
|
||||||
|
jtw.WriteValue(datItem.Original.Original);
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.OpenMSXSubType, Header.ExcludeFields)))
|
||||||
|
{
|
||||||
|
jtw.WritePropertyName("openmsx_subtype");
|
||||||
|
jtw.WriteValue(datItem.OpenMSXSubType);
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.OpenMSXType, Header.ExcludeFields)))
|
||||||
|
{
|
||||||
|
jtw.WritePropertyName("openmsx_type");
|
||||||
|
jtw.WriteValue(datItem.OpenMSXType);
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Remark, Header.ExcludeFields)))
|
||||||
|
{
|
||||||
|
jtw.WritePropertyName("remark");
|
||||||
|
jtw.WriteValue(datItem.Remark);
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Boot, Header.ExcludeFields)))
|
||||||
|
{
|
||||||
|
jtw.WritePropertyName("boot");
|
||||||
|
jtw.WriteValue(datItem.Boot);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region SoftwareList
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.PartName, Header.ExcludeFields)))
|
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.PartName, Header.ExcludeFields)))
|
||||||
{
|
{
|
||||||
jtw.WritePropertyName("partname");
|
jtw.WritePropertyName("partname");
|
||||||
@@ -2207,6 +2293,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
jtw.WriteValue(datItem.LoadFlag);
|
jtw.WriteValue(datItem.LoadFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
// End item
|
// End item
|
||||||
jtw.WriteEndObject();
|
jtw.WriteEndObject();
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using System.Xml;
|
|||||||
using SabreTools.Library.Data;
|
using SabreTools.Library.Data;
|
||||||
using SabreTools.Library.DatItems;
|
using SabreTools.Library.DatItems;
|
||||||
using SabreTools.Library.IO;
|
using SabreTools.Library.IO;
|
||||||
|
using SabreTools.Library.Tools;
|
||||||
|
|
||||||
namespace SabreTools.Library.DatFiles
|
namespace SabreTools.Library.DatFiles
|
||||||
{
|
{
|
||||||
@@ -204,7 +205,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
string filename,
|
string filename,
|
||||||
int indexId)
|
int indexId)
|
||||||
{
|
{
|
||||||
bool containsItems = false;
|
List<DatItem> items = new List<DatItem>();
|
||||||
|
OpenMSXOriginal original = null;
|
||||||
|
|
||||||
while (!reader.EOF)
|
while (!reader.EOF)
|
||||||
{
|
{
|
||||||
@@ -219,30 +221,36 @@ namespace SabreTools.Library.DatFiles
|
|||||||
switch (reader.Name)
|
switch (reader.Name)
|
||||||
{
|
{
|
||||||
case "rom":
|
case "rom":
|
||||||
containsItems = ReadRom(reader.ReadSubtree(), machine, diskno, filename, indexId);
|
DatItem rom = ReadRom(reader.ReadSubtree(), machine, diskno, filename, indexId);
|
||||||
|
if (rom != null)
|
||||||
|
items.Add(rom);
|
||||||
|
|
||||||
// Skip the rom now that we've processed it
|
// Skip the rom now that we've processed it
|
||||||
reader.Skip();
|
reader.Skip();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "megarom":
|
case "megarom":
|
||||||
containsItems = ReadMegaRom(reader.ReadSubtree(), machine, diskno, filename, indexId);
|
DatItem megarom = ReadMegaRom(reader.ReadSubtree(), machine, diskno, filename, indexId);
|
||||||
|
if (megarom != null)
|
||||||
|
items.Add(megarom);
|
||||||
|
|
||||||
// Skip the megarom now that we've processed it
|
// Skip the megarom now that we've processed it
|
||||||
reader.Skip();
|
reader.Skip();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "sccpluscart":
|
case "sccpluscart":
|
||||||
containsItems = ReadSccPlusCart(reader.ReadSubtree(), machine, diskno, filename, indexId);
|
DatItem sccpluscart = ReadSccPlusCart(reader.ReadSubtree(), machine, diskno, filename, indexId);
|
||||||
|
if (sccpluscart != null)
|
||||||
|
items.Add(sccpluscart);
|
||||||
|
|
||||||
// Skip the sccpluscart now that we've processed it
|
// Skip the sccpluscart now that we've processed it
|
||||||
reader.Skip();
|
reader.Skip();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "original":
|
case "original":
|
||||||
// bool value = Utilities.GetYesNo(reader.GetAttribute("value");
|
bool? value = reader.GetAttribute("value").AsYesNo();
|
||||||
// string original = reader.ReadElementContentAsString();
|
string orig = reader.ReadElementContentAsString();
|
||||||
reader.Read();
|
original = new OpenMSXOriginal(orig, value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -251,7 +259,15 @@ namespace SabreTools.Library.DatFiles
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return containsItems;
|
// If we have any items, loop through and add them
|
||||||
|
foreach (DatItem item in items)
|
||||||
|
{
|
||||||
|
item.CopyMachineInformation(machine);
|
||||||
|
item.Original = original;
|
||||||
|
ParseAddHelper(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return items.Count > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -262,7 +278,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <param name="diskno">Disk number to use when outputting to other DAT formats</param>
|
/// <param name="diskno">Disk number to use when outputting to other DAT formats</param>
|
||||||
/// <param name="filename">Name of the file to be parsed</param>
|
/// <param name="filename">Name of the file to be parsed</param>
|
||||||
/// <param name="indexId">Index ID for the DAT</param>
|
/// <param name="indexId">Index ID for the DAT</param>
|
||||||
private bool ReadRom(
|
private DatItem ReadRom(
|
||||||
XmlReader reader,
|
XmlReader reader,
|
||||||
Machine machine,
|
Machine machine,
|
||||||
int diskno,
|
int diskno,
|
||||||
@@ -271,8 +287,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
string filename,
|
string filename,
|
||||||
int indexId)
|
int indexId)
|
||||||
{
|
{
|
||||||
string hash = string.Empty, offset = string.Empty, remark = string.Empty;
|
string hash = string.Empty,
|
||||||
bool containsItems = false;
|
offset = string.Empty,
|
||||||
|
type = string.Empty,
|
||||||
|
remark = string.Empty;
|
||||||
|
|
||||||
while (!reader.EOF)
|
while (!reader.EOF)
|
||||||
{
|
{
|
||||||
@@ -287,7 +305,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
switch (reader.Name)
|
switch (reader.Name)
|
||||||
{
|
{
|
||||||
case "hash":
|
case "hash":
|
||||||
containsItems = true;
|
|
||||||
hash = reader.ReadElementContentAsString();
|
hash = reader.ReadElementContentAsString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -296,7 +313,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "type":
|
case "type":
|
||||||
reader.ReadElementContentAsString();
|
type = reader.ReadElementContentAsString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "remark":
|
case "remark":
|
||||||
@@ -309,25 +326,30 @@ namespace SabreTools.Library.DatFiles
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create and add the new rom
|
// If we got a hash, then create and return the item
|
||||||
Rom rom = new Rom
|
if (!string.IsNullOrWhiteSpace(hash))
|
||||||
{
|
{
|
||||||
Name = machine.Name + "_" + diskno + (!string.IsNullOrWhiteSpace(remark) ? " " + remark : string.Empty),
|
return new Rom
|
||||||
Offset = offset,
|
|
||||||
Size = -1,
|
|
||||||
SHA1 = hash,
|
|
||||||
|
|
||||||
Source = new Source
|
|
||||||
{
|
{
|
||||||
Index = indexId,
|
Name = machine.Name + "_" + diskno + (!string.IsNullOrWhiteSpace(remark) ? " " + remark : string.Empty),
|
||||||
Name = filename,
|
Offset = offset,
|
||||||
},
|
Size = -1,
|
||||||
};
|
SHA1 = hash,
|
||||||
|
|
||||||
rom.CopyMachineInformation(machine);
|
Source = new Source
|
||||||
ParseAddHelper(rom);
|
{
|
||||||
|
Index = indexId,
|
||||||
|
Name = filename,
|
||||||
|
},
|
||||||
|
|
||||||
return containsItems;
|
OpenMSXSubType = OpenMSXSubType.Rom,
|
||||||
|
OpenMSXType = type,
|
||||||
|
Remark = remark,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// No valid item means returning null
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -338,7 +360,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <param name="diskno">Disk number to use when outputting to other DAT formats</param>
|
/// <param name="diskno">Disk number to use when outputting to other DAT formats</param>
|
||||||
/// <param name="filename">Name of the file to be parsed</param>
|
/// <param name="filename">Name of the file to be parsed</param>
|
||||||
/// <param name="indexId">Index ID for the DAT</param>
|
/// <param name="indexId">Index ID for the DAT</param>
|
||||||
private bool ReadMegaRom(
|
private DatItem ReadMegaRom(
|
||||||
XmlReader reader,
|
XmlReader reader,
|
||||||
Machine machine,
|
Machine machine,
|
||||||
int diskno,
|
int diskno,
|
||||||
@@ -347,8 +369,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
string filename,
|
string filename,
|
||||||
int indexId)
|
int indexId)
|
||||||
{
|
{
|
||||||
string hash = string.Empty, offset = string.Empty, remark = string.Empty;
|
string hash = string.Empty,
|
||||||
bool containsItems = false;
|
offset = string.Empty,
|
||||||
|
type = string.Empty,
|
||||||
|
remark = string.Empty;
|
||||||
|
|
||||||
while (!reader.EOF)
|
while (!reader.EOF)
|
||||||
{
|
{
|
||||||
@@ -363,7 +387,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
switch (reader.Name)
|
switch (reader.Name)
|
||||||
{
|
{
|
||||||
case "hash":
|
case "hash":
|
||||||
containsItems = true;
|
|
||||||
hash = reader.ReadElementContentAsString();
|
hash = reader.ReadElementContentAsString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -385,25 +408,30 @@ namespace SabreTools.Library.DatFiles
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create and add the new rom
|
// If we got a hash, then create and return the item
|
||||||
Rom rom = new Rom
|
if (!string.IsNullOrWhiteSpace(hash))
|
||||||
{
|
{
|
||||||
Name = machine.Name + "_" + diskno + (!string.IsNullOrWhiteSpace(remark) ? " " + remark : string.Empty),
|
return new Rom
|
||||||
Offset = offset,
|
|
||||||
Size = -1,
|
|
||||||
SHA1 = hash,
|
|
||||||
|
|
||||||
Source = new Source
|
|
||||||
{
|
{
|
||||||
Index = indexId,
|
Name = machine.Name + "_" + diskno + (!string.IsNullOrWhiteSpace(remark) ? " " + remark : string.Empty),
|
||||||
Name = filename,
|
Offset = offset,
|
||||||
},
|
Size = -1,
|
||||||
};
|
SHA1 = hash,
|
||||||
|
|
||||||
rom.CopyMachineInformation(machine);
|
Source = new Source
|
||||||
ParseAddHelper(rom);
|
{
|
||||||
|
Index = indexId,
|
||||||
|
Name = filename,
|
||||||
|
},
|
||||||
|
|
||||||
return containsItems;
|
OpenMSXSubType = OpenMSXSubType.MegaRom,
|
||||||
|
OpenMSXType = type,
|
||||||
|
Remark = remark,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// No valid item means returning null
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -414,7 +442,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <param name="diskno">Disk number to use when outputting to other DAT formats</param>
|
/// <param name="diskno">Disk number to use when outputting to other DAT formats</param>
|
||||||
/// <param name="filename">Name of the file to be parsed</param>
|
/// <param name="filename">Name of the file to be parsed</param>
|
||||||
/// <param name="indexId">Index ID for the DAT</param>
|
/// <param name="indexId">Index ID for the DAT</param>
|
||||||
private bool ReadSccPlusCart(
|
private DatItem ReadSccPlusCart(
|
||||||
XmlReader reader,
|
XmlReader reader,
|
||||||
Machine machine,
|
Machine machine,
|
||||||
int diskno,
|
int diskno,
|
||||||
@@ -423,8 +451,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
string filename,
|
string filename,
|
||||||
int indexId)
|
int indexId)
|
||||||
{
|
{
|
||||||
string hash = string.Empty, remark = string.Empty;
|
string boot = string.Empty,
|
||||||
bool containsItems = false;
|
hash = string.Empty,
|
||||||
|
remark = string.Empty;
|
||||||
|
|
||||||
while (!reader.EOF)
|
while (!reader.EOF)
|
||||||
{
|
{
|
||||||
@@ -439,11 +468,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
switch (reader.Name)
|
switch (reader.Name)
|
||||||
{
|
{
|
||||||
case "boot":
|
case "boot":
|
||||||
reader.ReadElementContentAsString();
|
boot = reader.ReadElementContentAsString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "hash":
|
case "hash":
|
||||||
containsItems = true;
|
|
||||||
hash = reader.ReadElementContentAsString();
|
hash = reader.ReadElementContentAsString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -457,24 +485,29 @@ namespace SabreTools.Library.DatFiles
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create and add the new rom
|
// If we got a hash, then create and return the item
|
||||||
Rom rom = new Rom
|
if (!string.IsNullOrWhiteSpace(hash))
|
||||||
{
|
{
|
||||||
Name = machine.Name + "_" + diskno + (!string.IsNullOrWhiteSpace(remark) ? " " + remark : string.Empty),
|
return new Rom
|
||||||
Size = -1,
|
|
||||||
SHA1 = hash,
|
|
||||||
|
|
||||||
Source = new Source
|
|
||||||
{
|
{
|
||||||
Index = indexId,
|
Name = machine.Name + "_" + diskno + (!string.IsNullOrWhiteSpace(remark) ? " " + remark : string.Empty),
|
||||||
Name = filename,
|
Size = -1,
|
||||||
},
|
SHA1 = hash,
|
||||||
};
|
|
||||||
|
|
||||||
rom.CopyMachineInformation(machine);
|
Source = new Source
|
||||||
ParseAddHelper(rom);
|
{
|
||||||
|
Index = indexId,
|
||||||
|
Name = filename,
|
||||||
|
},
|
||||||
|
|
||||||
return containsItems;
|
OpenMSXSubType = OpenMSXSubType.SCCPlusCart,
|
||||||
|
Boot = boot,
|
||||||
|
Remark = remark,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// No valid item means returning null
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -689,24 +722,56 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// Build the state based on excluded fields
|
// Build the state based on excluded fields
|
||||||
switch (datItem.ItemType)
|
switch (datItem.ItemType)
|
||||||
{
|
{
|
||||||
case ItemType.Rom: // Currently this encapsulates rom, megarom, and sccpluscart
|
case ItemType.Rom:
|
||||||
var rom = datItem as Rom;
|
var rom = datItem as Rom;
|
||||||
xtw.WriteStartElement("dump");
|
xtw.WriteStartElement("dump");
|
||||||
|
|
||||||
//xtw.WriteStartElement("original");
|
if (!Header.ExcludeFields.Contains(Field.Original) && rom.Original != null)
|
||||||
//xtw.WriteAttributeString("value", "true");
|
{
|
||||||
//xtw.WriteString("GoodMSX");
|
xtw.WriteStartElement("original");
|
||||||
//xtw.WriteEndElement();
|
xtw.WriteAttributeString("value", rom.Original.Value == true ? "true" : "false");
|
||||||
|
xtw.WriteString(rom.Original.Original);
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
}
|
||||||
|
|
||||||
xtw.WriteStartElement("rom");
|
switch (datItem.OpenMSXSubType)
|
||||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Offset, Header.ExcludeFields)))
|
{
|
||||||
xtw.WriteElementString("start", rom.Offset);
|
// Default to Rom for converting from other formats
|
||||||
//xtw.WriteElementString("type", "Normal");
|
case OpenMSXSubType.Rom:
|
||||||
xtw.WriteElementString("hash", rom.GetField(Field.SHA1, Header.ExcludeFields).ToLowerInvariant());
|
case OpenMSXSubType.NULL:
|
||||||
//xtw.WriteElementString("remark", "");
|
xtw.WriteStartElement("rom");
|
||||||
|
xtw.WriteElementString("hash", rom.GetField(Field.SHA1, Header.ExcludeFields).ToLowerInvariant());
|
||||||
|
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Offset, Header.ExcludeFields)))
|
||||||
|
xtw.WriteElementString("start", rom.Offset);
|
||||||
|
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.OpenMSXType, Header.ExcludeFields)))
|
||||||
|
xtw.WriteElementString("type", rom.OpenMSXType);
|
||||||
|
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Remark, Header.ExcludeFields)))
|
||||||
|
xtw.WriteElementString("remark", rom.Remark);
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
break;
|
||||||
|
|
||||||
// End rom
|
case OpenMSXSubType.MegaRom:
|
||||||
xtw.WriteEndElement();
|
xtw.WriteStartElement("megarom");
|
||||||
|
xtw.WriteElementString("hash", rom.GetField(Field.SHA1, Header.ExcludeFields).ToLowerInvariant());
|
||||||
|
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Offset, Header.ExcludeFields)))
|
||||||
|
xtw.WriteElementString("start", rom.Offset);
|
||||||
|
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.OpenMSXType, Header.ExcludeFields)))
|
||||||
|
xtw.WriteElementString("type", rom.OpenMSXType);
|
||||||
|
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Remark, Header.ExcludeFields)))
|
||||||
|
xtw.WriteElementString("remark", rom.Remark);
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OpenMSXSubType.SCCPlusCart:
|
||||||
|
xtw.WriteStartElement("sccpluscart");
|
||||||
|
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Boot, Header.ExcludeFields)))
|
||||||
|
xtw.WriteElementString("boot", rom.Boot);
|
||||||
|
xtw.WriteElementString("hash", rom.GetField(Field.SHA1, Header.ExcludeFields).ToLowerInvariant());
|
||||||
|
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Remark, Header.ExcludeFields)))
|
||||||
|
xtw.WriteElementString("remark", rom.Remark);
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// End dump
|
// End dump
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
|
|||||||
@@ -84,6 +84,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
string name = null,
|
string name = null,
|
||||||
altName = null,
|
altName = null,
|
||||||
altTitle = null,
|
altTitle = null,
|
||||||
|
original = null,
|
||||||
|
msxType = null,
|
||||||
|
remark = null,
|
||||||
|
boot = null,
|
||||||
partName = null,
|
partName = null,
|
||||||
partInterface = null,
|
partInterface = null,
|
||||||
areaName = null,
|
areaName = null,
|
||||||
@@ -112,6 +116,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
long size = -1;
|
long size = -1;
|
||||||
ItemType itemType = ItemType.Rom;
|
ItemType itemType = ItemType.Rom;
|
||||||
ItemStatus status = ItemStatus.None;
|
ItemStatus status = ItemStatus.None;
|
||||||
|
OpenMSXSubType subType = OpenMSXSubType.NULL;
|
||||||
List<SoftwareListFeature> features = null;
|
List<SoftwareListFeature> features = null;
|
||||||
|
|
||||||
// Now we loop through and get values for everything
|
// Now we loop through and get values for everything
|
||||||
@@ -527,6 +532,30 @@ namespace SabreTools.Library.DatFiles
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region OpenMSX
|
||||||
|
|
||||||
|
case "DatItem.Original":
|
||||||
|
original = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "DatItem.OpenMSXSubType":
|
||||||
|
subType = value.AsOpenMSXSubType();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "DatItem.OpenMSXType":
|
||||||
|
msxType = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "DatItem.Remark":
|
||||||
|
remark = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "DatItem.Boot":
|
||||||
|
boot = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region SoftwareList
|
#region SoftwareList
|
||||||
|
|
||||||
case "DatItem.PartName":
|
case "DatItem.PartName":
|
||||||
@@ -686,6 +715,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
AltName = altName,
|
AltName = altName,
|
||||||
AltTitle = altTitle,
|
AltTitle = altTitle,
|
||||||
|
|
||||||
|
Original = new OpenMSXOriginal(original, null),
|
||||||
|
OpenMSXSubType = subType,
|
||||||
|
OpenMSXType = msxType,
|
||||||
|
Remark = remark,
|
||||||
|
Boot = boot,
|
||||||
|
|
||||||
PartName = partName,
|
PartName = partName,
|
||||||
PartInterface = partInterface,
|
PartInterface = partInterface,
|
||||||
Features = features,
|
Features = features,
|
||||||
@@ -715,6 +750,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
AltName = altName,
|
AltName = altName,
|
||||||
AltTitle = altTitle,
|
AltTitle = altTitle,
|
||||||
|
|
||||||
|
Original = new OpenMSXOriginal(original, null),
|
||||||
|
OpenMSXSubType = subType,
|
||||||
|
OpenMSXType = msxType,
|
||||||
|
Remark = remark,
|
||||||
|
Boot = boot,
|
||||||
|
|
||||||
PartName = partName,
|
PartName = partName,
|
||||||
PartInterface = partInterface,
|
PartInterface = partInterface,
|
||||||
Features = features,
|
Features = features,
|
||||||
@@ -747,6 +788,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
AltName = altName,
|
AltName = altName,
|
||||||
AltTitle = altTitle,
|
AltTitle = altTitle,
|
||||||
|
|
||||||
|
Original = new OpenMSXOriginal(original, null),
|
||||||
|
OpenMSXSubType = subType,
|
||||||
|
OpenMSXType = msxType,
|
||||||
|
Remark = remark,
|
||||||
|
Boot = boot,
|
||||||
|
|
||||||
PartName = partName,
|
PartName = partName,
|
||||||
PartInterface = partInterface,
|
PartInterface = partInterface,
|
||||||
Features = features,
|
Features = features,
|
||||||
@@ -791,6 +838,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
AltName = altName,
|
AltName = altName,
|
||||||
AltTitle = altTitle,
|
AltTitle = altTitle,
|
||||||
|
|
||||||
|
Original = new OpenMSXOriginal(original, null),
|
||||||
|
OpenMSXSubType = subType,
|
||||||
|
OpenMSXType = msxType,
|
||||||
|
Remark = remark,
|
||||||
|
Boot = boot,
|
||||||
|
|
||||||
PartName = partName,
|
PartName = partName,
|
||||||
PartInterface = partInterface,
|
PartInterface = partInterface,
|
||||||
Features = features,
|
Features = features,
|
||||||
@@ -825,6 +878,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
AltName = altName,
|
AltName = altName,
|
||||||
AltTitle = altTitle,
|
AltTitle = altTitle,
|
||||||
|
|
||||||
|
Original = new OpenMSXOriginal(original, null),
|
||||||
|
OpenMSXSubType = subType,
|
||||||
|
OpenMSXType = msxType,
|
||||||
|
Remark = remark,
|
||||||
|
Boot = boot,
|
||||||
|
|
||||||
PartName = partName,
|
PartName = partName,
|
||||||
PartInterface = partInterface,
|
PartInterface = partInterface,
|
||||||
Features = features,
|
Features = features,
|
||||||
@@ -873,6 +932,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
AltName = altName,
|
AltName = altName,
|
||||||
AltTitle = altTitle,
|
AltTitle = altTitle,
|
||||||
|
|
||||||
|
Original = new OpenMSXOriginal(original, null),
|
||||||
|
OpenMSXSubType = subType,
|
||||||
|
OpenMSXType = msxType,
|
||||||
|
Remark = remark,
|
||||||
|
Boot = boot,
|
||||||
|
|
||||||
PartName = partName,
|
PartName = partName,
|
||||||
PartInterface = partInterface,
|
PartInterface = partInterface,
|
||||||
Features = features,
|
Features = features,
|
||||||
@@ -1343,6 +1408,24 @@ namespace SabreTools.Library.DatFiles
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region OpenMSX
|
||||||
|
|
||||||
|
case "original":
|
||||||
|
return "DatItem.Original";
|
||||||
|
case "subtype":
|
||||||
|
case "sub type":
|
||||||
|
case "sub-type":
|
||||||
|
case "openmsx_subtype":
|
||||||
|
return "DatItem.OpenMSXSubType";
|
||||||
|
case "openmsx_type":
|
||||||
|
return "DatItem.OpenMSXType";
|
||||||
|
case "remark":
|
||||||
|
return "DatItem.Remark";
|
||||||
|
case "boot":
|
||||||
|
return "DatItem.Boot";
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region SoftwareList
|
#region SoftwareList
|
||||||
|
|
||||||
case "partname":
|
case "partname":
|
||||||
|
|||||||
@@ -31,6 +31,12 @@
|
|||||||
AltName = this.AltName,
|
AltName = this.AltName,
|
||||||
AltTitle = this.AltTitle,
|
AltTitle = this.AltTitle,
|
||||||
|
|
||||||
|
Original = this.Original,
|
||||||
|
OpenMSXSubType = this.OpenMSXSubType,
|
||||||
|
OpenMSXType = this.OpenMSXType,
|
||||||
|
Remark = this.Remark,
|
||||||
|
Boot = this.Boot,
|
||||||
|
|
||||||
PartName = this.PartName,
|
PartName = this.PartName,
|
||||||
PartInterface = this.PartInterface,
|
PartInterface = this.PartInterface,
|
||||||
Features = this.Features,
|
Features = this.Features,
|
||||||
|
|||||||
@@ -26,6 +26,25 @@ namespace SabreTools.Library.DatItems
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region OpenMSX
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents the OpenMSX original value
|
||||||
|
/// </summary>
|
||||||
|
public class OpenMSXOriginal
|
||||||
|
{
|
||||||
|
public string Original { get; set; }
|
||||||
|
public bool? Value { get; set; }
|
||||||
|
|
||||||
|
public OpenMSXOriginal(string original, bool? value)
|
||||||
|
{
|
||||||
|
Original = original;
|
||||||
|
Value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region SoftwareList
|
#region SoftwareList
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -107,6 +107,12 @@ namespace SabreTools.Library.DatItems
|
|||||||
AltName = this.AltName,
|
AltName = this.AltName,
|
||||||
AltTitle = this.AltTitle,
|
AltTitle = this.AltTitle,
|
||||||
|
|
||||||
|
Original = this.Original,
|
||||||
|
OpenMSXSubType = this.OpenMSXSubType,
|
||||||
|
OpenMSXType = this.OpenMSXType,
|
||||||
|
Remark = this.Remark,
|
||||||
|
Boot = this.Boot,
|
||||||
|
|
||||||
PartName = this.PartName,
|
PartName = this.PartName,
|
||||||
PartInterface = this.PartInterface,
|
PartInterface = this.PartInterface,
|
||||||
Features = this.Features,
|
Features = this.Features,
|
||||||
@@ -159,7 +165,9 @@ namespace SabreTools.Library.DatItems
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Filter on description
|
// Filter on description
|
||||||
if (filter.Description.MatchesNeutral(null, Description) == false)
|
if (filter.Description.MatchesPositiveSet(Description) == false)
|
||||||
|
return false;
|
||||||
|
if (filter.Description.MatchesNegativeSet(Description) == true)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Filter on default
|
// Filter on default
|
||||||
|
|||||||
@@ -31,6 +31,12 @@
|
|||||||
AltName = this.AltName,
|
AltName = this.AltName,
|
||||||
AltTitle = this.AltTitle,
|
AltTitle = this.AltTitle,
|
||||||
|
|
||||||
|
Original = this.Original,
|
||||||
|
OpenMSXSubType = this.OpenMSXSubType,
|
||||||
|
OpenMSXType = this.OpenMSXType,
|
||||||
|
Remark = this.Remark,
|
||||||
|
Boot = this.Boot,
|
||||||
|
|
||||||
PartName = this.PartName,
|
PartName = this.PartName,
|
||||||
PartInterface = this.PartInterface,
|
PartInterface = this.PartInterface,
|
||||||
Features = this.Features,
|
Features = this.Features,
|
||||||
|
|||||||
@@ -69,6 +69,41 @@ namespace SabreTools.Library.DatItems
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region OpenMSX
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// OpenMSX sub item type
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("original")]
|
||||||
|
public OpenMSXOriginal Original { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// OpenMSX sub item type
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("openmsx_subtype")]
|
||||||
|
public OpenMSXSubType OpenMSXSubType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// OpenMSX sub item type
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Not related to the subtype above</remarks>
|
||||||
|
[JsonProperty("openmsx_type")]
|
||||||
|
public string OpenMSXType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Item remark (like a comment)
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("remark")]
|
||||||
|
public string Remark { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Boot state
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("boot")]
|
||||||
|
public string Boot { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region SoftwareList Fields
|
#region SoftwareList Fields
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -160,6 +195,13 @@ namespace SabreTools.Library.DatItems
|
|||||||
Field.AltName,
|
Field.AltName,
|
||||||
Field.AltTitle,
|
Field.AltTitle,
|
||||||
|
|
||||||
|
// OpenMSX
|
||||||
|
Field.Original,
|
||||||
|
Field.OpenMSXSubType,
|
||||||
|
Field.OpenMSXType,
|
||||||
|
Field.Remark,
|
||||||
|
Field.Boot,
|
||||||
|
|
||||||
//SoftwareList
|
//SoftwareList
|
||||||
Field.PartName,
|
Field.PartName,
|
||||||
Field.PartInterface,
|
Field.PartInterface,
|
||||||
@@ -286,15 +328,47 @@ namespace SabreTools.Library.DatItems
|
|||||||
|
|
||||||
switch (field)
|
switch (field)
|
||||||
{
|
{
|
||||||
|
#region Common
|
||||||
|
|
||||||
case Field.Name:
|
case Field.Name:
|
||||||
fieldValue = Name;
|
fieldValue = Name;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region AttractMode
|
||||||
|
|
||||||
case Field.AltName:
|
case Field.AltName:
|
||||||
fieldValue = AltName;
|
fieldValue = AltName;
|
||||||
break;
|
break;
|
||||||
case Field.AltTitle:
|
case Field.AltTitle:
|
||||||
fieldValue = AltTitle;
|
fieldValue = AltTitle;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region OpenMSX
|
||||||
|
|
||||||
|
case Field.Original:
|
||||||
|
fieldValue = Original.Original;
|
||||||
|
break;
|
||||||
|
case Field.OpenMSXSubType:
|
||||||
|
fieldValue = OpenMSXSubType.ToString();
|
||||||
|
break;
|
||||||
|
case Field.OpenMSXType:
|
||||||
|
fieldValue = OpenMSXType;
|
||||||
|
break;
|
||||||
|
case Field.Remark:
|
||||||
|
fieldValue = Remark;
|
||||||
|
break;
|
||||||
|
case Field.Boot:
|
||||||
|
fieldValue = Boot;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region SoftwareList
|
||||||
|
|
||||||
case Field.PartName:
|
case Field.PartName:
|
||||||
fieldValue = PartName;
|
fieldValue = PartName;
|
||||||
break;
|
break;
|
||||||
@@ -323,6 +397,8 @@ namespace SabreTools.Library.DatItems
|
|||||||
fieldValue = LoadFlag;
|
fieldValue = LoadFlag;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
case Field.NULL:
|
case Field.NULL:
|
||||||
default:
|
default:
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
@@ -361,6 +437,25 @@ namespace SabreTools.Library.DatItems
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region OpenMSX
|
||||||
|
|
||||||
|
if (mappings.Keys.Contains(Field.Original))
|
||||||
|
Original = new OpenMSXOriginal(mappings[Field.Original], null);
|
||||||
|
|
||||||
|
if (mappings.Keys.Contains(Field.OpenMSXSubType))
|
||||||
|
OpenMSXSubType = mappings[Field.OpenMSXSubType].AsOpenMSXSubType();
|
||||||
|
|
||||||
|
if (mappings.Keys.Contains(Field.OpenMSXType))
|
||||||
|
OpenMSXType = mappings[Field.OpenMSXType];
|
||||||
|
|
||||||
|
if (mappings.Keys.Contains(Field.Remark))
|
||||||
|
Remark = mappings[Field.Remark];
|
||||||
|
|
||||||
|
if (mappings.Keys.Contains(Field.Boot))
|
||||||
|
Boot = mappings[Field.Boot];
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region SoftwareList
|
#region SoftwareList
|
||||||
|
|
||||||
if (mappings.Keys.Contains(Field.PartName))
|
if (mappings.Keys.Contains(Field.PartName))
|
||||||
@@ -625,6 +720,40 @@ namespace SabreTools.Library.DatItems
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region OpenMSX
|
||||||
|
|
||||||
|
// Filter on original
|
||||||
|
if (filter.Original.MatchesPositiveSet(Original.Original) == false)
|
||||||
|
return false;
|
||||||
|
if (filter.Original.MatchesNegativeSet(Original.Original) == true)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Filter on OpenMSX subtype
|
||||||
|
if (filter.SubType.MatchesPositiveSet(OpenMSXSubType) == false)
|
||||||
|
return false;
|
||||||
|
if (filter.SubType.MatchesNegativeSet(OpenMSXSubType) == true)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Filter on OpenMSX type
|
||||||
|
if (filter.OpenMSXType.MatchesPositiveSet(OpenMSXType) == false)
|
||||||
|
return false;
|
||||||
|
if (filter.OpenMSXType.MatchesNegativeSet(OpenMSXType) == true)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Filter on remark
|
||||||
|
if (filter.Remark.MatchesPositiveSet(Remark) == false)
|
||||||
|
return false;
|
||||||
|
if (filter.Remark.MatchesNegativeSet(Remark) == true)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Filter on boot
|
||||||
|
if (filter.Boot.MatchesPositiveSet(Boot) == false)
|
||||||
|
return false;
|
||||||
|
if (filter.Boot.MatchesNegativeSet(Boot) == true)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region SoftwareList
|
#region SoftwareList
|
||||||
|
|
||||||
// Filter on part name
|
// Filter on part name
|
||||||
@@ -708,6 +837,25 @@ namespace SabreTools.Library.DatItems
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region OpenMSX
|
||||||
|
|
||||||
|
if (fields.Contains(Field.Original))
|
||||||
|
Original = null;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.OpenMSXSubType))
|
||||||
|
OpenMSXSubType = OpenMSXSubType.NULL;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.OpenMSXType))
|
||||||
|
OpenMSXType = null;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.Remark))
|
||||||
|
Remark = null;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.Boot))
|
||||||
|
Boot = null;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region SoftwareList
|
#region SoftwareList
|
||||||
|
|
||||||
if (fields.Contains(Field.PartName))
|
if (fields.Contains(Field.PartName))
|
||||||
@@ -837,6 +985,25 @@ namespace SabreTools.Library.DatItems
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region OpenMSX
|
||||||
|
|
||||||
|
if (fields.Contains(Field.Original))
|
||||||
|
Original = item.Original;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.OpenMSXSubType))
|
||||||
|
OpenMSXSubType = item.OpenMSXSubType;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.OpenMSXType))
|
||||||
|
OpenMSXType = item.OpenMSXType;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.Remark))
|
||||||
|
Remark = item.Remark;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.Boot))
|
||||||
|
Boot = item.Boot;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region SoftwareList
|
#region SoftwareList
|
||||||
|
|
||||||
if (fields.Contains(Field.PartName))
|
if (fields.Contains(Field.PartName))
|
||||||
|
|||||||
@@ -295,6 +295,12 @@ namespace SabreTools.Library.DatItems
|
|||||||
AltName = this.AltName,
|
AltName = this.AltName,
|
||||||
AltTitle = this.AltTitle,
|
AltTitle = this.AltTitle,
|
||||||
|
|
||||||
|
Original = this.Original,
|
||||||
|
OpenMSXSubType = this.OpenMSXSubType,
|
||||||
|
OpenMSXType = this.OpenMSXType,
|
||||||
|
Remark = this.Remark,
|
||||||
|
Boot = this.Boot,
|
||||||
|
|
||||||
PartName = this.PartName,
|
PartName = this.PartName,
|
||||||
PartInterface = this.PartInterface,
|
PartInterface = this.PartInterface,
|
||||||
Features = this.Features,
|
Features = this.Features,
|
||||||
@@ -341,6 +347,12 @@ namespace SabreTools.Library.DatItems
|
|||||||
AltName = this.AltName,
|
AltName = this.AltName,
|
||||||
AltTitle = this.AltTitle,
|
AltTitle = this.AltTitle,
|
||||||
|
|
||||||
|
Original = this.Original,
|
||||||
|
OpenMSXSubType = this.OpenMSXSubType,
|
||||||
|
OpenMSXType = this.OpenMSXType,
|
||||||
|
Remark = this.Remark,
|
||||||
|
Boot = this.Boot,
|
||||||
|
|
||||||
PartName = this.PartName,
|
PartName = this.PartName,
|
||||||
PartInterface = this.PartInterface,
|
PartInterface = this.PartInterface,
|
||||||
Features = this.Features,
|
Features = this.Features,
|
||||||
|
|||||||
@@ -121,6 +121,16 @@ namespace SabreTools.Library.DatItems
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region OpenMSX
|
||||||
|
|
||||||
|
Original,
|
||||||
|
OpenMSXSubType,
|
||||||
|
OpenMSXType,
|
||||||
|
Remark,
|
||||||
|
Boot,
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region SoftwareList
|
#region SoftwareList
|
||||||
|
|
||||||
PartName,
|
PartName,
|
||||||
@@ -202,6 +212,18 @@ namespace SabreTools.Library.DatItems
|
|||||||
Blank = 99, // This is not a real type, only used internally
|
Blank = 99, // This is not a real type, only used internally
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determine which OpenMSX subtype an item is
|
||||||
|
/// </summary>
|
||||||
|
[Flags]
|
||||||
|
public enum OpenMSXSubType
|
||||||
|
{
|
||||||
|
NULL = 0,
|
||||||
|
Rom = 1,
|
||||||
|
MegaRom = 2,
|
||||||
|
SCCPlusCart = 3,
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determine what type of machine it is
|
/// Determine what type of machine it is
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -135,6 +135,12 @@ namespace SabreTools.Library.DatItems
|
|||||||
AltName = this.AltName,
|
AltName = this.AltName,
|
||||||
AltTitle = this.AltTitle,
|
AltTitle = this.AltTitle,
|
||||||
|
|
||||||
|
Original = this.Original,
|
||||||
|
OpenMSXSubType = this.OpenMSXSubType,
|
||||||
|
OpenMSXType = this.OpenMSXType,
|
||||||
|
Remark = this.Remark,
|
||||||
|
Boot = this.Boot,
|
||||||
|
|
||||||
PartName = this.PartName,
|
PartName = this.PartName,
|
||||||
PartInterface = this.PartInterface,
|
PartInterface = this.PartInterface,
|
||||||
Features = this.Features,
|
Features = this.Features,
|
||||||
|
|||||||
@@ -377,6 +377,12 @@ namespace SabreTools.Library.DatItems
|
|||||||
AltName = this.AltName,
|
AltName = this.AltName,
|
||||||
AltTitle = this.AltTitle,
|
AltTitle = this.AltTitle,
|
||||||
|
|
||||||
|
Original = this.Original,
|
||||||
|
OpenMSXSubType = this.OpenMSXSubType,
|
||||||
|
OpenMSXType = this.OpenMSXType,
|
||||||
|
Remark = this.Remark,
|
||||||
|
Boot = this.Boot,
|
||||||
|
|
||||||
PartName = this.PartName,
|
PartName = this.PartName,
|
||||||
PartInterface = this.PartInterface,
|
PartInterface = this.PartInterface,
|
||||||
Features = this.Features,
|
Features = this.Features,
|
||||||
|
|||||||
@@ -31,6 +31,12 @@
|
|||||||
AltName = this.AltName,
|
AltName = this.AltName,
|
||||||
AltTitle = this.AltTitle,
|
AltTitle = this.AltTitle,
|
||||||
|
|
||||||
|
Original = this.Original,
|
||||||
|
OpenMSXSubType = this.OpenMSXSubType,
|
||||||
|
OpenMSXType = this.OpenMSXType,
|
||||||
|
Remark = this.Remark,
|
||||||
|
Boot = this.Boot,
|
||||||
|
|
||||||
PartName = this.PartName,
|
PartName = this.PartName,
|
||||||
PartInterface = this.PartInterface,
|
PartInterface = this.PartInterface,
|
||||||
Features = this.Features,
|
Features = this.Features,
|
||||||
|
|||||||
@@ -267,6 +267,35 @@ namespace SabreTools.Library.Filtering
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region OpenMSX
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Include or exclude original value
|
||||||
|
/// </summary>
|
||||||
|
public FilterItem<string> Original { get; private set; } = new FilterItem<string>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Include or exclude items of a certain OpenMSX subtype
|
||||||
|
/// </summary>
|
||||||
|
public FilterItem<OpenMSXSubType> SubType { get; private set; } = new FilterItem<OpenMSXSubType>() { Positive = OpenMSXSubType.NULL, Negative = OpenMSXSubType.NULL };
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Include or exclude OpenMSX type
|
||||||
|
/// </summary>
|
||||||
|
public FilterItem<string> OpenMSXType { get; private set; } = new FilterItem<string>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Include or exclude remarks
|
||||||
|
/// </summary>
|
||||||
|
public FilterItem<string> Remark { get; private set; } = new FilterItem<string>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Include or exclude boots
|
||||||
|
/// </summary>
|
||||||
|
public FilterItem<string> Boot { get; private set; } = new FilterItem<string>();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region SoftwareList
|
#region SoftwareList
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -860,6 +889,45 @@ namespace SabreTools.Library.Filtering
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region OpenMSX
|
||||||
|
|
||||||
|
case Field.Original:
|
||||||
|
if (negate)
|
||||||
|
Original.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
Original.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Field.OpenMSXSubType:
|
||||||
|
if (negate)
|
||||||
|
SubType.Negative |= value.AsOpenMSXSubType();
|
||||||
|
else
|
||||||
|
SubType.Positive |= value.AsOpenMSXSubType();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Field.OpenMSXType:
|
||||||
|
if (negate)
|
||||||
|
OpenMSXType.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
OpenMSXType.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Field.Remark:
|
||||||
|
if (negate)
|
||||||
|
Remark.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
Remark.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Field.Boot:
|
||||||
|
if (negate)
|
||||||
|
Boot.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
Boot.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region SoftwareList
|
#region SoftwareList
|
||||||
|
|
||||||
case Field.PartName:
|
case Field.PartName:
|
||||||
|
|||||||
@@ -363,7 +363,6 @@ namespace SabreTools.Library.Tools
|
|||||||
case "alt romname":
|
case "alt romname":
|
||||||
case "alt-romname":
|
case "alt-romname":
|
||||||
return Field.AltName;
|
return Field.AltName;
|
||||||
|
|
||||||
case "alttitle":
|
case "alttitle":
|
||||||
case "alt title":
|
case "alt title":
|
||||||
case "alt-title":
|
case "alt-title":
|
||||||
@@ -374,6 +373,24 @@ namespace SabreTools.Library.Tools
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region OpenMSX
|
||||||
|
|
||||||
|
case "original":
|
||||||
|
return Field.Original;
|
||||||
|
case "subtype":
|
||||||
|
case "sub type":
|
||||||
|
case "sub-type":
|
||||||
|
case "openmsx_subtype":
|
||||||
|
return Field.OpenMSXSubType;
|
||||||
|
case "openmsx_type":
|
||||||
|
return Field.OpenMSXType;
|
||||||
|
case "remark":
|
||||||
|
return Field.Remark;
|
||||||
|
case "boot":
|
||||||
|
return Field.Boot;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region SoftwareList
|
#region SoftwareList
|
||||||
|
|
||||||
case "partname":
|
case "partname":
|
||||||
@@ -665,6 +682,36 @@ namespace SabreTools.Library.Tools
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get OpenMSXSubType value from input string
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="itemType">String to get value from</param>
|
||||||
|
/// <returns>OpenMSXSubType value corresponding to the string</returns>
|
||||||
|
public static OpenMSXSubType AsOpenMSXSubType(this string itemType)
|
||||||
|
{
|
||||||
|
#if NET_FRAMEWORK
|
||||||
|
switch (itemType?.ToLowerInvariant())
|
||||||
|
{
|
||||||
|
case "rom":
|
||||||
|
return OpenMSXSubType.Rom;
|
||||||
|
case "megarom":
|
||||||
|
return OpenMSXSubType.MegaRom;
|
||||||
|
case "sccpluscart":
|
||||||
|
return OpenMSXSubType.SCCPlusCart;
|
||||||
|
default:
|
||||||
|
return OpenMSXSubType.NULL;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return itemType?.ToLowerInvariant() switch
|
||||||
|
{
|
||||||
|
"rom" => OpenMSXSubType.Rom,
|
||||||
|
"megarom" => OpenMSXSubType.MegaRom,
|
||||||
|
"sccpluscart" => OpenMSXSubType.SCCPlusCart,
|
||||||
|
_ => OpenMSXSubType.NULL,
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get PackingFlag value from input string
|
/// Get PackingFlag value from input string
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user