mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFiles/] Abstract out prefix/postfix logic
This commit is contained in:
@@ -155,81 +155,8 @@ namespace SabreTools.Library.DatFiles
|
||||
try
|
||||
{
|
||||
string state = "", name = "", pre = "", post = "";
|
||||
pre = Prefix + (Quotes ? "\"" : "");
|
||||
post = (Quotes ? "\"" : "") + Postfix;
|
||||
|
||||
if (rom.Type == ItemType.Rom)
|
||||
{
|
||||
// Check for special strings in prefix and postfix
|
||||
pre = pre
|
||||
.Replace("%game%", rom.MachineName)
|
||||
.Replace("%name%", rom.Name)
|
||||
.Replace("%crc%", ((Rom)rom).CRC)
|
||||
.Replace("%md5%", ((Rom)rom).MD5)
|
||||
.Replace("%sha1%", ((Rom)rom).SHA1)
|
||||
.Replace("%sha256%", ((Rom)rom).SHA256)
|
||||
.Replace("%sha384%", ((Rom)rom).SHA384)
|
||||
.Replace("%sha512%", ((Rom)rom).SHA512)
|
||||
.Replace("%size%", ((Rom)rom).Size.ToString());
|
||||
post = post
|
||||
.Replace("%game%", rom.MachineName)
|
||||
.Replace("%name%", rom.Name)
|
||||
.Replace("%crc%", ((Rom)rom).CRC)
|
||||
.Replace("%md5%", ((Rom)rom).MD5)
|
||||
.Replace("%sha1%", ((Rom)rom).SHA1)
|
||||
.Replace("%sha256%", ((Rom)rom).SHA256)
|
||||
.Replace("%sha384%", ((Rom)rom).SHA384)
|
||||
.Replace("%sha512%", ((Rom)rom).SHA512)
|
||||
.Replace("%size%", ((Rom)rom).Size.ToString());
|
||||
}
|
||||
else if (rom.Type == ItemType.Disk)
|
||||
{
|
||||
// Check for special strings in prefix and postfix
|
||||
pre = pre
|
||||
.Replace("%game%", rom.MachineName)
|
||||
.Replace("%name%", rom.Name)
|
||||
.Replace("%crc%", string.Empty)
|
||||
.Replace("%md5%", ((Disk)rom).MD5)
|
||||
.Replace("%sha1%", ((Disk)rom).SHA1)
|
||||
.Replace("%sha256%", ((Disk)rom).SHA256)
|
||||
.Replace("%sha384%", ((Disk)rom).SHA384)
|
||||
.Replace("%sha512%", ((Disk)rom).SHA512)
|
||||
.Replace("%size%", string.Empty);
|
||||
post = post
|
||||
.Replace("%game%", rom.MachineName)
|
||||
.Replace("%name%", rom.Name)
|
||||
.Replace("%crc%", string.Empty)
|
||||
.Replace("%md5%", ((Disk)rom).MD5)
|
||||
.Replace("%sha1%", ((Disk)rom).SHA1)
|
||||
.Replace("%sha256%", ((Disk)rom).SHA256)
|
||||
.Replace("%sha384%", ((Disk)rom).SHA384)
|
||||
.Replace("%sha512%", ((Disk)rom).SHA512)
|
||||
.Replace("%size%", string.Empty);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check for special strings in prefix and postfix
|
||||
pre = pre
|
||||
.Replace("%game%", rom.MachineName)
|
||||
.Replace("%name%", rom.Name)
|
||||
.Replace("%crc%", string.Empty)
|
||||
.Replace("%md5%", string.Empty)
|
||||
.Replace("%sha1%", string.Empty)
|
||||
.Replace("%sha256%", string.Empty)
|
||||
.Replace("%sha384%", string.Empty)
|
||||
.Replace("%sha512%", string.Empty)
|
||||
.Replace("%size%", string.Empty);
|
||||
post = post
|
||||
.Replace("%game%", rom.MachineName)
|
||||
.Replace("%name%", rom.Name)
|
||||
.Replace("%crc%", string.Empty)
|
||||
.Replace("%md5%", string.Empty)
|
||||
.Replace("%sha1%", string.Empty)
|
||||
.Replace("%sha256%", string.Empty)
|
||||
.Replace("%sha384%", string.Empty)
|
||||
.Replace("%sha512%", string.Empty)
|
||||
.Replace("%size%", string.Empty);
|
||||
}
|
||||
pre = CreatePrefixPostfix(rom, true);
|
||||
post = CreatePrefixPostfix(rom, false);
|
||||
|
||||
// If we're in Romba mode, the state is consistent
|
||||
if (Romba)
|
||||
|
||||
Reference in New Issue
Block a user