mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[ALL] ExcludeFields instead of ExcludeOf
This commit is contained in:
@@ -233,12 +233,12 @@ namespace SabreTools.Library.DatFiles
|
||||
rom.MachineName = rom.MachineName.Substring(1);
|
||||
}
|
||||
|
||||
string state = rom.MachineName + ";"
|
||||
+ rom.MachineDescription + ";"
|
||||
string state = (!ExcludeFields.Contains(Field.MachineName) ? rom.MachineName : "") + ";"
|
||||
+ (!ExcludeFields.Contains(Field.Description) ? rom.MachineDescription : "") + ";"
|
||||
+ FileName + ";"
|
||||
+ rom.CloneOf + ";"
|
||||
+ rom.Year + ";"
|
||||
+ rom.Manufacturer + ";"
|
||||
+ (!ExcludeFields.Contains(Field.CloneOf) ? rom.CloneOf : "") + ";"
|
||||
+ (!ExcludeFields.Contains(Field.Year) ? rom.Year : "") + ";"
|
||||
+ (!ExcludeFields.Contains(Field.Manufacturer) ? rom.Manufacturer : "") + ";"
|
||||
/* + rom.Category */ + ";"
|
||||
/* + rom.Players */ + ";"
|
||||
/* + rom.Rotation */ + ";"
|
||||
@@ -248,7 +248,7 @@ namespace SabreTools.Library.DatFiles
|
||||
/* + rom.DisplayType */ + ";"
|
||||
/* + rom.AltRomname */ + ";"
|
||||
/* + rom.AltTitle */ + ";"
|
||||
+ rom.Comment + ";"
|
||||
+ (!ExcludeFields.Contains(Field.Comment) ? rom.Comment : "") + ";"
|
||||
/* + rom.Buttons */ + "\n";
|
||||
|
||||
sw.Write(state);
|
||||
|
||||
@@ -826,15 +826,13 @@ namespace SabreTools.Library.DatFiles
|
||||
rom.MachineName = rom.MachineName.Substring(1);
|
||||
}
|
||||
|
||||
string state = (rom.MachineType == MachineType.Bios ? "resource" : "game") + " (\n\tname \"" + rom.MachineName + "\"\n" +
|
||||
(ExcludeOf ? "" :
|
||||
(String.IsNullOrWhiteSpace(rom.RomOf) ? "" : "\tromof \"" + rom.RomOf + "\"\n") +
|
||||
(String.IsNullOrWhiteSpace(rom.CloneOf) ? "" : "\tcloneof \"" + rom.CloneOf + "\"\n") +
|
||||
(String.IsNullOrWhiteSpace(rom.SampleOf) ? "" : "\tsampleof \"" + rom.SampleOf + "\"\n")
|
||||
) +
|
||||
"\tdescription \"" + (String.IsNullOrWhiteSpace(rom.MachineDescription) ? rom.MachineName : rom.MachineDescription) + "\"\n" +
|
||||
(String.IsNullOrWhiteSpace(rom.Year) ? "" : "\tyear " + rom.Year + "\n") +
|
||||
(String.IsNullOrWhiteSpace(rom.Manufacturer) ? "" : "\tmanufacturer \"" + rom.Manufacturer + "\"\n");
|
||||
string state = (rom.MachineType == MachineType.Bios ? "resource" : "game") + " (\n\tname \"" + (!ExcludeFields[(int)Field.MachineName] ? rom.MachineName : "") + "\"\n" +
|
||||
(!ExcludeFields[(int)Field.RomOf] && String.IsNullOrWhiteSpace(rom.RomOf) ? "" : "\tromof \"" + rom.RomOf + "\"\n") +
|
||||
(!ExcludeFields[(int)Field.CloneOf] && String.IsNullOrWhiteSpace(rom.CloneOf) ? "" : "\tcloneof \"" + rom.CloneOf + "\"\n") +
|
||||
(!ExcludeFields[(int)Field.SampleOf] && String.IsNullOrWhiteSpace(rom.SampleOf) ? "" : "\tsampleof \"" + rom.SampleOf + "\"\n") +
|
||||
(!ExcludeFields[(int)Field.Description] ? "\tdescription \"" + (String.IsNullOrWhiteSpace(rom.MachineDescription) ? rom.MachineName : rom.MachineDescription) + "\"\n" : "") +
|
||||
(!ExcludeFields[(int)Field.Year] && String.IsNullOrWhiteSpace(rom.Year) ? "" : "\tyear " + rom.Year + "\n") +
|
||||
(!ExcludeFields[(int)Field.Manufacturer] && String.IsNullOrWhiteSpace(rom.Manufacturer) ? "" : "\tmanufacturer \"" + rom.Manufacturer + "\"\n");
|
||||
|
||||
sw.Write(state);
|
||||
sw.Flush();
|
||||
@@ -858,7 +856,7 @@ namespace SabreTools.Library.DatFiles
|
||||
{
|
||||
try
|
||||
{
|
||||
string state = (String.IsNullOrWhiteSpace(rom.SampleOf) ? "" : "\tsampleof \"" + rom.SampleOf + "\"\n") + ")\n";
|
||||
string state = (!ExcludeFields[(int)Field.SampleOf] && String.IsNullOrWhiteSpace(rom.SampleOf) ? "" : "\tsampleof \"" + rom.SampleOf + "\"\n") + ")\n";
|
||||
|
||||
sw.Write(state);
|
||||
sw.Flush();
|
||||
@@ -900,52 +898,52 @@ namespace SabreTools.Library.DatFiles
|
||||
switch (rom.Type)
|
||||
{
|
||||
case ItemType.Archive:
|
||||
state += "\tarchive ( name\"" + rom.Name + "\""
|
||||
state += "\tarchive ( name\"" + (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\""
|
||||
+ " )\n";
|
||||
break;
|
||||
case ItemType.BiosSet:
|
||||
state += "\tbiosset ( name\"" + rom.Name + "\""
|
||||
+ (!String.IsNullOrWhiteSpace(((BiosSet)rom).Description) ? " description \"" + ((BiosSet)rom).Description + "\"" : "")
|
||||
+ (((BiosSet)rom).Default != null
|
||||
state += "\tbiosset ( name\"" + (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\""
|
||||
+ (!ExcludeFields[(int)Field.Description] && !String.IsNullOrWhiteSpace(((BiosSet)rom).Description) ? " description \"" + ((BiosSet)rom).Description + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Default] && ((BiosSet)rom).Default != null
|
||||
? "default " + ((BiosSet)rom).Default.ToString().ToLowerInvariant()
|
||||
: "")
|
||||
+ " )\n";
|
||||
break;
|
||||
case ItemType.Disk:
|
||||
state += "\tdisk ( name \"" + rom.Name + "\""
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).MD5) ? " md5 " + ((Disk)rom).MD5.ToLowerInvariant() : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).SHA1) ? " sha1 " + ((Disk)rom).SHA1.ToLowerInvariant() : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).SHA256) ? " sha256 " + ((Disk)rom).SHA256.ToLowerInvariant() : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).SHA384) ? " sha384 " + ((Disk)rom).SHA384.ToLowerInvariant() : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).SHA512) ? " sha512 " + ((Disk)rom).SHA512.ToLowerInvariant() : "")
|
||||
+ (((Disk)rom).ItemStatus != ItemStatus.None ? " flags " + ((Disk)rom).ItemStatus.ToString().ToLowerInvariant() : "")
|
||||
state += "\tdisk ( name \"" + (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\""
|
||||
+ (!ExcludeFields[(int)Field.MD5] && !String.IsNullOrWhiteSpace(((Disk)rom).MD5) ? " md5 " + ((Disk)rom).MD5.ToLowerInvariant() : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA1] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA1) ? " sha1 " + ((Disk)rom).SHA1.ToLowerInvariant() : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA256] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA256) ? " sha256 " + ((Disk)rom).SHA256.ToLowerInvariant() : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA384] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA384) ? " sha384 " + ((Disk)rom).SHA384.ToLowerInvariant() : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA512] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA512) ? " sha512 " + ((Disk)rom).SHA512.ToLowerInvariant() : "")
|
||||
+ (!ExcludeFields[(int)Field.Status] && ((Disk)rom).ItemStatus != ItemStatus.None ? " flags " + ((Disk)rom).ItemStatus.ToString().ToLowerInvariant() : "")
|
||||
+ " )\n";
|
||||
break;
|
||||
case ItemType.Release:
|
||||
state += "\trelease ( name\"" + rom.Name + "\""
|
||||
+ (!String.IsNullOrWhiteSpace(((Release)rom).Region) ? " region \"" + ((Release)rom).Region + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Release)rom).Language) ? " language \"" + ((Release)rom).Language + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Release)rom).Date) ? " date \"" + ((Release)rom).Date + "\"" : "")
|
||||
+ (((Release)rom).Default != null
|
||||
state += "\trelease ( name\"" + (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\""
|
||||
+ (!ExcludeFields[(int)Field.Region] && !String.IsNullOrWhiteSpace(((Release)rom).Region) ? " region \"" + ((Release)rom).Region + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Language] && !String.IsNullOrWhiteSpace(((Release)rom).Language) ? " language \"" + ((Release)rom).Language + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Date] && !String.IsNullOrWhiteSpace(((Release)rom).Date) ? " date \"" + ((Release)rom).Date + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Default] && ((Release)rom).Default != null
|
||||
? "default " + ((Release)rom).Default.ToString().ToLowerInvariant()
|
||||
: "")
|
||||
+ " )\n";
|
||||
break;
|
||||
case ItemType.Rom:
|
||||
state += "\trom ( name \"" + rom.Name + "\""
|
||||
+ (((Rom)rom).Size != -1 ? " size " + ((Rom)rom).Size : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).CRC) ? " crc " + ((Rom)rom).CRC.ToLowerInvariant() : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).MD5) ? " md5 " + ((Rom)rom).MD5.ToLowerInvariant() : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).SHA1) ? " sha1 " + ((Rom)rom).SHA1.ToLowerInvariant() : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).SHA256) ? " sha256 " + ((Rom)rom).SHA256.ToLowerInvariant() : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).SHA384) ? " sha384 " + ((Rom)rom).SHA384.ToLowerInvariant() : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).SHA512) ? " sha512 " + ((Rom)rom).SHA512.ToLowerInvariant() : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).Date) ? " date \"" + ((Rom)rom).Date + "\"" : "")
|
||||
+ (((Rom)rom).ItemStatus != ItemStatus.None ? " flags " + ((Rom)rom).ItemStatus.ToString().ToLowerInvariant() : "")
|
||||
state += "\trom ( name \"" + (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\""
|
||||
+ (!ExcludeFields[(int)Field.Size] && ((Rom)rom).Size != -1 ? " size " + ((Rom)rom).Size : "")
|
||||
+ (!ExcludeFields[(int)Field.CRC] && !String.IsNullOrWhiteSpace(((Rom)rom).CRC) ? " crc " + ((Rom)rom).CRC.ToLowerInvariant() : "")
|
||||
+ (!ExcludeFields[(int)Field.MD5] && !String.IsNullOrWhiteSpace(((Disk)rom).MD5) ? " md5 " + ((Disk)rom).MD5.ToLowerInvariant() : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA1] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA1) ? " sha1 " + ((Disk)rom).SHA1.ToLowerInvariant() : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA256] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA256) ? " sha256 " + ((Disk)rom).SHA256.ToLowerInvariant() : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA384] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA384) ? " sha384 " + ((Disk)rom).SHA384.ToLowerInvariant() : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA512] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA512) ? " sha512 " + ((Disk)rom).SHA512.ToLowerInvariant() : "")
|
||||
+ (!ExcludeFields[(int)Field.Date] && !String.IsNullOrWhiteSpace(((Rom)rom).Date) ? " date \"" + ((Rom)rom).Date + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Status] && ((Rom)rom).ItemStatus != ItemStatus.None ? " flags " + ((Rom)rom).ItemStatus.ToString().ToLowerInvariant() : "")
|
||||
+ " )\n";
|
||||
break;
|
||||
case ItemType.Sample:
|
||||
state += "\tsample ( name\"" + rom.Name + "\""
|
||||
state += "\tsample ( name\"" + (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\""
|
||||
+ " )\n";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -286,20 +286,7 @@ namespace SabreTools.Library.DatFiles
|
||||
_datHeader.DatFormat = value;
|
||||
}
|
||||
}
|
||||
public bool ExcludeOf
|
||||
{
|
||||
get
|
||||
{
|
||||
EnsureDatHeader();
|
||||
return _datHeader.ExcludeOf;
|
||||
}
|
||||
set
|
||||
{
|
||||
EnsureDatHeader();
|
||||
_datHeader.ExcludeOf = value;
|
||||
}
|
||||
}
|
||||
public List<Field> ExcludeFields
|
||||
public bool[] ExcludeFields
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -1364,7 +1351,7 @@ namespace SabreTools.Library.DatFiles
|
||||
DatFormat = (this.DatFormat != 0 ? this.DatFormat : 0),
|
||||
|
||||
// Filtering that needs to be copied over
|
||||
ExcludeOf = this.ExcludeOf,
|
||||
ExcludeFields = (bool[])this.ExcludeFields.Clone(),
|
||||
OneRom = this.OneRom,
|
||||
KeepEmptyGames = this.KeepEmptyGames,
|
||||
SceneDateStrip = this.SceneDateStrip,
|
||||
@@ -1439,7 +1426,7 @@ namespace SabreTools.Library.DatFiles
|
||||
DatFormat = (this.DatFormat != 0 ? this.DatFormat : 0),
|
||||
|
||||
// Filtering that needs to be copied over
|
||||
ExcludeOf = this.ExcludeOf,
|
||||
ExcludeFields = (bool[])this.ExcludeFields.Clone(),
|
||||
OneRom = this.OneRom,
|
||||
KeepEmptyGames = this.KeepEmptyGames,
|
||||
SceneDateStrip = this.SceneDateStrip,
|
||||
|
||||
@@ -31,8 +31,7 @@ namespace SabreTools.Library.DatFiles
|
||||
private ForceNodump _forceNodump;
|
||||
private ForcePacking _forcePacking;
|
||||
private DatFormat _datFormat;
|
||||
private bool _excludeOf;
|
||||
private List<Field> _excludeFields;
|
||||
private bool[] _excludeFields = new bool[Enum.GetNames(typeof(Field)).Length];
|
||||
private bool _oneRom;
|
||||
private bool _keepEmptyGames;
|
||||
private bool _sceneDateStrip;
|
||||
@@ -145,12 +144,7 @@ namespace SabreTools.Library.DatFiles
|
||||
get { return _datFormat; }
|
||||
set { _datFormat = value; }
|
||||
}
|
||||
public bool ExcludeOf
|
||||
{
|
||||
get { return _excludeOf; }
|
||||
set { _excludeOf = value; }
|
||||
}
|
||||
public List<Field> ExcludeFields
|
||||
public bool[] ExcludeFields
|
||||
{
|
||||
get { return _excludeFields; }
|
||||
set { _excludeFields = value; }
|
||||
@@ -260,7 +254,6 @@ namespace SabreTools.Library.DatFiles
|
||||
_forceNodump = this._forceNodump,
|
||||
_forcePacking = this._forcePacking,
|
||||
_datFormat = this._datFormat,
|
||||
_excludeOf = this._excludeOf,
|
||||
_excludeFields = this._excludeFields,
|
||||
_oneRom = this._oneRom,
|
||||
_keepEmptyGames = this._keepEmptyGames,
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace SabreTools.Library.DatFiles
|
||||
/// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param>
|
||||
/// <param name="clean">True if game names are sanitized, false otherwise (default)</param>
|
||||
/// <param name="remUnicode">True if we should remove non-ASCII characters from output, false otherwise (default)</param>
|
||||
/// TODO: Pull parsing into this file instead of relying on CMP
|
||||
public override void ParseFile(
|
||||
// Standard Dat parsing
|
||||
string filename,
|
||||
@@ -211,7 +212,7 @@ namespace SabreTools.Library.DatFiles
|
||||
rom.MachineName = rom.MachineName.Substring(1);
|
||||
}
|
||||
|
||||
string state = "game (\n\tname \"" + rom.MachineName + ".zip\"\n";
|
||||
string state = "game (\n\tname \"" + (!ExcludeFields[(int)Field.MachineName] ? rom.MachineName + ".zip" : "") + "\"\n";
|
||||
|
||||
sw.Write(state);
|
||||
sw.Flush();
|
||||
@@ -235,7 +236,7 @@ namespace SabreTools.Library.DatFiles
|
||||
{
|
||||
try
|
||||
{
|
||||
string state = (String.IsNullOrWhiteSpace(rom.SampleOf) ? "" : "\tsampleof \"" + rom.SampleOf + "\"\n") + ")\n";
|
||||
string state = (!ExcludeFields[(int)Field.SampleOf] && String.IsNullOrWhiteSpace(rom.SampleOf) ? "" : "\tsampleof \"" + rom.SampleOf + "\"\n") + ")\n";
|
||||
|
||||
sw.Write(state);
|
||||
sw.Flush();
|
||||
@@ -283,10 +284,10 @@ namespace SabreTools.Library.DatFiles
|
||||
// We don't output these at all for DosCenter
|
||||
break;
|
||||
case ItemType.Rom:
|
||||
state += "\tfile ( name " + ((Rom)rom).Name
|
||||
+ (((Rom)rom).Size != -1 ? " size " + ((Rom)rom).Size : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).Date) ? " date " + ((Rom)rom).Date : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).CRC) ? " crc " + ((Rom)rom).CRC.ToLowerInvariant() : "")
|
||||
state += "\tfile ( name " + (!ExcludeFields[(int)Field.Name] ? ((Rom)rom).Name : "")
|
||||
+ (!ExcludeFields[(int)Field.Size] && ((Rom)rom).Size != -1 ? " size " + ((Rom)rom).Size : "")
|
||||
+ (!ExcludeFields[(int)Field.Date] && !String.IsNullOrWhiteSpace(((Rom)rom).Date) ? " date " + ((Rom)rom).Date : "")
|
||||
+ (!ExcludeFields[(int)Field.CRC] && !String.IsNullOrWhiteSpace(((Rom)rom).CRC) ? " crc " + ((Rom)rom).CRC.ToLowerInvariant() : "")
|
||||
+ " )\n";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -208,57 +208,79 @@ namespace SabreTools.Library.DatFiles
|
||||
case Hash.MD5:
|
||||
if (rom.Type == ItemType.Rom)
|
||||
{
|
||||
state += ((Rom)rom).MD5 + " *" + (GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + rom.Name + "\n";
|
||||
state += (!ExcludeFields[(int)Field.MD5] ? ((Rom)rom).MD5 : "")
|
||||
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
|
||||
+ (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n";
|
||||
}
|
||||
else if (rom.Type == ItemType.Disk)
|
||||
{
|
||||
state += ((Disk)rom).MD5 + " *" + (GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + rom.Name + "\n";
|
||||
state += (!ExcludeFields[(int)Field.MD5] ? ((Disk)rom).MD5 : "")
|
||||
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
|
||||
+ (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n";
|
||||
}
|
||||
break;
|
||||
case Hash.CRC:
|
||||
if (rom.Type == ItemType.Rom)
|
||||
{
|
||||
state += (GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + rom.Name + " " + ((Rom)rom).CRC + "\n";
|
||||
state += (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
|
||||
+ (!ExcludeFields[(int)Field.Name] ? rom.Name : "")
|
||||
+ " " + (!ExcludeFields[(int)Field.CRC] ? ((Rom)rom).CRC : "") + "\n";
|
||||
}
|
||||
break;
|
||||
case Hash.SHA1:
|
||||
if (rom.Type == ItemType.Rom)
|
||||
{
|
||||
state += ((Rom)rom).SHA1 + " *" + (GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + rom.Name + "\n";
|
||||
state += (!ExcludeFields[(int)Field.SHA1] ? ((Rom)rom).SHA1 : "")
|
||||
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
|
||||
+ (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n";
|
||||
}
|
||||
else if (rom.Type == ItemType.Disk)
|
||||
{
|
||||
state += ((Disk)rom).SHA1 + " *" + (GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + rom.Name + "\n";
|
||||
state += (!ExcludeFields[(int)Field.SHA1] ? ((Disk)rom).SHA1 : "")
|
||||
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
|
||||
+ (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n";
|
||||
}
|
||||
break;
|
||||
case Hash.SHA256:
|
||||
if (rom.Type == ItemType.Rom)
|
||||
{
|
||||
state += ((Rom)rom).SHA256 + " *" + (GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + rom.Name + "\n";
|
||||
state += (!ExcludeFields[(int)Field.SHA256] ? ((Rom)rom).SHA256 : "")
|
||||
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
|
||||
+ (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n";
|
||||
}
|
||||
else if (rom.Type == ItemType.Disk)
|
||||
{
|
||||
state += ((Disk)rom).SHA256 + " *" + (GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + rom.Name + "\n";
|
||||
state += (!ExcludeFields[(int)Field.SHA256] ? ((Disk)rom).SHA256 : "")
|
||||
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
|
||||
+ (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n";
|
||||
}
|
||||
break;
|
||||
case Hash.SHA384:
|
||||
if (rom.Type == ItemType.Rom)
|
||||
{
|
||||
state += ((Rom)rom).SHA384 + " *" + (GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + rom.Name + "\n";
|
||||
state += (!ExcludeFields[(int)Field.SHA384] ? ((Rom)rom).SHA384 : "")
|
||||
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
|
||||
+ (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n";
|
||||
}
|
||||
else if (rom.Type == ItemType.Disk)
|
||||
{
|
||||
state += ((Disk)rom).SHA384 + " *" + (GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + rom.Name + "\n";
|
||||
state += (!ExcludeFields[(int)Field.SHA384] ? ((Disk)rom).SHA384 : "")
|
||||
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
|
||||
+ (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n";
|
||||
}
|
||||
break;
|
||||
case Hash.SHA512:
|
||||
if (rom.Type == ItemType.Rom)
|
||||
{
|
||||
state += ((Rom)rom).SHA512 + " *" + (GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + rom.Name + "\n";
|
||||
state += (!ExcludeFields[(int)Field.SHA512] ? ((Rom)rom).SHA512 : "")
|
||||
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
|
||||
+ (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n";
|
||||
}
|
||||
else if (rom.Type == ItemType.Disk)
|
||||
{
|
||||
state += ((Disk)rom).SHA512 + " *" + (GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + rom.Name + "\n";
|
||||
state += (!ExcludeFields[(int)Field.SHA512] ? ((Disk)rom).SHA512 : "")
|
||||
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
|
||||
+ (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ namespace SabreTools.Library.DatFiles
|
||||
rom.MachineName = rom.MachineName.Substring(1);
|
||||
}
|
||||
|
||||
string state = "ROMs required for driver \"" + rom.MachineName + "\".\n" +
|
||||
string state = "ROMs required for driver \"" + (!ExcludeFields[(int)Field.MachineName] ? rom.MachineName : "") + "\".\n" +
|
||||
"Name Size Checksum\n";
|
||||
|
||||
sw.Write(state);
|
||||
@@ -432,24 +432,24 @@ namespace SabreTools.Library.DatFiles
|
||||
}
|
||||
|
||||
// If we have a baddump, put the first indicator
|
||||
if (((Disk)rom).ItemStatus == ItemStatus.BadDump)
|
||||
if (!ExcludeFields[(int)Field.Status] && ((Disk)rom).ItemStatus == ItemStatus.BadDump)
|
||||
{
|
||||
state += " BAD";
|
||||
}
|
||||
|
||||
// If we have a nodump, write out the indicator
|
||||
if (((Disk)rom).ItemStatus == ItemStatus.Nodump)
|
||||
if (!ExcludeFields[(int)Field.Status] && ((Disk)rom).ItemStatus == ItemStatus.Nodump)
|
||||
{
|
||||
state += " NO GOOD DUMP KNOWN";
|
||||
}
|
||||
// Otherwise, write out the SHA-1 hash
|
||||
else
|
||||
else if (!ExcludeFields[(int)Field.SHA1])
|
||||
{
|
||||
state += " SHA1(" + ((Disk)rom).SHA1 + ")";
|
||||
}
|
||||
|
||||
// If we have a baddump, put the second indicator
|
||||
if (((Disk)rom).ItemStatus == ItemStatus.BadDump)
|
||||
if (!ExcludeFields[(int)Field.Status] && ((Disk)rom).ItemStatus == ItemStatus.BadDump)
|
||||
{
|
||||
state += " BAD_DUMP";
|
||||
}
|
||||
@@ -474,25 +474,25 @@ namespace SabreTools.Library.DatFiles
|
||||
}
|
||||
|
||||
// If we have a baddump, put the first indicator
|
||||
if (((Rom)rom).ItemStatus == ItemStatus.BadDump)
|
||||
if (!ExcludeFields[(int)Field.Status] && ((Rom)rom).ItemStatus == ItemStatus.BadDump)
|
||||
{
|
||||
state += " BAD";
|
||||
}
|
||||
|
||||
// If we have a nodump, write out the indicator
|
||||
if (((Rom)rom).ItemStatus == ItemStatus.Nodump)
|
||||
if (!ExcludeFields[(int)Field.Status] && ((Rom)rom).ItemStatus == ItemStatus.Nodump)
|
||||
{
|
||||
state += " NO GOOD DUMP KNOWN";
|
||||
}
|
||||
// Otherwise, write out the CRC and SHA-1 hashes
|
||||
else
|
||||
{
|
||||
state += " CRC(" + ((Rom)rom).CRC + ")";
|
||||
state += " SHA1(" + ((Rom)rom).SHA1 + ")";
|
||||
state += (!ExcludeFields[(int)Field.CRC] ? " CRC(" + ((Rom)rom).CRC + ")" : "");
|
||||
state += (!ExcludeFields[(int)Field.SHA1] ? " SHA1(" + ((Rom)rom).SHA1 + ")" : "");
|
||||
}
|
||||
|
||||
// If we have a baddump, put the second indicator
|
||||
if (((Rom)rom).ItemStatus == ItemStatus.BadDump)
|
||||
if (!ExcludeFields[(int)Field.Status] && ((Rom)rom).ItemStatus == ItemStatus.BadDump)
|
||||
{
|
||||
state += " BAD_DUMP";
|
||||
}
|
||||
|
||||
@@ -695,28 +695,29 @@ namespace SabreTools.Library.DatFiles
|
||||
rom.MachineName = rom.MachineName.Substring(1);
|
||||
}
|
||||
|
||||
string state = "\t<machine name=\"" + HttpUtility.HtmlEncode(rom.MachineName) + "\""
|
||||
+ (rom.SourceFile != null ? " sourcefile=\"" + rom.SourceFile + "\"" : "")
|
||||
+ ((rom.MachineType & MachineType.Bios) != 0 ? " isbios=\"yes\"" : "")
|
||||
+ ((rom.MachineType & MachineType.Device) != 0 ? " isdevice=\"yes\"" : "")
|
||||
+ ((rom.MachineType & MachineType.Mechanical) != 0 ? " ismechanical=\"yes\"" : "")
|
||||
+ (rom.Runnable == true ? " runnable=\"yes\"" : (rom.Runnable == false ? " runnable=\"no\"" : ""))
|
||||
+ (ExcludeOf ? "" :
|
||||
(String.IsNullOrWhiteSpace(rom.CloneOf) || (rom.MachineName.ToLowerInvariant() == rom.CloneOf.ToLowerInvariant())
|
||||
string state = "\t<machine name=\"" + (!ExcludeFields[(int)Field.MachineName] ? HttpUtility.HtmlEncode(rom.MachineName) : "") + "\""
|
||||
+ (!ExcludeFields[(int)Field.SourceFile] && rom.SourceFile != null ? " sourcefile=\"" + rom.SourceFile + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.MachineType] && (rom.MachineType & MachineType.Bios) != 0 ? " isbios=\"yes\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.MachineType] && (rom.MachineType & MachineType.Device) != 0 ? " isdevice=\"yes\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.MachineType] && (rom.MachineType & MachineType.Mechanical) != 0 ? " ismechanical=\"yes\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Runnable] && rom.Runnable == true
|
||||
? " runnable=\"yes\""
|
||||
: (!ExcludeFields[(int)Field.Runnable] && rom.Runnable == false ? " runnable=\"no\"" : ""))
|
||||
+ (!ExcludeFields[(int)Field.CloneOf] && String.IsNullOrWhiteSpace(rom.CloneOf) || (rom.MachineName.ToLowerInvariant() == rom.CloneOf.ToLowerInvariant())
|
||||
? ""
|
||||
: " cloneof=\"" + HttpUtility.HtmlEncode(rom.CloneOf) + "\"") +
|
||||
(String.IsNullOrWhiteSpace(rom.RomOf) || (rom.MachineName.ToLowerInvariant() == rom.RomOf.ToLowerInvariant())
|
||||
: " cloneof=\"" + HttpUtility.HtmlEncode(rom.CloneOf) + "\"")
|
||||
+ (!ExcludeFields[(int)Field.RomOf] && String.IsNullOrWhiteSpace(rom.RomOf) || (rom.MachineName.ToLowerInvariant() == rom.RomOf.ToLowerInvariant())
|
||||
? ""
|
||||
: " romof=\"" + HttpUtility.HtmlEncode(rom.RomOf) + "\"") +
|
||||
(String.IsNullOrWhiteSpace(rom.SampleOf) || (rom.MachineName.ToLowerInvariant() == rom.SampleOf.ToLowerInvariant())
|
||||
: " romof=\"" + HttpUtility.HtmlEncode(rom.RomOf) + "\"")
|
||||
+ (!ExcludeFields[(int)Field.SampleOf] && String.IsNullOrWhiteSpace(rom.SampleOf) || (rom.MachineName.ToLowerInvariant() == rom.SampleOf.ToLowerInvariant())
|
||||
? ""
|
||||
: " sampleof=\"" + HttpUtility.HtmlEncode(rom.SampleOf) + "\"")
|
||||
) + ">\n"
|
||||
+ "\t\t<description>" + HttpUtility.HtmlEncode(rom.MachineDescription) + "</description>\n"
|
||||
+ (rom.Year != null ? "\t\t<year>" + HttpUtility.HtmlEncode(rom.Year) + "</year>\n" : "")
|
||||
+ (rom.Publisher != null ? "\t\t<publisher>" + HttpUtility.HtmlEncode(rom.Publisher) + "</publisher>\n" : "");
|
||||
+ ">\n"
|
||||
+ (!ExcludeFields[(int)Field.Description] ? "\t\t<description>" + HttpUtility.HtmlEncode(rom.MachineDescription) + "</description>\n" : "")
|
||||
+ (!ExcludeFields[(int)Field.Year] && rom.Year != null ? "\t\t<year>" + HttpUtility.HtmlEncode(rom.Year) + "</year>\n" : "")
|
||||
+ (!ExcludeFields[(int)Field.Publisher] && rom.Publisher != null ? "\t\t<publisher>" + HttpUtility.HtmlEncode(rom.Publisher) + "</publisher>\n" : "");
|
||||
|
||||
if (rom.Infos != null && rom.Infos.Count > 0)
|
||||
if (!ExcludeFields[(int)Field.Infos] && rom.Infos != null && rom.Infos.Count > 0)
|
||||
{
|
||||
foreach (Tuple<string, string> kvp in rom.Infos)
|
||||
{
|
||||
@@ -787,48 +788,51 @@ namespace SabreTools.Library.DatFiles
|
||||
{
|
||||
case ItemType.Archive:
|
||||
break;
|
||||
case ItemType.BiosSet:
|
||||
state += "\t\t<biosset name\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (!String.IsNullOrWhiteSpace(((BiosSet)rom).Description) ? " description=\"" + HttpUtility.HtmlEncode(((BiosSet)rom).Description) + "\"" : "")
|
||||
+ (((BiosSet)rom).Default != null
|
||||
case ItemType.BiosSet: // TODO: Separate out MachineDescription from Description
|
||||
state += "\t\t<biosset name\"" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "\""
|
||||
+ (!ExcludeFields[(int)Field.Description] && !String.IsNullOrWhiteSpace(((BiosSet)rom).Description) ? " description=\"" + HttpUtility.HtmlEncode(((BiosSet)rom).Description) + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Default] && ((BiosSet)rom).Default != null
|
||||
? ((BiosSet)rom).Default.ToString().ToLowerInvariant()
|
||||
: "")
|
||||
+ "/>\n";
|
||||
break;
|
||||
case ItemType.Disk:
|
||||
state += "\t\t<disk name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).MD5) ? " md5=\"" + ((Disk)rom).MD5.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).SHA1) ? " sha1=\"" + ((Disk)rom).SHA1.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).SHA256) ? " sha256=\"" + ((Disk)rom).SHA256.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).SHA384) ? " sha384=\"" + ((Disk)rom).SHA384.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).SHA512) ? " sha512=\"" + ((Disk)rom).SHA512.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).MergeTag) ? " merge=\"" + ((Disk)rom).MergeTag + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).Region) ? " region=\"" + ((Disk)rom).Region + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).Index) ? " index=\"" + ((Disk)rom).Index + "\"" : "")
|
||||
+ (((Disk)rom).Writable != null ? " writable=\"" + (((Disk)rom).Writable == true ? "yes" : "no") + "\"" : "")
|
||||
+ (((Disk)rom).ItemStatus != ItemStatus.None ? " status=\"" + ((Disk)rom).ItemStatus.ToString().ToLowerInvariant() + "\"" : "")
|
||||
+ (((Disk)rom).Optional != null ? " optional=\"" + (((Disk)rom).Optional == true ? "yes" : "no") + "\"" : "")
|
||||
state += "\t\t<disk name=\"" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "\""
|
||||
+ (!ExcludeFields[(int)Field.MD5] && !String.IsNullOrWhiteSpace(((Disk)rom).MD5) ? " md5=\"" + ((Disk)rom).MD5.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA1] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA1) ? " sha1=\"" + ((Disk)rom).SHA1.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA256] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA256) ? " sha256=\"" + ((Disk)rom).SHA256.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA384] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA384) ? " sha384=\"" + ((Disk)rom).SHA384.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA512] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA512) ? " sha512=\"" + ((Disk)rom).SHA512.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Merge] && !String.IsNullOrWhiteSpace(((Disk)rom).MergeTag) ? " merge=\"" + ((Disk)rom).MergeTag + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Region] && !String.IsNullOrWhiteSpace(((Disk)rom).Region) ? " region=\"" + ((Disk)rom).Region + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Index] && !String.IsNullOrWhiteSpace(((Disk)rom).Index) ? " index=\"" + ((Disk)rom).Index + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Writable] && ((Disk)rom).Writable != null ? " writable=\"" + (((Disk)rom).Writable == true ? "yes" : "no") + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Status] && ((Disk)rom).ItemStatus != ItemStatus.None ? " status=\"" + ((Disk)rom).ItemStatus.ToString().ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Optional] && ((Disk)rom).Optional != null ? " optional=\"" + (((Disk)rom).Optional == true ? "yes" : "no") + "\"" : "")
|
||||
+ "/>\n";
|
||||
break;
|
||||
case ItemType.Release:
|
||||
//TODO: Am I missing this?
|
||||
break;
|
||||
case ItemType.Rom:
|
||||
state += "\t\t<rom name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (((Rom)rom).Size != -1 ? " size=\"" + ((Rom)rom).Size + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).CRC) ? " crc=\"" + ((Rom)rom).CRC.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).MD5) ? " md5=\"" + ((Rom)rom).MD5.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).SHA1) ? " sha1=\"" + ((Rom)rom).SHA1.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).SHA256) ? " sha256=\"" + ((Rom)rom).SHA256.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).SHA384) ? " sha384=\"" + ((Rom)rom).SHA384.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).SHA512) ? " sha512=\"" + ((Rom)rom).SHA512.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).Bios) ? " bios=\"" + ((Rom)rom).Bios + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).MergeTag) ? " merge=\"" + ((Rom)rom).MergeTag + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).Region) ? " region=\"" + ((Rom)rom).Region + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).Offset) ? " offset=\"" + ((Rom)rom).Offset + "\"" : "")
|
||||
+ (((Rom)rom).ItemStatus != ItemStatus.None ? " status=\"" + ((Rom)rom).ItemStatus.ToString().ToLowerInvariant() + "\"" : "")
|
||||
+ (((Rom)rom).Optional != null ? " optional=\"" + (((Rom)rom).Optional == true ? "yes" : "no") + "\"" : "")
|
||||
state += "\t\t<rom name=\"" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "\""
|
||||
+ (!ExcludeFields[(int)Field.Size] && ((Rom)rom).Size != -1 ? " size=\"" + ((Rom)rom).Size + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.CRC] && !String.IsNullOrWhiteSpace(((Rom)rom).CRC) ? " crc=\"" + ((Rom)rom).CRC.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.MD5] && !String.IsNullOrWhiteSpace(((Rom)rom).MD5) ? " md5=\"" + ((Rom)rom).MD5.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA1] && !String.IsNullOrWhiteSpace(((Rom)rom).SHA1) ? " sha1=\"" + ((Rom)rom).SHA1.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA256] && !String.IsNullOrWhiteSpace(((Rom)rom).SHA256) ? " sha256=\"" + ((Rom)rom).SHA256.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA384] && !String.IsNullOrWhiteSpace(((Rom)rom).SHA384) ? " sha384=\"" + ((Rom)rom).SHA384.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA512] && !String.IsNullOrWhiteSpace(((Rom)rom).SHA512) ? " sha512=\"" + ((Rom)rom).SHA512.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Bios] && !String.IsNullOrWhiteSpace(((Rom)rom).Bios) ? " bios=\"" + ((Rom)rom).Bios + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Merge] && !String.IsNullOrWhiteSpace(((Rom)rom).MergeTag) ? " merge=\"" + ((Rom)rom).MergeTag + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Region] && !String.IsNullOrWhiteSpace(((Rom)rom).Region) ? " region=\"" + ((Rom)rom).Region + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Offset] && !String.IsNullOrWhiteSpace(((Rom)rom).Offset) ? " offset=\"" + ((Rom)rom).Offset + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Status] && ((Rom)rom).ItemStatus != ItemStatus.None ? " status=\"" + ((Rom)rom).ItemStatus.ToString().ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Optional] && ((Rom)rom).Optional != null ? " optional=\"" + (((Rom)rom).Optional == true ? "yes" : "no") + "\"" : "")
|
||||
+ "/>\n";
|
||||
break;
|
||||
case ItemType.Sample:
|
||||
state += "\t\t<sample name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
state += "\t\t<sample name=\"" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "\""
|
||||
+ "/>\n";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -810,27 +810,26 @@ namespace SabreTools.Library.DatFiles
|
||||
rom.MachineName = rom.MachineName.Substring(1);
|
||||
}
|
||||
|
||||
string state = "\t<" + (_depreciated ? "game" : "machine") + " name=\"" + HttpUtility.HtmlEncode(rom.MachineName) + "\""
|
||||
+ (ExcludeOf ? "" :
|
||||
((rom.MachineType & MachineType.Bios) != 0 ? " isbios=\"yes\"" : "")
|
||||
+ ((rom.MachineType & MachineType.Device) != 0 ? " isdevice=\"yes\"" : "")
|
||||
+ ((rom.MachineType & MachineType.Mechanical) != 0 ? " ismechanical=\"yes\"" : "")
|
||||
+ (rom.Runnable == true ? " runnable=\"yes\"" : (rom.Runnable == false ? " runnable=\"no\"" : ""))
|
||||
+ (String.IsNullOrWhiteSpace(rom.CloneOf) || (rom.MachineName.ToLowerInvariant() == rom.CloneOf.ToLowerInvariant())
|
||||
? ""
|
||||
: " cloneof=\"" + HttpUtility.HtmlEncode(rom.CloneOf) + "\"")
|
||||
+ (String.IsNullOrWhiteSpace(rom.RomOf) || (rom.MachineName.ToLowerInvariant() == rom.RomOf.ToLowerInvariant())
|
||||
? ""
|
||||
: " romof=\"" + HttpUtility.HtmlEncode(rom.RomOf) + "\"")
|
||||
+ (String.IsNullOrWhiteSpace(rom.SampleOf) || (rom.MachineName.ToLowerInvariant() == rom.SampleOf.ToLowerInvariant())
|
||||
? ""
|
||||
: " sampleof=\"" + HttpUtility.HtmlEncode(rom.SampleOf) + "\"")
|
||||
) + ">\n"
|
||||
+ (String.IsNullOrWhiteSpace(rom.Comment) ? "" : "\t\t<comment>" + HttpUtility.HtmlEncode(rom.Comment) + "</comment>\n")
|
||||
+ "\t\t<description>" + HttpUtility.HtmlEncode((String.IsNullOrWhiteSpace(rom.MachineDescription) ? rom.MachineName : rom.MachineDescription)) + "</description>\n"
|
||||
+ (String.IsNullOrWhiteSpace(rom.Year) ? "" : "\t\t<year>" + HttpUtility.HtmlEncode(rom.Year) + "</year>\n")
|
||||
+ (String.IsNullOrWhiteSpace(rom.Publisher) ? "" : "\t\t<publisher>" + HttpUtility.HtmlEncode(rom.Publisher) + "</publisher>\n")
|
||||
+ (String.IsNullOrWhiteSpace(rom.Manufacturer) ? "" : "\t\t<manufacturer>" + HttpUtility.HtmlEncode(rom.Manufacturer) + "</manufacturer>\n");
|
||||
string state = "\t<" + (_depreciated ? "game" : "machine") + " name=\"" + (!ExcludeFields[(int)Field.MachineName] ? HttpUtility.HtmlEncode(rom.MachineName) : "") + "\""
|
||||
+ (!ExcludeFields[(int)Field.MachineType] && (rom.MachineType & MachineType.Bios) != 0 ? " isbios=\"yes\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.MachineType] && (rom.MachineType & MachineType.Device) != 0 ? " isdevice=\"yes\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.MachineType] && (rom.MachineType & MachineType.Mechanical) != 0 ? " ismechanical=\"yes\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Runnable] && rom.Runnable == true ? " runnable=\"yes\"" : (rom.Runnable == false ? " runnable=\"no\"" : ""))
|
||||
+ (!ExcludeFields[(int)Field.CloneOf] && !String.IsNullOrWhiteSpace(rom.CloneOf) && (rom.MachineName.ToLowerInvariant() != rom.CloneOf.ToLowerInvariant())
|
||||
? " cloneof=\"" + HttpUtility.HtmlEncode(rom.CloneOf) + "\""
|
||||
: "")
|
||||
+ (!ExcludeFields[(int)Field.RomOf] && !String.IsNullOrWhiteSpace(rom.RomOf) && (rom.MachineName.ToLowerInvariant() != rom.RomOf.ToLowerInvariant())
|
||||
? " romof=\"" + HttpUtility.HtmlEncode(rom.RomOf) + "\""
|
||||
: "")
|
||||
+ (!ExcludeFields[(int)Field.SampleOf] && !String.IsNullOrWhiteSpace(rom.SampleOf) && (rom.MachineName.ToLowerInvariant() != rom.SampleOf.ToLowerInvariant())
|
||||
? " sampleof=\"" + HttpUtility.HtmlEncode(rom.SampleOf) + "\""
|
||||
: "")
|
||||
+ ">\n"
|
||||
+ (!ExcludeFields[(int)Field.Comment] && !String.IsNullOrWhiteSpace(rom.Comment) ? "\t\t<comment>" + HttpUtility.HtmlEncode(rom.Comment) + "</comment>\n" : "")
|
||||
+ (!ExcludeFields[(int)Field.Description] ? "\t\t<description>" + HttpUtility.HtmlEncode((String.IsNullOrWhiteSpace(rom.MachineDescription) ? rom.MachineName : rom.MachineDescription)) + "</description>\n" : "")
|
||||
+ (!ExcludeFields[(int)Field.Year] && !String.IsNullOrWhiteSpace(rom.Year) ? "\t\t<year>" + HttpUtility.HtmlEncode(rom.Year) + "</year>\n" : "")
|
||||
+ (!ExcludeFields[(int)Field.Publisher] && !String.IsNullOrWhiteSpace(rom.Publisher) ? "\t\t<publisher>" + HttpUtility.HtmlEncode(rom.Publisher) + "</publisher>\n" : "")
|
||||
+ (!ExcludeFields[(int)Field.Manufacturer] && !String.IsNullOrWhiteSpace(rom.Manufacturer) ? "\t\t<manufacturer>" + HttpUtility.HtmlEncode(rom.Manufacturer) + "</manufacturer>\n" : "");
|
||||
|
||||
sw.Write(state);
|
||||
sw.Flush();
|
||||
@@ -894,52 +893,52 @@ namespace SabreTools.Library.DatFiles
|
||||
switch (rom.Type)
|
||||
{
|
||||
case ItemType.Archive:
|
||||
state += "\t\t<archive name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
state += "\t\t<archive name=\"" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "\""
|
||||
+ "/>\n";
|
||||
break;
|
||||
case ItemType.BiosSet:
|
||||
state += "\t\t<biosset name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (!String.IsNullOrWhiteSpace(((BiosSet)rom).Description) ? " description=\"" + HttpUtility.HtmlEncode(((BiosSet)rom).Description) + "\"" : "")
|
||||
+ (((BiosSet)rom).Default != null
|
||||
state += "\t\t<biosset name=\"" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "\""
|
||||
+ (!ExcludeFields[(int)Field.Description] && !String.IsNullOrWhiteSpace(((BiosSet)rom).Description) ? " description=\"" + HttpUtility.HtmlEncode(((BiosSet)rom).Description) + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Default] && ((BiosSet)rom).Default != null
|
||||
? ((BiosSet)rom).Default.ToString().ToLowerInvariant()
|
||||
: "")
|
||||
+ "/>\n";
|
||||
break;
|
||||
case ItemType.Disk:
|
||||
state += "\t\t<disk name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).MD5) ? " md5=\"" + ((Disk)rom).MD5.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).SHA1) ? " sha1=\"" + ((Disk)rom).SHA1.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).SHA256) ? " sha256=\"" + ((Disk)rom).SHA256.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).SHA384) ? " sha384=\"" + ((Disk)rom).SHA384.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).SHA512) ? " sha512=\"" + ((Disk)rom).SHA512.ToLowerInvariant() + "\"" : "")
|
||||
+ (((Disk)rom).ItemStatus != ItemStatus.None ? " status=\"" + ((Disk)rom).ItemStatus.ToString().ToLowerInvariant() + "\"" : "")
|
||||
state += "\t\t<disk name=\"" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "\""
|
||||
+ (!ExcludeFields[(int)Field.MD5] && !String.IsNullOrWhiteSpace(((Disk)rom).MD5) ? " md5=\"" + ((Disk)rom).MD5.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA1] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA1) ? " sha1=\"" + ((Disk)rom).SHA1.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA256] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA256) ? " sha256=\"" + ((Disk)rom).SHA256.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA384] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA384) ? " sha384=\"" + ((Disk)rom).SHA384.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA512] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA512) ? " sha512=\"" + ((Disk)rom).SHA512.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Status] && ((Disk)rom).ItemStatus != ItemStatus.None ? " status=\"" + ((Disk)rom).ItemStatus.ToString().ToLowerInvariant() + "\"" : "")
|
||||
+ "/>\n";
|
||||
break;
|
||||
case ItemType.Release:
|
||||
state += "\t\t<release name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (!String.IsNullOrWhiteSpace(((Release)rom).Region) ? " region=\"" + HttpUtility.HtmlEncode(((Release)rom).Region) + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Release)rom).Language) ? " language=\"" + HttpUtility.HtmlEncode(((Release)rom).Language) + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Release)rom).Date) ? " date=\"" + HttpUtility.HtmlEncode(((Release)rom).Date) + "\"" : "")
|
||||
+ (((Release)rom).Default != null
|
||||
state += "\t\t<release name=\"" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "\""
|
||||
+ (!ExcludeFields[(int)Field.Region] && !String.IsNullOrWhiteSpace(((Release)rom).Region) ? " region=\"" + HttpUtility.HtmlEncode(((Release)rom).Region) + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Language] && !String.IsNullOrWhiteSpace(((Release)rom).Language) ? " language=\"" + HttpUtility.HtmlEncode(((Release)rom).Language) + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Date] && !String.IsNullOrWhiteSpace(((Release)rom).Date) ? " date=\"" + HttpUtility.HtmlEncode(((Release)rom).Date) + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Default] && ((Release)rom).Default != null
|
||||
? ((Release)rom).Default.ToString().ToLowerInvariant()
|
||||
: "")
|
||||
+ "/>\n";
|
||||
break;
|
||||
case ItemType.Rom:
|
||||
state += "\t\t<rom name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (((Rom)rom).Size != -1 ? " size=\"" + ((Rom)rom).Size + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).CRC) ? " crc=\"" + ((Rom)rom).CRC.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).MD5) ? " md5=\"" + ((Rom)rom).MD5.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).SHA1) ? " sha1=\"" + ((Rom)rom).SHA1.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).SHA256) ? " sha256=\"" + ((Rom)rom).SHA256.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).SHA384) ? " sha384=\"" + ((Rom)rom).SHA384.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).SHA512) ? " sha512=\"" + ((Rom)rom).SHA512.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).Date) ? " date=\"" + ((Rom)rom).Date + "\"" : "")
|
||||
+ (((Rom)rom).ItemStatus != ItemStatus.None ? " status=\"" + ((Rom)rom).ItemStatus.ToString().ToLowerInvariant() + "\"" : "")
|
||||
state += "\t\t<rom name=\"" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "\""
|
||||
+ (!ExcludeFields[(int)Field.Size] && ((Rom)rom).Size != -1 ? " size=\"" + ((Rom)rom).Size + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.CRC] && !String.IsNullOrWhiteSpace(((Rom)rom).CRC) ? " crc=\"" + ((Rom)rom).CRC.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.MD5] && !String.IsNullOrWhiteSpace(((Rom)rom).MD5) ? " md5=\"" + ((Rom)rom).MD5.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA1] && !String.IsNullOrWhiteSpace(((Rom)rom).SHA1) ? " sha1=\"" + ((Rom)rom).SHA1.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA256] && !String.IsNullOrWhiteSpace(((Rom)rom).SHA256) ? " sha256=\"" + ((Rom)rom).SHA256.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA384] && !String.IsNullOrWhiteSpace(((Rom)rom).SHA384) ? " sha384=\"" + ((Rom)rom).SHA384.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA512] && !String.IsNullOrWhiteSpace(((Rom)rom).SHA512) ? " sha512=\"" + ((Rom)rom).SHA512.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Date] && !String.IsNullOrWhiteSpace(((Rom)rom).Date) ? " date=\"" + ((Rom)rom).Date + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Status] && ((Rom)rom).ItemStatus != ItemStatus.None ? " status=\"" + ((Rom)rom).ItemStatus.ToString().ToLowerInvariant() + "\"" : "")
|
||||
+ "/>\n";
|
||||
break;
|
||||
case ItemType.Sample:
|
||||
state += "\t\t<sample name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
state += "\t\t<sample name=\"" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "\""
|
||||
+ "/>\n";
|
||||
break;
|
||||
}
|
||||
@@ -965,7 +964,7 @@ namespace SabreTools.Library.DatFiles
|
||||
{
|
||||
try
|
||||
{
|
||||
string footer = "\t</machine>\n</datafile>\n";
|
||||
string footer = "\t</" + (_depreciated ? "game" : "machine") + ">\n</datafile>\n";
|
||||
|
||||
// Write the footer out
|
||||
sw.Write(footer);
|
||||
|
||||
@@ -162,19 +162,19 @@ namespace SabreTools.Library.DatFiles
|
||||
// If we're in Romba mode, the state is consistent
|
||||
if (Romba)
|
||||
{
|
||||
state += rom.Name + "\n";
|
||||
state += (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n";
|
||||
}
|
||||
// Otherwise, use any flags
|
||||
else
|
||||
{
|
||||
if (!UseRomName && rom.MachineName != lastgame)
|
||||
{
|
||||
state += rom.Name + "\n";
|
||||
state += (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n";
|
||||
lastgame = rom.MachineName;
|
||||
}
|
||||
else if (UseRomName)
|
||||
{
|
||||
state += rom.Name + "\n";
|
||||
state += (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -961,12 +961,12 @@ namespace SabreTools.Library.DatFiles
|
||||
state += "\t\t<game>\n"
|
||||
+ "\t\t\t<imageNumber>1</imageNumber>\n"
|
||||
+ "\t\t\t<releaseNumber>1</releaseNumber>\n"
|
||||
+ "\t\t\t<title>" + HttpUtility.HtmlEncode(rom.Name) + "</title>\n"
|
||||
+ "\t\t\t<title>" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "</title>\n"
|
||||
+ "\t\t\t<saveType>None</saveType>\n";
|
||||
|
||||
if (rom.Type == ItemType.Rom)
|
||||
{
|
||||
state += "\t\t\t<romSize>" + ((Rom)rom).Size + "</romSize>\n";
|
||||
state += "\t\t\t<romSize>" + (!ExcludeFields[(int)Field.Size] ? ((Rom)rom).Size.ToString() : "") + "</romSize>\n";
|
||||
}
|
||||
|
||||
state += "\t\t\t<publisher>None</publisher>\n"
|
||||
@@ -978,8 +978,8 @@ namespace SabreTools.Library.DatFiles
|
||||
{
|
||||
state += "\t\t\t<files>\n"
|
||||
+ (((Disk)rom).MD5 != null
|
||||
? "\t\t\t\t<romMD5 extension=\".chd\">" + ((Disk)rom).MD5.ToUpperInvariant() + "</romMD5>\n"
|
||||
: "\t\t\t\t<romSHA1 extension=\".chd\">" + ((Disk)rom).SHA1.ToUpperInvariant() + "</romSHA1>\n")
|
||||
? "\t\t\t\t<romMD5 extension=\".chd\">" + (!ExcludeFields[(int)Field.MD5] ? ((Disk)rom).MD5.ToUpperInvariant() : "") + "</romMD5>\n"
|
||||
: "\t\t\t\t<romSHA1 extension=\".chd\">" + (!ExcludeFields[(int)Field.SHA1] ? ((Disk)rom).SHA1.ToUpperInvariant() : "") + "</romSHA1>\n")
|
||||
+ "\t\t\t</files>\n";
|
||||
}
|
||||
else if (rom.Type == ItemType.Rom)
|
||||
@@ -988,10 +988,10 @@ namespace SabreTools.Library.DatFiles
|
||||
|
||||
state += "\t\t\t<files>\n"
|
||||
+ (((Rom)rom).CRC != null
|
||||
? "\t\t\t\t<romCRC extension=\"" + tempext + "\">" + ((Rom)rom).CRC.ToUpperInvariant() + "</romMD5>\n"
|
||||
? "\t\t\t\t<romCRC extension=\"" + tempext + "\">" + (!ExcludeFields[(int)Field.CRC] ? ((Rom)rom).CRC.ToUpperInvariant() : "") + "</romCRC>\n"
|
||||
: ((Rom)rom).MD5 != null
|
||||
? "\t\t\t\t<romMD5 extension=\"" + tempext + "\">" + ((Rom)rom).MD5.ToUpperInvariant() + "</romMD5>\n"
|
||||
: "\t\t\t\t<romSHA1 extension=\"" + tempext + "\">" + ((Rom)rom).SHA1.ToUpperInvariant() + "</romSHA1>\n")
|
||||
? "\t\t\t\t<romMD5 extension=\"" + tempext + "\">" + (!ExcludeFields[(int)Field.MD5] ? ((Rom)rom).MD5.ToUpperInvariant() : "") + "</romMD5>\n"
|
||||
: "\t\t\t\t<romSHA1 extension=\"" + tempext + "\">" + (!ExcludeFields[(int)Field.SHA1] ? ((Rom)rom).SHA1.ToUpperInvariant() : "") + "</romSHA1>\n")
|
||||
+ "\t\t\t</files>\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -662,12 +662,12 @@ Generation MSXIDs by www.generation-msx.nl
|
||||
}
|
||||
|
||||
string state = "<software>\n"
|
||||
+ "\t<title>" + HttpUtility.HtmlEncode(rom.MachineName) + "</title>\n"
|
||||
+ "\t<title>" + (!ExcludeFields[(int)Field.MachineName] ? HttpUtility.HtmlEncode(rom.MachineName) : "") + "</title>\n"
|
||||
// + "\t<genmsxid>" + msxid + "</genmsxid>\n"
|
||||
// + "\t<system>" + system + "</system>\n"
|
||||
+ "\t<company>" + rom.Manufacturer + "</company>\n"
|
||||
+ "\t<year>" + rom.Year + "</year>\n";
|
||||
// + "\t<country>" + rom.Year + "</country>\n";
|
||||
+ "\t<company>" + (!ExcludeFields[(int)Field.Manufacturer] ? rom.Manufacturer : "") + "</company>\n"
|
||||
+ "\t<year>" + (!ExcludeFields[(int)Field.Year] ? rom.Year : "") + "</year>\n";
|
||||
// + "\t<country>" + country + "</country>\n";
|
||||
|
||||
sw.Write(state);
|
||||
sw.Flush();
|
||||
@@ -742,9 +742,9 @@ Generation MSXIDs by www.generation-msx.nl
|
||||
state += "\t\t<dump>"
|
||||
// + "<original value=\"true\">GoodMSX</original>"
|
||||
+ "<rom>"
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).Offset) ? "<start>" + ((Rom)rom).Offset + "</start>" : "")
|
||||
+ (!ExcludeFields[(int)Field.Offset] && !String.IsNullOrWhiteSpace(((Rom)rom).Offset) ? "<start>" + ((Rom)rom).Offset + "</start>" : "")
|
||||
// + "<type>Normal</type>"
|
||||
+ "<hash>" + ((Rom)rom).SHA1 + "</hash>"
|
||||
+ "<hash>" + (!ExcludeFields[(int)Field.SHA1] ? ((Rom)rom).SHA1 : "") + "</hash>"
|
||||
// + "<remark></remark>"
|
||||
+ "</rom></dump>\n";
|
||||
break;
|
||||
|
||||
@@ -345,21 +345,21 @@ namespace SabreTools.Library.DatFiles
|
||||
|
||||
if (rom.Type == ItemType.Rom)
|
||||
{
|
||||
state += "¬" + (String.IsNullOrWhiteSpace(rom.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.CloneOf)) +
|
||||
"¬" + (String.IsNullOrWhiteSpace(rom.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.CloneOf)) +
|
||||
"¬" + HttpUtility.HtmlEncode(rom.MachineName) +
|
||||
"¬" + HttpUtility.HtmlEncode((String.IsNullOrWhiteSpace(rom.MachineDescription) ? rom.MachineName : rom.MachineDescription)) +
|
||||
"¬" + HttpUtility.HtmlEncode(rom.Name) +
|
||||
"¬" + ((Rom)rom).CRC.ToLowerInvariant() +
|
||||
"¬" + (((Rom)rom).Size != -1 ? ((Rom)rom).Size.ToString() : "") + "¬¬¬\n";
|
||||
state += "¬" + (!ExcludeFields[(int)Field.CloneOf] && String.IsNullOrWhiteSpace(rom.CloneOf) ? HttpUtility.HtmlEncode(rom.CloneOf) : "") +
|
||||
"¬" + (!ExcludeFields[(int)Field.CloneOf] && String.IsNullOrWhiteSpace(rom.CloneOf) ? HttpUtility.HtmlEncode(rom.CloneOf) : "") +
|
||||
"¬" + (!ExcludeFields[(int)Field.MachineName] ? HttpUtility.HtmlEncode(rom.MachineName) : "") +
|
||||
"¬" + (!ExcludeFields[(int)Field.Description] ? HttpUtility.HtmlEncode((String.IsNullOrWhiteSpace(rom.MachineDescription) ? rom.MachineName : rom.MachineDescription)) : "") +
|
||||
"¬" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") +
|
||||
"¬" + (!ExcludeFields[(int)Field.CRC] ? ((Rom)rom).CRC.ToLowerInvariant() : "") +
|
||||
"¬" + (!ExcludeFields[(int)Field.Size] && ((Rom)rom).Size != -1 ? ((Rom)rom).Size.ToString() : "") + "¬¬¬\n";
|
||||
}
|
||||
else if (rom.Type == ItemType.Disk)
|
||||
{
|
||||
state += "¬" + (String.IsNullOrWhiteSpace(rom.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.CloneOf)) +
|
||||
"¬" + (String.IsNullOrWhiteSpace(rom.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.CloneOf)) +
|
||||
"¬" + HttpUtility.HtmlEncode(rom.MachineName) +
|
||||
"¬" + HttpUtility.HtmlEncode((String.IsNullOrWhiteSpace(rom.MachineDescription) ? rom.MachineName : rom.MachineDescription)) +
|
||||
"¬" + HttpUtility.HtmlEncode(rom.Name) +
|
||||
state += "¬" + (!ExcludeFields[(int)Field.CloneOf] && String.IsNullOrWhiteSpace(rom.CloneOf) ? HttpUtility.HtmlEncode(rom.CloneOf) : "") +
|
||||
"¬" + (!ExcludeFields[(int)Field.CloneOf] && String.IsNullOrWhiteSpace(rom.CloneOf) ? HttpUtility.HtmlEncode(rom.CloneOf) : "") +
|
||||
"¬" + (!ExcludeFields[(int)Field.MachineName] ? HttpUtility.HtmlEncode(rom.MachineName) : "") +
|
||||
"¬" + (!ExcludeFields[(int)Field.Description] ? HttpUtility.HtmlEncode((String.IsNullOrWhiteSpace(rom.MachineDescription) ? rom.MachineName : rom.MachineDescription)) : "") +
|
||||
"¬" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") +
|
||||
"¬¬¬¬¬\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -727,7 +727,7 @@ namespace SabreTools.Library.DatFiles
|
||||
{
|
||||
state += "\t";
|
||||
}
|
||||
state += "<directory name=\"" + HttpUtility.HtmlEncode(newsplit[i]) + "\" description=\"" +
|
||||
state += "<directory name=\"" + (!ExcludeFields[(int)Field.MachineName] ? HttpUtility.HtmlEncode(newsplit[i]) : "") + "\" description=\"" +
|
||||
HttpUtility.HtmlEncode(newsplit[i]) + "\">\n";
|
||||
}
|
||||
depth = depth - (last == -1 ? 0 : last) + newsplit.Count;
|
||||
@@ -835,56 +835,56 @@ namespace SabreTools.Library.DatFiles
|
||||
switch (rom.Type)
|
||||
{
|
||||
case ItemType.Archive:
|
||||
state += "<file type=\"archive\" name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
state += "<file type=\"archive\" name=\"" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "\""
|
||||
+ "/>\n";
|
||||
break;
|
||||
case ItemType.BiosSet:
|
||||
state += "<file type=\"biosset\" name\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (!String.IsNullOrWhiteSpace(((BiosSet)rom).Description) ? " description=\"" + HttpUtility.HtmlEncode(((BiosSet)rom).Description) + "\"" : "")
|
||||
+ (((BiosSet)rom).Default != null
|
||||
state += "<file type=\"biosset\" name\"" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "\""
|
||||
+ (!ExcludeFields[(int)Field.Description] && !String.IsNullOrWhiteSpace(((BiosSet)rom).Description) ? " description=\"" + HttpUtility.HtmlEncode(((BiosSet)rom).Description) + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Default] && ((BiosSet)rom).Default != null
|
||||
? ((BiosSet)rom).Default.ToString().ToLowerInvariant()
|
||||
: "")
|
||||
+ "/>\n";
|
||||
break;
|
||||
case ItemType.Disk:
|
||||
state += "<file type=\"disk\" name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).MD5) ? " md5=\"" + ((Disk)rom).MD5.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).SHA1) ? " sha1=\"" + ((Disk)rom).SHA1.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).SHA256) ? " sha256=\"" + ((Disk)rom).SHA256.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).SHA384) ? " sha384=\"" + ((Disk)rom).SHA384.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).SHA512) ? " sha512=\"" + ((Disk)rom).SHA512.ToLowerInvariant() + "\"" : "")
|
||||
+ (((Disk)rom).ItemStatus != ItemStatus.None ? prefix + "/>\n" + prefix + "\t<flags>\n" +
|
||||
state += "<file type=\"disk\" name=\"" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "\""
|
||||
+ (!ExcludeFields[(int)Field.MD5] && !String.IsNullOrWhiteSpace(((Disk)rom).MD5) ? " md5=\"" + ((Disk)rom).MD5.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA1] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA1) ? " sha1=\"" + ((Disk)rom).SHA1.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA256] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA256) ? " sha256=\"" + ((Disk)rom).SHA256.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA384] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA384) ? " sha384=\"" + ((Disk)rom).SHA384.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA512] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA512) ? " sha512=\"" + ((Disk)rom).SHA512.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Status] && ((Disk)rom).ItemStatus != ItemStatus.None ? prefix + "/>\n" + prefix + "\t<flags>\n" +
|
||||
prefix + "\t\t<flag name=\"status\" value=\"" + ((Disk)rom).ItemStatus.ToString().ToLowerInvariant() + "\"/>\n" +
|
||||
prefix + "\t</flags>\n" +
|
||||
prefix + "</file>\n" : "/>\n");
|
||||
break;
|
||||
case ItemType.Release:
|
||||
state += "<file type=\"release\" name\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (!String.IsNullOrWhiteSpace(((Release)rom).Region) ? " region=\"" + HttpUtility.HtmlEncode(((Release)rom).Region) + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Release)rom).Language) ? " language=\"" + HttpUtility.HtmlEncode(((Release)rom).Language) + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Release)rom).Date) ? " date=\"" + HttpUtility.HtmlEncode(((Release)rom).Date) + "\"" : "")
|
||||
+ (((Release)rom).Default != null
|
||||
state += "<file type=\"release\" name\"" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "\""
|
||||
+ (!ExcludeFields[(int)Field.Region] && !String.IsNullOrWhiteSpace(((Release)rom).Region) ? " region=\"" + HttpUtility.HtmlEncode(((Release)rom).Region) + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Language] && !String.IsNullOrWhiteSpace(((Release)rom).Language) ? " language=\"" + HttpUtility.HtmlEncode(((Release)rom).Language) + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Date] && !String.IsNullOrWhiteSpace(((Release)rom).Date) ? " date=\"" + HttpUtility.HtmlEncode(((Release)rom).Date) + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Default] && ((Release)rom).Default != null
|
||||
? ((Release)rom).Default.ToString().ToLowerInvariant()
|
||||
: "")
|
||||
+ "/>\n";
|
||||
break;
|
||||
case ItemType.Rom:
|
||||
state += "<file type=\"rom\" name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (((Rom)rom).Size != -1 ? " size=\"" + ((Rom)rom).Size + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).CRC) ? " crc=\"" + ((Rom)rom).CRC.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).MD5) ? " md5=\"" + ((Rom)rom).MD5.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).SHA1) ? " sha1=\"" + ((Rom)rom).SHA1.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).SHA256) ? " sha256=\"" + ((Rom)rom).SHA256.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).SHA384) ? " sha384=\"" + ((Rom)rom).SHA384.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).SHA512) ? " sha512=\"" + ((Rom)rom).SHA512.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).Date) ? " date=\"" + ((Rom)rom).Date + "\"" : "")
|
||||
+ (((Rom)rom).ItemStatus != ItemStatus.None ? prefix + "/>\n" + prefix + "\t<flags>\n" +
|
||||
state += "<file type=\"rom\" name=\"" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "\""
|
||||
+ (!ExcludeFields[(int)Field.Size] && ((Rom)rom).Size != -1 ? " size=\"" + ((Rom)rom).Size + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.CRC] && !String.IsNullOrWhiteSpace(((Rom)rom).CRC) ? " crc=\"" + ((Rom)rom).CRC.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.MD5] && !String.IsNullOrWhiteSpace(((Rom)rom).MD5) ? " md5=\"" + ((Rom)rom).MD5.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA1] && !String.IsNullOrWhiteSpace(((Rom)rom).SHA1) ? " sha1=\"" + ((Rom)rom).SHA1.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA256] && !String.IsNullOrWhiteSpace(((Rom)rom).SHA256) ? " sha256=\"" + ((Rom)rom).SHA256.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA384] && !String.IsNullOrWhiteSpace(((Rom)rom).SHA384) ? " sha384=\"" + ((Rom)rom).SHA384.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA512] && !String.IsNullOrWhiteSpace(((Rom)rom).SHA512) ? " sha512=\"" + ((Rom)rom).SHA512.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Date] && !String.IsNullOrWhiteSpace(((Rom)rom).Date) ? " date=\"" + ((Rom)rom).Date + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Status] && ((Rom)rom).ItemStatus != ItemStatus.None ? prefix + "/>\n" + prefix + "\t<flags>\n" +
|
||||
prefix + "\t\t<flag name=\"status\" value=\"" + ((Rom)rom).ItemStatus.ToString().ToLowerInvariant() + "\"/>\n" +
|
||||
prefix + "\t</flags>\n" +
|
||||
prefix + "</file>\n" : "/>\n");
|
||||
break;
|
||||
case ItemType.Sample:
|
||||
state += "<file type=\"sample\" name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
state += "<file type=\"sample\" name=\"" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "\""
|
||||
+ "/>\n";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -502,18 +502,18 @@ namespace SabreTools.Library.DatFiles
|
||||
string inline = string.Format("\"" + FileName + "\""
|
||||
+ "{0}\"" + Name + "\""
|
||||
+ "{0}\"" + Description + "\""
|
||||
+ "{0}\"" + rom.MachineName + "\""
|
||||
+ "{0}\"" + rom.MachineDescription + "\""
|
||||
+ "{0}\"" + (!ExcludeFields[(int)Field.MachineName] ? rom.MachineName : "") + "\""
|
||||
+ "{0}\"" + (!ExcludeFields[(int)Field.Description] ? rom.MachineDescription : "") + "\""
|
||||
+ "{0}\"" + type + "\""
|
||||
+ "{0}\"" + romname + "\""
|
||||
+ "{0}\"" + diskname + "\""
|
||||
+ "{0}\"" + size + "\""
|
||||
+ "{0}\"" + crc + "\""
|
||||
+ "{0}\"" + md5 + "\""
|
||||
+ "{0}\"" + sha1 + "\""
|
||||
+ "{0}\"" + sha256 + "\""
|
||||
// + "{0}\"" + sha384 + "\""
|
||||
// + "{0}\"" + sha512 + "\""
|
||||
+ "{0}\"" + (!ExcludeFields[(int)Field.Name] ? romname : "") + "\""
|
||||
+ "{0}\"" + (!ExcludeFields[(int)Field.Name] ? diskname : "") + "\""
|
||||
+ "{0}\"" + (!ExcludeFields[(int)Field.Size] ? size : "") + "\""
|
||||
+ "{0}\"" + (!ExcludeFields[(int)Field.CRC] ? crc : "") + "\""
|
||||
+ "{0}\"" + (!ExcludeFields[(int)Field.MD5] ? md5 : "") + "\""
|
||||
+ "{0}\"" + (!ExcludeFields[(int)Field.SHA1] ? sha1 : "") + "\""
|
||||
+ "{0}\"" + (!ExcludeFields[(int)Field.SHA256] ? sha256 : "") + "\""
|
||||
// + "{0}\"" + (!ExcludeFields[(int)Field.SHA384] ? sha384 : "") + "\""
|
||||
// + "{0}\"" + (!ExcludeFields[(int)Field.SHA512] ? sha512 : "") + "\""
|
||||
+ "{0}" + status, _delim);
|
||||
state += pre + inline + post + "\n";
|
||||
|
||||
|
||||
@@ -711,21 +711,21 @@ namespace SabreTools.Library.DatFiles
|
||||
rom.MachineName = rom.MachineName.Substring(1);
|
||||
}
|
||||
|
||||
string state = "\t<software name=\"" + HttpUtility.HtmlEncode(rom.MachineName) + "\""
|
||||
+ (ExcludeOf ? "" :
|
||||
(String.IsNullOrWhiteSpace(rom.CloneOf) || (rom.MachineName.ToLowerInvariant() == rom.CloneOf.ToLowerInvariant())
|
||||
? ""
|
||||
: " cloneof=\"" + HttpUtility.HtmlEncode(rom.CloneOf) + "\"")
|
||||
)
|
||||
+ " supported=\"" + (rom.Supported == true ? "yes" : rom.Supported == false ? "no" : "partial") + "\">\n"
|
||||
+ "\t\t<description>" + HttpUtility.HtmlEncode(rom.MachineDescription) + "</description>\n"
|
||||
+ (rom.Year != null ? "\t\t<year>" + HttpUtility.HtmlEncode(rom.Year) + "</year>\n" : "")
|
||||
+ (rom.Publisher != null ? "\t\t<publisher>" + HttpUtility.HtmlEncode(rom.Publisher) + "</publisher>\n" : "");
|
||||
string state = "\t<software name=\"" + (!ExcludeFields[(int)Field.MachineName] ? HttpUtility.HtmlEncode(rom.MachineName) : "") + "\""
|
||||
+ (!ExcludeFields[(int)Field.CloneOf] && !String.IsNullOrWhiteSpace(rom.CloneOf) && (rom.MachineName.ToLowerInvariant() != rom.CloneOf.ToLowerInvariant())
|
||||
? " cloneof=\"" + HttpUtility.HtmlEncode(rom.CloneOf) + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Supported] ? " supported=\"" + (rom.Supported == true ? "yes" : rom.Supported == false ? "no" : "partial") + "\">\n" : "")
|
||||
+ (!ExcludeFields[(int)Field.Description] ? "\t\t<description>" + HttpUtility.HtmlEncode(rom.MachineDescription) + "</description>\n" : "")
|
||||
+ (!ExcludeFields[(int)Field.Year] && rom.Year != null ? "\t\t<year>" + HttpUtility.HtmlEncode(rom.Year) + "</year>\n" : "")
|
||||
+ (!ExcludeFields[(int)Field.Publisher] && rom.Publisher != null ? "\t\t<publisher>" + HttpUtility.HtmlEncode(rom.Publisher) + "</publisher>\n" : "");
|
||||
|
||||
if (!ExcludeFields[(int)Field.Infos])
|
||||
{
|
||||
foreach (Tuple<string, string> kvp in rom.Infos)
|
||||
{
|
||||
state += "\t\t<info name=\"" + HttpUtility.HtmlEncode(kvp.Item1) + "\" value=\"" + HttpUtility.HtmlEncode(kvp.Item2) + "\" />\n";
|
||||
}
|
||||
}
|
||||
|
||||
sw.Write(state);
|
||||
sw.Flush();
|
||||
@@ -786,44 +786,48 @@ namespace SabreTools.Library.DatFiles
|
||||
// Pre-process the item name
|
||||
ProcessItemName(rom, true);
|
||||
|
||||
state += "\t\t<part name=\"" + rom.PartName + "\" interface=\"" + rom.PartInterface + "\">\n";
|
||||
state += "\t\t<part name=\"" + (!ExcludeFields[(int)Field.PartName] ? rom.PartName : "") + "\" interface=\""
|
||||
+ (!ExcludeFields[(int)Field.PartInterface] ? rom.PartInterface : "") + "\">\n";
|
||||
|
||||
if (!ExcludeFields[(int)Field.Features])
|
||||
{
|
||||
foreach (Tuple<string, string> kvp in rom.Features)
|
||||
{
|
||||
state += "\t\t\t<feature name=\"" + HttpUtility.HtmlEncode(kvp.Item1) + "\" value=\"" + HttpUtility.HtmlEncode(kvp.Item2) + "\"/>\n";
|
||||
}
|
||||
}
|
||||
|
||||
switch (rom.Type)
|
||||
{
|
||||
case ItemType.Disk:
|
||||
state += "\t\t\t<diskarea name=\"" + (String.IsNullOrWhiteSpace(rom.AreaName) ? "cdrom" : rom.AreaName) + "\""
|
||||
+ (rom.AreaSize != null ? " size=\"" + rom.AreaSize + "\"" : "") + ">\n"
|
||||
+ "\t\t\t\t<disk name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).MD5) ? " md5=\"" + ((Disk)rom).MD5.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).SHA1) ? " sha1=\"" + ((Disk)rom).SHA1.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).SHA256) ? " sha256=\"" + ((Disk)rom).SHA256.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).SHA384) ? " sha384=\"" + ((Disk)rom).SHA384.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Disk)rom).SHA512) ? " sha512=\"" + ((Disk)rom).SHA512.ToLowerInvariant() + "\"" : "")
|
||||
+ (((Disk)rom).ItemStatus != ItemStatus.None ? " status=\"" + ((Disk)rom).ItemStatus.ToString().ToLowerInvariant() + "\"" : "")
|
||||
+ (((Disk)rom).Writable != null ? " writable=\"" + (((Disk)rom).Writable == true ? "yes" : "no") + "\"" : "")
|
||||
state += "\t\t\t<diskarea name=\"" + (!ExcludeFields[(int)Field.AreaName] ? (String.IsNullOrWhiteSpace(rom.AreaName) ? "cdrom" : rom.AreaName) : "") + "\""
|
||||
+ (!ExcludeFields[(int)Field.AreaSize] && rom.AreaSize != null ? " size=\"" + rom.AreaSize + "\"" : "") + ">\n"
|
||||
+ "\t\t\t\t<disk name=\"" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "\""
|
||||
+ (!ExcludeFields[(int)Field.MD5] && !String.IsNullOrWhiteSpace(((Disk)rom).MD5) ? " md5=\"" + ((Disk)rom).MD5.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA1] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA1) ? " sha1=\"" + ((Disk)rom).SHA1.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA256] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA256) ? " sha256=\"" + ((Disk)rom).SHA256.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA384] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA384) ? " sha384=\"" + ((Disk)rom).SHA384.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA512] && !String.IsNullOrWhiteSpace(((Disk)rom).SHA512) ? " sha512=\"" + ((Disk)rom).SHA512.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Status] && ((Disk)rom).ItemStatus != ItemStatus.None ? " status=\"" + ((Disk)rom).ItemStatus.ToString().ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Writable] && ((Disk)rom).Writable != null ? " writable=\"" + (((Disk)rom).Writable == true ? "yes" : "no") + "\"" : "")
|
||||
+ "/>\n"
|
||||
+ "\t\t\t</diskarea>\n";
|
||||
break;
|
||||
case ItemType.Rom:
|
||||
state += "\t\t\t<dataarea name=\"" + (String.IsNullOrWhiteSpace(rom.AreaName) ? "rom" : rom.AreaName) + "\""
|
||||
+ (rom.AreaSize != null ? " size=\"" + rom.AreaSize + "\"" : "") + ">\n"
|
||||
+ "\t\t\t\t<rom name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (((Rom)rom).Size != -1 ? " size=\"" + ((Rom)rom).Size + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).CRC) ? " crc=\"" + ((Rom)rom).CRC.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).MD5) ? " md5=\"" + ((Rom)rom).MD5.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).SHA1) ? " sha1=\"" + ((Rom)rom).SHA1.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).SHA256) ? " sha256=\"" + ((Rom)rom).SHA256.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).SHA384) ? " sha384=\"" + ((Rom)rom).SHA384.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).SHA512) ? " sha512=\"" + ((Rom)rom).SHA512.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrWhiteSpace(((Rom)rom).Offset) ? " offset=\"" + ((Rom)rom).Offset + "\"" : "")
|
||||
// + (!String.IsNullOrWhiteSpace(((Rom)rom).Value) ? " value=\"" + ((Rom)rom).Value + "\"" : "")
|
||||
+ (((Rom)rom).ItemStatus != ItemStatus.None ? " status=\"" + ((Rom)rom).ItemStatus.ToString().ToLowerInvariant() + "\"" : "")
|
||||
// + (!String.IsNullOrWhiteSpace(((Rom)rom).Loadflag) ? " loadflag=\"" + ((Rom)rom).Loadflag + "\"" : "")
|
||||
state += "\t\t\t<dataarea name=\"" + (!ExcludeFields[(int)Field.AreaName] ? (String.IsNullOrWhiteSpace(rom.AreaName) ? "rom" : rom.AreaName) : "") + "\""
|
||||
+ (!ExcludeFields[(int)Field.AreaSize] && rom.AreaSize != null ? " size=\"" + rom.AreaSize + "\"" : "") + ">\n"
|
||||
+ "\t\t\t\t<rom name=\"" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "\""
|
||||
+ (!ExcludeFields[(int)Field.Size] && ((Rom)rom).Size != -1 ? " size=\"" + ((Rom)rom).Size + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.CRC] && !String.IsNullOrWhiteSpace(((Rom)rom).CRC) ? " crc=\"" + ((Rom)rom).CRC.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.MD5] && !String.IsNullOrWhiteSpace(((Rom)rom).MD5) ? " md5=\"" + ((Rom)rom).MD5.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA1] && !String.IsNullOrWhiteSpace(((Rom)rom).SHA1) ? " sha1=\"" + ((Rom)rom).SHA1.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA256] && !String.IsNullOrWhiteSpace(((Rom)rom).SHA256) ? " sha256=\"" + ((Rom)rom).SHA256.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA384] && !String.IsNullOrWhiteSpace(((Rom)rom).SHA384) ? " sha384=\"" + ((Rom)rom).SHA384.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.SHA512] && !String.IsNullOrWhiteSpace(((Rom)rom).SHA512) ? " sha512=\"" + ((Rom)rom).SHA512.ToLowerInvariant() + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Offset] && !String.IsNullOrWhiteSpace(((Rom)rom).Offset) ? " offset=\"" + ((Rom)rom).Offset + "\"" : "")
|
||||
// + (!ExcludeFields[(int)Field.Value] && !String.IsNullOrWhiteSpace(((Rom)rom).Value) ? " value=\"" + ((Rom)rom).Value + "\"" : "")
|
||||
+ (!ExcludeFields[(int)Field.Status] && ((Rom)rom).ItemStatus != ItemStatus.None ? " status=\"" + ((Rom)rom).ItemStatus.ToString().ToLowerInvariant() + "\"" : "")
|
||||
// + (!ExcludeFields[(int)Field.Loadflag] && !String.IsNullOrWhiteSpace(((Rom)rom).Loadflag) ? " loadflag=\"" + ((Rom)rom).Loadflag + "\"" : "")
|
||||
+ "/>\n"
|
||||
+ "\t\t\t</dataarea>\n";
|
||||
break;
|
||||
|
||||
@@ -360,9 +360,9 @@
|
||||
/// <summary>
|
||||
/// List of valid field types within a DatItem/Machine
|
||||
/// </summary>
|
||||
public enum Field
|
||||
public enum Field : int
|
||||
{
|
||||
NULL,
|
||||
NULL = 0,
|
||||
|
||||
// Generic DatItem
|
||||
Name,
|
||||
|
||||
@@ -291,11 +291,9 @@ namespace SabreTools
|
||||
updateMode |= UpdateMode.DiffReverseCascade;
|
||||
break;
|
||||
case "exclude-of": // TODO: Remove entire flag when transitioning to exclude-fields
|
||||
datHeader.ExcludeOf = true;
|
||||
|
||||
datHeader.ExcludeFields.Add(Field.CloneOf);
|
||||
datHeader.ExcludeFields.Add(Field.RomOf);
|
||||
datHeader.ExcludeFields.Add(Field.SampleOf);
|
||||
datHeader.ExcludeFields[(int)Field.CloneOf] = true;
|
||||
datHeader.ExcludeFields[(int)Field.RomOf] = true;
|
||||
datHeader.ExcludeFields[(int)Field.SampleOf] = true;
|
||||
break;
|
||||
case "extension":
|
||||
splittingMode |= SplittingMode.Extension;
|
||||
@@ -645,7 +643,7 @@ namespace SabreTools
|
||||
case "exclude-field": // TODO: Use this
|
||||
foreach (string field in (List<string>)feat.Value.GetValue())
|
||||
{
|
||||
datHeader.ExcludeFields.Add(Utilities.GetField(field));
|
||||
datHeader.ExcludeFields[(int)Utilities.GetField(field)] = true;
|
||||
}
|
||||
break;
|
||||
case "exta":
|
||||
|
||||
Reference in New Issue
Block a user