[DatFile, DatItem] Rename Description to MachineDescription

BiosSet is the only DatItem type that, by default, has a "Description" field and it was overriding the Machine variant. To make things more consistent, I have renamed this one field since, technically speaking, it is a Machine description, not the DatItem one.
This commit is contained in:
Matt Nadareski
2017-10-06 21:21:40 -07:00
parent c9170e6b52
commit dd4dbfb450
8 changed files with 27 additions and 28 deletions

View File

@@ -404,7 +404,7 @@ namespace SabreTools.Library.DatFiles
// Update rom information // Update rom information
datItem.Name = romname; datItem.Name = romname;
datItem.MachineName = gamename; datItem.MachineName = gamename;
datItem.Description = gamename; datItem.MachineDescription = gamename;
// Add the file information to the DAT // Add the file information to the DAT
Add(key, datItem); Add(key, datItem);

View File

@@ -255,7 +255,7 @@ namespace SabreTools.Library.DatFiles
// If the key mapping doesn't exist, add it // If the key mapping doesn't exist, add it
if (!mapping.ContainsKey(item.MachineName)) if (!mapping.ContainsKey(item.MachineName))
{ {
mapping.TryAdd(item.MachineName, item.Description.Replace('/', '_').Replace("\"", "''")); mapping.TryAdd(item.MachineName, item.MachineDescription.Replace('/', '_').Replace("\"", "''"));
} }
} }
}); });
@@ -826,7 +826,7 @@ namespace SabreTools.Library.DatFiles
} }
// Otherwise, move the items from the current game to a subfolder of the parent game // Otherwise, move the items from the current game to a subfolder of the parent game
DatItem copyFrom = this[parent].Count == 0 ? new Rom { MachineName = parent, Description = parent } : this[parent][0]; DatItem copyFrom = this[parent].Count == 0 ? new Rom { MachineName = parent, MachineDescription = parent } : this[parent][0];
List<DatItem> items = this[game]; List<DatItem> items = this[game];
foreach (DatItem item in items) foreach (DatItem item in items)
{ {

View File

@@ -264,7 +264,7 @@ namespace SabreTools.Library.DatFiles
ItemStatus = ItemStatus.None, ItemStatus = ItemStatus.None,
MachineName = gameinfo[0], MachineName = gameinfo[0],
Description = gameinfo[1], MachineDescription = gameinfo[1],
CloneOf = gameinfo[3], CloneOf = gameinfo[3],
Year = gameinfo[4], Year = gameinfo[4],
Manufacturer = gameinfo[5], Manufacturer = gameinfo[5],
@@ -380,7 +380,7 @@ namespace SabreTools.Library.DatFiles
// Then populate it with information // Then populate it with information
item.MachineName = tempgamename; item.MachineName = tempgamename;
item.Description = gamedesc; item.MachineDescription = gamedesc;
item.CloneOf = cloneof; item.CloneOf = cloneof;
item.RomOf = romof; item.RomOf = romof;
item.SampleOf = sampleof; item.SampleOf = sampleof;
@@ -1283,7 +1283,7 @@ namespace SabreTools.Library.DatFiles
ItemStatus = ItemStatus.None, ItemStatus = ItemStatus.None,
MachineName = rominfo[3], MachineName = rominfo[3],
Description = rominfo[4], MachineDescription = rominfo[4],
CloneOf = rominfo[1], CloneOf = rominfo[1],
RomOf = rominfo[8], RomOf = rominfo[8],
@@ -1550,7 +1550,7 @@ namespace SabreTools.Library.DatFiles
Name = name, Name = name,
MachineName = machineName, MachineName = machineName,
Description = machineDesc, MachineDescription = machineDesc,
}; };
ParseAddHelper(archive, clean, remUnicode); ParseAddHelper(archive, clean, remUnicode);
@@ -1577,7 +1577,7 @@ namespace SabreTools.Library.DatFiles
SHA512 = sha512, SHA512 = sha512,
MachineName = machineName, MachineName = machineName,
Description = machineDesc, MachineDescription = machineDesc,
ItemStatus = status, ItemStatus = status,
}; };
@@ -1590,7 +1590,7 @@ namespace SabreTools.Library.DatFiles
Name = name, Name = name,
MachineName = machineName, MachineName = machineName,
Description = machineDesc, MachineDescription = machineDesc,
}; };
ParseAddHelper(release, clean, remUnicode); ParseAddHelper(release, clean, remUnicode);
@@ -1608,7 +1608,7 @@ namespace SabreTools.Library.DatFiles
SHA512 = sha512, SHA512 = sha512,
MachineName = machineName, MachineName = machineName,
Description = machineDesc, MachineDescription = machineDesc,
ItemStatus = status, ItemStatus = status,
}; };
@@ -1621,7 +1621,7 @@ namespace SabreTools.Library.DatFiles
Name = name, Name = name,
MachineName = machineName, MachineName = machineName,
Description = machineDesc, MachineDescription = machineDesc,
}; };
ParseAddHelper(sample, clean, remUnicode); ParseAddHelper(sample, clean, remUnicode);
@@ -2796,7 +2796,7 @@ namespace SabreTools.Library.DatFiles
{ {
item.Name = Style.RemoveUnicodeCharacters(item.Name); item.Name = Style.RemoveUnicodeCharacters(item.Name);
item.MachineName = Style.RemoveUnicodeCharacters(item.MachineName); item.MachineName = Style.RemoveUnicodeCharacters(item.MachineName);
item.Description = Style.RemoveUnicodeCharacters(item.Description); item.MachineDescription = Style.RemoveUnicodeCharacters(item.MachineDescription);
} }
// If we have a Rom or a Disk, clean the hash data // If we have a Rom or a Disk, clean the hash data

