[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
datItem.Name = romname;
datItem.MachineName = gamename;
datItem.Description = gamename;
datItem.MachineDescription = gamename;
// Add the file information to the DAT
Add(key, datItem);

View File

@@ -255,7 +255,7 @@ namespace SabreTools.Library.DatFiles
// If the key mapping doesn't exist, add it
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
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];
foreach (DatItem item in items)
{

View File

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

View File

@@ -642,13 +642,13 @@ namespace SabreTools.Library.DatFiles
// Get the item from the current file
Rom item = FileTools.GetStreamInfo(fileStream, fileStream.Length, keepReadOpen: true);
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 (machinename != null)
{
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));

View File

@@ -437,7 +437,7 @@ namespace SabreTools.Library.DatFiles
// Clean the input list and set all games to be pathless
List<DatItem> items = this[key];
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
tempDat.AddRange(key, items);

View File

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

View File

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

View File

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