mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[Structs] Add GameDescription to Rom
This commit is contained in:
@@ -9,6 +9,7 @@ namespace SabreTools.Helper
|
|||||||
public struct Rom : IComparable, IEquatable<Rom>
|
public struct Rom : IComparable, IEquatable<Rom>
|
||||||
{
|
{
|
||||||
public string Game;
|
public string Game;
|
||||||
|
public string GameDescription;
|
||||||
public string Name;
|
public string Name;
|
||||||
public string Type;
|
public string Type;
|
||||||
public long Size;
|
public long Size;
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ namespace SabreTools.Helper
|
|||||||
StreamReader sr = new StreamReader(File.OpenRead(filename));
|
StreamReader sr = new StreamReader(File.OpenRead(filename));
|
||||||
|
|
||||||
bool block = false, superdat = false;
|
bool block = false, superdat = false;
|
||||||
string blockname = "", gamename = "";
|
string blockname = "", gamename = "", gamedesc = "";
|
||||||
while (!sr.EndOfStream)
|
while (!sr.EndOfStream)
|
||||||
{
|
{
|
||||||
string line = sr.ReadLine();
|
string line = sr.ReadLine();
|
||||||
@@ -173,6 +173,7 @@ namespace SabreTools.Helper
|
|||||||
Rom rom = new Rom
|
Rom rom = new Rom
|
||||||
{
|
{
|
||||||
Game = gamename,
|
Game = gamename,
|
||||||
|
GameDescription = gamedesc,
|
||||||
Type = (line.Trim().StartsWith("disk (") ? "disk" : "rom"),
|
Type = (line.Trim().StartsWith("disk (") ? "disk" : "rom"),
|
||||||
Metadata = new SourceMetadata { SystemID = sysid, SourceID = srcid },
|
Metadata = new SourceMetadata { SystemID = sysid, SourceID = srcid },
|
||||||
};
|
};
|
||||||
@@ -347,6 +348,10 @@ namespace SabreTools.Helper
|
|||||||
{
|
{
|
||||||
gamename = gc[2].Value.Replace("\"", "");
|
gamename = gc[2].Value.Replace("\"", "");
|
||||||
}
|
}
|
||||||
|
else if (gc[1].Value == "description" && blockname != "header")
|
||||||
|
{
|
||||||
|
gamedesc = gc[2].Value.Replace("\"", "");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string itemval = gc[2].Value.Replace("\"", "");
|
string itemval = gc[2].Value.Replace("\"", "");
|
||||||
@@ -561,6 +566,7 @@ namespace SabreTools.Helper
|
|||||||
Rom rom = new Rom
|
Rom rom = new Rom
|
||||||
{
|
{
|
||||||
Game = rominfo[3],
|
Game = rominfo[3],
|
||||||
|
GameDescription = rominfo[4],
|
||||||
Name = rominfo[5],
|
Name = rominfo[5],
|
||||||
CRC = rominfo[6].ToLowerInvariant(),
|
CRC = rominfo[6].ToLowerInvariant(),
|
||||||
Size = Int64.Parse(rominfo[7]),
|
Size = Int64.Parse(rominfo[7]),
|
||||||
@@ -667,6 +673,7 @@ namespace SabreTools.Helper
|
|||||||
Type = "rom",
|
Type = "rom",
|
||||||
Name = "null",
|
Name = "null",
|
||||||
Game = tempgame,
|
Game = tempgame,
|
||||||
|
GameDescription = tempgame,
|
||||||
Size = -1,
|
Size = -1,
|
||||||
CRC = "null",
|
CRC = "null",
|
||||||
MD5 = "null",
|
MD5 = "null",
|
||||||
@@ -965,7 +972,7 @@ namespace SabreTools.Helper
|
|||||||
case "game":
|
case "game":
|
||||||
case "software":
|
case "software":
|
||||||
string temptype = xtr.Name;
|
string temptype = xtr.Name;
|
||||||
string tempname = "";
|
string tempname = "", gamedesc = "";
|
||||||
|
|
||||||
// We want to process the entire subtree of the game
|
// We want to process the entire subtree of the game
|
||||||
subreader = xtr.ReadSubtree();
|
subreader = xtr.ReadSubtree();
|
||||||
@@ -1021,6 +1028,9 @@ namespace SabreTools.Helper
|
|||||||
// Get the roms from the machine
|
// Get the roms from the machine
|
||||||
switch (subreader.Name)
|
switch (subreader.Name)
|
||||||
{
|
{
|
||||||
|
case "description":
|
||||||
|
gamedesc = subreader.ReadElementContentAsString();
|
||||||
|
break;
|
||||||
case "rom":
|
case "rom":
|
||||||
case "disk":
|
case "disk":
|
||||||
empty = false;
|
empty = false;
|
||||||
@@ -1105,6 +1115,7 @@ namespace SabreTools.Helper
|
|||||||
Rom rom = new Rom
|
Rom rom = new Rom
|
||||||
{
|
{
|
||||||
Game = tempname,
|
Game = tempname,
|
||||||
|
GameDescription = gamedesc,
|
||||||
Name = subreader.GetAttribute("name"),
|
Name = subreader.GetAttribute("name"),
|
||||||
Type = subreader.Name,
|
Type = subreader.Name,
|
||||||
Size = size,
|
Size = size,
|
||||||
@@ -1159,6 +1170,7 @@ namespace SabreTools.Helper
|
|||||||
Type = "rom",
|
Type = "rom",
|
||||||
Name = "null",
|
Name = "null",
|
||||||
Game = tempname,
|
Game = tempname,
|
||||||
|
GameDescription = tempname,
|
||||||
Size = -1,
|
Size = -1,
|
||||||
CRC = "null",
|
CRC = "null",
|
||||||
MD5 = "null",
|
MD5 = "null",
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ namespace SabreTools.Helper
|
|||||||
{
|
{
|
||||||
case OutputFormat.ClrMamePro:
|
case OutputFormat.ClrMamePro:
|
||||||
state += "game (\n\tname \"" + rom.Game + "\"\n" +
|
state += "game (\n\tname \"" + rom.Game + "\"\n" +
|
||||||
"\tdescription \"" + rom.Game + "\"\n";
|
"\tdescription \"" + (String.IsNullOrEmpty(rom.GameDescription) ? rom.Game : rom.GameDescription) + "\"\n";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.SabreDat:
|
case OutputFormat.SabreDat:
|
||||||
for (int i = (last == -1 ? 0 : last); i < newsplit.Count; i++)
|
for (int i = (last == -1 ? 0 : last); i < newsplit.Count; i++)
|
||||||
@@ -316,7 +316,7 @@ namespace SabreTools.Helper
|
|||||||
break;
|
break;
|
||||||
case OutputFormat.Xml:
|
case OutputFormat.Xml:
|
||||||
state += "\t<machine name=\"" + HttpUtility.HtmlEncode(rom.Game) + "\">\n" +
|
state += "\t<machine name=\"" + HttpUtility.HtmlEncode(rom.Game) + "\">\n" +
|
||||||
"\t\t<description>" + HttpUtility.HtmlEncode(rom.Game) + "</description>\n";
|
"\t\t<description>" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.GameDescription) ? rom.Game : rom.GameDescription)) + "</description>\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,7 +497,7 @@ namespace SabreTools.Helper
|
|||||||
break;
|
break;
|
||||||
case OutputFormat.RomCenter:
|
case OutputFormat.RomCenter:
|
||||||
state += "¬¬¬" + HttpUtility.HtmlEncode(rom.Game) +
|
state += "¬¬¬" + HttpUtility.HtmlEncode(rom.Game) +
|
||||||
"¬" + HttpUtility.HtmlEncode(rom.Game) +
|
"¬" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.GameDescription) ? rom.Game : rom.GameDescription)) +
|
||||||
"¬" + HttpUtility.HtmlEncode(rom.Name) +
|
"¬" + HttpUtility.HtmlEncode(rom.Name) +
|
||||||
"¬" + rom.CRC.ToLowerInvariant() +
|
"¬" + rom.CRC.ToLowerInvariant() +
|
||||||
"¬" + (rom.Size != -1 ? rom.Size.ToString() : "") + "¬¬¬\n";
|
"¬" + (rom.Size != -1 ? rom.Size.ToString() : "") + "¬¬¬\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user