mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[Structs] Rename Rom field "Game" to "Machine"
This commit is contained in:
@@ -46,7 +46,7 @@ namespace SabreTools.Helper
|
||||
/// </summary>
|
||||
public struct Rom : IComparable, IEquatable<Rom>
|
||||
{
|
||||
public Machine Game;
|
||||
public Machine Machine;
|
||||
public string Name;
|
||||
public string Type;
|
||||
public HashData HashData;
|
||||
@@ -66,7 +66,7 @@ namespace SabreTools.Helper
|
||||
{
|
||||
Rom comp = (Rom)obj;
|
||||
|
||||
if (this.Game.Name == comp.Game.Name)
|
||||
if (this.Machine.Name == comp.Machine.Name)
|
||||
{
|
||||
if (this.Name == comp.Name)
|
||||
{
|
||||
@@ -74,7 +74,7 @@ namespace SabreTools.Helper
|
||||
}
|
||||
ret = String.Compare(this.Name, comp.Name);
|
||||
}
|
||||
ret = String.Compare(this.Game.Name, comp.Game.Name);
|
||||
ret = String.Compare(this.Machine.Name, comp.Machine.Name);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -92,7 +92,7 @@ namespace SabreTools.Helper
|
||||
bool isdupe = RomTools.IsDuplicate(this, other, temp);
|
||||
temp.Close();
|
||||
|
||||
return (this.Game.Name == other.Game.Name &&
|
||||
return (this.Machine.Name == other.Machine.Name &&
|
||||
this.Name == other.Name &&
|
||||
isdupe);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace SabreTools.Helper
|
||||
/// <param name="rom">RomData representing the new information</param>
|
||||
public static void WriteToArchive(string input, string output, Rom rom)
|
||||
{
|
||||
string archiveFileName = Path.Combine(output, rom.Game + ".zip");
|
||||
string archiveFileName = Path.Combine(output, rom.Machine + ".zip");
|
||||
|
||||
System.IO.Compression.ZipArchive outarchive = null;
|
||||
try
|
||||
@@ -71,7 +71,7 @@ namespace SabreTools.Helper
|
||||
/// <param name="rom">RomData representing the new information</param>
|
||||
public static void WriteToManagedArchive(string input, string output, Rom rom)
|
||||
{
|
||||
string archiveFileName = Path.Combine(output, rom.Game + ".zip");
|
||||
string archiveFileName = Path.Combine(output, rom.Machine + ".zip");
|
||||
|
||||
// Delete an empty file first
|
||||
if (File.Exists(archiveFileName) && new FileInfo(archiveFileName).Length == 0)
|
||||
@@ -538,7 +538,7 @@ namespace SabreTools.Helper
|
||||
{
|
||||
Type = "rom",
|
||||
Name = reader.Entry.Key,
|
||||
Game = new Machine
|
||||
Machine = new Machine
|
||||
{
|
||||
Name = gamename,
|
||||
},
|
||||
@@ -621,7 +621,7 @@ namespace SabreTools.Helper
|
||||
Rom rom = new Rom
|
||||
{
|
||||
Type = "rom",
|
||||
Game = new Machine
|
||||
Machine = new Machine
|
||||
{
|
||||
Name = Path.GetFileNameWithoutExtension(input).ToLowerInvariant(),
|
||||
},
|
||||
|
||||
@@ -172,7 +172,7 @@ namespace SabreTools.Helper
|
||||
|
||||
Rom rom = new Rom
|
||||
{
|
||||
Game = new Machine
|
||||
Machine = new Machine
|
||||
{
|
||||
Name = gamename,
|
||||
Description = gamedesc,
|
||||
@@ -568,7 +568,7 @@ namespace SabreTools.Helper
|
||||
|
||||
Rom rom = new Rom
|
||||
{
|
||||
Game = new Machine
|
||||
Machine = new Machine
|
||||
{
|
||||
Name = rominfo[3],
|
||||
Description = rominfo[4],
|
||||
@@ -681,7 +681,7 @@ namespace SabreTools.Helper
|
||||
{
|
||||
Type = "rom",
|
||||
Name = "null",
|
||||
Game = new Machine
|
||||
Machine = new Machine
|
||||
{
|
||||
Name = tempgame,
|
||||
Description = tempgame,
|
||||
@@ -1129,7 +1129,7 @@ namespace SabreTools.Helper
|
||||
|
||||
Rom rom = new Rom
|
||||
{
|
||||
Game = new Machine
|
||||
Machine = new Machine
|
||||
{
|
||||
Name = tempname,
|
||||
Description = gamedesc,
|
||||
@@ -1190,7 +1190,7 @@ namespace SabreTools.Helper
|
||||
{
|
||||
Type = "rom",
|
||||
Name = "null",
|
||||
Game = new Machine
|
||||
Machine = new Machine
|
||||
{
|
||||
Name = tempname,
|
||||
Description = tempname,
|
||||
@@ -1369,7 +1369,7 @@ namespace SabreTools.Helper
|
||||
|
||||
Rom rom = new Rom
|
||||
{
|
||||
Game = new Machine
|
||||
Machine = new Machine
|
||||
{
|
||||
Name = tempname,
|
||||
},
|
||||
@@ -1474,9 +1474,9 @@ namespace SabreTools.Helper
|
||||
: rom.Metadata.SystemID.ToString().PadLeft(10, '0')
|
||||
+ "-"
|
||||
+ rom.Metadata.SourceID.ToString().PadLeft(10, '0') + "-")
|
||||
+ (String.IsNullOrEmpty(rom.Game.Name)
|
||||
+ (String.IsNullOrEmpty(rom.Machine.Name)
|
||||
? ""
|
||||
: rom.Game.Name.ToLowerInvariant());
|
||||
: rom.Machine.Name.ToLowerInvariant());
|
||||
if (sortable.ContainsKey(newkey))
|
||||
{
|
||||
sortable[newkey].Add(rom);
|
||||
@@ -1832,15 +1832,15 @@ namespace SabreTools.Helper
|
||||
// Filter on game name
|
||||
if (gamename != "")
|
||||
{
|
||||
if (gamename.StartsWith("*") && gamename.EndsWith("*") && !rom.Game.Name.ToLowerInvariant().Contains(gamename.ToLowerInvariant().Replace("*", "")))
|
||||
if (gamename.StartsWith("*") && gamename.EndsWith("*") && !rom.Machine.Name.ToLowerInvariant().Contains(gamename.ToLowerInvariant().Replace("*", "")))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (gamename.StartsWith("*") && !rom.Game.Name.EndsWith(gamename.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
else if (gamename.StartsWith("*") && !rom.Machine.Name.EndsWith(gamename.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (gamename.EndsWith("*") && !rom.Game.Name.StartsWith(gamename.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
else if (gamename.EndsWith("*") && !rom.Machine.Name.StartsWith(gamename.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -1940,14 +1940,14 @@ namespace SabreTools.Helper
|
||||
// If we are in single game mode, rename all games
|
||||
if (single)
|
||||
{
|
||||
rom.Game.Name = "!";
|
||||
rom.Machine.Name = "!";
|
||||
}
|
||||
|
||||
// If we are in NTFS trim mode, trim the game name
|
||||
if (trim)
|
||||
{
|
||||
// Windows max name length is 260
|
||||
int usableLength = 260 - rom.Game.Name.Length - root.Length;
|
||||
int usableLength = 260 - rom.Machine.Name.Length - root.Length;
|
||||
if (rom.Name.Length > usableLength)
|
||||
{
|
||||
string ext = Path.GetExtension(rom.Name);
|
||||
@@ -2071,7 +2071,7 @@ namespace SabreTools.Helper
|
||||
if ((diff & DiffMode.NoDupes) != 0)
|
||||
{
|
||||
Rom newrom = rom;
|
||||
newrom.Game.Name += " (" + Path.GetFileNameWithoutExtension(inputs[newrom.Metadata.SystemID].Split('¬')[0]) + ")";
|
||||
newrom.Machine.Name += " (" + Path.GetFileNameWithoutExtension(inputs[newrom.Metadata.SystemID].Split('¬')[0]) + ")";
|
||||
|
||||
if (outerDiffData.Roms.ContainsKey(key))
|
||||
{
|
||||
@@ -2093,7 +2093,7 @@ namespace SabreTools.Helper
|
||||
if (rom.Dupe >= DupeType.ExternalHash)
|
||||
{
|
||||
Rom newrom = rom;
|
||||
newrom.Game.Name += " (" + Path.GetFileNameWithoutExtension(inputs[newrom.Metadata.SystemID].Split('¬')[0]) + ")";
|
||||
newrom.Machine.Name += " (" + Path.GetFileNameWithoutExtension(inputs[newrom.Metadata.SystemID].Split('¬')[0]) + ")";
|
||||
|
||||
if (dupeData.Roms.ContainsKey(key))
|
||||
{
|
||||
@@ -2265,9 +2265,9 @@ namespace SabreTools.Helper
|
||||
|
||||
rootpath += (rootpath == "" ? "" : Path.DirectorySeparatorChar.ToString());
|
||||
filename = filename.Remove(0, rootpath.Length);
|
||||
newrom.Game.Name = Path.GetDirectoryName(filename) + Path.DirectorySeparatorChar
|
||||
newrom.Machine.Name = Path.GetDirectoryName(filename) + Path.DirectorySeparatorChar
|
||||
+ Path.GetFileNameWithoutExtension(filename) + Path.DirectorySeparatorChar
|
||||
+ newrom.Game.Name;
|
||||
+ newrom.Machine.Name;
|
||||
newroms.Add(newrom);
|
||||
}
|
||||
userData.Roms[key] = newroms;
|
||||
|
||||
@@ -100,16 +100,16 @@ namespace SabreTools.Helper
|
||||
for (int index = 0; index < roms.Count; index++)
|
||||
{
|
||||
Rom rom = roms[index];
|
||||
List<string> newsplit = rom.Game.Name.Split('\\').ToList();
|
||||
List<string> newsplit = rom.Machine.Name.Split('\\').ToList();
|
||||
|
||||
// If we have a different game and we're not at the start of the list, output the end of last item
|
||||
if (lastgame != null && lastgame.ToLowerInvariant() != rom.Game.Name.ToLowerInvariant())
|
||||
if (lastgame != null && lastgame.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant())
|
||||
{
|
||||
depth = WriteEndGame(sw, rom, splitpath, newsplit, lastgame, datdata, depth, out last, logger);
|
||||
}
|
||||
|
||||
// If we have a new game, output the beginning of the new item
|
||||
if (lastgame == null || lastgame.ToLowerInvariant() != rom.Game.Name.ToLowerInvariant())
|
||||
if (lastgame == null || lastgame.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant())
|
||||
{
|
||||
depth = WriteStartGame(sw, rom, newsplit, lastgame, datdata, depth, last, logger);
|
||||
}
|
||||
@@ -117,7 +117,7 @@ namespace SabreTools.Helper
|
||||
// If we have a "null" game (created by DATFromDir or something similar), log it to file
|
||||
if (rom.Name == "null" && rom.HashData.Size == -1 && rom.HashData.CRC == "null" && rom.HashData.MD5 == "null" && rom.HashData.SHA1 == "null")
|
||||
{
|
||||
logger.Log("Empty folder found: " + rom.Game);
|
||||
logger.Log("Empty folder found: " + rom.Machine);
|
||||
|
||||
// If we're in a mode that doesn't allow for actual empty folders, add the blank info
|
||||
if (datdata.OutputFormat != OutputFormat.SabreDat && datdata.OutputFormat != OutputFormat.MissFile)
|
||||
@@ -133,7 +133,7 @@ namespace SabreTools.Helper
|
||||
else
|
||||
{
|
||||
splitpath = newsplit;
|
||||
lastgame = rom.Game.Name;
|
||||
lastgame = rom.Machine.Name;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -143,7 +143,7 @@ namespace SabreTools.Helper
|
||||
|
||||
// Set the new data to compare against
|
||||
splitpath = newsplit;
|
||||
lastgame = rom.Game.Name;
|
||||
lastgame = rom.Machine.Name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,17 +290,17 @@ namespace SabreTools.Helper
|
||||
try
|
||||
{
|
||||
// No game should start with a path separator
|
||||
if (rom.Game.Name.StartsWith(Path.DirectorySeparatorChar.ToString()))
|
||||
if (rom.Machine.Name.StartsWith(Path.DirectorySeparatorChar.ToString()))
|
||||
{
|
||||
rom.Game.Name = rom.Game.Name.Substring(1);
|
||||
rom.Machine.Name = rom.Machine.Name.Substring(1);
|
||||
}
|
||||
|
||||
string state = "";
|
||||
switch (datdata.OutputFormat)
|
||||
{
|
||||
case OutputFormat.ClrMamePro:
|
||||
state += "game (\n\tname \"" + rom.Game + "\"\n" +
|
||||
"\tdescription \"" + (String.IsNullOrEmpty(rom.Game.Description) ? rom.Game.Name : rom.Game.Description) + "\"\n";
|
||||
state += "game (\n\tname \"" + rom.Machine + "\"\n" +
|
||||
"\tdescription \"" + (String.IsNullOrEmpty(rom.Machine.Description) ? rom.Machine.Name : rom.Machine.Description) + "\"\n";
|
||||
break;
|
||||
case OutputFormat.SabreDat:
|
||||
for (int i = (last == -1 ? 0 : last); i < newsplit.Count; i++)
|
||||
@@ -315,8 +315,8 @@ namespace SabreTools.Helper
|
||||
depth = depth - (last == -1 ? 0 : last) + newsplit.Count;
|
||||
break;
|
||||
case OutputFormat.Xml:
|
||||
state += "\t<machine name=\"" + HttpUtility.HtmlEncode(rom.Game) + "\">\n" +
|
||||
"\t\t<description>" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.Game.Description) ? rom.Game.Name : rom.Game.Description)) + "</description>\n";
|
||||
state += "\t<machine name=\"" + HttpUtility.HtmlEncode(rom.Machine) + "\">\n" +
|
||||
"\t\t<description>" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.Machine.Description) ? rom.Machine.Name : rom.Machine.Description)) + "</description>\n";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -452,7 +452,7 @@ namespace SabreTools.Helper
|
||||
// If we're in TSV mode, similarly the state is consistent
|
||||
else if (datdata.TSV == true)
|
||||
{
|
||||
string inline = "\"" + datdata.FileName + "\"\t\"" + datdata.Name + "\"\t\"" + datdata.Description + "\"\t\"" + rom.Game + "\"\t\"" + rom.Game + "\"\t\"" +
|
||||
string inline = "\"" + datdata.FileName + "\"\t\"" + datdata.Name + "\"\t\"" + datdata.Description + "\"\t\"" + rom.Machine + "\"\t\"" + rom.Machine + "\"\t\"" +
|
||||
rom.Type + "\"\t\"" + (rom.Type == "rom" ? rom.Name : "") + "\"\t\"" + (rom.Type == "disk" ? rom.Name : "") + "\"\t\"" + rom.HashData.Size + "\"\t\"" +
|
||||
rom.HashData.CRC + "\"\t\"" + rom.HashData.MD5 + "\"\t\"" + rom.HashData.SHA1 + "\"\t" + (rom.Nodump ? "\"Nodump\"" : "\"\"");
|
||||
state += pre + inline + post + "\n";
|
||||
@@ -460,7 +460,7 @@ namespace SabreTools.Helper
|
||||
// If we're in CSV mode, similarly the state is consistent
|
||||
else if (datdata.TSV == false)
|
||||
{
|
||||
string inline = "\"" + datdata.FileName + "\",\"" + datdata.Name + "\",\"" + datdata.Description + "\",\"" + rom.Game + "\",\"" + rom.Game + "\",\"" +
|
||||
string inline = "\"" + datdata.FileName + "\",\"" + datdata.Name + "\",\"" + datdata.Description + "\",\"" + rom.Machine + "\",\"" + rom.Machine + "\",\"" +
|
||||
rom.Type + "\",\"" + (rom.Type == "rom" ? rom.Name : "") + "\",\"" + (rom.Type == "disk" ? rom.Name : "") + "\",\"" + rom.HashData.Size + "\",\"" +
|
||||
rom.HashData.CRC + "\",\"" + rom.HashData.MD5 + "\",\"" + rom.HashData.SHA1 + "\"," + (rom.Nodump ? "\"Nodump\"" : "\"\"");
|
||||
state += pre + inline + post + "\n";
|
||||
@@ -468,7 +468,7 @@ namespace SabreTools.Helper
|
||||
// Otherwise, use any flags
|
||||
else
|
||||
{
|
||||
string name = (datdata.UseGame ? rom.Game.Name : rom.Name);
|
||||
string name = (datdata.UseGame ? rom.Machine.Name : rom.Name);
|
||||
if (datdata.RepExt != "")
|
||||
{
|
||||
string dir = Path.GetDirectoryName(name);
|
||||
@@ -481,13 +481,13 @@ namespace SabreTools.Helper
|
||||
}
|
||||
if (!datdata.UseGame && datdata.GameName)
|
||||
{
|
||||
name = Path.Combine(rom.Game.Name, name);
|
||||
name = Path.Combine(rom.Machine.Name, name);
|
||||
}
|
||||
|
||||
if (datdata.UseGame && rom.Game.Name != lastgame)
|
||||
if (datdata.UseGame && rom.Machine.Name != lastgame)
|
||||
{
|
||||
state += pre + name + post + "\n";
|
||||
lastgame = rom.Game.Name;
|
||||
lastgame = rom.Machine.Name;
|
||||
}
|
||||
else if (!datdata.UseGame)
|
||||
{
|
||||
@@ -496,8 +496,8 @@ namespace SabreTools.Helper
|
||||
}
|
||||
break;
|
||||
case OutputFormat.RomCenter:
|
||||
state += "¬¬¬" + HttpUtility.HtmlEncode(rom.Game) +
|
||||
"¬" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.Game.Description) ? rom.Game.Name : rom.Game.Description)) +
|
||||
state += "¬¬¬" + HttpUtility.HtmlEncode(rom.Machine) +
|
||||
"¬" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.Machine.Description) ? rom.Machine.Name : rom.Machine.Description)) +
|
||||
"¬" + HttpUtility.HtmlEncode(rom.Name) +
|
||||
"¬" + rom.HashData.CRC.ToLowerInvariant() +
|
||||
"¬" + (rom.HashData.Size != -1 ? rom.HashData.Size.ToString() : "") + "¬¬¬\n";
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace SabreTools.Helper
|
||||
{
|
||||
savedrom.Metadata.SystemID = rom.Metadata.SystemID;
|
||||
savedrom.Metadata.System = rom.Metadata.System;
|
||||
savedrom.Game.Name = rom.Game.Name;
|
||||
savedrom.Machine.Name = rom.Machine.Name;
|
||||
savedrom.Name = rom.Name;
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace SabreTools.Helper
|
||||
{
|
||||
savedrom.Metadata.SourceID = rom.Metadata.SourceID;
|
||||
savedrom.Metadata.Source = rom.Metadata.Source;
|
||||
savedrom.Game.Name = rom.Game.Name;
|
||||
savedrom.Machine.Name = rom.Machine.Name;
|
||||
savedrom.Name = rom.Name;
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ namespace SabreTools.Helper
|
||||
// If the duplicate is external already or should be, set it
|
||||
if (lastrom.Dupe >= DupeType.ExternalHash || lastrom.Metadata.SystemID != rom.Metadata.SystemID || lastrom.Metadata.SourceID != rom.Metadata.SourceID)
|
||||
{
|
||||
if (lastrom.Game.Name == rom.Game.Name && lastrom.Name == rom.Name)
|
||||
if (lastrom.Machine.Name == rom.Machine.Name && lastrom.Name == rom.Name)
|
||||
{
|
||||
output = DupeType.ExternalAll;
|
||||
}
|
||||
@@ -300,7 +300,7 @@ namespace SabreTools.Helper
|
||||
// Otherwise, it's considered an internal dupe
|
||||
else
|
||||
{
|
||||
if (lastrom.Game.Name == rom.Game.Name && lastrom.Name == rom.Name)
|
||||
if (lastrom.Machine.Name == rom.Machine.Name && lastrom.Name == rom.Name)
|
||||
{
|
||||
output = DupeType.InternalAll;
|
||||
}
|
||||
@@ -327,15 +327,15 @@ namespace SabreTools.Helper
|
||||
{
|
||||
if (x.Metadata.SourceID == y.Metadata.SourceID)
|
||||
{
|
||||
if (x.Game.Name == y.Game.Name)
|
||||
if (x.Machine.Name == y.Machine.Name)
|
||||
{
|
||||
return String.Compare(x.Name, y.Name);
|
||||
}
|
||||
return String.Compare(x.Game.Name, y.Game.Name);
|
||||
return String.Compare(x.Machine.Name, y.Machine.Name);
|
||||
}
|
||||
return (norename ? String.Compare(x.Game.Name, y.Game.Name) : x.Metadata.SourceID - y.Metadata.SourceID);
|
||||
return (norename ? String.Compare(x.Machine.Name, y.Machine.Name) : x.Metadata.SourceID - y.Metadata.SourceID);
|
||||
}
|
||||
return (norename ? String.Compare(x.Game.Name, y.Game.Name) : x.Metadata.SystemID - y.Metadata.SystemID);
|
||||
return (norename ? String.Compare(x.Machine.Name, y.Machine.Name) : x.Metadata.SystemID - y.Metadata.SystemID);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ namespace SabreTools
|
||||
Rom rom = new Rom
|
||||
{
|
||||
Name = "null",
|
||||
Game = new Machine
|
||||
Machine = new Machine
|
||||
{
|
||||
Name = (_datdata.Type == "SuperDAT" ?
|
||||
(actualroot != "" && !actualroot.StartsWith(Path.DirectorySeparatorChar.ToString()) ?
|
||||
@@ -212,7 +212,7 @@ namespace SabreTools
|
||||
Rom rom = new Rom
|
||||
{
|
||||
Name = "null",
|
||||
Game = new Machine
|
||||
Machine = new Machine
|
||||
{
|
||||
Name = (_datdata.Type == "SuperDAT" ?
|
||||
(actualroot != "" && !actualroot.StartsWith(Path.DirectorySeparatorChar.ToString()) ?
|
||||
@@ -293,13 +293,13 @@ namespace SabreTools
|
||||
{
|
||||
// If we have a different game and we're not at the start of the list, output the end of last item
|
||||
int last = 0;
|
||||
if (lastparent != null && lastparent.ToLowerInvariant() != rom.Game.Name.ToLowerInvariant())
|
||||
if (lastparent != null && lastparent.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant())
|
||||
{
|
||||
Output.WriteEndGame(sw, rom, new List<string>(), new List<string>(), lastparent, _datdata, 0, out last, _logger);
|
||||
}
|
||||
|
||||
// If we have a new game, output the beginning of the new item
|
||||
if (lastparent == null || lastparent.ToLowerInvariant() != rom.Game.Name.ToLowerInvariant())
|
||||
if (lastparent == null || lastparent.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant())
|
||||
{
|
||||
Output.WriteStartGame(sw, rom, new List<string>(), lastparent, _datdata, 0, last, _logger);
|
||||
}
|
||||
@@ -311,7 +311,7 @@ namespace SabreTools
|
||||
}
|
||||
}
|
||||
|
||||
lastparent = rom.Game.Name;
|
||||
lastparent = rom.Machine.Name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ namespace SabreTools
|
||||
}
|
||||
|
||||
_logger.User("File added: " + Path.GetFileNameWithoutExtension(item) + Environment.NewLine);
|
||||
return rom.Game.Name;
|
||||
return rom.Machine.Name;
|
||||
}
|
||||
|
||||
// If both deep hash skip flags are set, do a quickscan
|
||||
@@ -517,7 +517,7 @@ namespace SabreTools
|
||||
_logger.Log("Actual item added: " + actualitem);
|
||||
|
||||
// Update rom information
|
||||
rom.Game = new Machine
|
||||
rom.Machine = new Machine
|
||||
{
|
||||
Name = (datdata.Type == "SuperDAT" ?
|
||||
(actualroot != "" && !actualroot.StartsWith(Path.DirectorySeparatorChar.ToString()) ?
|
||||
@@ -525,7 +525,7 @@ namespace SabreTools
|
||||
"") + actualroot :
|
||||
actualroot),
|
||||
};
|
||||
rom.Game.Name = rom.Game.Name.Replace(Path.DirectorySeparatorChar.ToString() + Path.DirectorySeparatorChar.ToString(), Path.DirectorySeparatorChar.ToString());
|
||||
rom.Machine.Name = rom.Machine.Name.Replace(Path.DirectorySeparatorChar.ToString() + Path.DirectorySeparatorChar.ToString(), Path.DirectorySeparatorChar.ToString());
|
||||
rom.Name = actualitem;
|
||||
|
||||
if (_nowrite)
|
||||
@@ -546,13 +546,13 @@ namespace SabreTools
|
||||
{
|
||||
// If we have a different game and we're not at the start of the list, output the end of last item
|
||||
int last = 0;
|
||||
if (lastparent != null && lastparent.ToLowerInvariant() != rom.Game.Name.ToLowerInvariant())
|
||||
if (lastparent != null && lastparent.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant())
|
||||
{
|
||||
Output.WriteEndGame(sw, rom, new List<string>(), new List<string>(), lastparent, datdata, 0, out last, _logger);
|
||||
}
|
||||
|
||||
// If we have a new game, output the beginning of the new item
|
||||
if (lastparent == null || lastparent.ToLowerInvariant() != rom.Game.Name.ToLowerInvariant())
|
||||
if (lastparent == null || lastparent.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant())
|
||||
{
|
||||
Output.WriteStartGame(sw, rom, new List<string>(), lastparent, datdata, 0, last, _logger);
|
||||
}
|
||||
@@ -562,7 +562,7 @@ namespace SabreTools
|
||||
}
|
||||
_logger.User("File added: " + actualitem + Environment.NewLine);
|
||||
|
||||
return rom.Game.Name;
|
||||
return rom.Machine.Name;
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
|
||||
@@ -195,7 +195,7 @@ namespace SabreTools
|
||||
Rom rom = newroms[i];
|
||||
|
||||
// In the case that the RomData is incomplete, skip it
|
||||
if (rom.Name == null || rom.Game.Name == null)
|
||||
if (rom.Name == null || rom.Machine.Name == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -209,21 +209,21 @@ namespace SabreTools
|
||||
rom.Name = Regex.Replace(rom.Name, @"(.*) \.(.*)", "$1.$2");
|
||||
|
||||
// Run the name through the filters to make sure that it's correct
|
||||
rom.Game.Name = Style.NormalizeChars(rom.Game.Name);
|
||||
rom.Game.Name = Style.RussianToLatin(rom.Game.Name);
|
||||
rom.Game.Name = Style.SearchPattern(rom.Game.Name);
|
||||
rom.Machine.Name = Style.NormalizeChars(rom.Machine.Name);
|
||||
rom.Machine.Name = Style.RussianToLatin(rom.Machine.Name);
|
||||
rom.Machine.Name = Style.SearchPattern(rom.Machine.Name);
|
||||
|
||||
// WoD gets rid of anything past the first "(" or "[" as the name, we will do the same
|
||||
string stripPattern = @"(([[(].*[\)\]] )?([^([]+))";
|
||||
Regex stripRegex = new Regex(stripPattern);
|
||||
Match stripMatch = stripRegex.Match(rom.Game.Name);
|
||||
rom.Game.Name = stripMatch.Groups[1].Value;
|
||||
Match stripMatch = stripRegex.Match(rom.Machine.Name);
|
||||
rom.Machine.Name = stripMatch.Groups[1].Value;
|
||||
|
||||
rom.Game.Name = rom.Game.Name.TrimEnd().TrimStart();
|
||||
rom.Machine.Name = rom.Machine.Name.TrimEnd().TrimStart();
|
||||
|
||||
if (!_norename)
|
||||
{
|
||||
rom.Game.Name += " [" + sources[rom.Metadata.SourceID] + "]";
|
||||
rom.Machine.Name += " [" + sources[rom.Metadata.SourceID] + "]";
|
||||
}
|
||||
|
||||
// If a game has source "0" it's Default. Make this Int32.MaxValue for sorting purposes
|
||||
|
||||
@@ -523,7 +523,7 @@ namespace SabreTools
|
||||
if (_toFolder)
|
||||
{
|
||||
// Copy file to output directory
|
||||
string gamedir = Path.Combine(_outdir, found.Game.Name);
|
||||
string gamedir = Path.Combine(_outdir, found.Machine.Name);
|
||||
if (!Directory.Exists(gamedir))
|
||||
{
|
||||
Directory.CreateDirectory(gamedir);
|
||||
@@ -590,7 +590,7 @@ namespace SabreTools
|
||||
if (_toFolder)
|
||||
{
|
||||
// Copy file to output directory
|
||||
string gamedir = Path.Combine(_outdir, found.Game.Name);
|
||||
string gamedir = Path.Combine(_outdir, found.Machine.Name);
|
||||
if (!Directory.Exists(gamedir))
|
||||
{
|
||||
Directory.CreateDirectory(gamedir);
|
||||
@@ -635,7 +635,7 @@ namespace SabreTools
|
||||
if (_toFolder)
|
||||
{
|
||||
// Copy file to output directory
|
||||
string gamedir = Path.Combine(_outdir, found.Game.Name);
|
||||
string gamedir = Path.Combine(_outdir, found.Machine.Name);
|
||||
if (!Directory.Exists(gamedir))
|
||||
{
|
||||
Directory.CreateDirectory(gamedir);
|
||||
@@ -714,7 +714,7 @@ namespace SabreTools
|
||||
string outfile = ArchiveTools.ExtractSingleItemFromArchive(input, rom.Name, _tempdir, _logger);
|
||||
if (File.Exists(outfile))
|
||||
{
|
||||
string gamedir = Path.Combine(_outdir, found.Game.Name);
|
||||
string gamedir = Path.Combine(_outdir, found.Machine.Name);
|
||||
if (!Directory.Exists(gamedir))
|
||||
{
|
||||
Directory.CreateDirectory(gamedir);
|
||||
@@ -755,7 +755,7 @@ namespace SabreTools
|
||||
}
|
||||
else
|
||||
{
|
||||
string archiveFileName = Path.Combine(_outdir, found.Game + ".zip");
|
||||
string archiveFileName = Path.Combine(_outdir, found.Machine + ".zip");
|
||||
ArchiveTools.CopyFileBetweenManagedArchives(input, archiveFileName, rom.Name, found.Name, _logger);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user