View File

@@ -642,13 +642,13 @@ namespace SabreTools.Library.DatFiles
// Get the item from the current file // Get the item from the current file
Rom item = FileTools.GetStreamInfo(fileStream, fileStream.Length, keepReadOpen: true); Rom item = FileTools.GetStreamInfo(fileStream, fileStream.Length, keepReadOpen: true);
item.MachineName = Style.GetFileNameWithoutExtension(item.Name); item.MachineName = Style.GetFileNameWithoutExtension(item.Name);
item.Description = Style.GetFileNameWithoutExtension(item.Name); item.MachineDescription = Style.GetFileNameWithoutExtension(item.Name);
// If we are coming from an archive, set the correct machine name // If we are coming from an archive, set the correct machine name
if (machinename != null) if (machinename != null)
{ {
item.MachineName = machinename; item.MachineName = machinename;
item.Description = machinename; item.MachineDescription = machinename;
} }
Globals.Logger.User("No matches found for '{0}', rebuilding accordingly from inverse flag...", Style.GetFileName(rom.Name)); Globals.Logger.User("No matches found for '{0}', rebuilding accordingly from inverse flag...", Style.GetFileName(rom.Name));

View File

@@ -437,7 +437,7 @@ namespace SabreTools.Library.DatFiles
// Clean the input list and set all games to be pathless // Clean the input list and set all games to be pathless
List<DatItem> items = this[key]; List<DatItem> items = this[key];
items.ForEach(item => item.MachineName = Style.GetFileName(item.MachineName)); items.ForEach(item => item.MachineName = Style.GetFileName(item.MachineName));
items.ForEach(item => item.Description = Style.GetFileName(item.Description)); items.ForEach(item => item.MachineDescription = Style.GetFileName(item.MachineDescription));
// Now add the game to the output DAT // Now add the game to the output DAT
tempDat.AddRange(key, items); tempDat.AddRange(key, items);

View File

@@ -487,7 +487,7 @@ namespace SabreTools.Library.DatFiles
{ {
case DatFormat.AttractMode: case DatFormat.AttractMode:
state += rom.MachineName + ";" state += rom.MachineName + ";"
+ rom.Description + ";" + rom.MachineDescription + ";"
+ FileName + ";" + FileName + ";"
+ rom.CloneOf + ";" + rom.CloneOf + ";"
+ rom.Year + ";" + rom.Year + ";"
@@ -511,7 +511,7 @@ namespace SabreTools.Library.DatFiles
(String.IsNullOrEmpty(rom.CloneOf) ? "" : "\tcloneof \"" + rom.CloneOf + "\"\n") + (String.IsNullOrEmpty(rom.CloneOf) ? "" : "\tcloneof \"" + rom.CloneOf + "\"\n") +
(String.IsNullOrEmpty(rom.SampleOf) ? "" : "\tsampleof \"" + rom.SampleOf + "\"\n") (String.IsNullOrEmpty(rom.SampleOf) ? "" : "\tsampleof \"" + rom.SampleOf + "\"\n")
) + ) +
"\tdescription \"" + (String.IsNullOrEmpty(rom.Description) ? rom.MachineName : rom.Description) + "\"\n" + "\tdescription \"" + (String.IsNullOrEmpty(rom.MachineDescription) ? rom.MachineName : rom.MachineDescription) + "\"\n" +
(String.IsNullOrEmpty(rom.Year) ? "" : "\tyear " + rom.Year + "\n") + (String.IsNullOrEmpty(rom.Year) ? "" : "\tyear " + rom.Year + "\n") +
(String.IsNullOrEmpty(rom.Manufacturer) ? "" : "\tmanufacturer \"" + rom.Manufacturer + "\"\n"); (String.IsNullOrEmpty(rom.Manufacturer) ? "" : "\tmanufacturer \"" + rom.Manufacturer + "\"\n");
break; break;
@@ -541,7 +541,7 @@ namespace SabreTools.Library.DatFiles
) + ) +
">\n" + ">\n" +
(String.IsNullOrEmpty(rom.Comment) ? "" : "\t\t<comment>" + HttpUtility.HtmlEncode(rom.Comment) + "</comment>\n") + (String.IsNullOrEmpty(rom.Comment) ? "" : "\t\t<comment>" + HttpUtility.HtmlEncode(rom.Comment) + "</comment>\n") +
"\t\t<description>" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.Description) ? rom.MachineName : rom.Description)) + "</description>\n" + "\t\t<description>" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.MachineDescription) ? rom.MachineName : rom.MachineDescription)) + "</description>\n" +
(String.IsNullOrEmpty(rom.Year) ? "" : "\t\t<year>" + HttpUtility.HtmlEncode(rom.Year) + "</year>\n") + (String.IsNullOrEmpty(rom.Year) ? "" : "\t\t<year>" + HttpUtility.HtmlEncode(rom.Year) + "</year>\n") +
(String.IsNullOrEmpty(rom.Manufacturer) ? "" : "\t\t<manufacturer>" + HttpUtility.HtmlEncode(rom.Manufacturer) + "</manufacturer>\n"); (String.IsNullOrEmpty(rom.Manufacturer) ? "" : "\t\t<manufacturer>" + HttpUtility.HtmlEncode(rom.Manufacturer) + "</manufacturer>\n");
break; break;
@@ -571,7 +571,7 @@ namespace SabreTools.Library.DatFiles
? "" ? ""
: " sampleof=\"" + HttpUtility.HtmlEncode(rom.SampleOf) + "\"") : " sampleof=\"" + HttpUtility.HtmlEncode(rom.SampleOf) + "\"")
) + ">\n" ) + ">\n"
+ "\t\t<description>" + HttpUtility.HtmlEncode(rom.Description) + "</description>\n" + "\t\t<description>" + HttpUtility.HtmlEncode(rom.MachineDescription) + "</description>\n"
+ (rom.Year != null ? "\t\t<year>" + HttpUtility.HtmlEncode(rom.Year) + "</year>\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" : ""); + (rom.Publisher != null ? "\t\t<publisher>" + HttpUtility.HtmlEncode(rom.Publisher) + "</publisher>\n" : "");
@@ -839,7 +839,7 @@ namespace SabreTools.Library.DatFiles
+ ",\"" + Name + "\"" + ",\"" + Name + "\""
+ ",\"" + Description + "\"" + ",\"" + Description + "\""
+ ",\"" + rom.MachineName + "\"" + ",\"" + rom.MachineName + "\""
+ ",\"" + rom.Description + "\"" + ",\"" + rom.MachineDescription + "\""
+ "," + "\"rom\"" + "," + "\"rom\""
+ ",\"" + rom.Name + "\"" + ",\"" + rom.Name + "\""
+ "," + "\"\"" + "," + "\"\""
@@ -859,7 +859,7 @@ namespace SabreTools.Library.DatFiles
+ ",\"" + Name + "\"" + ",\"" + Name + "\""
+ ",\"" + Description + "\"" + ",\"" + Description + "\""
+ ",\"" + rom.MachineName + "\"" + ",\"" + rom.MachineName + "\""
+ ",\"" + rom.Description + "\"" + ",\"" + rom.MachineDescription + "\""
+ "," + "\"disk\"" + "," + "\"disk\""
+ "," + "\"\"" + "," + "\"\""
+ ",\"" + rom.Name + "\"" + ",\"" + rom.Name + "\""
@@ -1291,7 +1291,7 @@ namespace SabreTools.Library.DatFiles
state += "¬" + (String.IsNullOrEmpty(rom.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.CloneOf)) + state += "¬" + (String.IsNullOrEmpty(rom.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.CloneOf)) +
"¬" + (String.IsNullOrEmpty(rom.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.CloneOf)) + "¬" + (String.IsNullOrEmpty(rom.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.CloneOf)) +
"¬" + HttpUtility.HtmlEncode(rom.MachineName) + "¬" + HttpUtility.HtmlEncode(rom.MachineName) +
"¬" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.Description) ? rom.MachineName : rom.Description)) + "¬" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.MachineDescription) ? rom.MachineName : rom.MachineDescription)) +
"¬" + HttpUtility.HtmlEncode(rom.Name) + "¬" + HttpUtility.HtmlEncode(rom.Name) +
"¬" + ((Rom)rom).CRC.ToLowerInvariant() + "¬" + ((Rom)rom).CRC.ToLowerInvariant() +
"¬" + (((Rom)rom).Size != -1 ? ((Rom)rom).Size.ToString() : "") + "¬¬¬\n"; "¬" + (((Rom)rom).Size != -1 ? ((Rom)rom).Size.ToString() : "") + "¬¬¬\n";
@@ -1301,7 +1301,7 @@ namespace SabreTools.Library.DatFiles
state += "¬" + (String.IsNullOrEmpty(rom.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.CloneOf)) + state += "¬" + (String.IsNullOrEmpty(rom.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.CloneOf)) +
"¬" + (String.IsNullOrEmpty(rom.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.CloneOf)) + "¬" + (String.IsNullOrEmpty(rom.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.CloneOf)) +
"¬" + HttpUtility.HtmlEncode(rom.MachineName) + "¬" + HttpUtility.HtmlEncode(rom.MachineName) +
"¬" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.Description) ? rom.MachineName : rom.Description)) + "¬" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.MachineDescription) ? rom.MachineName : rom.MachineDescription)) +
"¬" + HttpUtility.HtmlEncode(rom.Name) + "¬" + HttpUtility.HtmlEncode(rom.Name) +
"¬¬¬¬¬\n"; "¬¬¬¬¬\n";
} }
@@ -1543,7 +1543,7 @@ namespace SabreTools.Library.DatFiles
+ "\t\"" + Name + "\"" + "\t\"" + Name + "\""
+ "\t\"" + Description + "\"" + "\t\"" + Description + "\""
+ "\t\"" + rom.MachineName + "\"" + "\t\"" + rom.MachineName + "\""
+ "\t\"" + rom.Description + "\"" + "\t\"" + rom.MachineDescription + "\""
+ "\t" + "\"rom\"" + "\t" + "\"rom\""
+ "\t\"" + rom.Name + "\"" + "\t\"" + rom.Name + "\""
+ "\t" + "\"\"" + "\t" + "\"\""
@@ -1563,7 +1563,7 @@ namespace SabreTools.Library.DatFiles
+ "\t\"" + Name + "\"" + "\t\"" + Name + "\""
+ "\t\"" + Description + "\"" + "\t\"" + Description + "\""
+ "\t\"" + rom.MachineName + "\"" + "\t\"" + rom.MachineName + "\""
+ "\t\"" + rom.Description + "\"" + "\t\"" + rom.MachineDescription + "\""
+ "\t" + "\"disk\"" + "\t" + "\"disk\""
+ "\t" + "\"\"" + "\t" + "\"\""
+ "\t\"" + rom.Name + "\"" + "\t\"" + rom.Name + "\""

View File

@@ -1,5 +1,4 @@
using System; using SabreTools.Library.Data;
using SabreTools.Library.Data;
namespace SabreTools.Library.Items namespace SabreTools.Library.Items
{ {

View File

@@ -112,7 +112,7 @@ namespace SabreTools.Library.Items
_machine.Comment = value; _machine.Comment = value;
} }
} }
public string Description public string MachineDescription
{ {
get get
{ {