mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[ALL] String.Empty
This commit is contained in:
@@ -87,7 +87,7 @@ namespace SabreTools
|
||||
dbc.Open();
|
||||
StreamWriter sw = new StreamWriter(File.Open("export.csv", FileMode.Create, FileAccess.Write));
|
||||
|
||||
sw.WriteLine("\"ID\",\"Size\",\"CRC\",\"MD5\",\"SHA-1\",\"In Depot\",\"DAT Hash\"");
|
||||
sw.WriteLine("\"ID\",\"Size\",\"CRC\",\"MD5\",\"SHA-1\",\"In Depot\",\"DAT Hash"");
|
||||
|
||||
string query = "SELECT dats.id, size, crc, md5, sha1, indepot, hash FROM data JOIN dats ON data.id=dats.id";
|
||||
SqliteCommand slc = new SqliteCommand(query, dbc);
|
||||
@@ -97,13 +97,13 @@ namespace SabreTools
|
||||
{
|
||||
while (sldr.Read())
|
||||
{
|
||||
string line = "\"" + sldr.GetInt32(0) + "\","
|
||||
+ "\"" + sldr.GetInt64(1) + "\","
|
||||
+ "\"" + sldr.GetString(2) + "\","
|
||||
+ "\"" + sldr.GetString(3) + "\","
|
||||
+ "\"" + sldr.GetString(4) + "\","
|
||||
+ "\"" + sldr.GetInt32(5) + "\","
|
||||
+ "\"" + sldr.GetString(6) + "\"";
|
||||
string line = """ + sldr.GetInt32(0) + "\","
|
||||
+ """ + sldr.GetInt64(1) + "\","
|
||||
+ """ + sldr.GetString(2) + "\","
|
||||
+ """ + sldr.GetString(3) + "\","
|
||||
+ """ + sldr.GetString(4) + "\","
|
||||
+ """ + sldr.GetInt32(5) + "\","
|
||||
+ """ + sldr.GetString(6) + """;
|
||||
sw.WriteLine(line);
|
||||
}
|
||||
}
|
||||
@@ -158,7 +158,7 @@ namespace SabreTools
|
||||
baddir = "bad",
|
||||
dats = "dats",
|
||||
db = "db",
|
||||
connectionString = "";
|
||||
connectionString = String.Empty;
|
||||
Dictionary<string, Tuple<long, bool>> depots = new Dictionary<string, Tuple<long, bool>>();
|
||||
|
||||
// Get the XML text reader for the configuration file, if possible
|
||||
@@ -210,7 +210,7 @@ namespace SabreTools
|
||||
XmlReader subreader = xtr.ReadSubtree();
|
||||
if (subreader != null)
|
||||
{
|
||||
string root = "";
|
||||
string root = String.Empty;
|
||||
long maxsize = -1;
|
||||
bool online = true;
|
||||
|
||||
@@ -459,7 +459,7 @@ namespace SabreTools
|
||||
|
||||
foreach (string dathash in unneeded)
|
||||
{
|
||||
query = "DELETE FROM dats WHERE hash=\"" + dathash + "\"";
|
||||
query = "DELETE FROM dats WHERE hash="" + dathash + """;
|
||||
slc = new SqliteCommand(query, dbc);
|
||||
slc.ExecuteNonQuery();
|
||||
slc.Dispose();
|
||||
@@ -472,7 +472,7 @@ namespace SabreTools
|
||||
private static void AddDatToDatabase(Rom dat, SqliteConnection dbc)
|
||||
{
|
||||
// Get the dat full path
|
||||
string fullpath = Path.Combine(_dats, (dat.Machine.Name == "dats" ? "" : dat.Machine.Name), dat.Name);
|
||||
string fullpath = Path.Combine(_dats, (dat.Machine.Name == "dats" ? String.Empty : dat.Machine.Name), dat.Name);
|
||||
|
||||
// Parse the Dat if possible
|
||||
_logger.User("Adding from '" + dat.Name + "'");
|
||||
@@ -502,23 +502,23 @@ namespace SabreTools
|
||||
|
||||
if (!String.IsNullOrEmpty(rom.CRC))
|
||||
{
|
||||
crcquery += " (\"" + rom.CRC + "\"),";
|
||||
crcquery += " ("" + rom.CRC + "\"),";
|
||||
}
|
||||
if (!String.IsNullOrEmpty(rom.MD5))
|
||||
{
|
||||
md5query += " (\"" + rom.MD5 + "\"),";
|
||||
md5query += " ("" + rom.MD5 + "\"),";
|
||||
}
|
||||
if (!String.IsNullOrEmpty(rom.SHA1))
|
||||
{
|
||||
sha1query += " (\"" + rom.SHA1 + "\"),";
|
||||
sha1query += " ("" + rom.SHA1 + "\"),";
|
||||
|
||||
if (!String.IsNullOrEmpty(rom.CRC))
|
||||
{
|
||||
crcsha1query += " (\"" + rom.CRC + "\", \"" + rom.SHA1 + "\"),";
|
||||
crcsha1query += " ("" + rom.CRC + "\", "" + rom.SHA1 + "\"),";
|
||||
}
|
||||
if (!String.IsNullOrEmpty(rom.MD5))
|
||||
{
|
||||
md5sha1query += " (\"" + rom.MD5 + "\", \"" + rom.SHA1 + "\"),";
|
||||
md5sha1query += " ("" + rom.MD5 + "\", "" + rom.SHA1 + "\"),";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -528,15 +528,15 @@ namespace SabreTools
|
||||
|
||||
if (!String.IsNullOrEmpty(disk.MD5))
|
||||
{
|
||||
md5query += " (\"" + disk.MD5 + "\"),";
|
||||
md5query += " ("" + disk.MD5 + "\"),";
|
||||
}
|
||||
if (!String.IsNullOrEmpty(disk.SHA1))
|
||||
{
|
||||
sha1query += " (\"" + disk.SHA1 + "\"),";
|
||||
sha1query += " ("" + disk.SHA1 + "\"),";
|
||||
|
||||
if (!String.IsNullOrEmpty(disk.MD5))
|
||||
{
|
||||
md5sha1query += " (\"" + disk.MD5 + "\", \"" + disk.SHA1 + "\"),";
|
||||
md5sha1query += " ("" + disk.MD5 + "\", "" + disk.SHA1 + "\"),";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -571,7 +571,7 @@ namespace SabreTools
|
||||
}
|
||||
}
|
||||
|
||||
string datquery = "INSERT OR IGNORE INTO dat (hash) VALUES (\"" + dat.SHA1 + "\")";
|
||||
string datquery = "INSERT OR IGNORE INTO dat (hash) VALUES ("" + dat.SHA1 + "\")";
|
||||
slc = new SqliteCommand(datquery, dbc);
|
||||
slc.ExecuteNonQuery();
|
||||
slc.Dispose();
|
||||
@@ -603,7 +603,7 @@ namespace SabreTools
|
||||
|
||||
// If we have it, then check for all hashes that are in that depot
|
||||
List<string> hashes = new List<string>();
|
||||
string query = "SELECT sha1 FROM sha1 WHERE depot=\"" + depotname + "\"";
|
||||
string query = "SELECT sha1 FROM sha1 WHERE depot="" + depotname + """;
|
||||
SqliteCommand slc = new SqliteCommand(query, dbc);
|
||||
SqliteDataReader sldr = slc.ExecuteReader();
|
||||
if (sldr.HasRows)
|
||||
@@ -643,23 +643,23 @@ namespace SabreTools
|
||||
{
|
||||
if (!String.IsNullOrEmpty(rom.CRC))
|
||||
{
|
||||
crcquery += " (\"" + rom.CRC + "\"),";
|
||||
crcquery += " ("" + rom.CRC + "\"),";
|
||||
}
|
||||
if (!String.IsNullOrEmpty(rom.MD5))
|
||||
{
|
||||
md5query += " (\"" + rom.MD5 + "\"),";
|
||||
md5query += " ("" + rom.MD5 + "\"),";
|
||||
}
|
||||
if (!String.IsNullOrEmpty(rom.SHA1))
|
||||
{
|
||||
sha1query += " (\"" + rom.SHA1 + "\", \"" + depotname + "\"),";
|
||||
sha1query += " ("" + rom.SHA1 + "\", "" + depotname + "\"),";
|
||||
|
||||
if (!String.IsNullOrEmpty(rom.CRC))
|
||||
{
|
||||
crcsha1query += " (\"" + rom.CRC + "\", \"" + rom.SHA1 + "\"),";
|
||||
crcsha1query += " ("" + rom.CRC + "\", "" + rom.SHA1 + "\"),";
|
||||
}
|
||||
if (!String.IsNullOrEmpty(rom.MD5))
|
||||
{
|
||||
md5sha1query += " (\"" + rom.MD5 + "\", \"" + rom.SHA1 + "\"),";
|
||||
md5sha1query += " ("" + rom.MD5 + "\", "" + rom.SHA1 + "\"),";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -703,7 +703,7 @@ JOIN crc
|
||||
ON crcsha1.crc=crc.crc
|
||||
JOIN md5
|
||||
ON md5sha1.md5=md5.md5
|
||||
WHERE sha1.sha1 IN (""" + String.Join("\",\"", hashes) + "\")";
|
||||
WHERE sha1.sha1 IN (String.Empty" + String.Join("\","", hashes) + "\")";
|
||||
slc = new SqliteCommand(query, dbc);
|
||||
slc.ExecuteNonQuery();
|
||||
|
||||
|
||||
@@ -73,9 +73,9 @@ namespace SabreTools
|
||||
if (onlyNeeded)
|
||||
{
|
||||
string query = "SELECT * FROM crcsha1 JOIN md5sha1 ON crcsha1.sha1=md5sha1.sha1"
|
||||
+ " WHERE crcsha1.crc=\"" + rom.CRC + "\""
|
||||
+ " OR md5sha1.md5=\"" + rom.MD5 + "\""
|
||||
+ " OR md5sha1.sha1=\"" + rom.SHA1 + "\"";
|
||||
+ " WHERE crcsha1.crc="" + rom.CRC + """
|
||||
+ " OR md5sha1.md5="" + rom.MD5 + """
|
||||
+ " OR md5sha1.sha1="" + rom.SHA1 + """;
|
||||
SqliteCommand slc = new SqliteCommand(query, dbc);
|
||||
SqliteDataReader sldr = slc.ExecuteReader();
|
||||
|
||||
@@ -84,23 +84,23 @@ namespace SabreTools
|
||||
// Add to the queries
|
||||
if (!String.IsNullOrEmpty(rom.CRC))
|
||||
{
|
||||
crcquery += " (\"" + rom.CRC + "\"),";
|
||||
crcquery += " ("" + rom.CRC + "\"),";
|
||||
}
|
||||
if (!String.IsNullOrEmpty(rom.MD5))
|
||||
{
|
||||
md5query += " (\"" + rom.MD5 + "\"),";
|
||||
md5query += " ("" + rom.MD5 + "\"),";
|
||||
}
|
||||
if (!String.IsNullOrEmpty(rom.SHA1))
|
||||
{
|
||||
sha1query += " (\"" + rom.SHA1 + "\", \"" + _depots.Keys.ToList()[0] + "\"),";
|
||||
sha1query += " ("" + rom.SHA1 + "\", "" + _depots.Keys.ToList()[0] + "\"),";
|
||||
|
||||
if (!String.IsNullOrEmpty(rom.CRC))
|
||||
{
|
||||
crcsha1query += " (\"" + rom.CRC + "\", \"" + rom.SHA1 + "\"),";
|
||||
crcsha1query += " ("" + rom.CRC + "\", "" + rom.SHA1 + "\"),";
|
||||
}
|
||||
if (!String.IsNullOrEmpty(rom.MD5))
|
||||
{
|
||||
md5sha1query += " (\"" + rom.MD5 + "\", \"" + rom.SHA1 + "\"),";
|
||||
md5sha1query += " ("" + rom.MD5 + "\", "" + rom.SHA1 + "\"),";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,23 +114,23 @@ namespace SabreTools
|
||||
// Add to the queries
|
||||
if (!String.IsNullOrEmpty(rom.CRC))
|
||||
{
|
||||
crcquery += " (\"" + rom.CRC + "\"),";
|
||||
crcquery += " ("" + rom.CRC + "\"),";
|
||||
}
|
||||
if (!String.IsNullOrEmpty(rom.MD5))
|
||||
{
|
||||
md5query += " (\"" + rom.MD5 + "\"),";
|
||||
md5query += " ("" + rom.MD5 + "\"),";
|
||||
}
|
||||
if (!String.IsNullOrEmpty(rom.SHA1))
|
||||
{
|
||||
sha1query += " (\"" + rom.SHA1 + "\", \"" + _depots.Keys.ToList()[0] + "\"),";
|
||||
sha1query += " ("" + rom.SHA1 + "\", "" + _depots.Keys.ToList()[0] + "\"),";
|
||||
|
||||
if (!String.IsNullOrEmpty(rom.CRC))
|
||||
{
|
||||
crcsha1query += " (\"" + rom.CRC + "\", \"" + rom.SHA1 + "\"),";
|
||||
crcsha1query += " ("" + rom.CRC + "\", "" + rom.SHA1 + "\"),";
|
||||
}
|
||||
if (!String.IsNullOrEmpty(rom.MD5))
|
||||
{
|
||||
md5sha1query += " (\"" + rom.MD5 + "\", \"" + rom.SHA1 + "\"),";
|
||||
md5sha1query += " ("" + rom.MD5 + "\", "" + rom.SHA1 + "\"),";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ namespace SabreTools
|
||||
datdata.PopulateFromDir(input, false /* noMD5 */, false /* noSHA1 */, true /* bare */, false /* archivesAsFiles */,
|
||||
true /* enableGzip */, false /* addBlanks */, false /* addDate */, _tmpdir /* tempDir */, false /* copyFiles */,
|
||||
null /* headerToCheckAgainst */, _workers /* maxDegreeOfParallelism */, _logger);
|
||||
datdata.WriteToFile("", logger);
|
||||
datdata.WriteToFile(String.Empty, logger);
|
||||
}
|
||||
logger.Close();
|
||||
}
|
||||
@@ -287,11 +287,11 @@ namespace SabreTools
|
||||
List<string> sha1 = new List<string>();
|
||||
foreach (string input in inputs)
|
||||
{
|
||||
string temp = "";
|
||||
string temp = String.Empty;
|
||||
if (input.Length == Constants.CRCLength)
|
||||
{
|
||||
temp = Style.CleanHashData(input, Constants.CRCLength);
|
||||
if (temp != "")
|
||||
if (temp != String.Empty)
|
||||
{
|
||||
crc.Add(temp);
|
||||
}
|
||||
@@ -299,7 +299,7 @@ namespace SabreTools
|
||||
else if (input.Length == Constants.MD5Length)
|
||||
{
|
||||
temp = Style.CleanHashData(input, Constants.MD5Length);
|
||||
if (temp != "")
|
||||
if (temp != String.Empty)
|
||||
{
|
||||
md5.Add(temp);
|
||||
}
|
||||
@@ -307,7 +307,7 @@ namespace SabreTools
|
||||
else if (input.Length == Constants.SHA1Length)
|
||||
{
|
||||
temp = Style.CleanHashData(input, Constants.SHA1Length);
|
||||
if (temp != "")
|
||||
if (temp != String.Empty)
|
||||
{
|
||||
sha1.Add(temp);
|
||||
}
|
||||
@@ -320,7 +320,7 @@ namespace SabreTools
|
||||
// Now, search for each of them and return true or false for each
|
||||
foreach (string input in crc)
|
||||
{
|
||||
string query = "SELECT * FROM crc WHERE crc=\"" + input + "\"";
|
||||
string query = "SELECT * FROM crc WHERE crc="" + input + """;
|
||||
SqliteCommand slc = new SqliteCommand(query, dbc);
|
||||
SqliteDataReader sldr = slc.ExecuteReader();
|
||||
if (sldr.HasRows)
|
||||
@@ -337,7 +337,7 @@ namespace SabreTools
|
||||
}
|
||||
foreach (string input in md5)
|
||||
{
|
||||
string query = "SELECT * FROM md5 WHERE md5=\"" + input + "\"";
|
||||
string query = "SELECT * FROM md5 WHERE md5="" + input + """;
|
||||
SqliteCommand slc = new SqliteCommand(query, dbc);
|
||||
SqliteDataReader sldr = slc.ExecuteReader();
|
||||
if (sldr.HasRows)
|
||||
@@ -354,7 +354,7 @@ namespace SabreTools
|
||||
}
|
||||
foreach (string input in sha1)
|
||||
{
|
||||
string query = "SELECT * FROM sha1 WHERE sha1=\"" + input + "\"";
|
||||
string query = "SELECT * FROM sha1 WHERE sha1="" + input + """;
|
||||
SqliteCommand slc = new SqliteCommand(query, dbc);
|
||||
SqliteDataReader sldr = slc.ExecuteReader();
|
||||
if (sldr.HasRows)
|
||||
|
||||
@@ -6,13 +6,13 @@ using System.Runtime.InteropServices;
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("RombaSharp")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyDescription(String.Empty)]
|
||||
[assembly: AssemblyConfiguration(String.Empty)]
|
||||
[assembly: AssemblyCompany(String.Empty)]
|
||||
[assembly: AssemblyProduct("RombaSharp")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: AssemblyTrademark(String.Empty)]
|
||||
[assembly: AssemblyCulture(String.Empty)]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
||||
@@ -93,8 +93,8 @@ namespace SabreTools
|
||||
onlyNeeded = false;
|
||||
|
||||
// User inputs
|
||||
string newdat ="",
|
||||
outdat = "";
|
||||
string newdat =String.Empty,
|
||||
outdat = String.Empty;
|
||||
List<string> inputs = new List<string>();
|
||||
|
||||
// Determine which switches are enabled (with values if necessary)
|
||||
@@ -178,7 +178,7 @@ namespace SabreTools
|
||||
outdat = args[i];
|
||||
break;
|
||||
default:
|
||||
string temparg = args[i].Replace("\"", "").Replace("file://", "");
|
||||
string temparg = args[i].Replace(""", String.Empty).Replace("file://", String.Empty);
|
||||
|
||||
if (temparg.StartsWith("-") && temparg.Contains("="))
|
||||
{
|
||||
@@ -186,7 +186,7 @@ namespace SabreTools
|
||||
string[] split = temparg.Split('=');
|
||||
if (split[1] == null)
|
||||
{
|
||||
split[1] = "";
|
||||
split[1] = String.Empty;
|
||||
}
|
||||
|
||||
switch (split[0])
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace SabreTools.Helper.Data
|
||||
helptext.Add(barrier);
|
||||
helptext.Add("Credits");
|
||||
helptext.Add(barrier);
|
||||
helptext.Add("");
|
||||
helptext.Add(String.Empty);
|
||||
helptext.Add("Programmer / Lead: Matt Nadareski (darksabre76)");
|
||||
helptext.Add("Additional code: emuLOAD, @tractivo, motoschifo");
|
||||
helptext.Add("Testing: emuLOAD, @tractivo, Kludge, Obiwantje, edc");
|
||||
@@ -86,7 +86,7 @@ namespace SabreTools.Helper.Data
|
||||
helptext.Add(Resources.Resources.RombaSharp_Name + " - " + Resources.Resources.RombaSharp_Desc);
|
||||
helptext.Add(barrier);
|
||||
helptext.Add(Resources.Resources.Usage + ": " + Resources.Resources.RombaSharp_Name + " [option] [filename|dirname] ...");
|
||||
helptext.Add("");
|
||||
helptext.Add(String.Empty);
|
||||
helptext.Add("Options:");
|
||||
helptext.Add(" -?, -h, --help Show this help");
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace SabreTools.Helper.Data
|
||||
helptext.Add(Resources.Resources.SabreTools_Name + " - " + Resources.Resources.SabreTools_Desc);
|
||||
helptext.Add(barrier);
|
||||
helptext.Add(Resources.Resources.Usage + ": " + Resources.Resources.SabreTools_Name + " [option] [filename|dirname] ...");
|
||||
helptext.Add("");
|
||||
helptext.Add(String.Empty);
|
||||
helptext.Add("Options:");
|
||||
helptext.Add(" -?, -h, --help Show this help");
|
||||
helptext.Add(" --script Enable script mode (no clear screen)");
|
||||
@@ -384,13 +384,13 @@ namespace SabreTools.Helper.Data
|
||||
helptext.Add(" -h=, --header= Set a header skipper to use, blank means all");
|
||||
|
||||
// Additional Notes
|
||||
helptext.Add("");
|
||||
helptext.Add(String.Empty);
|
||||
helptext.Add("Archive scanning levels:");
|
||||
helptext.Add(" 0 Hash archive and contents");
|
||||
helptext.Add(" 1 Only hash contents");
|
||||
helptext.Add(" 2 Only hash archive");
|
||||
|
||||
helptext.Add("");
|
||||
helptext.Add(String.Empty);
|
||||
helptext.Add("Filter parameters game name, rom name, CRC, MD5, SHA-1 can");
|
||||
helptext.Add("do partial matches using asterisks as follows (case insensitive):");
|
||||
helptext.Add(" *00 means ends with '00'");
|
||||
@@ -398,11 +398,11 @@ namespace SabreTools.Helper.Data
|
||||
helptext.Add(" *00* means contains '00'");
|
||||
helptext.Add(" 00 means exactly equals '00'");
|
||||
|
||||
helptext.Add("");
|
||||
helptext.Add(String.Empty);
|
||||
helptext.Add("Filter parameters for size can use postfixes for inputs:");
|
||||
helptext.Add(" e.g. 8kb => 8000 or 8kib => 8192");
|
||||
|
||||
helptext.Add("");
|
||||
helptext.Add(String.Empty);
|
||||
helptext.Add("Most of the filter parameters allow for multiple inputs:");
|
||||
helptext.Add(" e.g. --game-name=foo --game-name=bar");
|
||||
break;
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace SabreTools.Helper.Dats
|
||||
/// </summary>
|
||||
public Archive()
|
||||
{
|
||||
_name = "";
|
||||
_name = String.Empty;
|
||||
_itemType = ItemType.Archive;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace SabreTools.Helper.Dats
|
||||
/// </summary>
|
||||
public BiosSet()
|
||||
{
|
||||
_name = "";
|
||||
_name = String.Empty;
|
||||
_itemType = ItemType.BiosSet;
|
||||
}
|
||||
|
||||
|
||||
@@ -247,7 +247,7 @@ namespace SabreTools.Helper.Dats
|
||||
}
|
||||
|
||||
// Get the correct dictionary based on what is available
|
||||
string key = "";
|
||||
string key = String.Empty;
|
||||
if (_itemType == ItemType.Rom && ((Rom)this).CRC != null)
|
||||
{
|
||||
key = ((Rom)this).CRC;
|
||||
@@ -322,7 +322,7 @@ namespace SabreTools.Helper.Dats
|
||||
}
|
||||
|
||||
// Get the correct dictionary based on what is available
|
||||
string key = "";
|
||||
string key = String.Empty;
|
||||
if (_itemType == ItemType.Rom && ((Rom)this).CRC != null)
|
||||
{
|
||||
key = ((Rom)this).CRC;
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace SabreTools.Helper.Dats
|
||||
/// </summary>
|
||||
public Disk()
|
||||
{
|
||||
_name = "";
|
||||
_name = String.Empty;
|
||||
_itemType = ItemType.Disk;
|
||||
_dupeType = 0x00;
|
||||
_itemStatus = ItemStatus.None;
|
||||
|
||||
@@ -188,21 +188,21 @@ namespace SabreTools.Helper.Dats
|
||||
{
|
||||
if (crc.StartsWith("*") && crc.EndsWith("*"))
|
||||
{
|
||||
if (!rom.CRC.ToLowerInvariant().Contains(crc.ToLowerInvariant().Replace("*", "")))
|
||||
if (!rom.CRC.ToLowerInvariant().Contains(crc.ToLowerInvariant().Replace("*", String.Empty)))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (crc.StartsWith("*"))
|
||||
{
|
||||
if (!rom.CRC.EndsWith(crc.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!rom.CRC.EndsWith(crc.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (crc.EndsWith("*"))
|
||||
{
|
||||
if (!rom.CRC.StartsWith(crc.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!rom.CRC.StartsWith(crc.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
@@ -230,21 +230,21 @@ namespace SabreTools.Helper.Dats
|
||||
{
|
||||
if (crc.StartsWith("*") && crc.EndsWith("*"))
|
||||
{
|
||||
if (rom.CRC.ToLowerInvariant().Contains(crc.ToLowerInvariant().Replace("*", "")))
|
||||
if (rom.CRC.ToLowerInvariant().Contains(crc.ToLowerInvariant().Replace("*", String.Empty)))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (crc.StartsWith("*"))
|
||||
{
|
||||
if (rom.CRC.EndsWith(crc.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (rom.CRC.EndsWith(crc.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (crc.EndsWith("*"))
|
||||
{
|
||||
if (rom.CRC.StartsWith(crc.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (rom.CRC.StartsWith(crc.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
@@ -275,21 +275,21 @@ namespace SabreTools.Helper.Dats
|
||||
{
|
||||
if (md5.StartsWith("*") && md5.EndsWith("*"))
|
||||
{
|
||||
if (!rom.MD5.ToLowerInvariant().Contains(md5.ToLowerInvariant().Replace("*", "")))
|
||||
if (!rom.MD5.ToLowerInvariant().Contains(md5.ToLowerInvariant().Replace("*", String.Empty)))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (md5.StartsWith("*"))
|
||||
{
|
||||
if (!rom.MD5.EndsWith(md5.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!rom.MD5.EndsWith(md5.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (md5.EndsWith("*"))
|
||||
{
|
||||
if (!rom.MD5.StartsWith(md5.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!rom.MD5.StartsWith(md5.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
@@ -317,21 +317,21 @@ namespace SabreTools.Helper.Dats
|
||||
{
|
||||
if (md5.StartsWith("*") && md5.EndsWith("*"))
|
||||
{
|
||||
if (rom.MD5.ToLowerInvariant().Contains(md5.ToLowerInvariant().Replace("*", "")))
|
||||
if (rom.MD5.ToLowerInvariant().Contains(md5.ToLowerInvariant().Replace("*", String.Empty)))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (md5.StartsWith("*"))
|
||||
{
|
||||
if (rom.MD5.EndsWith(md5.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (rom.MD5.EndsWith(md5.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (md5.EndsWith("*"))
|
||||
{
|
||||
if (rom.MD5.StartsWith(md5.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (rom.MD5.StartsWith(md5.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
@@ -362,21 +362,21 @@ namespace SabreTools.Helper.Dats
|
||||
{
|
||||
if (sha1.StartsWith("*") && sha1.EndsWith("*"))
|
||||
{
|
||||
if (!rom.SHA1.ToLowerInvariant().Contains(sha1.ToLowerInvariant().Replace("*", "")))
|
||||
if (!rom.SHA1.ToLowerInvariant().Contains(sha1.ToLowerInvariant().Replace("*", String.Empty)))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (sha1.StartsWith("*"))
|
||||
{
|
||||
if (!rom.SHA1.EndsWith(sha1.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!rom.SHA1.EndsWith(sha1.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (sha1.EndsWith("*"))
|
||||
{
|
||||
if (!rom.SHA1.StartsWith(sha1.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!rom.SHA1.StartsWith(sha1.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
@@ -404,21 +404,21 @@ namespace SabreTools.Helper.Dats
|
||||
{
|
||||
if (sha1.StartsWith("*") && sha1.EndsWith("*"))
|
||||
{
|
||||
if (rom.SHA1.ToLowerInvariant().Contains(sha1.ToLowerInvariant().Replace("*", "")))
|
||||
if (rom.SHA1.ToLowerInvariant().Contains(sha1.ToLowerInvariant().Replace("*", String.Empty)))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (sha1.StartsWith("*"))
|
||||
{
|
||||
if (rom.SHA1.EndsWith(sha1.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (rom.SHA1.EndsWith(sha1.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (sha1.EndsWith("*"))
|
||||
{
|
||||
if (rom.SHA1.StartsWith(sha1.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (rom.SHA1.StartsWith(sha1.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
@@ -463,21 +463,21 @@ namespace SabreTools.Helper.Dats
|
||||
{
|
||||
if (md5.StartsWith("*") && md5.EndsWith("*"))
|
||||
{
|
||||
if (!rom.MD5.ToLowerInvariant().Contains(md5.ToLowerInvariant().Replace("*", "")))
|
||||
if (!rom.MD5.ToLowerInvariant().Contains(md5.ToLowerInvariant().Replace("*", String.Empty)))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (md5.StartsWith("*"))
|
||||
{
|
||||
if (!rom.MD5.EndsWith(md5.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!rom.MD5.EndsWith(md5.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (md5.EndsWith("*"))
|
||||
{
|
||||
if (!rom.MD5.StartsWith(md5.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!rom.MD5.StartsWith(md5.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
@@ -505,21 +505,21 @@ namespace SabreTools.Helper.Dats
|
||||
{
|
||||
if (md5.StartsWith("*") && md5.EndsWith("*"))
|
||||
{
|
||||
if (rom.MD5.ToLowerInvariant().Contains(md5.ToLowerInvariant().Replace("*", "")))
|
||||
if (rom.MD5.ToLowerInvariant().Contains(md5.ToLowerInvariant().Replace("*", String.Empty)))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (md5.StartsWith("*"))
|
||||
{
|
||||
if (rom.MD5.EndsWith(md5.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (rom.MD5.EndsWith(md5.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (md5.EndsWith("*"))
|
||||
{
|
||||
if (rom.MD5.StartsWith(md5.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (rom.MD5.StartsWith(md5.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
@@ -550,21 +550,21 @@ namespace SabreTools.Helper.Dats
|
||||
{
|
||||
if (sha1.StartsWith("*") && sha1.EndsWith("*"))
|
||||
{
|
||||
if (!rom.SHA1.ToLowerInvariant().Contains(sha1.ToLowerInvariant().Replace("*", "")))
|
||||
if (!rom.SHA1.ToLowerInvariant().Contains(sha1.ToLowerInvariant().Replace("*", String.Empty)))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (sha1.StartsWith("*"))
|
||||
{
|
||||
if (!rom.SHA1.EndsWith(sha1.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!rom.SHA1.EndsWith(sha1.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (sha1.EndsWith("*"))
|
||||
{
|
||||
if (!rom.SHA1.StartsWith(sha1.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!rom.SHA1.StartsWith(sha1.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
@@ -592,21 +592,21 @@ namespace SabreTools.Helper.Dats
|
||||
{
|
||||
if (sha1.StartsWith("*") && sha1.EndsWith("*"))
|
||||
{
|
||||
if (rom.SHA1.ToLowerInvariant().Contains(sha1.ToLowerInvariant().Replace("*", "")))
|
||||
if (rom.SHA1.ToLowerInvariant().Contains(sha1.ToLowerInvariant().Replace("*", String.Empty)))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (sha1.StartsWith("*"))
|
||||
{
|
||||
if (rom.SHA1.EndsWith(sha1.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (rom.SHA1.EndsWith(sha1.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (sha1.EndsWith("*"))
|
||||
{
|
||||
if (rom.SHA1.StartsWith(sha1.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (rom.SHA1.StartsWith(sha1.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
@@ -636,21 +636,21 @@ namespace SabreTools.Helper.Dats
|
||||
{
|
||||
if (name.StartsWith("*") && name.EndsWith("*"))
|
||||
{
|
||||
if (!item.Machine.Name.ToLowerInvariant().Contains(name.ToLowerInvariant().Replace("*", "")))
|
||||
if (!item.Machine.Name.ToLowerInvariant().Contains(name.ToLowerInvariant().Replace("*", String.Empty)))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (name.StartsWith("*"))
|
||||
{
|
||||
if (!item.Machine.Name.EndsWith(name.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!item.Machine.Name.EndsWith(name.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (name.EndsWith("*"))
|
||||
{
|
||||
if (!item.Machine.Name.StartsWith(name.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!item.Machine.Name.StartsWith(name.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
@@ -677,21 +677,21 @@ namespace SabreTools.Helper.Dats
|
||||
{
|
||||
if (name.StartsWith("*") && name.EndsWith("*"))
|
||||
{
|
||||
if (item.Machine.Name.ToLowerInvariant().Contains(name.ToLowerInvariant().Replace("*", "")))
|
||||
if (item.Machine.Name.ToLowerInvariant().Contains(name.ToLowerInvariant().Replace("*", String.Empty)))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (name.StartsWith("*"))
|
||||
{
|
||||
if (item.Machine.Name.EndsWith(name.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (item.Machine.Name.EndsWith(name.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (name.EndsWith("*"))
|
||||
{
|
||||
if (item.Machine.Name.StartsWith(name.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (item.Machine.Name.StartsWith(name.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
@@ -720,21 +720,21 @@ namespace SabreTools.Helper.Dats
|
||||
{
|
||||
if (name.StartsWith("*") && name.EndsWith("*"))
|
||||
{
|
||||
if (!item.Name.ToLowerInvariant().Contains(name.ToLowerInvariant().Replace("*", "")))
|
||||
if (!item.Name.ToLowerInvariant().Contains(name.ToLowerInvariant().Replace("*", String.Empty)))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (name.StartsWith("*"))
|
||||
{
|
||||
if (!item.Name.EndsWith(name.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!item.Name.EndsWith(name.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (name.EndsWith("*"))
|
||||
{
|
||||
if (!item.Name.StartsWith(name.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!item.Name.StartsWith(name.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
@@ -761,21 +761,21 @@ namespace SabreTools.Helper.Dats
|
||||
{
|
||||
if (name.StartsWith("*") && name.EndsWith("*"))
|
||||
{
|
||||
if (item.Name.ToLowerInvariant().Contains(name.ToLowerInvariant().Replace("*", "")))
|
||||
if (item.Name.ToLowerInvariant().Contains(name.ToLowerInvariant().Replace("*", String.Empty)))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (name.StartsWith("*"))
|
||||
{
|
||||
if (item.Name.EndsWith(name.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (item.Name.EndsWith(name.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
else if (name.EndsWith("*"))
|
||||
{
|
||||
if (item.Name.StartsWith(name.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase))
|
||||
if (item.Name.StartsWith(name.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
|
||||
@@ -109,8 +109,8 @@ namespace SabreTools.Helper.Dats
|
||||
/// </summary>
|
||||
public Machine()
|
||||
{
|
||||
_name = "";
|
||||
_description = "";
|
||||
_name = String.Empty;
|
||||
_description = String.Empty;
|
||||
_runnable = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace SabreTools.Helper.Dats
|
||||
SortedDictionary<string, List<DatItem>> sortable = new SortedDictionary<string, List<DatItem>>();
|
||||
long count = 0;
|
||||
|
||||
logger.User("Organizing " + (mergeroms ? "and merging " : "") + "roms by CRC");
|
||||
logger.User("Organizing " + (mergeroms ? "and merging " : String.Empty) + "roms by CRC");
|
||||
|
||||
// Process each all of the roms
|
||||
List<string> keys = Keys.ToList();
|
||||
@@ -102,7 +102,7 @@ namespace SabreTools.Helper.Dats
|
||||
SortedDictionary<string, List<DatItem>> sortable = new SortedDictionary<string, List<DatItem>>();
|
||||
long count = 0;
|
||||
|
||||
logger.User("Organizing " + (mergeroms ? "and merging " : "") + "roms by game");
|
||||
logger.User("Organizing " + (mergeroms ? "and merging " : String.Empty) + "roms by game");
|
||||
|
||||
// Process each all of the roms
|
||||
List<string> keys = Keys.ToList();
|
||||
@@ -120,7 +120,7 @@ namespace SabreTools.Helper.Dats
|
||||
foreach (DatItem rom in roms)
|
||||
{
|
||||
count++;
|
||||
string newkey = (norename ? ""
|
||||
string newkey = (norename ? String.Empty
|
||||
: rom.SystemID.ToString().PadLeft(10, '0')
|
||||
+ "-"
|
||||
+ rom.SourceID.ToString().PadLeft(10, '0') + "-")
|
||||
@@ -188,7 +188,7 @@ namespace SabreTools.Helper.Dats
|
||||
SortedDictionary<string, List<DatItem>> sortable = new SortedDictionary<string, List<DatItem>>();
|
||||
long count = 0;
|
||||
|
||||
logger.User("Organizing " + (mergeroms ? "and merging " : "") + "roms by MD5");
|
||||
logger.User("Organizing " + (mergeroms ? "and merging " : String.Empty) + "roms by MD5");
|
||||
|
||||
// Process each all of the roms
|
||||
List<string> keys = Keys.ToList();
|
||||
@@ -259,7 +259,7 @@ namespace SabreTools.Helper.Dats
|
||||
SortedDictionary<string, List<DatItem>> sortable = new SortedDictionary<string, List<DatItem>>();
|
||||
long count = 0;
|
||||
|
||||
logger.User("Organizing " + (mergeroms ? "and merging " : "") + "roms by SHA-1");
|
||||
logger.User("Organizing " + (mergeroms ? "and merging " : String.Empty) + "roms by SHA-1");
|
||||
|
||||
// Process each all of the roms
|
||||
List<string> keys = Keys.ToList();
|
||||
@@ -330,7 +330,7 @@ namespace SabreTools.Helper.Dats
|
||||
SortedDictionary<string, List<DatItem>> sortable = new SortedDictionary<string, List<DatItem>>();
|
||||
long count = 0;
|
||||
|
||||
logger.User("Organizing " + (mergeroms ? "and merging " : "") + "roms by size");
|
||||
logger.User("Organizing " + (mergeroms ? "and merging " : String.Empty) + "roms by size");
|
||||
|
||||
// Process each all of the roms
|
||||
List<string> keys = Keys.ToList();
|
||||
@@ -1083,7 +1083,7 @@ namespace SabreTools.Helper.Dats
|
||||
/// <returns>SortedDictionary bucketed by game name</returns>
|
||||
public static SortedDictionary<string, List<DatItem>> BucketListByGame(List<DatItem> list, bool mergeroms, bool norename, Logger logger, bool output = true)
|
||||
{
|
||||
logger.User("Organizing " + (mergeroms ? "and merging " : "") + "roms for output");
|
||||
logger.User("Organizing " + (mergeroms ? "and merging " : String.Empty) + "roms for output");
|
||||
|
||||
SortedDictionary<string, List<DatItem>> sortable = new SortedDictionary<string, List<DatItem>>();
|
||||
long count = 0;
|
||||
@@ -1109,7 +1109,7 @@ namespace SabreTools.Helper.Dats
|
||||
}
|
||||
|
||||
count++;
|
||||
string newkey = (norename ? ""
|
||||
string newkey = (norename ? String.Empty
|
||||
: rom.SystemID.ToString().PadLeft(10, '0')
|
||||
+ "-"
|
||||
+ rom.SourceID.ToString().PadLeft(10, '0') + "-")
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace SabreTools.Helper.Dats
|
||||
logger.User("Initializing all output DATs");
|
||||
|
||||
// Default vars for use
|
||||
string post = "";
|
||||
string post = String.Empty;
|
||||
DatFile outerDiffData = new DatFile();
|
||||
DatFile dupeData = new DatFile();
|
||||
|
||||
@@ -313,7 +313,7 @@ namespace SabreTools.Helper.Dats
|
||||
/// <param name="logger">Logging object for console and file output</param>
|
||||
public void DiffCascade(string outDir, bool inplace, List<string> inputs, List<DatFile> datHeaders, bool skip, Logger logger)
|
||||
{
|
||||
string post = "";
|
||||
string post = String.Empty;
|
||||
|
||||
// Create a list of DatData objects representing output files
|
||||
List<DatFile> outDats = new List<DatFile>();
|
||||
@@ -381,7 +381,7 @@ namespace SabreTools.Helper.Dats
|
||||
for (int j = (skip ? 1 : 0); j < inputs.Count; j++)
|
||||
{
|
||||
// If we have an output directory set, replace the path
|
||||
string path = "";
|
||||
string path = String.Empty;
|
||||
if (inplace)
|
||||
{
|
||||
path = Path.GetDirectoryName(inputs[j].Split('¬')[0]);
|
||||
@@ -425,7 +425,7 @@ namespace SabreTools.Helper.Dats
|
||||
string filename = inputs[newrom.SystemID].Split('¬')[0];
|
||||
string rootpath = inputs[newrom.SystemID].Split('¬')[1];
|
||||
|
||||
rootpath += (rootpath == "" ? "" : Path.DirectorySeparatorChar.ToString());
|
||||
rootpath += (rootpath == String.Empty ? String.Empty : Path.DirectorySeparatorChar.ToString());
|
||||
filename = filename.Remove(0, rootpath.Length);
|
||||
newrom.Machine.Name = Path.GetDirectoryName(filename) + Path.DirectorySeparatorChar
|
||||
+ Path.GetFileNameWithoutExtension(filename) + Path.DirectorySeparatorChar
|
||||
@@ -470,7 +470,7 @@ namespace SabreTools.Helper.Dats
|
||||
inputFileName =>
|
||||
{
|
||||
// Clean the input string
|
||||
if (inputFileName != "")
|
||||
if (inputFileName != String.Empty)
|
||||
{
|
||||
inputFileName = Path.GetFullPath(inputFileName);
|
||||
}
|
||||
@@ -478,7 +478,7 @@ namespace SabreTools.Helper.Dats
|
||||
if (File.Exists(inputFileName))
|
||||
{
|
||||
DatFile innerDatdata = new DatFile(this);
|
||||
logger.User("Processing \"" + Path.GetFileName(inputFileName) + "\"");
|
||||
logger.User("Processing "" + Path.GetFileName(inputFileName) + """);
|
||||
innerDatdata.Parse(inputFileName, 0, 0, filter, splitType, trim, single,
|
||||
root, logger, true, clean, softlist,
|
||||
keepext: ((innerDatdata.DatFormat & DatFormat.TSV) != 0 || (innerDatdata.DatFormat & DatFormat.CSV) != 0));
|
||||
@@ -486,7 +486,7 @@ namespace SabreTools.Helper.Dats
|
||||
// If we have roms, output them
|
||||
if (innerDatdata.Count != 0)
|
||||
{
|
||||
innerDatdata.WriteToFile((outDir == "" ? Path.GetDirectoryName(inputFileName) : outDir), logger, overwrite: (outDir != ""));
|
||||
innerDatdata.WriteToFile((outDir == String.Empty ? Path.GetDirectoryName(inputFileName) : outDir), logger, overwrite: (outDir != String.Empty));
|
||||
}
|
||||
}
|
||||
else if (Directory.Exists(inputFileName))
|
||||
@@ -497,7 +497,7 @@ namespace SabreTools.Helper.Dats
|
||||
new ParallelOptions { MaxDegreeOfParallelism = maxDegreeOfParallelism },
|
||||
file =>
|
||||
{
|
||||
logger.User("Processing \"" + Path.GetFullPath(file).Remove(0, inputFileName.Length) + "\"");
|
||||
logger.User("Processing "" + Path.GetFullPath(file).Remove(0, inputFileName.Length) + """);
|
||||
DatFile innerDatdata = new DatFile(this);
|
||||
innerDatdata.Parse(file, 0, 0, filter, splitType,
|
||||
trim, single, root, logger, true, clean, softlist,
|
||||
@@ -506,7 +506,7 @@ namespace SabreTools.Helper.Dats
|
||||
// If we have roms, output them
|
||||
if (innerDatdata.Count > 0)
|
||||
{
|
||||
innerDatdata.WriteToFile((outDir == "" ? Path.GetDirectoryName(file) : outDir + Path.GetDirectoryName(file).Remove(0, inputFileName.Length - 1)), logger, overwrite: (outDir != ""));
|
||||
innerDatdata.WriteToFile((outDir == String.Empty ? Path.GetDirectoryName(file) : outDir + Path.GetDirectoryName(file).Remove(0, inputFileName.Length - 1)), logger, overwrite: (outDir != String.Empty));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -52,14 +52,14 @@ namespace SabreTools.Helper.Dats
|
||||
// If the name is defined but not the description, set the description from the name
|
||||
else if (!String.IsNullOrEmpty(Name) && String.IsNullOrEmpty(Description))
|
||||
{
|
||||
Description = Name + (bare ? "" : " (" + Date + ")");
|
||||
Description = Name + (bare ? String.Empty : " (" + Date + ")");
|
||||
}
|
||||
|
||||
// If neither the name or description are defined, set them from the automatic values
|
||||
else if (String.IsNullOrEmpty(Name) && String.IsNullOrEmpty(Description))
|
||||
{
|
||||
Name = basePath.Split(Path.DirectorySeparatorChar).Last();
|
||||
Description = Name + (bare ? "" : " (" + Date + ")");
|
||||
Description = Name + (bare ? String.Empty : " (" + Date + ")");
|
||||
}
|
||||
|
||||
// Process the input
|
||||
@@ -107,8 +107,8 @@ namespace SabreTools.Helper.Dats
|
||||
string fulldir = Path.GetFullPath(dir);
|
||||
|
||||
// Set the temporary variables
|
||||
string gamename = "";
|
||||
string romname = "";
|
||||
string gamename = String.Empty;
|
||||
string romname = String.Empty;
|
||||
|
||||
// If we have a SuperDAT, we want anything that's not the base path as the game, and the file as the rom
|
||||
if (Type == "SuperDAT")
|
||||
@@ -249,7 +249,7 @@ namespace SabreTools.Helper.Dats
|
||||
// Otherwise, just get the info on the file itself
|
||||
else if (File.Exists(newItem))
|
||||
{
|
||||
PopulateFromDirProcessFile(newItem, "", newBasePath, noMD5, noSHA1, addDate, headerToCheckAgainst, logger);
|
||||
PopulateFromDirProcessFile(newItem, String.Empty, newBasePath, noMD5, noSHA1, addDate, headerToCheckAgainst, logger);
|
||||
}
|
||||
}
|
||||
// Otherwise, attempt to extract the files to the temporary directory
|
||||
@@ -274,7 +274,7 @@ namespace SabreTools.Helper.Dats
|
||||
PopulateFromDirProcessFile(entry,
|
||||
Path.Combine((Type == "SuperDAT"
|
||||
? (Path.GetDirectoryName(Path.GetFullPath(item)) + Path.DirectorySeparatorChar).Remove(0, basePath.Length)
|
||||
: ""),
|
||||
: String.Empty),
|
||||
Path.GetFileNameWithoutExtension(item)),
|
||||
tempSubDir,
|
||||
noMD5,
|
||||
@@ -287,7 +287,7 @@ namespace SabreTools.Helper.Dats
|
||||
// Otherwise, just get the info on the file itself
|
||||
else if (File.Exists(newItem))
|
||||
{
|
||||
PopulateFromDirProcessFile(newItem, "", newBasePath, noMD5, noSHA1, addDate, headerToCheckAgainst, logger);
|
||||
PopulateFromDirProcessFile(newItem, String.Empty, newBasePath, noMD5, noSHA1, addDate, headerToCheckAgainst, logger);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@ namespace SabreTools.Helper.Dats
|
||||
return;
|
||||
}
|
||||
|
||||
string key = "";
|
||||
string key = String.Empty;
|
||||
if (datItem.Type == ItemType.Rom)
|
||||
{
|
||||
key = ((Rom)datItem).Size + "-" + ((Rom)datItem).CRC;
|
||||
@@ -367,11 +367,11 @@ namespace SabreTools.Helper.Dats
|
||||
item = Path.GetFullPath(item);
|
||||
|
||||
// Get the data to be added as game and item names
|
||||
string gamename = "";
|
||||
string romname = "";
|
||||
string gamename = String.Empty;
|
||||
string romname = String.Empty;
|
||||
|
||||
// If the parent is blank, then we have a non-archive file
|
||||
if (parent == "")
|
||||
if (parent == String.Empty)
|
||||
{
|
||||
// If we have a SuperDAT, we want anything that's not the base path as the game, and the file as the rom
|
||||
if (Type == "SuperDAT")
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace SabreTools.Helper.Dats
|
||||
/// <param name="keepext">True if original extension should be kept, false otherwise (default)</param>
|
||||
public void Parse(string filename, int sysid, int srcid, Logger logger, bool keep = false, bool clean = false, bool softlist = false, bool keepext = false)
|
||||
{
|
||||
Parse(filename, sysid, srcid, new Filter(), SplitType.None, false, false, "", logger, keep, clean, softlist, keepext);
|
||||
Parse(filename, sysid, srcid, new Filter(), SplitType.None, false, false, String.Empty, logger, keep, clean, softlist, keepext);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -229,7 +229,7 @@ namespace SabreTools.Helper.Dats
|
||||
};
|
||||
|
||||
// Now process and add the rom
|
||||
string key = "";
|
||||
string key = String.Empty;
|
||||
ParseAddHelper(rom, filter, trim, single, root, clean, logger, out key);
|
||||
}
|
||||
|
||||
@@ -273,8 +273,8 @@ namespace SabreTools.Helper.Dats
|
||||
StreamReader sr = new StreamReader(File.OpenRead(filename), enc);
|
||||
|
||||
bool block = false, superdat = false;
|
||||
string blockname = "", tempgamename = "", gamedesc = "", cloneof = "",
|
||||
romof = "", sampleof = "", year = "", manufacturer = "";
|
||||
string blockname = String.Empty, tempgamename = String.Empty, gamedesc = String.Empty, cloneof = String.Empty,
|
||||
romof = String.Empty, sampleof = String.Empty, year = String.Empty, manufacturer = String.Empty;
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
string line = sr.ReadLine();
|
||||
@@ -364,16 +364,16 @@ namespace SabreTools.Helper.Dats
|
||||
item.SourceID = srcid;
|
||||
|
||||
// Get the blank key to write to
|
||||
string key = "";
|
||||
string key = String.Empty;
|
||||
|
||||
// If we have a sample, treat it special
|
||||
if (temptype == ItemType.Sample)
|
||||
{
|
||||
line = line.Trim().Remove(0, 6).Trim().Replace("\"", ""); // Remove "sample" from the input string
|
||||
line = line.Trim().Remove(0, 6).Trim().Replace(""", String.Empty); // Remove "sample" from the input string
|
||||
item.Name = line;
|
||||
|
||||
// Now process and add the sample
|
||||
key = "";
|
||||
key = String.Empty;
|
||||
ParseAddHelper(item, filter, trim, single, root, clean, logger, out key);
|
||||
|
||||
continue;
|
||||
@@ -421,7 +421,7 @@ namespace SabreTools.Helper.Dats
|
||||
else if (gc[i] == "date")
|
||||
{
|
||||
i++;
|
||||
((Rom)item).Date = gc[i].Replace("\"", "") + " " + gc[i + 1].Replace("\"", "");
|
||||
((Rom)item).Date = gc[i].Replace(""", String.Empty) + " " + gc[i + 1].Replace(""", String.Empty);
|
||||
i += 3;
|
||||
}
|
||||
|
||||
@@ -429,12 +429,12 @@ namespace SabreTools.Helper.Dats
|
||||
else if (gc[i] == "crc")
|
||||
{
|
||||
i++;
|
||||
((Rom)item).CRC = gc[i].Replace("\"", "").ToLowerInvariant();
|
||||
((Rom)item).CRC = gc[i].Replace(""", String.Empty).ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
|
||||
// Now process and add the rom
|
||||
key = "";
|
||||
key = String.Empty;
|
||||
ParseAddHelper(item, filter, trim, single, root, clean, logger, out key);
|
||||
continue;
|
||||
}
|
||||
@@ -443,11 +443,11 @@ namespace SabreTools.Helper.Dats
|
||||
for (int i = 0; i < gc.Length; i++)
|
||||
{
|
||||
// Look at the current item and use it if possible
|
||||
string quoteless = gc[i].Replace("\"", "");
|
||||
string quoteless = gc[i].Replace(""", String.Empty);
|
||||
switch (quoteless)
|
||||
{
|
||||
//If the item is empty, we automatically skip it because it's a fluke
|
||||
case "":
|
||||
case String.Empty:
|
||||
continue;
|
||||
|
||||
// Special cases for standalone item statuses
|
||||
@@ -495,14 +495,14 @@ namespace SabreTools.Helper.Dats
|
||||
// Regular attributes
|
||||
case "name":
|
||||
i++;
|
||||
quoteless = gc[i].Replace("\"", "");
|
||||
quoteless = gc[i].Replace(""", String.Empty);
|
||||
item.Name = quoteless;
|
||||
break;
|
||||
case "size":
|
||||
if (item.Type == ItemType.Rom)
|
||||
{
|
||||
i++;
|
||||
quoteless = gc[i].Replace("\"", "");
|
||||
quoteless = gc[i].Replace(""", String.Empty);
|
||||
long size = -1;
|
||||
if (Int64.TryParse(quoteless, out size))
|
||||
{
|
||||
@@ -515,7 +515,7 @@ namespace SabreTools.Helper.Dats
|
||||
if (item.Type == ItemType.Rom)
|
||||
{
|
||||
i++;
|
||||
quoteless = gc[i].Replace("\"", "");
|
||||
quoteless = gc[i].Replace(""", String.Empty);
|
||||
((Rom)item).CRC = quoteless.ToLowerInvariant();
|
||||
}
|
||||
break;
|
||||
@@ -523,13 +523,13 @@ namespace SabreTools.Helper.Dats
|
||||
if (item.Type == ItemType.Rom)
|
||||
{
|
||||
i++;
|
||||
quoteless = gc[i].Replace("\"", "");
|
||||
quoteless = gc[i].Replace(""", String.Empty);
|
||||
((Rom)item).MD5 = quoteless.ToLowerInvariant();
|
||||
}
|
||||
else if (item.Type == ItemType.Disk)
|
||||
{
|
||||
i++;
|
||||
quoteless = gc[i].Replace("\"", "");
|
||||
quoteless = gc[i].Replace(""", String.Empty);
|
||||
((Disk)item).MD5 = quoteless.ToLowerInvariant();
|
||||
}
|
||||
break;
|
||||
@@ -537,20 +537,20 @@ namespace SabreTools.Helper.Dats
|
||||
if (item.Type == ItemType.Rom)
|
||||
{
|
||||
i++;
|
||||
quoteless = gc[i].Replace("\"", "");
|
||||
quoteless = gc[i].Replace(""", String.Empty);
|
||||
((Rom)item).SHA1 = quoteless.ToLowerInvariant();
|
||||
}
|
||||
else if (item.Type == ItemType.Disk)
|
||||
{
|
||||
i++;
|
||||
quoteless = gc[i].Replace("\"", "");
|
||||
quoteless = gc[i].Replace(""", String.Empty);
|
||||
((Disk)item).SHA1 = quoteless.ToLowerInvariant();
|
||||
}
|
||||
break;
|
||||
case "status":
|
||||
case "flags":
|
||||
i++;
|
||||
quoteless = gc[i].Replace("\"", "");
|
||||
quoteless = gc[i].Replace(""", String.Empty);
|
||||
if (quoteless.ToLowerInvariant() == "good")
|
||||
{
|
||||
if (item.Type == ItemType.Rom)
|
||||
@@ -600,7 +600,7 @@ namespace SabreTools.Helper.Dats
|
||||
if (item.Type == ItemType.Rom)
|
||||
{
|
||||
i++;
|
||||
quoteless = gc[i].Replace("\"", "") + " " + gc[i + 1].Replace("\"", "");
|
||||
quoteless = gc[i].Replace(""", String.Empty) + " " + gc[i + 1].Replace(""", String.Empty);
|
||||
((Rom)item).Date = quoteless;
|
||||
}
|
||||
i++;
|
||||
@@ -609,7 +609,7 @@ namespace SabreTools.Helper.Dats
|
||||
}
|
||||
|
||||
// Now process and add the rom
|
||||
key = "";
|
||||
key = String.Empty;
|
||||
ParseAddHelper(item, filter, trim, single, root, clean, logger, out key);
|
||||
}
|
||||
|
||||
@@ -620,7 +620,7 @@ namespace SabreTools.Helper.Dats
|
||||
|
||||
if (blockname != "header")
|
||||
{
|
||||
string itemval = gc[2].Value.Replace("\"", "");
|
||||
string itemval = gc[2].Value.Replace(""", String.Empty);
|
||||
switch (gc[1].Value)
|
||||
{
|
||||
case "name":
|
||||
@@ -648,7 +648,7 @@ namespace SabreTools.Helper.Dats
|
||||
}
|
||||
else
|
||||
{
|
||||
string itemval = gc[2].Value.Replace("\"", "");
|
||||
string itemval = gc[2].Value.Replace(""", String.Empty);
|
||||
|
||||
if (line.Trim().StartsWith("Name:"))
|
||||
{
|
||||
@@ -768,8 +768,8 @@ namespace SabreTools.Helper.Dats
|
||||
else if (Regex.IsMatch(line, Constants.EndPatternCMP) && block)
|
||||
{
|
||||
block = false;
|
||||
blockname = ""; tempgamename = ""; gamedesc = ""; cloneof = "";
|
||||
romof = ""; sampleof = ""; year = ""; manufacturer = "";
|
||||
blockname = String.Empty; tempgamename = String.Empty; gamedesc = String.Empty; cloneof = String.Empty;
|
||||
romof = String.Empty; sampleof = String.Empty; year = String.Empty; manufacturer = String.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -813,7 +813,7 @@ namespace SabreTools.Helper.Dats
|
||||
// Prepare all internal variables
|
||||
XmlReader subreader, headreader, flagreader;
|
||||
bool superdat = false, empty = true;
|
||||
string key = "", date = "";
|
||||
string key = String.Empty, date = String.Empty;
|
||||
long size = -1;
|
||||
ItemStatus its = ItemStatus.None;
|
||||
List<string> parent = new List<string>();
|
||||
@@ -970,7 +970,7 @@ namespace SabreTools.Helper.Dats
|
||||
}
|
||||
|
||||
// Get all header items (ONLY OVERWRITE IF THERE'S NO DATA)
|
||||
string content = "";
|
||||
string content = String.Empty;
|
||||
switch (headreader.Name.ToLowerInvariant())
|
||||
{
|
||||
case "datname":
|
||||
@@ -1015,7 +1015,7 @@ namespace SabreTools.Helper.Dats
|
||||
}
|
||||
|
||||
// Get all header items (ONLY OVERWRITE IF THERE'S NO DATA)
|
||||
string content = "";
|
||||
string content = String.Empty;
|
||||
switch (headreader.Name)
|
||||
{
|
||||
case "name":
|
||||
@@ -1236,7 +1236,7 @@ namespace SabreTools.Helper.Dats
|
||||
case "machine":
|
||||
case "game":
|
||||
case "software":
|
||||
string temptype = xtr.Name, publisher = "", partname = "", partinterface = "", areaname = "";
|
||||
string temptype = xtr.Name, publisher = String.Empty, partname = String.Empty, partinterface = String.Empty, areaname = String.Empty;
|
||||
bool? supported = null;
|
||||
long? areasize = null;
|
||||
List<Tuple<string, string>> infos = new List<Tuple<string, string>>();
|
||||
@@ -1264,9 +1264,9 @@ namespace SabreTools.Helper.Dats
|
||||
Name = xtr.GetAttribute("name"),
|
||||
Description = xtr.GetAttribute("name"),
|
||||
|
||||
RomOf = xtr.GetAttribute("romof") ?? "",
|
||||
CloneOf = xtr.GetAttribute("cloneof") ?? "",
|
||||
SampleOf = xtr.GetAttribute("sampleof") ?? "",
|
||||
RomOf = xtr.GetAttribute("romof") ?? String.Empty,
|
||||
CloneOf = xtr.GetAttribute("cloneof") ?? String.Empty,
|
||||
SampleOf = xtr.GetAttribute("sampleof") ?? String.Empty,
|
||||
|
||||
Devices = new List<string>(),
|
||||
MachineType =
|
||||
@@ -1294,7 +1294,7 @@ namespace SabreTools.Helper.Dats
|
||||
if (superdat && !keep)
|
||||
{
|
||||
string tempout = Regex.Match(machine.Name, @".*?\\(.*)").Groups[1].Value;
|
||||
if (tempout != "")
|
||||
if (tempout != String.Empty)
|
||||
{
|
||||
machine.Name = tempout;
|
||||
}
|
||||
@@ -1306,8 +1306,8 @@ namespace SabreTools.Helper.Dats
|
||||
}
|
||||
|
||||
// Special offline list parts
|
||||
string ext = "";
|
||||
string releaseNumber = "";
|
||||
string ext = String.Empty;
|
||||
string releaseNumber = String.Empty;
|
||||
|
||||
while (software || !subreader.EOF)
|
||||
{
|
||||
@@ -1318,13 +1318,13 @@ namespace SabreTools.Helper.Dats
|
||||
{
|
||||
if (subreader.NodeType == XmlNodeType.EndElement && subreader.Name == "part")
|
||||
{
|
||||
partname = "";
|
||||
partinterface = "";
|
||||
partname = String.Empty;
|
||||
partinterface = String.Empty;
|
||||
features = new List<Tuple<string, string>>();
|
||||
}
|
||||
if (subreader.NodeType == XmlNodeType.EndElement && (subreader.Name == "dataarea" || subreader.Name == "diskarea"))
|
||||
{
|
||||
areaname = "";
|
||||
areaname = String.Empty;
|
||||
areasize = null;
|
||||
}
|
||||
|
||||
@@ -1351,7 +1351,7 @@ namespace SabreTools.Helper.Dats
|
||||
case "romCRC":
|
||||
empty = false;
|
||||
|
||||
ext = (subreader.GetAttribute("extension") != null ? subreader.GetAttribute("extension") : "");
|
||||
ext = (subreader.GetAttribute("extension") != null ? subreader.GetAttribute("extension") : String.Empty);
|
||||
|
||||
DatItem olrom = new Rom
|
||||
{
|
||||
@@ -1418,7 +1418,7 @@ namespace SabreTools.Helper.Dats
|
||||
machine.Description = subreader.ReadElementContentAsString();
|
||||
if (!softlist && temptype == "software")
|
||||
{
|
||||
machine.Name = machine.Description.Replace('/', '_').Replace("\"", "''");
|
||||
machine.Name = machine.Description.Replace('/', '_').Replace(""", "''");
|
||||
}
|
||||
break;
|
||||
case "year":
|
||||
@@ -1580,13 +1580,13 @@ namespace SabreTools.Helper.Dats
|
||||
if (subreader.GetAttribute("flags") == "baddump" || subreader.GetAttribute("status") == "baddump")
|
||||
{
|
||||
logger.Verbose("Bad dump detected: " +
|
||||
(subreader.GetAttribute("name") != null && subreader.GetAttribute("name") != "" ? "\"" + xtr.GetAttribute("name") + "\"" : "ROM NAME NOT FOUND"));
|
||||
(subreader.GetAttribute("name") != null && subreader.GetAttribute("name") != String.Empty ? """ + xtr.GetAttribute("name") + """ : "ROM NAME NOT FOUND"));
|
||||
its = ItemStatus.BadDump;
|
||||
}
|
||||
if (subreader.GetAttribute("flags") == "nodump" || subreader.GetAttribute("status") == "nodump")
|
||||
{
|
||||
logger.Verbose("Nodump detected: " +
|
||||
(subreader.GetAttribute("name") != null && subreader.GetAttribute("name") != "" ? "\"" + xtr.GetAttribute("name") + "\"" : "ROM NAME NOT FOUND"));
|
||||
(subreader.GetAttribute("name") != null && subreader.GetAttribute("name") != String.Empty ? """ + xtr.GetAttribute("name") + """ : "ROM NAME NOT FOUND"));
|
||||
its = ItemStatus.Nodump;
|
||||
}
|
||||
if (subreader.GetAttribute("flags") == "verified" || subreader.GetAttribute("status") == "verified")
|
||||
@@ -1595,7 +1595,7 @@ namespace SabreTools.Helper.Dats
|
||||
}
|
||||
|
||||
// If the rom has a Date attached, read it in and then sanitize it
|
||||
date = "";
|
||||
date = String.Empty;
|
||||
if (subreader.GetAttribute("date") != null)
|
||||
{
|
||||
DateTime dateTime = DateTime.Now;
|
||||
@@ -1717,11 +1717,11 @@ namespace SabreTools.Helper.Dats
|
||||
superdat = true;
|
||||
if (keep)
|
||||
{
|
||||
Type = (Type == "" ? "SuperDAT" : Type);
|
||||
Type = (Type == String.Empty ? "SuperDAT" : Type);
|
||||
}
|
||||
|
||||
string foldername = (xtr.GetAttribute("name") == null ? "" : xtr.GetAttribute("name"));
|
||||
if (foldername != "")
|
||||
string foldername = (xtr.GetAttribute("name") == null ? String.Empty : xtr.GetAttribute("name"));
|
||||
if (foldername != String.Empty)
|
||||
{
|
||||
parent.Add(foldername);
|
||||
}
|
||||
@@ -1764,13 +1764,13 @@ namespace SabreTools.Helper.Dats
|
||||
its = ItemStatus.Good;
|
||||
break;
|
||||
case "baddump":
|
||||
logger.Verbose("Bad dump detected: " + (xtr.GetAttribute("name") != null && xtr.GetAttribute("name") != "" ?
|
||||
"\"" + xtr.GetAttribute("name") + "\"" : "ROM NAME NOT FOUND"));
|
||||
logger.Verbose("Bad dump detected: " + (xtr.GetAttribute("name") != null && xtr.GetAttribute("name") != String.Empty ?
|
||||
""" + xtr.GetAttribute("name") + """ : "ROM NAME NOT FOUND"));
|
||||
its = ItemStatus.BadDump;
|
||||
break;
|
||||
case "nodump":
|
||||
logger.Verbose("Nodump detected: " + (xtr.GetAttribute("name") != null && xtr.GetAttribute("name") != "" ?
|
||||
"\"" + xtr.GetAttribute("name") + "\"" : "ROM NAME NOT FOUND"));
|
||||
logger.Verbose("Nodump detected: " + (xtr.GetAttribute("name") != null && xtr.GetAttribute("name") != String.Empty ?
|
||||
""" + xtr.GetAttribute("name") + """ : "ROM NAME NOT FOUND"));
|
||||
its = ItemStatus.Nodump;
|
||||
break;
|
||||
case "verified":
|
||||
@@ -1785,7 +1785,7 @@ namespace SabreTools.Helper.Dats
|
||||
}
|
||||
|
||||
// If the rom has a Date attached, read it in and then sanitize it
|
||||
date = "";
|
||||
date = String.Empty;
|
||||
if (xtr.GetAttribute("date") != null)
|
||||
{
|
||||
date = DateTime.Parse(xtr.GetAttribute("date")).ToString();
|
||||
@@ -1826,7 +1826,7 @@ namespace SabreTools.Helper.Dats
|
||||
if (!keep || !superdat)
|
||||
{
|
||||
string tempout = Regex.Match(dir.Name, @".*?\\(.*)").Groups[1].Value;
|
||||
if (tempout != "")
|
||||
if (tempout != String.Empty)
|
||||
{
|
||||
dir.Name = tempout;
|
||||
}
|
||||
@@ -1948,7 +1948,7 @@ namespace SabreTools.Helper.Dats
|
||||
};
|
||||
|
||||
// Now process and add the rom
|
||||
string key = "";
|
||||
string key = String.Empty;
|
||||
ParseAddHelper(rom, filter, trim, single, root, clean, logger, out key);
|
||||
}
|
||||
|
||||
@@ -2010,7 +2010,7 @@ namespace SabreTools.Helper.Dats
|
||||
};
|
||||
|
||||
// Now process and add the rom
|
||||
string key = "";
|
||||
string key = String.Empty;
|
||||
ParseAddHelper(rom, filter, trim, single, root, clean, logger, out key);
|
||||
}
|
||||
|
||||
@@ -2072,7 +2072,7 @@ namespace SabreTools.Helper.Dats
|
||||
};
|
||||
|
||||
// Now process and add the rom
|
||||
string key = "";
|
||||
string key = String.Empty;
|
||||
ParseAddHelper(rom, filter, trim, single, root, clean, logger, out key);
|
||||
}
|
||||
|
||||
@@ -2113,7 +2113,7 @@ namespace SabreTools.Helper.Dats
|
||||
Encoding enc = Style.GetEncoding(filename);
|
||||
StreamReader sr = new StreamReader(File.OpenRead(filename), enc);
|
||||
|
||||
string blocktype = "";
|
||||
string blocktype = String.Empty;
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
string line = sr.ReadLine();
|
||||
@@ -2204,7 +2204,7 @@ namespace SabreTools.Helper.Dats
|
||||
// Some old RC DATs have this behavior
|
||||
if (line.Contains("¬N¬O"))
|
||||
{
|
||||
line = line.Replace("¬N¬O", "") + "¬¬";
|
||||
line = line.Replace("¬N¬O", String.Empty) + "¬¬";
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2248,7 +2248,7 @@ namespace SabreTools.Helper.Dats
|
||||
};
|
||||
|
||||
// Now process and add the rom
|
||||
string key = "";
|
||||
string key = String.Empty;
|
||||
ParseAddHelper(rom, filter, trim, single, root, clean, logger, out key);
|
||||
}
|
||||
}
|
||||
@@ -2268,7 +2268,7 @@ namespace SabreTools.Helper.Dats
|
||||
/// <param name="logger">Logger object for console and/or file output</param>
|
||||
private void ParseAddHelper(DatItem item, Filter filter, bool trim, bool single, string root, bool clean, Logger logger, out string key)
|
||||
{
|
||||
key = "";
|
||||
key = String.Empty;
|
||||
|
||||
// If there's no name in the rom, we log and skip it
|
||||
if (item.Name == null)
|
||||
@@ -2304,7 +2304,7 @@ namespace SabreTools.Helper.Dats
|
||||
// If the file has no size and it's not the above case, skip and log
|
||||
else if (itemRom.ItemStatus != ItemStatus.Nodump && (itemRom.Size == 0 || itemRom.Size == -1))
|
||||
{
|
||||
logger.Verbose("Incomplete entry for \"" + itemRom.Name + "\" will be output as nodump");
|
||||
logger.Verbose("Incomplete entry for "" + itemRom.Name + "\" will be output as nodump");
|
||||
itemRom.ItemStatus = ItemStatus.Nodump;
|
||||
}
|
||||
// If the file has a size but aboslutely no hashes, skip and log
|
||||
@@ -2314,7 +2314,7 @@ namespace SabreTools.Helper.Dats
|
||||
&& String.IsNullOrEmpty(itemRom.MD5)
|
||||
&& String.IsNullOrEmpty(itemRom.SHA1))
|
||||
{
|
||||
logger.Verbose("Incomplete entry for \"" + itemRom.Name + "\" will be output as nodump");
|
||||
logger.Verbose("Incomplete entry for "" + itemRom.Name + "\" will be output as nodump");
|
||||
itemRom.ItemStatus = ItemStatus.Nodump;
|
||||
}
|
||||
|
||||
@@ -2333,7 +2333,7 @@ namespace SabreTools.Helper.Dats
|
||||
&& String.IsNullOrEmpty(itemDisk.MD5)
|
||||
&& String.IsNullOrEmpty(itemDisk.SHA1))
|
||||
{
|
||||
logger.Verbose("Incomplete entry for \"" + itemDisk.Name + "\" will be output as nodump");
|
||||
logger.Verbose("Incomplete entry for "" + itemDisk.Name + "\" will be output as nodump");
|
||||
itemDisk.ItemStatus = ItemStatus.Nodump;
|
||||
}
|
||||
|
||||
|
||||
@@ -655,7 +655,7 @@ namespace SabreTools.Helper.Dats
|
||||
// Now output the fixdat to the main folder
|
||||
if (found)
|
||||
{
|
||||
matched.WriteToFile("", logger, stats: true);
|
||||
matched.WriteToFile(String.Empty, logger, stats: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace SabreTools.Helper.Dats
|
||||
}
|
||||
|
||||
// Get the output directory
|
||||
if (outDir != "")
|
||||
if (outDir != String.Empty)
|
||||
{
|
||||
outDir = outDir + Path.GetDirectoryName(this.FileName).Remove(0, basepath.Length - 1);
|
||||
}
|
||||
@@ -287,7 +287,7 @@ namespace SabreTools.Helper.Dats
|
||||
}
|
||||
|
||||
// Get the output directory
|
||||
if (outDir != "")
|
||||
if (outDir != String.Empty)
|
||||
{
|
||||
outDir = outDir + Path.GetDirectoryName(this.FileName).Remove(0, basepath.Length - 1);
|
||||
}
|
||||
@@ -535,7 +535,7 @@ namespace SabreTools.Helper.Dats
|
||||
}
|
||||
|
||||
// Get the output directory
|
||||
if (outDir != "")
|
||||
if (outDir != String.Empty)
|
||||
{
|
||||
outDir = outDir + Path.GetDirectoryName(this.FileName).Remove(0, basepath.Length - 1);
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace SabreTools.Helper.Dats
|
||||
logger.User(results);
|
||||
|
||||
// Now write it out to file as well
|
||||
string line = "";
|
||||
string line = String.Empty;
|
||||
if (outputs.ContainsKey(StatDatFormat.None))
|
||||
{
|
||||
line = @"'" + FileName + @"':
|
||||
@@ -158,22 +158,22 @@ namespace SabreTools.Helper.Dats
|
||||
}
|
||||
if (outputs.ContainsKey(StatDatFormat.CSV))
|
||||
{
|
||||
line = "\"" + FileName + "\","
|
||||
+ "\"" + TotalSize + "\","
|
||||
+ "\"" + (game == -1 ? Count : game) + "\","
|
||||
+ "\"" + RomCount + "\","
|
||||
+ "\"" + DiskCount + "\","
|
||||
+ "\"" + CRCCount + "\","
|
||||
+ "\"" + MD5Count + "\","
|
||||
+ "\"" + SHA1Count + "\"";
|
||||
line = """ + FileName + "\","
|
||||
+ """ + TotalSize + "\","
|
||||
+ """ + (game == -1 ? Count : game) + "\","
|
||||
+ """ + RomCount + "\","
|
||||
+ """ + DiskCount + "\","
|
||||
+ """ + CRCCount + "\","
|
||||
+ """ + MD5Count + "\","
|
||||
+ """ + SHA1Count + """;
|
||||
|
||||
if (baddumpCol)
|
||||
{
|
||||
line += ",\"" + BaddumpCount + "\"";
|
||||
line += ","" + BaddumpCount + """;
|
||||
}
|
||||
if (nodumpCol)
|
||||
{
|
||||
line += ",\"" + NodumpCount + "\"";
|
||||
line += ","" + NodumpCount + """;
|
||||
}
|
||||
|
||||
line += "\n";
|
||||
@@ -206,22 +206,22 @@ namespace SabreTools.Helper.Dats
|
||||
}
|
||||
if (outputs.ContainsKey(StatDatFormat.TSV))
|
||||
{
|
||||
line = "\"" + FileName + "\"\t"
|
||||
+ "\"" + TotalSize + "\"\t"
|
||||
+ "\"" + (game == -1 ? Count : game) + "\"\t"
|
||||
+ "\"" + RomCount + "\"\t"
|
||||
+ "\"" + DiskCount + "\"\t"
|
||||
+ "\"" + CRCCount + "\"\t"
|
||||
+ "\"" + MD5Count + "\"\t"
|
||||
+ "\"" + SHA1Count + "\"";
|
||||
line = """ + FileName + "\"\t"
|
||||
+ """ + TotalSize + "\"\t"
|
||||
+ """ + (game == -1 ? Count : game) + "\"\t"
|
||||
+ """ + RomCount + "\"\t"
|
||||
+ """ + DiskCount + "\"\t"
|
||||
+ """ + CRCCount + "\"\t"
|
||||
+ """ + MD5Count + "\"\t"
|
||||
+ """ + SHA1Count + """;
|
||||
|
||||
if (baddumpCol)
|
||||
{
|
||||
line += "\t\"" + BaddumpCount + "\"";
|
||||
line += "\t"" + BaddumpCount + """;
|
||||
}
|
||||
if (nodumpCol)
|
||||
{
|
||||
line += "\t\"" + NodumpCount + "\"";
|
||||
line += "\t"" + NodumpCount + """;
|
||||
}
|
||||
|
||||
line += "\n";
|
||||
@@ -530,8 +530,8 @@ Please check the log folder if the stats scrolled offscreen", false);
|
||||
}
|
||||
if (outputs.ContainsKey(StatDatFormat.CSV))
|
||||
{
|
||||
outputs[StatDatFormat.CSV].Write("\"File Name\",\"Total Size\",\"Games\",\"Roms\",\"Disks\",\"# with CRC\",\"# with MD5\",\"# with SHA-1\""
|
||||
+ (baddumpCol ? ",\"BadDumps\"" : "") + (nodumpCol ? ",\"Nodumps\"" : "") + "\n");
|
||||
outputs[StatDatFormat.CSV].Write("\"File Name\",\"Total Size\",\"Games\",\"Roms\",\"Disks\",\"# with CRC\",\"# with MD5\",\"# with SHA-1""
|
||||
+ (baddumpCol ? ",\"BadDumps"" : String.Empty) + (nodumpCol ? ",\"Nodumps"" : String.Empty) + "\n");
|
||||
}
|
||||
if (outputs.ContainsKey(StatDatFormat.HTML))
|
||||
{
|
||||
@@ -553,13 +553,13 @@ Please check the log folder if the stats scrolled offscreen", false);
|
||||
</header>
|
||||
<body>
|
||||
<h2>DAT Statistics Report (" + DateTime.Now.ToShortDateString() + @")</h2>
|
||||
<table border=""1"" cellpadding=""5"" cellspacing=""0"">
|
||||
<table border=String.Empty1String.Empty cellpadding=String.Empty5String.Empty cellspacing=String.Empty0String.Empty>
|
||||
");
|
||||
}
|
||||
if (outputs.ContainsKey(StatDatFormat.TSV))
|
||||
{
|
||||
outputs[StatDatFormat.TSV].Write("\"File Name\"\t\"Total Size\"\t\"Games\"\t\"Roms\"\t\"Disks\"\t\"# with CRC\"\t\"# with MD5\"\t\"# with SHA-1\""
|
||||
+ (baddumpCol ? "\t\"BadDumps\"" : "") + (nodumpCol ? "\t\"Nodumps\"" : "") + "\n");
|
||||
outputs[StatDatFormat.TSV].Write("\"File Name\"\t\"Total Size\"\t\"Games\"\t\"Roms\"\t\"Disks\"\t\"# with CRC\"\t\"# with MD5\"\t\"# with SHA-1""
|
||||
+ (baddumpCol ? "\t\"BadDumps"" : String.Empty) + (nodumpCol ? "\t\"Nodumps"" : String.Empty) + "\n");
|
||||
}
|
||||
|
||||
// Now write the mid header for those who need it
|
||||
@@ -585,9 +585,9 @@ Please check the log folder if the stats scrolled offscreen", false);
|
||||
}
|
||||
if (outputs.ContainsKey(StatDatFormat.HTML))
|
||||
{
|
||||
outputs[StatDatFormat.HTML].Write(@" <tr bgcolor=""gray""><th>File Name</th><th align=""right"">Total Size</th><th align=""right"">Games</th><th align=""right"">Roms</th>"
|
||||
+ @"<th align=""right"">Disks</th><th align=""right""># with CRC</th><th align=""right""># with MD5</th><th align=""right""># with SHA-1</th>"
|
||||
+ (baddumpCol ? "<th class=\".right\">Baddumps</th>" : "") + (nodumpCol ? "<th class=\".right\">Nodumps</th>" : "") + "</tr>\n");
|
||||
outputs[StatDatFormat.HTML].Write(@" <tr bgcolor=String.EmptygrayString.Empty><th>File Name</th><th align=String.EmptyrightString.Empty>Total Size</th><th align=String.EmptyrightString.Empty>Games</th><th align=String.EmptyrightString.Empty>Roms</th>"
|
||||
+ @"<th align=String.EmptyrightString.Empty>Disks</th><th align=String.EmptyrightString.Empty># with CRC</th><th align=String.EmptyrightString.Empty># with MD5</th><th align=String.EmptyrightString.Empty># with SHA-1</th>"
|
||||
+ (baddumpCol ? "<th class=\".right\">Baddumps</th>" : String.Empty) + (nodumpCol ? "<th class=\".right\">Nodumps</th>" : String.Empty) + "</tr>\n");
|
||||
}
|
||||
if (outputs.ContainsKey(StatDatFormat.TSV))
|
||||
{
|
||||
@@ -614,7 +614,7 @@ Please check the log folder if the stats scrolled offscreen", false);
|
||||
}
|
||||
if (outputs.ContainsKey(StatDatFormat.HTML))
|
||||
{
|
||||
outputs[StatDatFormat.HTML].Write("<tr><td colspan=\""
|
||||
outputs[StatDatFormat.HTML].Write("<tr><td colspan=""
|
||||
+ (baddumpCol && nodumpCol
|
||||
? "11"
|
||||
: (baddumpCol ^ nodumpCol
|
||||
@@ -648,7 +648,7 @@ Please check the log folder if the stats scrolled offscreen", false);
|
||||
}
|
||||
if (outputs.ContainsKey(StatDatFormat.HTML))
|
||||
{
|
||||
outputs[StatDatFormat.HTML].Write("<tr border=\"0\"><td colspan=\""
|
||||
outputs[StatDatFormat.HTML].Write("<tr border=\"0\"><td colspan=""
|
||||
+ (baddumpCol && nodumpCol
|
||||
? "11"
|
||||
: (baddumpCol ^ nodumpCol
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace SabreTools.Helper.Dats
|
||||
}
|
||||
|
||||
// If output directory is empty, use the current folder
|
||||
if (outDir.Trim() == "")
|
||||
if (outDir.Trim() == String.Empty)
|
||||
{
|
||||
logger.Verbose("No output directory defined, defaulting to curent folder");
|
||||
outDir = Environment.CurrentDirectory;
|
||||
@@ -233,7 +233,7 @@ namespace SabreTools.Helper.Dats
|
||||
{
|
||||
try
|
||||
{
|
||||
string header = "";
|
||||
string header = String.Empty;
|
||||
switch (datFormat)
|
||||
{
|
||||
case DatFormat.AttractMode:
|
||||
@@ -243,18 +243,18 @@ namespace SabreTools.Helper.Dats
|
||||
header = "clrmamepro (\n" +
|
||||
"\tname \"" + Name + "\"\n" +
|
||||
"\tdescription \"" + Description + "\"\n" +
|
||||
(!String.IsNullOrEmpty(Category) ? "\tcategory \"" + Category + "\"\n" : "") +
|
||||
(!String.IsNullOrEmpty(Category) ? "\tcategory \"" + Category + "\"\n" : String.Empty) +
|
||||
"\tversion \"" + Version + "\"\n" +
|
||||
(!String.IsNullOrEmpty(Date) ? "\tdate \"" + Date + "\"\n" : "") +
|
||||
(!String.IsNullOrEmpty(Date) ? "\tdate \"" + Date + "\"\n" : String.Empty) +
|
||||
"\tauthor \"" + Author + "\"\n" +
|
||||
(!String.IsNullOrEmpty(Email) ? "\temail \"" + Email + "\"\n" : "") +
|
||||
(!String.IsNullOrEmpty(Homepage) ? "\thomepage \"" + Homepage + "\"\n" : "") +
|
||||
(!String.IsNullOrEmpty(Url) ? "\turl \"" + Url + "\"\n" : "") +
|
||||
(!String.IsNullOrEmpty(Comment) ? "\tcomment \"" + Comment + "\"\n" : "") +
|
||||
(ForcePacking == ForcePacking.Unzip ? "\tforcezipping no\n" : "") +
|
||||
(ForcePacking == ForcePacking.Zip ? "\tforcezipping yes\n" : "") +
|
||||
(ForceMerging == ForceMerging.Full ? "\tforcemerging full\n" : "") +
|
||||
(ForceMerging == ForceMerging.Split ? "\tforcemerging split\n" : "") +
|
||||
(!String.IsNullOrEmpty(Email) ? "\temail \"" + Email + "\"\n" : String.Empty) +
|
||||
(!String.IsNullOrEmpty(Homepage) ? "\thomepage \"" + Homepage + "\"\n" : String.Empty) +
|
||||
(!String.IsNullOrEmpty(Url) ? "\turl \"" + Url + "\"\n" : String.Empty) +
|
||||
(!String.IsNullOrEmpty(Comment) ? "\tcomment \"" + Comment + "\"\n" : String.Empty) +
|
||||
(ForcePacking == ForcePacking.Unzip ? "\tforcezipping no\n" : String.Empty) +
|
||||
(ForcePacking == ForcePacking.Zip ? "\tforcezipping yes\n" : String.Empty) +
|
||||
(ForceMerging == ForceMerging.Full ? "\tforcemerging full\n" : String.Empty) +
|
||||
(ForceMerging == ForceMerging.Split ? "\tforcemerging split\n" : String.Empty) +
|
||||
")\n";
|
||||
break;
|
||||
case DatFormat.CSV:
|
||||
@@ -279,27 +279,27 @@ namespace SabreTools.Helper.Dats
|
||||
"\t<header>\n" +
|
||||
"\t\t<name>" + HttpUtility.HtmlEncode(Name) + "</name>\n" +
|
||||
"\t\t<description>" + HttpUtility.HtmlEncode(Description) + "</description>\n" +
|
||||
(!String.IsNullOrEmpty(RootDir) ? "\t\t<rootdir>" + HttpUtility.HtmlEncode(RootDir) + "</rootdir>\n" : "") +
|
||||
(!String.IsNullOrEmpty(Category) ? "\t\t<category>" + HttpUtility.HtmlEncode(Category) + "</category>\n" : "") +
|
||||
(!String.IsNullOrEmpty(RootDir) ? "\t\t<rootdir>" + HttpUtility.HtmlEncode(RootDir) + "</rootdir>\n" : String.Empty) +
|
||||
(!String.IsNullOrEmpty(Category) ? "\t\t<category>" + HttpUtility.HtmlEncode(Category) + "</category>\n" : String.Empty) +
|
||||
"\t\t<version>" + HttpUtility.HtmlEncode(Version) + "</version>\n" +
|
||||
(!String.IsNullOrEmpty(Date) ? "\t\t<date>" + HttpUtility.HtmlEncode(Date) + "</date>\n" : "") +
|
||||
(!String.IsNullOrEmpty(Date) ? "\t\t<date>" + HttpUtility.HtmlEncode(Date) + "</date>\n" : String.Empty) +
|
||||
"\t\t<author>" + HttpUtility.HtmlEncode(Author) + "</author>\n" +
|
||||
(!String.IsNullOrEmpty(Email) ? "\t\t<email>" + HttpUtility.HtmlEncode(Email) + "</email>\n" : "") +
|
||||
(!String.IsNullOrEmpty(Homepage) ? "\t\t<homepage>" + HttpUtility.HtmlEncode(Homepage) + "</homepage>\n" : "") +
|
||||
(!String.IsNullOrEmpty(Url) ? "\t\t<url>" + HttpUtility.HtmlEncode(Url) + "</url>\n" : "") +
|
||||
(!String.IsNullOrEmpty(Comment) ? "\t\t<comment>" + HttpUtility.HtmlEncode(Comment) + "</comment>\n" : "") +
|
||||
(!String.IsNullOrEmpty(Type) ? "\t\t<type>" + HttpUtility.HtmlEncode(Type) + "</type>\n" : "") +
|
||||
(!String.IsNullOrEmpty(Email) ? "\t\t<email>" + HttpUtility.HtmlEncode(Email) + "</email>\n" : String.Empty) +
|
||||
(!String.IsNullOrEmpty(Homepage) ? "\t\t<homepage>" + HttpUtility.HtmlEncode(Homepage) + "</homepage>\n" : String.Empty) +
|
||||
(!String.IsNullOrEmpty(Url) ? "\t\t<url>" + HttpUtility.HtmlEncode(Url) + "</url>\n" : String.Empty) +
|
||||
(!String.IsNullOrEmpty(Comment) ? "\t\t<comment>" + HttpUtility.HtmlEncode(Comment) + "</comment>\n" : String.Empty) +
|
||||
(!String.IsNullOrEmpty(Type) ? "\t\t<type>" + HttpUtility.HtmlEncode(Type) + "</type>\n" : String.Empty) +
|
||||
(ForcePacking != ForcePacking.None || ForceMerging != ForceMerging.None || ForceNodump != ForceNodump.None ?
|
||||
"\t\t<clrmamepro" +
|
||||
(ForcePacking == ForcePacking.Unzip ? " forcepacking=\"unzip\"" : "") +
|
||||
(ForcePacking == ForcePacking.Zip ? " forcepacking=\"zip\"" : "") +
|
||||
(ForceMerging == ForceMerging.Full ? " forcemerging=\"full\"" : "") +
|
||||
(ForceMerging == ForceMerging.Split ? " forcemerging=\"split\"" : "") +
|
||||
(ForceNodump == ForceNodump.Ignore ? " forceitemStatus=\"ignore\"" : "") +
|
||||
(ForceNodump == ForceNodump.Obsolete ? " forceitemStatus=\"obsolete\"" : "") +
|
||||
(ForceNodump == ForceNodump.Required ? " forceitemStatus=\"required\"" : "") +
|
||||
(ForcePacking == ForcePacking.Unzip ? " forcepacking=\"unzip\"" : String.Empty) +
|
||||
(ForcePacking == ForcePacking.Zip ? " forcepacking=\"zip\"" : String.Empty) +
|
||||
(ForceMerging == ForceMerging.Full ? " forcemerging=\"full\"" : String.Empty) +
|
||||
(ForceMerging == ForceMerging.Split ? " forcemerging=\"split\"" : String.Empty) +
|
||||
(ForceNodump == ForceNodump.Ignore ? " forceitemStatus=\"ignore\"" : String.Empty) +
|
||||
(ForceNodump == ForceNodump.Obsolete ? " forceitemStatus=\"obsolete\"" : String.Empty) +
|
||||
(ForceNodump == ForceNodump.Required ? " forceitemStatus=\"required\"" : String.Empty) +
|
||||
" />\n"
|
||||
: "") +
|
||||
: String.Empty) +
|
||||
"\t</header>\n";
|
||||
break;
|
||||
case DatFormat.TSV:
|
||||
@@ -371,24 +371,24 @@ namespace SabreTools.Helper.Dats
|
||||
"\t<header>\n" +
|
||||
"\t\t<name>" + HttpUtility.HtmlEncode(Name) + "</name>\n" +
|
||||
"\t\t<description>" + HttpUtility.HtmlEncode(Description) + "</description>\n" +
|
||||
(!String.IsNullOrEmpty(RootDir) ? "\t\t<rootdir>" + HttpUtility.HtmlEncode(RootDir) + "</rootdir>\n" : "") +
|
||||
(!String.IsNullOrEmpty(Category) ? "\t\t<category>" + HttpUtility.HtmlEncode(Category) + "</category>\n" : "") +
|
||||
(!String.IsNullOrEmpty(RootDir) ? "\t\t<rootdir>" + HttpUtility.HtmlEncode(RootDir) + "</rootdir>\n" : String.Empty) +
|
||||
(!String.IsNullOrEmpty(Category) ? "\t\t<category>" + HttpUtility.HtmlEncode(Category) + "</category>\n" : String.Empty) +
|
||||
"\t\t<version>" + HttpUtility.HtmlEncode(Version) + "</version>\n" +
|
||||
(!String.IsNullOrEmpty(Date) ? "\t\t<date>" + HttpUtility.HtmlEncode(Date) + "</date>\n" : "") +
|
||||
(!String.IsNullOrEmpty(Date) ? "\t\t<date>" + HttpUtility.HtmlEncode(Date) + "</date>\n" : String.Empty) +
|
||||
"\t\t<author>" + HttpUtility.HtmlEncode(Author) + "</author>\n" +
|
||||
(!String.IsNullOrEmpty(Comment) ? "\t\t<comment>" + HttpUtility.HtmlEncode(Comment) + "</comment>\n" : "") +
|
||||
(!String.IsNullOrEmpty(Comment) ? "\t\t<comment>" + HttpUtility.HtmlEncode(Comment) + "</comment>\n" : String.Empty) +
|
||||
(!String.IsNullOrEmpty(Type) || ForcePacking != ForcePacking.None || ForceMerging != ForceMerging.None || ForceNodump != ForceNodump.None ?
|
||||
"\t\t<flags>\n" +
|
||||
(!String.IsNullOrEmpty(Type) ? "\t\t\t<flag name=\"type\" value=\"" + HttpUtility.HtmlEncode(Type) + "\"/>\n" : "") +
|
||||
(ForcePacking == ForcePacking.Unzip ? "\t\t\t<flag name=\"forcepacking\" value=\"unzip\"/>\n" : "") +
|
||||
(ForcePacking == ForcePacking.Zip ? "\t\t\t<flag name=\"forcepacking\" value=\"zip\"/>\n" : "") +
|
||||
(ForceMerging == ForceMerging.Full ? "\t\t\t<flag name=\"forcemerging\" value=\"full\"/>\n" : "") +
|
||||
(ForceMerging == ForceMerging.Split ? "\t\t\t<flag name=\"forcemerging\" value=\"split\"/>\n" : "") +
|
||||
(ForceNodump == ForceNodump.Ignore ? "\t\t\t<flag name=\"forceitemStatus\" value=\"ignore\"/>\n" : "") +
|
||||
(ForceNodump == ForceNodump.Obsolete ? "\t\t\t<flag name=\"forceitemStatus\" value=\"obsolete\"/>\n" : "") +
|
||||
(ForceNodump == ForceNodump.Required ? "\t\t\t<flag name=\"forceitemStatus\" value=\"required\"/>\n" : "") +
|
||||
(!String.IsNullOrEmpty(Type) ? "\t\t\t<flag name=\"type\" value=\"" + HttpUtility.HtmlEncode(Type) + "\"/>\n" : String.Empty) +
|
||||
(ForcePacking == ForcePacking.Unzip ? "\t\t\t<flag name=\"forcepacking\" value=\"unzip\"/>\n" : String.Empty) +
|
||||
(ForcePacking == ForcePacking.Zip ? "\t\t\t<flag name=\"forcepacking\" value=\"zip\"/>\n" : String.Empty) +
|
||||
(ForceMerging == ForceMerging.Full ? "\t\t\t<flag name=\"forcemerging\" value=\"full\"/>\n" : String.Empty) +
|
||||
(ForceMerging == ForceMerging.Split ? "\t\t\t<flag name=\"forcemerging\" value=\"split\"/>\n" : String.Empty) +
|
||||
(ForceNodump == ForceNodump.Ignore ? "\t\t\t<flag name=\"forceitemStatus\" value=\"ignore\"/>\n" : String.Empty) +
|
||||
(ForceNodump == ForceNodump.Obsolete ? "\t\t\t<flag name=\"forceitemStatus\" value=\"obsolete\"/>\n" : String.Empty) +
|
||||
(ForceNodump == ForceNodump.Required ? "\t\t\t<flag name=\"forceitemStatus\" value=\"required\"/>\n" : String.Empty) +
|
||||
"\t\t</flags>\n"
|
||||
: "") +
|
||||
: String.Empty) +
|
||||
"\t</header>\n" +
|
||||
"\t<data>\n";
|
||||
break;
|
||||
@@ -397,13 +397,13 @@ namespace SabreTools.Helper.Dats
|
||||
"<!DOCTYPE softwarelist SYSTEM \"softwarelist.dtd\">\n\n" +
|
||||
"<softwarelist name=\"" + HttpUtility.HtmlEncode(Name) + "\"" +
|
||||
" description=\"" + HttpUtility.HtmlEncode(Description) + "\"" +
|
||||
(ForcePacking == ForcePacking.Unzip ? " forcepacking=\"unzip\"" : "") +
|
||||
(ForcePacking == ForcePacking.Zip ? " forcepacking=\"zip\"" : "") +
|
||||
(ForceMerging == ForceMerging.Full ? " forcemerging=\"full\"" : "") +
|
||||
(ForceMerging == ForceMerging.Split ? " forcemerging=\"split\"" : "") +
|
||||
(ForceNodump == ForceNodump.Ignore ? " forceitemStatus=\"ignore\"" : "") +
|
||||
(ForceNodump == ForceNodump.Obsolete ? " forceitemStatus=\"obsolete\"" : "") +
|
||||
(ForceNodump == ForceNodump.Required ? " forceitemStatus=\"required\"" : "") +
|
||||
(ForcePacking == ForcePacking.Unzip ? " forcepacking=\"unzip\"" : String.Empty) +
|
||||
(ForcePacking == ForcePacking.Zip ? " forcepacking=\"zip\"" : String.Empty) +
|
||||
(ForceMerging == ForceMerging.Full ? " forcemerging=\"full\"" : String.Empty) +
|
||||
(ForceMerging == ForceMerging.Split ? " forcemerging=\"split\"" : String.Empty) +
|
||||
(ForceNodump == ForceNodump.Ignore ? " forceitemStatus=\"ignore\"" : String.Empty) +
|
||||
(ForceNodump == ForceNodump.Obsolete ? " forceitemStatus=\"obsolete\"" : String.Empty) +
|
||||
(ForceNodump == ForceNodump.Required ? " forceitemStatus=\"required\"" : String.Empty) +
|
||||
">\n\n";
|
||||
break;
|
||||
}
|
||||
@@ -443,7 +443,7 @@ namespace SabreTools.Helper.Dats
|
||||
rom.Machine.Name = rom.Machine.Name.Substring(1);
|
||||
}
|
||||
|
||||
string state = "";
|
||||
string state = String.Empty;
|
||||
switch (datFormat)
|
||||
{
|
||||
case DatFormat.AttractMode:
|
||||
@@ -467,40 +467,40 @@ namespace SabreTools.Helper.Dats
|
||||
break;
|
||||
case DatFormat.ClrMamePro:
|
||||
state += "game (\n\tname \"" + rom.Machine.Name + "\"\n" +
|
||||
(ExcludeOf ? "" :
|
||||
(String.IsNullOrEmpty(rom.Machine.RomOf) ? "" : "\tromof \"" + rom.Machine.RomOf + "\"\n") +
|
||||
(String.IsNullOrEmpty(rom.Machine.CloneOf) ? "" : "\tcloneof \"" + rom.Machine.CloneOf + "\"\n") +
|
||||
(String.IsNullOrEmpty(rom.Machine.SampleOf) ? "" : "\tsampleof \"" + rom.Machine.SampleOf + "\"\n")
|
||||
(ExcludeOf ? String.Empty :
|
||||
(String.IsNullOrEmpty(rom.Machine.RomOf) ? String.Empty : "\tromof \"" + rom.Machine.RomOf + "\"\n") +
|
||||
(String.IsNullOrEmpty(rom.Machine.CloneOf) ? String.Empty : "\tcloneof \"" + rom.Machine.CloneOf + "\"\n") +
|
||||
(String.IsNullOrEmpty(rom.Machine.SampleOf) ? String.Empty : "\tsampleof \"" + rom.Machine.SampleOf + "\"\n")
|
||||
) +
|
||||
"\tdescription \"" + (String.IsNullOrEmpty(rom.Machine.Description) ? rom.Machine.Name : rom.Machine.Description) + "\"\n" +
|
||||
(String.IsNullOrEmpty(rom.Machine.Year) ? "" : "\tyear " + rom.Machine.Year + "\n") +
|
||||
(String.IsNullOrEmpty(rom.Machine.Manufacturer) ? "" : "\tmanufacturer \"" + rom.Machine.Manufacturer + "\"\n");
|
||||
(String.IsNullOrEmpty(rom.Machine.Year) ? String.Empty : "\tyear " + rom.Machine.Year + "\n") +
|
||||
(String.IsNullOrEmpty(rom.Machine.Manufacturer) ? String.Empty : "\tmanufacturer \"" + rom.Machine.Manufacturer + "\"\n");
|
||||
break;
|
||||
case DatFormat.DOSCenter:
|
||||
state += "game (\n\tname \"" + rom.Machine.Name + ".zip\"\n";
|
||||
break;
|
||||
case DatFormat.Logiqx:
|
||||
state += "\t<machine name=\"" + HttpUtility.HtmlEncode(rom.Machine.Name) + "\"" +
|
||||
(ExcludeOf ? "" :
|
||||
(rom.Machine.MachineType == MachineType.Bios ? " isbios=\"yes\"" : "") +
|
||||
(rom.Machine.MachineType == MachineType.Device ? " isdevice=\"yes\"" : "") +
|
||||
(rom.Machine.MachineType == MachineType.Mechanical ? " ismechanical=\"yes\"" : "") +
|
||||
(rom.Machine.Runnable ? " runnable=\"yes\"" : "") +
|
||||
(ExcludeOf ? String.Empty :
|
||||
(rom.Machine.MachineType == MachineType.Bios ? " isbios=\"yes\"" : String.Empty) +
|
||||
(rom.Machine.MachineType == MachineType.Device ? " isdevice=\"yes\"" : String.Empty) +
|
||||
(rom.Machine.MachineType == MachineType.Mechanical ? " ismechanical=\"yes\"" : String.Empty) +
|
||||
(rom.Machine.Runnable ? " runnable=\"yes\"" : String.Empty) +
|
||||
(String.IsNullOrEmpty(rom.Machine.CloneOf) || (rom.Machine.Name.ToLowerInvariant() == rom.Machine.CloneOf.ToLowerInvariant())
|
||||
? ""
|
||||
? String.Empty
|
||||
: " cloneof=\"" + HttpUtility.HtmlEncode(rom.Machine.CloneOf) + "\"") +
|
||||
(String.IsNullOrEmpty(rom.Machine.RomOf) || (rom.Machine.Name.ToLowerInvariant() == rom.Machine.RomOf.ToLowerInvariant())
|
||||
? ""
|
||||
? String.Empty
|
||||
: " romof=\"" + HttpUtility.HtmlEncode(rom.Machine.RomOf) + "\"") +
|
||||
(String.IsNullOrEmpty(rom.Machine.SampleOf) || (rom.Machine.Name.ToLowerInvariant() == rom.Machine.SampleOf.ToLowerInvariant())
|
||||
? ""
|
||||
? String.Empty
|
||||
: " sampleof=\"" + HttpUtility.HtmlEncode(rom.Machine.SampleOf) + "\"")
|
||||
) +
|
||||
">\n" +
|
||||
(String.IsNullOrEmpty(rom.Machine.Comment) ? "" : "\t\t<comment>" + HttpUtility.HtmlEncode(rom.Machine.Comment) + "</comment>\n") +
|
||||
(String.IsNullOrEmpty(rom.Machine.Comment) ? String.Empty : "\t\t<comment>" + HttpUtility.HtmlEncode(rom.Machine.Comment) + "</comment>\n") +
|
||||
"\t\t<description>" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.Machine.Description) ? rom.Machine.Name : rom.Machine.Description)) + "</description>\n" +
|
||||
(String.IsNullOrEmpty(rom.Machine.Year) ? "" : "\t\t<year>" + HttpUtility.HtmlEncode(rom.Machine.Year) + "</year>\n") +
|
||||
(String.IsNullOrEmpty(rom.Machine.Manufacturer) ? "" : "\t\t<manufacturer>" + HttpUtility.HtmlEncode(rom.Machine.Manufacturer) + "</manufacturer>\n");
|
||||
(String.IsNullOrEmpty(rom.Machine.Year) ? String.Empty : "\t\t<year>" + HttpUtility.HtmlEncode(rom.Machine.Year) + "</year>\n") +
|
||||
(String.IsNullOrEmpty(rom.Machine.Manufacturer) ? String.Empty : "\t\t<manufacturer>" + HttpUtility.HtmlEncode(rom.Machine.Manufacturer) + "</manufacturer>\n");
|
||||
break;
|
||||
case DatFormat.SabreDat:
|
||||
for (int i = (last == -1 ? 0 : last); i < newsplit.Count; i++)
|
||||
@@ -516,21 +516,21 @@ namespace SabreTools.Helper.Dats
|
||||
break;
|
||||
case DatFormat.SoftwareList:
|
||||
state += "\t<software name=\"" + HttpUtility.HtmlEncode(rom.Machine.Name) + "\""
|
||||
+ (rom.Supported != null ? " supported=\"" + (rom.Supported == true ? "yes" : "no") + "\"" : "") +
|
||||
(ExcludeOf ? "" :
|
||||
+ (rom.Supported != null ? " supported=\"" + (rom.Supported == true ? "yes" : "no") + "\"" : String.Empty) +
|
||||
(ExcludeOf ? String.Empty :
|
||||
(String.IsNullOrEmpty(rom.Machine.CloneOf) || (rom.Machine.Name.ToLowerInvariant() == rom.Machine.CloneOf.ToLowerInvariant())
|
||||
? ""
|
||||
? String.Empty
|
||||
: " cloneof=\"" + HttpUtility.HtmlEncode(rom.Machine.CloneOf) + "\"") +
|
||||
(String.IsNullOrEmpty(rom.Machine.RomOf) || (rom.Machine.Name.ToLowerInvariant() == rom.Machine.RomOf.ToLowerInvariant())
|
||||
? ""
|
||||
? String.Empty
|
||||
: " romof=\"" + HttpUtility.HtmlEncode(rom.Machine.RomOf) + "\"") +
|
||||
(String.IsNullOrEmpty(rom.Machine.SampleOf) || (rom.Machine.Name.ToLowerInvariant() == rom.Machine.SampleOf.ToLowerInvariant())
|
||||
? ""
|
||||
? String.Empty
|
||||
: " sampleof=\"" + HttpUtility.HtmlEncode(rom.Machine.SampleOf) + "\"")
|
||||
) + ">\n"
|
||||
+ "\t\t<description>" + HttpUtility.HtmlEncode(rom.Machine.Description) + "</description>\n"
|
||||
+ (rom.Machine.Year != null ? "\t\t<year>" + HttpUtility.HtmlEncode(rom.Machine.Year) + "</year>\n" : "")
|
||||
+ (rom.Publisher != null ? "\t\t<publisher>" + HttpUtility.HtmlEncode(rom.Publisher) + "</publisher>\n" : "");
|
||||
+ (rom.Machine.Year != null ? "\t\t<year>" + HttpUtility.HtmlEncode(rom.Machine.Year) + "</year>\n" : String.Empty)
|
||||
+ (rom.Publisher != null ? "\t\t<publisher>" + HttpUtility.HtmlEncode(rom.Publisher) + "</publisher>\n" : String.Empty);
|
||||
|
||||
foreach (Tuple<string, string> kvp in rom.Infos)
|
||||
{
|
||||
@@ -570,13 +570,13 @@ namespace SabreTools.Helper.Dats
|
||||
|
||||
try
|
||||
{
|
||||
string state = "";
|
||||
string state = String.Empty;
|
||||
|
||||
switch (datFormat)
|
||||
{
|
||||
case DatFormat.ClrMamePro:
|
||||
case DatFormat.DOSCenter:
|
||||
state += (String.IsNullOrEmpty(rom.Machine.SampleOf) ? "" : "\tsampleof \"" + rom.Machine.SampleOf + "\"\n") + ")\n";
|
||||
state += (String.IsNullOrEmpty(rom.Machine.SampleOf) ? String.Empty : "\tsampleof \"" + rom.Machine.SampleOf + "\"\n") + ")\n";
|
||||
break;
|
||||
case DatFormat.Logiqx:
|
||||
state += "\t</machine>\n";
|
||||
@@ -654,7 +654,7 @@ namespace SabreTools.Helper.Dats
|
||||
|
||||
try
|
||||
{
|
||||
string state = "", name = "", pre = "", post = "";
|
||||
string state = String.Empty, name = String.Empty, pre = String.Empty, post = String.Empty;
|
||||
switch (datFormat)
|
||||
{
|
||||
case DatFormat.ClrMamePro:
|
||||
@@ -666,37 +666,37 @@ namespace SabreTools.Helper.Dats
|
||||
break;
|
||||
case ItemType.BiosSet:
|
||||
state += "\tbiosset ( name\"" + rom.Name + "\""
|
||||
+ (!String.IsNullOrEmpty(((BiosSet)rom).Description) ? " description \"" + ((BiosSet)rom).Description + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((BiosSet)rom).Description) ? " description \"" + ((BiosSet)rom).Description + "\"" : String.Empty)
|
||||
+ (((BiosSet)rom).Default != null
|
||||
? "default " + ((BiosSet)rom).Default.ToString().ToLowerInvariant()
|
||||
: "")
|
||||
: String.Empty)
|
||||
+ " )\n";
|
||||
break;
|
||||
case ItemType.Disk:
|
||||
state += "\tdisk ( name \"" + rom.Name + "\""
|
||||
+ (!String.IsNullOrEmpty(((Disk)rom).MD5) ? " md5 " + ((Disk)rom).MD5.ToLowerInvariant() : "")
|
||||
+ (!String.IsNullOrEmpty(((Disk)rom).SHA1) ? " sha1 " + ((Disk)rom).SHA1.ToLowerInvariant() : "")
|
||||
+ (((Disk)rom).ItemStatus != ItemStatus.None ? " flags " + ((Disk)rom).ItemStatus.ToString().ToLowerInvariant() : "")
|
||||
+ (!String.IsNullOrEmpty(((Disk)rom).MD5) ? " md5 " + ((Disk)rom).MD5.ToLowerInvariant() : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Disk)rom).SHA1) ? " sha1 " + ((Disk)rom).SHA1.ToLowerInvariant() : String.Empty)
|
||||
+ (((Disk)rom).ItemStatus != ItemStatus.None ? " flags " + ((Disk)rom).ItemStatus.ToString().ToLowerInvariant() : String.Empty)
|
||||
+ " )\n";
|
||||
break;
|
||||
case ItemType.Release:
|
||||
state += "\trelease ( name\"" + rom.Name + "\""
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Region) ? " region \"" + ((Release)rom).Region + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Language) ? " language \"" + ((Release)rom).Language + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Date) ? " date \"" + ((Release)rom).Date + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Region) ? " region \"" + ((Release)rom).Region + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Language) ? " language \"" + ((Release)rom).Language + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Date) ? " date \"" + ((Release)rom).Date + "\"" : String.Empty)
|
||||
+ (((Release)rom).Default != null
|
||||
? "default " + ((Release)rom).Default.ToString().ToLowerInvariant()
|
||||
: "")
|
||||
: String.Empty)
|
||||
+ " )\n";
|
||||
break;
|
||||
case ItemType.Rom:
|
||||
state += "\trom ( name \"" + rom.Name + "\""
|
||||
+ (((Rom)rom).Size != -1 ? " size " + ((Rom)rom).Size : "")
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).CRC) ? " crc " + ((Rom)rom).CRC.ToLowerInvariant() : "")
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).MD5) ? " md5 " + ((Rom)rom).MD5.ToLowerInvariant() : "")
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).SHA1) ? " sha1 " + ((Rom)rom).SHA1.ToLowerInvariant() : "")
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).Date) ? " date \"" + ((Rom)rom).Date + "\"" : "")
|
||||
+ (((Rom)rom).ItemStatus != ItemStatus.None ? " flags " + ((Rom)rom).ItemStatus.ToString().ToLowerInvariant() : "")
|
||||
+ (((Rom)rom).Size != -1 ? " size " + ((Rom)rom).Size : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).CRC) ? " crc " + ((Rom)rom).CRC.ToLowerInvariant() : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).MD5) ? " md5 " + ((Rom)rom).MD5.ToLowerInvariant() : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).SHA1) ? " sha1 " + ((Rom)rom).SHA1.ToLowerInvariant() : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).Date) ? " date \"" + ((Rom)rom).Date + "\"" : String.Empty)
|
||||
+ (((Rom)rom).ItemStatus != ItemStatus.None ? " flags " + ((Rom)rom).ItemStatus.ToString().ToLowerInvariant() : String.Empty)
|
||||
+ " )\n";
|
||||
break;
|
||||
case ItemType.Sample:
|
||||
@@ -713,8 +713,8 @@ namespace SabreTools.Helper.Dats
|
||||
return true;
|
||||
}
|
||||
|
||||
pre = Prefix + (Quotes ? "\"" : "");
|
||||
post = (Quotes ? "\"" : "") + Postfix;
|
||||
pre = Prefix + (Quotes ? "\"" : String.Empty);
|
||||
post = (Quotes ? "\"" : String.Empty) + Postfix;
|
||||
|
||||
if (rom.Type == ItemType.Rom)
|
||||
{
|
||||
@@ -796,9 +796,9 @@ namespace SabreTools.Helper.Dats
|
||||
break;
|
||||
case ItemType.Rom:
|
||||
state += "\tfile ( name " + ((Rom)rom).Name
|
||||
+ (((Rom)rom).Size != -1 ? " size " + ((Rom)rom).Size : "")
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).Date) ? " date " + ((Rom)rom).Date : "")
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).CRC) ? " crc " + ((Rom)rom).CRC.ToLowerInvariant() : "")
|
||||
+ (((Rom)rom).Size != -1 ? " size " + ((Rom)rom).Size : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).Date) ? " date " + ((Rom)rom).Date : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).CRC) ? " crc " + ((Rom)rom).CRC.ToLowerInvariant() : String.Empty)
|
||||
+ " )\n";
|
||||
break;
|
||||
}
|
||||
@@ -812,37 +812,37 @@ namespace SabreTools.Helper.Dats
|
||||
break;
|
||||
case ItemType.BiosSet:
|
||||
state += "\t\t<biosset name\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (!String.IsNullOrEmpty(((BiosSet)rom).Description) ? " description=\"" + HttpUtility.HtmlEncode(((BiosSet)rom).Description) + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((BiosSet)rom).Description) ? " description=\"" + HttpUtility.HtmlEncode(((BiosSet)rom).Description) + "\"" : String.Empty)
|
||||
+ (((BiosSet)rom).Default != null
|
||||
? ((BiosSet)rom).Default.ToString().ToLowerInvariant()
|
||||
: "")
|
||||
: String.Empty)
|
||||
+ "/>\n";
|
||||
break;
|
||||
case ItemType.Disk:
|
||||
state += "\t\t<disk name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (!String.IsNullOrEmpty(((Disk)rom).MD5) ? " md5=\"" + ((Disk)rom).MD5.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Disk)rom).SHA1) ? " sha1=\"" + ((Disk)rom).SHA1.ToLowerInvariant() + "\"" : "")
|
||||
+ (((Disk)rom).ItemStatus != ItemStatus.None ? " status=\"" + ((Disk)rom).ItemStatus.ToString().ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Disk)rom).MD5) ? " md5=\"" + ((Disk)rom).MD5.ToLowerInvariant() + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Disk)rom).SHA1) ? " sha1=\"" + ((Disk)rom).SHA1.ToLowerInvariant() + "\"" : String.Empty)
|
||||
+ (((Disk)rom).ItemStatus != ItemStatus.None ? " status=\"" + ((Disk)rom).ItemStatus.ToString().ToLowerInvariant() + "\"" : String.Empty)
|
||||
+ "/>\n";
|
||||
break;
|
||||
case ItemType.Release:
|
||||
state += "\t\t<release name\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Region) ? " region=\"" + HttpUtility.HtmlEncode(((Release)rom).Region) + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Language) ? " language=\"" + HttpUtility.HtmlEncode(((Release)rom).Language) + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Date) ? " date=\"" + HttpUtility.HtmlEncode(((Release)rom).Date) + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Region) ? " region=\"" + HttpUtility.HtmlEncode(((Release)rom).Region) + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Language) ? " language=\"" + HttpUtility.HtmlEncode(((Release)rom).Language) + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Date) ? " date=\"" + HttpUtility.HtmlEncode(((Release)rom).Date) + "\"" : String.Empty)
|
||||
+ (((Release)rom).Default != null
|
||||
? ((Release)rom).Default.ToString().ToLowerInvariant()
|
||||
: "")
|
||||
: String.Empty)
|
||||
+ "/>\n";
|
||||
break;
|
||||
case ItemType.Rom:
|
||||
state += "\t\t<rom name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (((Rom)rom).Size != -1 ? " size=\"" + ((Rom)rom).Size + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).CRC) ? " crc=\"" + ((Rom)rom).CRC.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).MD5) ? " md5=\"" + ((Rom)rom).MD5.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).SHA1) ? " sha1=\"" + ((Rom)rom).SHA1.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).Date) ? " date=\"" + ((Rom)rom).Date + "\"" : "")
|
||||
+ (((Rom)rom).ItemStatus != ItemStatus.None ? " status=\"" + ((Rom)rom).ItemStatus.ToString().ToLowerInvariant() + "\"" : "")
|
||||
+ (((Rom)rom).Size != -1 ? " size=\"" + ((Rom)rom).Size + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).CRC) ? " crc=\"" + ((Rom)rom).CRC.ToLowerInvariant() + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).MD5) ? " md5=\"" + ((Rom)rom).MD5.ToLowerInvariant() + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).SHA1) ? " sha1=\"" + ((Rom)rom).SHA1.ToLowerInvariant() + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).Date) ? " date=\"" + ((Rom)rom).Date + "\"" : String.Empty)
|
||||
+ (((Rom)rom).ItemStatus != ItemStatus.None ? " status=\"" + ((Rom)rom).ItemStatus.ToString().ToLowerInvariant() + "\"" : String.Empty)
|
||||
+ "/>\n";
|
||||
break;
|
||||
case ItemType.Sample:
|
||||
@@ -858,8 +858,8 @@ namespace SabreTools.Helper.Dats
|
||||
return true;
|
||||
}
|
||||
|
||||
pre = Prefix + (Quotes ? "\"" : "");
|
||||
post = (Quotes ? "\"" : "") + Postfix;
|
||||
pre = Prefix + (Quotes ? "\"" : String.Empty);
|
||||
post = (Quotes ? "\"" : String.Empty) + Postfix;
|
||||
|
||||
if (rom.Type == ItemType.Rom)
|
||||
{
|
||||
@@ -900,7 +900,7 @@ namespace SabreTools.Helper.Dats
|
||||
if (rom.Type == ItemType.Rom)
|
||||
{
|
||||
// We can only write out if there's a SHA-1
|
||||
if (((Rom)rom).SHA1 != "")
|
||||
if (((Rom)rom).SHA1 != String.Empty)
|
||||
{
|
||||
name = ((Rom)rom).SHA1.Substring(0, 2)
|
||||
+ "/" + ((Rom)rom).SHA1.Substring(2, 2)
|
||||
@@ -913,7 +913,7 @@ namespace SabreTools.Helper.Dats
|
||||
else if (rom.Type == ItemType.Disk)
|
||||
{
|
||||
// We can only write out if there's a SHA-1
|
||||
if (((Disk)rom).SHA1 != "")
|
||||
if (((Disk)rom).SHA1 != String.Empty)
|
||||
{
|
||||
name = ((Disk)rom).SHA1.Substring(0, 2)
|
||||
+ "/" + ((Disk)rom).SHA1.Substring(2, 2)
|
||||
@@ -927,18 +927,18 @@ namespace SabreTools.Helper.Dats
|
||||
|
||||
// Otherwise, use any flags
|
||||
name = (UseGame ? rom.Machine.Name : rom.Name);
|
||||
if (RepExt != "" || RemExt)
|
||||
if (RepExt != String.Empty || RemExt)
|
||||
{
|
||||
if (RemExt)
|
||||
{
|
||||
RepExt = "";
|
||||
RepExt = String.Empty;
|
||||
}
|
||||
|
||||
string dir = Path.GetDirectoryName(name);
|
||||
dir = (dir.StartsWith(Path.DirectorySeparatorChar.ToString()) ? dir.Remove(0, 1) : dir);
|
||||
name = Path.Combine(dir, Path.GetFileNameWithoutExtension(name) + RepExt);
|
||||
}
|
||||
if (AddExt != "")
|
||||
if (AddExt != String.Empty)
|
||||
{
|
||||
name += AddExt;
|
||||
}
|
||||
@@ -1008,44 +1008,44 @@ namespace SabreTools.Helper.Dats
|
||||
case DatFormat.RedumpMD5:
|
||||
if (rom.Type == ItemType.Rom)
|
||||
{
|
||||
state += ((Rom)rom).MD5 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + "\n";
|
||||
state += ((Rom)rom).MD5 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : String.Empty) + rom.Name + "\n";
|
||||
}
|
||||
else if (rom.Type == ItemType.Disk)
|
||||
{
|
||||
state += ((Disk)rom).MD5 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + "\n";
|
||||
state += ((Disk)rom).MD5 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : String.Empty) + rom.Name + "\n";
|
||||
}
|
||||
break;
|
||||
case DatFormat.RedumpSFV:
|
||||
if (rom.Type == ItemType.Rom)
|
||||
{
|
||||
state += (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + " " + ((Rom)rom).CRC + "\n";
|
||||
state += (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : String.Empty) + rom.Name + " " + ((Rom)rom).CRC + "\n";
|
||||
}
|
||||
break;
|
||||
case DatFormat.RedumpSHA1:
|
||||
if (rom.Type == ItemType.Rom)
|
||||
{
|
||||
state += ((Rom)rom).SHA1 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + "\n";
|
||||
state += ((Rom)rom).SHA1 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : String.Empty) + rom.Name + "\n";
|
||||
}
|
||||
else if (rom.Type == ItemType.Disk)
|
||||
{
|
||||
state += ((Disk)rom).SHA1 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + "\n";
|
||||
state += ((Disk)rom).SHA1 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : String.Empty) + rom.Name + "\n";
|
||||
}
|
||||
break;
|
||||
case DatFormat.RomCenter:
|
||||
if (rom.Type == ItemType.Rom)
|
||||
{
|
||||
state += "¬" + (String.IsNullOrEmpty(rom.Machine.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.Machine.CloneOf)) +
|
||||
"¬" + (String.IsNullOrEmpty(rom.Machine.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.Machine.CloneOf)) +
|
||||
state += "¬" + (String.IsNullOrEmpty(rom.Machine.CloneOf) ? String.Empty : HttpUtility.HtmlEncode(rom.Machine.CloneOf)) +
|
||||
"¬" + (String.IsNullOrEmpty(rom.Machine.CloneOf) ? String.Empty : HttpUtility.HtmlEncode(rom.Machine.CloneOf)) +
|
||||
"¬" + HttpUtility.HtmlEncode(rom.Machine.Name) +
|
||||
"¬" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.Machine.Description) ? rom.Machine.Name : rom.Machine.Description)) +
|
||||
"¬" + HttpUtility.HtmlEncode(rom.Name) +
|
||||
"¬" + ((Rom)rom).CRC.ToLowerInvariant() +
|
||||
"¬" + (((Rom)rom).Size != -1 ? ((Rom)rom).Size.ToString() : "") + "¬¬¬\n";
|
||||
"¬" + (((Rom)rom).Size != -1 ? ((Rom)rom).Size.ToString() : String.Empty) + "¬¬¬\n";
|
||||
}
|
||||
else if (rom.Type == ItemType.Disk)
|
||||
{
|
||||
state += "¬" + (String.IsNullOrEmpty(rom.Machine.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.Machine.CloneOf)) +
|
||||
"¬" + (String.IsNullOrEmpty(rom.Machine.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.Machine.CloneOf)) +
|
||||
state += "¬" + (String.IsNullOrEmpty(rom.Machine.CloneOf) ? String.Empty : HttpUtility.HtmlEncode(rom.Machine.CloneOf)) +
|
||||
"¬" + (String.IsNullOrEmpty(rom.Machine.CloneOf) ? String.Empty : HttpUtility.HtmlEncode(rom.Machine.CloneOf)) +
|
||||
"¬" + HttpUtility.HtmlEncode(rom.Machine.Name) +
|
||||
"¬" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.Machine.Description) ? rom.Machine.Name : rom.Machine.Description)) +
|
||||
"¬" + HttpUtility.HtmlEncode(rom.Name) +
|
||||
@@ -1054,7 +1054,7 @@ namespace SabreTools.Helper.Dats
|
||||
|
||||
break;
|
||||
case DatFormat.SabreDat:
|
||||
string prefix = "";
|
||||
string prefix = String.Empty;
|
||||
for (int i = 0; i < depth; i++)
|
||||
{
|
||||
prefix += "\t";
|
||||
@@ -1069,16 +1069,16 @@ namespace SabreTools.Helper.Dats
|
||||
break;
|
||||
case ItemType.BiosSet:
|
||||
state += "<file type=\"biosset\" name\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (!String.IsNullOrEmpty(((BiosSet)rom).Description) ? " description=\"" + HttpUtility.HtmlEncode(((BiosSet)rom).Description) + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((BiosSet)rom).Description) ? " description=\"" + HttpUtility.HtmlEncode(((BiosSet)rom).Description) + "\"" : String.Empty)
|
||||
+ (((BiosSet)rom).Default != null
|
||||
? ((BiosSet)rom).Default.ToString().ToLowerInvariant()
|
||||
: "")
|
||||
: String.Empty)
|
||||
+ "/>\n";
|
||||
break;
|
||||
case ItemType.Disk:
|
||||
state += "<file type=\"disk\" name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (!String.IsNullOrEmpty(((Disk)rom).MD5) ? " md5=\"" + ((Disk)rom).MD5.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Disk)rom).SHA1) ? " sha1=\"" + ((Disk)rom).SHA1.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Disk)rom).MD5) ? " md5=\"" + ((Disk)rom).MD5.ToLowerInvariant() + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Disk)rom).SHA1) ? " sha1=\"" + ((Disk)rom).SHA1.ToLowerInvariant() + "\"" : String.Empty)
|
||||
+ (((Disk)rom).ItemStatus != ItemStatus.None ? prefix + "/>\n" + prefix + "\t<flags>\n" +
|
||||
prefix + "\t\t<flag name=\"status\" value=\"" + ((Disk)rom).ItemStatus.ToString().ToLowerInvariant() + "\"/>\n" +
|
||||
prefix + "\t</flags>\n" +
|
||||
@@ -1086,21 +1086,21 @@ namespace SabreTools.Helper.Dats
|
||||
break;
|
||||
case ItemType.Release:
|
||||
state += "<file type=\"release\" name\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Region) ? " region=\"" + HttpUtility.HtmlEncode(((Release)rom).Region) + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Language) ? " language=\"" + HttpUtility.HtmlEncode(((Release)rom).Language) + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Date) ? " date=\"" + HttpUtility.HtmlEncode(((Release)rom).Date) + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Region) ? " region=\"" + HttpUtility.HtmlEncode(((Release)rom).Region) + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Language) ? " language=\"" + HttpUtility.HtmlEncode(((Release)rom).Language) + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Date) ? " date=\"" + HttpUtility.HtmlEncode(((Release)rom).Date) + "\"" : String.Empty)
|
||||
+ (((Release)rom).Default != null
|
||||
? ((Release)rom).Default.ToString().ToLowerInvariant()
|
||||
: "")
|
||||
: String.Empty)
|
||||
+ "/>\n";
|
||||
break;
|
||||
case ItemType.Rom:
|
||||
state += "<file type=\"rom\" name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (((Rom)rom).Size != -1 ? " size=\"" + ((Rom)rom).Size + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).CRC) ? " crc=\"" + ((Rom)rom).CRC.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).MD5) ? " md5=\"" + ((Rom)rom).MD5.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).SHA1) ? " sha1=\"" + ((Rom)rom).SHA1.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).Date) ? " date=\"" + ((Rom)rom).Date + "\"" : "")
|
||||
+ (((Rom)rom).Size != -1 ? " size=\"" + ((Rom)rom).Size + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).CRC) ? " crc=\"" + ((Rom)rom).CRC.ToLowerInvariant() + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).MD5) ? " md5=\"" + ((Rom)rom).MD5.ToLowerInvariant() + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).SHA1) ? " sha1=\"" + ((Rom)rom).SHA1.ToLowerInvariant() + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).Date) ? " date=\"" + ((Rom)rom).Date + "\"" : String.Empty)
|
||||
+ (((Rom)rom).ItemStatus != ItemStatus.None ? prefix + "/>\n" + prefix + "\t<flags>\n" +
|
||||
prefix + "\t\t<flag name=\"status\" value=\"" + ((Rom)rom).ItemStatus.ToString().ToLowerInvariant() + "\"/>\n" +
|
||||
prefix + "\t</flags>\n" +
|
||||
@@ -1124,61 +1124,61 @@ namespace SabreTools.Helper.Dats
|
||||
{
|
||||
case ItemType.Archive:
|
||||
state += "\t\t\t<dataarea name=\"" + (String.IsNullOrEmpty(rom.AreaName) ? "archive" : rom.AreaName) + "\""
|
||||
+ (rom.AreaSize != null ? " size=\"" + rom.AreaSize + "\"" : "") + ">\n"
|
||||
+ (rom.AreaSize != null ? " size=\"" + rom.AreaSize + "\"" : String.Empty) + ">\n"
|
||||
+ "\t\t\t\t<archive name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ "/>\n"
|
||||
+ "\t\t\t</dataarea>\n";
|
||||
break;
|
||||
case ItemType.BiosSet:
|
||||
state += "\t\t\t<dataarea name=\"" + (String.IsNullOrEmpty(rom.AreaName) ? "biosset" : rom.AreaName) + "\""
|
||||
+ (rom.AreaSize != null ? " size=\"" + rom.AreaSize + "\"" : "") + ">\n"
|
||||
+ (rom.AreaSize != null ? " size=\"" + rom.AreaSize + "\"" : String.Empty) + ">\n"
|
||||
+ "\t\t\t\t<biosset name\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (!String.IsNullOrEmpty(((BiosSet)rom).Description) ? " description=\"" + HttpUtility.HtmlEncode(((BiosSet)rom).Description) + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((BiosSet)rom).Description) ? " description=\"" + HttpUtility.HtmlEncode(((BiosSet)rom).Description) + "\"" : String.Empty)
|
||||
+ (((BiosSet)rom).Default != null
|
||||
? ((BiosSet)rom).Default.ToString().ToLowerInvariant()
|
||||
: "")
|
||||
: String.Empty)
|
||||
+ "/>\n"
|
||||
+ "\t\t\t</dataarea>\n";
|
||||
break;
|
||||
case ItemType.Disk:
|
||||
state += "\t\t\t<diskarea name=\"" + (String.IsNullOrEmpty(rom.AreaName) ? "cdrom" : rom.AreaName) + "\""
|
||||
+ (rom.AreaSize != null ? " size=\"" + rom.AreaSize + "\"" : "") + ">\n"
|
||||
+ (rom.AreaSize != null ? " size=\"" + rom.AreaSize + "\"" : String.Empty) + ">\n"
|
||||
+ "\t\t\t\t<disk name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (!String.IsNullOrEmpty(((Disk)rom).MD5) ? " md5=\"" + ((Disk)rom).MD5.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Disk)rom).SHA1) ? " sha1=\"" + ((Disk)rom).SHA1.ToLowerInvariant() + "\"" : "")
|
||||
+ (((Disk)rom).ItemStatus != ItemStatus.None ? " status=\"" + ((Disk)rom).ItemStatus.ToString().ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Disk)rom).MD5) ? " md5=\"" + ((Disk)rom).MD5.ToLowerInvariant() + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Disk)rom).SHA1) ? " sha1=\"" + ((Disk)rom).SHA1.ToLowerInvariant() + "\"" : String.Empty)
|
||||
+ (((Disk)rom).ItemStatus != ItemStatus.None ? " status=\"" + ((Disk)rom).ItemStatus.ToString().ToLowerInvariant() + "\"" : String.Empty)
|
||||
+ "/>\n"
|
||||
+ "\t\t\t</diskarea>\n";
|
||||
break;
|
||||
case ItemType.Release:
|
||||
state += "\t\t\t<dataarea name=\"" + (String.IsNullOrEmpty(rom.AreaName) ? "release" : rom.AreaName) + "\""
|
||||
+ (rom.AreaSize != null ? " size=\"" + rom.AreaSize + "\"" : "") + ">\n"
|
||||
+ (rom.AreaSize != null ? " size=\"" + rom.AreaSize + "\"" : String.Empty) + ">\n"
|
||||
+ "\t\t\t\t<release name\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Region) ? " region=\"" + HttpUtility.HtmlEncode(((Release)rom).Region) + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Language) ? " language=\"" + HttpUtility.HtmlEncode(((Release)rom).Language) + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Date) ? " date=\"" + HttpUtility.HtmlEncode(((Release)rom).Date) + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Region) ? " region=\"" + HttpUtility.HtmlEncode(((Release)rom).Region) + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Language) ? " language=\"" + HttpUtility.HtmlEncode(((Release)rom).Language) + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Release)rom).Date) ? " date=\"" + HttpUtility.HtmlEncode(((Release)rom).Date) + "\"" : String.Empty)
|
||||
+ (((Release)rom).Default != null
|
||||
? ((Release)rom).Default.ToString().ToLowerInvariant()
|
||||
: "")
|
||||
: String.Empty)
|
||||
+ "/>\n"
|
||||
+ "\t\t\t</dataarea>\n";
|
||||
break;
|
||||
case ItemType.Rom:
|
||||
state += "\t\t\t<dataarea name=\"" + (String.IsNullOrEmpty(rom.AreaName) ? "rom" : rom.AreaName) + "\""
|
||||
+ (rom.AreaSize != null ? " size=\"" + rom.AreaSize + "\"" : "") + ">\n"
|
||||
+ (rom.AreaSize != null ? " size=\"" + rom.AreaSize + "\"" : String.Empty) + ">\n"
|
||||
+ "\t\t\t\t<rom name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ (((Rom)rom).Size != -1 ? " size=\"" + ((Rom)rom).Size + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).CRC) ? " crc=\"" + ((Rom)rom).CRC.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).MD5) ? " md5=\"" + ((Rom)rom).MD5.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).SHA1) ? " sha1=\"" + ((Rom)rom).SHA1.ToLowerInvariant() + "\"" : "")
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).Date) ? " date=\"" + ((Rom)rom).Date + "\"" : "")
|
||||
+ (((Rom)rom).ItemStatus != ItemStatus.None ? " status=\"" + ((Rom)rom).ItemStatus.ToString().ToLowerInvariant() + "\"" : "")
|
||||
+ (((Rom)rom).Size != -1 ? " size=\"" + ((Rom)rom).Size + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).CRC) ? " crc=\"" + ((Rom)rom).CRC.ToLowerInvariant() + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).MD5) ? " md5=\"" + ((Rom)rom).MD5.ToLowerInvariant() + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).SHA1) ? " sha1=\"" + ((Rom)rom).SHA1.ToLowerInvariant() + "\"" : String.Empty)
|
||||
+ (!String.IsNullOrEmpty(((Rom)rom).Date) ? " date=\"" + ((Rom)rom).Date + "\"" : String.Empty)
|
||||
+ (((Rom)rom).ItemStatus != ItemStatus.None ? " status=\"" + ((Rom)rom).ItemStatus.ToString().ToLowerInvariant() + "\"" : String.Empty)
|
||||
+ "/>\n"
|
||||
+ "\t\t\t</dataarea>\n";
|
||||
break;
|
||||
case ItemType.Sample:
|
||||
state += "\t\t\t<dataarea name=\"" + (String.IsNullOrEmpty(rom.AreaName) ? "sample" : rom.AreaName) + "\""
|
||||
+ (rom.AreaSize != null ? " size=\"" + rom.AreaSize + "\"" : "") + ">\n"
|
||||
+ (rom.AreaSize != null ? " size=\"" + rom.AreaSize + "\"" : String.Empty) + ">\n"
|
||||
+ "\t\t\t\t<sample type=\"sample\" name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
|
||||
+ "/>\n"
|
||||
+ "\t\t\t</dataarea>\n";
|
||||
@@ -1194,8 +1194,8 @@ namespace SabreTools.Helper.Dats
|
||||
return true;
|
||||
}
|
||||
|
||||
pre = Prefix + (Quotes ? "\"" : "");
|
||||
post = (Quotes ? "\"" : "") + Postfix;
|
||||
pre = Prefix + (Quotes ? "\"" : String.Empty);
|
||||
post = (Quotes ? "\"" : String.Empty) + Postfix;
|
||||
|
||||
if (rom.Type == ItemType.Rom)
|
||||
{
|
||||
@@ -1291,7 +1291,7 @@ namespace SabreTools.Helper.Dats
|
||||
{
|
||||
try
|
||||
{
|
||||
string footer = "";
|
||||
string footer = String.Empty;
|
||||
|
||||
// If we have roms, output the full footer
|
||||
if (Count > 0)
|
||||
|
||||
@@ -47,11 +47,11 @@ namespace SabreTools.Helper.Dats
|
||||
/// </summary>
|
||||
public Release()
|
||||
{
|
||||
_name = "";
|
||||
_name = String.Empty;
|
||||
_itemType = ItemType.Release;
|
||||
_region = "";
|
||||
_language = "";
|
||||
_date = "";
|
||||
_region = String.Empty;
|
||||
_language = String.Empty;
|
||||
_date = String.Empty;
|
||||
_default = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,11 +43,11 @@ namespace SabreTools.Helper.Dats
|
||||
/// </summary>
|
||||
public Rom()
|
||||
{
|
||||
_name = "";
|
||||
_name = String.Empty;
|
||||
_itemType = ItemType.Rom;
|
||||
_dupeType = 0x00;
|
||||
_itemStatus = ItemStatus.None;
|
||||
_date = "";
|
||||
_date = String.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace SabreTools.Helper.Dats
|
||||
/// </summary>
|
||||
public Sample()
|
||||
{
|
||||
_name = "";
|
||||
_name = String.Empty;
|
||||
_itemType = ItemType.Sample;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,14 +42,14 @@ namespace NaturalSort
|
||||
string[] x1, y1;
|
||||
if (!table.TryGetValue(x, out x1))
|
||||
{
|
||||
//x1 = Regex.Split(x.Replace(" ", ""), "([0-9]+)");
|
||||
x1 = Regex.Split(x, "([0-9]+)").Where(s => s != "").ToArray();
|
||||
//x1 = Regex.Split(x.Replace(" ", String.Empty), "([0-9]+)");
|
||||
x1 = Regex.Split(x, "([0-9]+)").Where(s => s != String.Empty).ToArray();
|
||||
table.Add(x, x1);
|
||||
}
|
||||
if (!table.TryGetValue(y, out y1))
|
||||
{
|
||||
//y1 = Regex.Split(y.Replace(" ", ""), "([0-9]+)");
|
||||
y1 = Regex.Split(y, "([0-9]+)").Where(s => s != "").ToArray();
|
||||
//y1 = Regex.Split(y.Replace(" ", String.Empty), "([0-9]+)");
|
||||
y1 = Regex.Split(y, "([0-9]+)").Where(s => s != String.Empty).ToArray();
|
||||
table.Add(y, y1);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,14 +42,14 @@ namespace NaturalSort
|
||||
string[] x1, y1;
|
||||
if (!table.TryGetValue(x, out x1))
|
||||
{
|
||||
//x1 = Regex.Split(x.Replace(" ", ""), "([0-9]+)");
|
||||
x1 = Regex.Split(x, "([0-9]+)").Where(s => s != "").ToArray();
|
||||
//x1 = Regex.Split(x.Replace(" ", String.Empty), "([0-9]+)");
|
||||
x1 = Regex.Split(x, "([0-9]+)").Where(s => s != String.Empty).ToArray();
|
||||
table.Add(x, x1);
|
||||
}
|
||||
if (!table.TryGetValue(y, out y1))
|
||||
{
|
||||
//y1 = Regex.Split(y.Replace(" ", ""), "([0-9]+)");
|
||||
y1 = Regex.Split(y, "([0-9]+)").Where(s => s != "").ToArray();
|
||||
//y1 = Regex.Split(y.Replace(" ", String.Empty), "([0-9]+)");
|
||||
y1 = Regex.Split(y, "([0-9]+)").Where(s => s != String.Empty).ToArray();
|
||||
table.Add(y, y1);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace ROMVault2.SupportedFiles.Zip
|
||||
|
||||
public string ZipFilename
|
||||
{
|
||||
get { return (_zipFileInfo != null ? _zipFileInfo.FullName : ""); }
|
||||
get { return (_zipFileInfo != null ? _zipFileInfo.FullName : String.Empty); }
|
||||
}
|
||||
public long TimeStamp
|
||||
{
|
||||
@@ -944,7 +944,7 @@ namespace ROMVault2.SupportedFiles.Zip
|
||||
switch (zr)
|
||||
{
|
||||
case ZipReturn.ZipGood:
|
||||
ret = "";
|
||||
ret = String.Empty;
|
||||
break;
|
||||
case ZipReturn.ZipFileCountError:
|
||||
ret = "The number of file in the Zip does not mach the number of files in the Zips Centeral Directory";
|
||||
|
||||
4
SabreTools.Helper/External/Zlib/Deflate.cs
vendored
4
SabreTools.Helper/External/Zlib/Deflate.cs
vendored
@@ -153,14 +153,14 @@ namespace Ionic.Zlib
|
||||
{
|
||||
"need dictionary",
|
||||
"stream end",
|
||||
"",
|
||||
String.Empty,
|
||||
"file error",
|
||||
"stream error",
|
||||
"data error",
|
||||
"insufficient memory",
|
||||
"buffer error",
|
||||
"incompatible version",
|
||||
""
|
||||
String.Empty
|
||||
};
|
||||
|
||||
// preset dictionary flag in zlib header
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace SabreTools.Helper
|
||||
// USER and ERROR writes to console
|
||||
if (loglevel == LogLevel.USER || loglevel == LogLevel.ERROR)
|
||||
{
|
||||
Console.WriteLine((loglevel == LogLevel.ERROR && appendPrefix ? loglevel.ToString() + " " : "") + output);
|
||||
Console.WriteLine((loglevel == LogLevel.ERROR && appendPrefix ? loglevel.ToString() + " " : String.Empty) + output);
|
||||
}
|
||||
|
||||
// If we're writing to file, use the existing stream
|
||||
@@ -169,7 +169,7 @@ namespace SabreTools.Helper
|
||||
{
|
||||
try
|
||||
{
|
||||
_log.WriteLine((appendPrefix ? loglevel.ToString() + " - " + DateTime.Now + " - " : "" ) + output);
|
||||
_log.WriteLine((appendPrefix ? loglevel.ToString() + " - " + DateTime.Now + " - " : String.Empty ) + output);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -6,13 +6,13 @@ using System.Runtime.InteropServices;
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("SabreHelper")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyDescription(String.Empty)]
|
||||
[assembly: AssemblyConfiguration(String.Empty)]
|
||||
[assembly: AssemblyCompany(String.Empty)]
|
||||
[assembly: AssemblyProduct("SabreHelper")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: AssemblyTrademark(String.Empty)]
|
||||
[assembly: AssemblyCulture(String.Empty)]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:schema id="root" xmlns=String.Empty xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:schema id="root" xmlns=String.Empty xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:schema id="root" xmlns=String.Empty xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:schema id="root" xmlns=String.Empty xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
|
||||
@@ -55,11 +55,11 @@ namespace SabreTools.Helper.Skippers
|
||||
/// </summary>
|
||||
public Skipper()
|
||||
{
|
||||
Name = "";
|
||||
Author = "";
|
||||
Version = "";
|
||||
Name = String.Empty;
|
||||
Author = String.Empty;
|
||||
Version = String.Empty;
|
||||
Rules = new List<SkipperRule>();
|
||||
SourceFile = "";
|
||||
SourceFile = String.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -221,7 +221,7 @@ namespace SabreTools.Helper.Tools
|
||||
/// <returns>Name of the extracted file, null on error</returns>
|
||||
public static string ExtractItem(string input, string entryName, string tempDir, Logger logger)
|
||||
{
|
||||
string realEntry = "";
|
||||
string realEntry = String.Empty;
|
||||
Stream ms = ExtractStream(input, entryName, out realEntry, logger);
|
||||
|
||||
// If we got out a null or empty entry, then we don't have a stream
|
||||
@@ -265,7 +265,7 @@ namespace SabreTools.Helper.Tools
|
||||
public static Stream ExtractStream(string input, string entryName, out string realEntry, Logger logger)
|
||||
{
|
||||
// Set the real entry name
|
||||
realEntry = "";
|
||||
realEntry = String.Empty;
|
||||
|
||||
// Get a writable stream to return
|
||||
Stream st = new MemoryStream();
|
||||
@@ -433,7 +433,7 @@ namespace SabreTools.Helper.Tools
|
||||
{
|
||||
logger.Verbose("Found archive of type: " + at);
|
||||
long size = 0;
|
||||
string crc = "";
|
||||
string crc = String.Empty;
|
||||
|
||||
switch (at)
|
||||
{
|
||||
@@ -445,14 +445,14 @@ namespace SabreTools.Helper.Tools
|
||||
{
|
||||
logger.Verbose("Entry found: '" + entry.Key + "': "
|
||||
+ (size == 0 ? entry.Size : size) + ", "
|
||||
+ (crc == "" ? entry.Crc.ToString("X").ToLowerInvariant() : crc));
|
||||
+ (crc == String.Empty ? entry.Crc.ToString("X").ToLowerInvariant() : crc));
|
||||
|
||||
roms.Add(new Rom
|
||||
{
|
||||
Type = ItemType.Rom,
|
||||
Name = entry.Key,
|
||||
Size = (size == 0 ? entry.Size : size),
|
||||
CRC = (crc == "" ? entry.Crc.ToString("X").ToLowerInvariant() : crc),
|
||||
CRC = (crc == String.Empty ? entry.Crc.ToString("X").ToLowerInvariant() : crc),
|
||||
|
||||
Machine = new Machine
|
||||
{
|
||||
@@ -481,14 +481,14 @@ namespace SabreTools.Helper.Tools
|
||||
{
|
||||
logger.Verbose("Entry found: '" + entry.Key + "': "
|
||||
+ (size == 0 ? entry.Size : size) + ", "
|
||||
+ (crc == "" ? entry.Crc.ToString("X").ToLowerInvariant() : crc));
|
||||
+ (crc == String.Empty ? entry.Crc.ToString("X").ToLowerInvariant() : crc));
|
||||
|
||||
roms.Add(new Rom
|
||||
{
|
||||
Type = ItemType.Rom,
|
||||
Name = entry.Key,
|
||||
Size = (size == 0 ? entry.Size : size),
|
||||
CRC = (crc == "" ? entry.Crc.ToString("X").ToLowerInvariant() : crc),
|
||||
CRC = (crc == String.Empty ? entry.Crc.ToString("X").ToLowerInvariant() : crc),
|
||||
|
||||
Machine = new Machine
|
||||
{
|
||||
@@ -507,14 +507,14 @@ namespace SabreTools.Helper.Tools
|
||||
{
|
||||
logger.Verbose("Entry found: '" + entry.Key + "': "
|
||||
+ (size == 0 ? entry.Size : size) + ", "
|
||||
+ (crc == "" ? entry.Crc.ToString("X").ToLowerInvariant() : crc));
|
||||
+ (crc == String.Empty ? entry.Crc.ToString("X").ToLowerInvariant() : crc));
|
||||
|
||||
roms.Add(new Rom
|
||||
{
|
||||
Type = ItemType.Rom,
|
||||
Name = entry.Key,
|
||||
Size = (size == 0 ? entry.Size : size),
|
||||
CRC = (crc == "" ? entry.Crc.ToString("X").ToLowerInvariant() : crc),
|
||||
CRC = (crc == String.Empty ? entry.Crc.ToString("X").ToLowerInvariant() : crc),
|
||||
|
||||
Machine = new Machine
|
||||
{
|
||||
@@ -1119,7 +1119,7 @@ namespace SabreTools.Helper.Tools
|
||||
}
|
||||
|
||||
// Get the output archive name from the first rebuild rom
|
||||
string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(roms[0].Machine.Name) + (roms[0].Machine.Name.EndsWith(".tar") ? "" : ".tar"));
|
||||
string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(roms[0].Machine.Name) + (roms[0].Machine.Name.EndsWith(".tar") ? String.Empty : ".tar"));
|
||||
|
||||
// Set internal variables
|
||||
Stream tarstream = new MemoryStream();
|
||||
@@ -1445,7 +1445,7 @@ namespace SabreTools.Helper.Tools
|
||||
}
|
||||
|
||||
// Get the output archive name from the first rebuild rom
|
||||
string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(roms[0].Machine.Name) + (roms[0].Machine.Name.EndsWith(".zip") ? "" : ".zip"));
|
||||
string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(roms[0].Machine.Name) + (roms[0].Machine.Name.EndsWith(".zip") ? String.Empty : ".zip"));
|
||||
|
||||
// Set internal variables
|
||||
Stream writeStream = null;
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace SabreTools.Helper.Tools
|
||||
}
|
||||
|
||||
// Read the input file, if possible
|
||||
logger.Verbose("Attempting to read file to get format: \"" + filename + "\"");
|
||||
logger.Verbose("Attempting to read file to get format: "" + filename + """);
|
||||
|
||||
// Check if file exists
|
||||
if (!File.Exists(filename))
|
||||
@@ -224,7 +224,7 @@ namespace SabreTools.Helper.Tools
|
||||
|
||||
// Add unique data from the file
|
||||
rom.Name = Path.GetFileName(input);
|
||||
rom.Date = (date ? new FileInfo(input).LastWriteTime.ToString("yyyy/MM/dd HH:mm:ss") : "");
|
||||
rom.Date = (date ? new FileInfo(input).LastWriteTime.ToString("yyyy/MM/dd HH:mm:ss") : String.Empty);
|
||||
|
||||
return rom;
|
||||
}
|
||||
@@ -315,7 +315,7 @@ namespace SabreTools.Helper.Tools
|
||||
public static bool DetectSkipperAndTransform(string file, string outDir, Logger logger)
|
||||
{
|
||||
// Create the output directory if it doesn't exist
|
||||
if (outDir != "" && !Directory.Exists(outDir))
|
||||
if (outDir != String.Empty && !Directory.Exists(outDir))
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
}
|
||||
@@ -323,7 +323,7 @@ namespace SabreTools.Helper.Tools
|
||||
logger.User("\nGetting skipper information for '" + file + "'");
|
||||
|
||||
// Get the skipper rule that matches the file, if any
|
||||
SkipperRule rule = Skipper.GetMatchingRule(file, "", logger);
|
||||
SkipperRule rule = Skipper.GetMatchingRule(file, String.Empty, logger);
|
||||
|
||||
// If we have an empty rule, return false
|
||||
if (rule.Tests == null || rule.Tests.Count == 0 || rule.Operation != HeaderSkipOperation.None)
|
||||
@@ -346,7 +346,7 @@ namespace SabreTools.Helper.Tools
|
||||
br.Dispose();
|
||||
|
||||
// Apply the rule to the file
|
||||
string newfile = (outDir == "" ? Path.GetFullPath(file) + ".new" : Path.Combine(outDir, Path.GetFileName(file)));
|
||||
string newfile = (outDir == String.Empty ? Path.GetFullPath(file) + ".new" : Path.Combine(outDir, Path.GetFileName(file)));
|
||||
rule.TransformFile(file, newfile, logger);
|
||||
|
||||
// If the output file doesn't exist, return false
|
||||
@@ -385,7 +385,7 @@ namespace SabreTools.Helper.Tools
|
||||
{
|
||||
try
|
||||
{
|
||||
outputs.Add(Path.GetFullPath(file) + (appendparent ? "¬" + Path.GetFullPath(input) : ""));
|
||||
outputs.Add(Path.GetFullPath(file) + (appendparent ? "¬" + Path.GetFullPath(input) : String.Empty));
|
||||
}
|
||||
catch (PathTooLongException)
|
||||
{
|
||||
@@ -401,7 +401,7 @@ namespace SabreTools.Helper.Tools
|
||||
{
|
||||
try
|
||||
{
|
||||
outputs.Add(Path.GetFullPath(input) + (appendparent ? "¬" + Path.GetFullPath(input) : ""));
|
||||
outputs.Add(Path.GetFullPath(input) + (appendparent ? "¬" + Path.GetFullPath(input) : String.Empty));
|
||||
}
|
||||
catch (PathTooLongException)
|
||||
{
|
||||
@@ -437,7 +437,7 @@ namespace SabreTools.Helper.Tools
|
||||
/// <returns>The XmlTextReader representing the (possibly converted) file, null otherwise</returns>
|
||||
public static XmlReader GetXmlTextReader(string filename, Logger logger)
|
||||
{
|
||||
logger.Verbose("Attempting to read file: \"" + filename + "\"");
|
||||
logger.Verbose("Attempting to read file: "" + filename + """);
|
||||
|
||||
// Check if file exists
|
||||
if (!File.Exists(filename))
|
||||
@@ -494,7 +494,7 @@ namespace SabreTools.Helper.Tools
|
||||
public static bool RestoreHeader(string file, string outDir, Logger logger)
|
||||
{
|
||||
// Create the output directory if it doesn't exist
|
||||
if (outDir != "" && !Directory.Exists(outDir))
|
||||
if (outDir != String.Empty && !Directory.Exists(outDir))
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
}
|
||||
@@ -515,9 +515,9 @@ namespace SabreTools.Helper.Tools
|
||||
for (int i = 0; i < headers.Count; i++)
|
||||
{
|
||||
logger.User("Creating reheadered file: " +
|
||||
(outDir == "" ? Path.GetFullPath(file) + ".new" : Path.Combine(outDir, Path.GetFileName(file))) + i);
|
||||
(outDir == String.Empty ? Path.GetFullPath(file) + ".new" : Path.Combine(outDir, Path.GetFileName(file))) + i);
|
||||
AppendBytesToFile(file,
|
||||
(outDir == "" ? Path.GetFullPath(file) + ".new" : Path.Combine(outDir, Path.GetFileName(file))) + i, headers[i], string.Empty);
|
||||
(outDir == String.Empty ? Path.GetFullPath(file) + ".new" : Path.Combine(outDir, Path.GetFileName(file))) + i, headers[i], string.Empty);
|
||||
logger.User("Reheadered file created!");
|
||||
}
|
||||
|
||||
@@ -587,12 +587,12 @@ namespace SabreTools.Helper.Tools
|
||||
if (!noMD5)
|
||||
{
|
||||
md5.TransformFinalBlock(buffer, 0, 0);
|
||||
rom.MD5 = BitConverter.ToString(md5.Hash).Replace("-", "").ToLowerInvariant();
|
||||
rom.MD5 = BitConverter.ToString(md5.Hash).Replace("-", String.Empty).ToLowerInvariant();
|
||||
}
|
||||
if (!noSHA1)
|
||||
{
|
||||
sha1.TransformFinalBlock(buffer, 0, 0);
|
||||
rom.SHA1 = BitConverter.ToString(sha1.Hash).Replace("-", "").ToLowerInvariant();
|
||||
rom.SHA1 = BitConverter.ToString(sha1.Hash).Replace("-", String.Empty).ToLowerInvariant();
|
||||
}
|
||||
|
||||
// Dispose of the hashers
|
||||
|
||||
@@ -67,16 +67,16 @@ namespace SabreTools.Helper.Tools
|
||||
public static string CleanHashData(string hash, int padding)
|
||||
{
|
||||
// First get the hash to the correct length
|
||||
hash = (String.IsNullOrEmpty(hash) ? "" : hash.Trim());
|
||||
hash = (String.IsNullOrEmpty(hash) ? String.Empty : hash.Trim());
|
||||
hash = (hash.StartsWith("0x") ? hash.Remove(0, 2) : hash);
|
||||
hash = (hash == "-" ? "" : hash);
|
||||
hash = (String.IsNullOrEmpty(hash) ? "" : hash.PadLeft(padding, '0'));
|
||||
hash = (hash == "-" ? String.Empty : hash);
|
||||
hash = (String.IsNullOrEmpty(hash) ? String.Empty : hash.PadLeft(padding, '0'));
|
||||
hash = hash.ToLowerInvariant();
|
||||
|
||||
// Then make sure that it has the correct characters
|
||||
if (!Regex.IsMatch(hash, "[0-9a-f]{" + padding + "}"))
|
||||
{
|
||||
hash = "";
|
||||
hash = String.Empty;
|
||||
}
|
||||
|
||||
return hash;
|
||||
@@ -418,15 +418,15 @@ namespace SabreTools.Helper.Tools
|
||||
{
|
||||
// Preprocess the string
|
||||
s = s.Trim();
|
||||
s = Regex.Replace(s, @"^\S* \(", ""); // Remove item identifier and opening brace
|
||||
s = Regex.Replace(s, @"\)\S*#.*$", ""); // Remove trailing comments
|
||||
s = Regex.Replace(s, @"^\S* \(", String.Empty); // Remove item identifier and opening brace
|
||||
s = Regex.Replace(s, @"\)\S*#.*$", String.Empty); // Remove trailing comments
|
||||
s = s.TrimEnd(')'); // Remove closing brace
|
||||
s = s.Trim(); // Remove leading and trailing whitespace
|
||||
|
||||
// Now we get each string, divided up as cleanly as possible
|
||||
string[] matches = Regex
|
||||
//.Matches(s, @"([^\s]*""[^""]+""[^\s]*)|[^""]?\w+[^""]?")
|
||||
.Matches(s, @"[^\s""]+|""[^""]*""")
|
||||
//.Matches(s, @"([^\s]*String.Empty[^String.Empty]+String.Empty[^\s]*)|[^String.Empty]?\w+[^String.Empty]?")
|
||||
.Matches(s, @"[^\sString.Empty]+|String.Empty[^String.Empty]*String.Empty")
|
||||
.Cast<Match>()
|
||||
.Select(m => m.Groups[0].Value)
|
||||
.ToArray();
|
||||
@@ -448,7 +448,7 @@ namespace SabreTools.Helper.Tools
|
||||
{
|
||||
if (s == null)
|
||||
{
|
||||
return "";
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
if (s.Contains("/"))
|
||||
@@ -462,7 +462,7 @@ namespace SabreTools.Helper.Tools
|
||||
return String.Join("\\", tempkey.Take(tempkey.Length - 1));
|
||||
}
|
||||
|
||||
return "";
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -475,7 +475,7 @@ namespace SabreTools.Helper.Tools
|
||||
{
|
||||
if (s == null)
|
||||
{
|
||||
return "";
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
if (s.Contains("/"))
|
||||
@@ -575,14 +575,14 @@ namespace SabreTools.Helper.Tools
|
||||
{ "Й", "J" }, { "К", "K" }, { "Л", "L" }, { "М", "M" }, { "Н", "N" },
|
||||
{ "О", "O" }, { "П", "P" }, { "Р", "R" }, { "С", "S" }, { "Т", "T" },
|
||||
{ "У", "U" }, { "Ф", "f" }, { "Х", "Kh" }, { "Ц", "Ts" }, { "Ч", "Ch" },
|
||||
{ "Ш", "Sh" }, { "Щ", "Sch" }, { "Ъ", "" }, { "Ы", "y" }, { "Ь", "" },
|
||||
{ "Ш", "Sh" }, { "Щ", "Sch" }, { "Ъ", String.Empty }, { "Ы", "y" }, { "Ь", String.Empty },
|
||||
{ "Э", "e" }, { "Ю", "yu" }, { "Я", "ya" }, { "а", "a" }, { "б", "b" },
|
||||
{ "в", "v" }, { "г", "g" }, { "д", "d" }, { "е", "e" }, { "ё", "yo" },
|
||||
{ "ж", "zh" }, { "з", "z" }, { "и", "i" }, { "й", "j" }, { "к", "k" },
|
||||
{ "л", "l" }, { "м", "m" }, { "н", "n" }, { "о", "o" }, { "п", "p" },
|
||||
{ "р", "r" }, { "с", "s" }, { "т", "t" }, { "у", "u" }, { "ф", "f" },
|
||||
{ "х", "kh" }, { "ц", "ts" }, { "ч", "ch" }, { "ш", "sh" }, { "щ", "sch" },
|
||||
{ "ъ", "" }, { "ы", "y" }, { "ь", "" }, { "э", "e" }, { "ю", "yu" },
|
||||
{ "ъ", String.Empty }, { "ы", "y" }, { "ь", String.Empty }, { "э", "e" }, { "ю", "yu" },
|
||||
{ "я", "ya" },
|
||||
};
|
||||
|
||||
@@ -715,7 +715,7 @@ namespace SabreTools.Helper.Tools
|
||||
{
|
||||
if (hexString.Contains("-"))
|
||||
{
|
||||
hexString = hexString.Replace("-", "");
|
||||
hexString = hexString.Replace("-", String.Empty);
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@@ -734,7 +734,7 @@ namespace SabreTools.Helper.Tools
|
||||
/// </summary>
|
||||
public static string ConvertAsciiToHex(string asciiString)
|
||||
{
|
||||
string hexOutput = "";
|
||||
string hexOutput = String.Empty;
|
||||
foreach (char _eachChar in asciiString.ToCharArray())
|
||||
{
|
||||
// Get the integral value of the character.
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace SabreTools
|
||||
DatFormat = (datFormat == 0 ? DatFormat.Logiqx : datFormat),
|
||||
Romba = romba,
|
||||
ExcludeOf = excludeOf,
|
||||
Type = (superdat ? "SuperDAT" : ""),
|
||||
Type = (superdat ? "SuperDAT" : String.Empty),
|
||||
};
|
||||
|
||||
// Clean the temp directory
|
||||
@@ -707,34 +707,34 @@ namespace SabreTools
|
||||
}
|
||||
|
||||
// Normalize the extensions
|
||||
addext = (addext == "" || addext.StartsWith(".") ? addext : "." + addext);
|
||||
repext = (repext == "" || repext.StartsWith(".") ? repext : "." + repext);
|
||||
addext = (addext == String.Empty || addext.StartsWith(".") ? addext : "." + addext);
|
||||
repext = (repext == String.Empty || repext.StartsWith(".") ? repext : "." + repext);
|
||||
|
||||
// If we're in merge or diff mode and the names aren't set, set defaults
|
||||
if (merge || diffMode != 0)
|
||||
{
|
||||
// Get the values that will be used
|
||||
if (date == "")
|
||||
if (date == String.Empty)
|
||||
{
|
||||
date = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
}
|
||||
if (name == "")
|
||||
if (name == String.Empty)
|
||||
{
|
||||
name = (diffMode != 0 ? "DiffDAT" : "MergeDAT") + (superdat ? "-SuperDAT" : "") + (dedup ? "-deduped" : "");
|
||||
name = (diffMode != 0 ? "DiffDAT" : "MergeDAT") + (superdat ? "-SuperDAT" : String.Empty) + (dedup ? "-deduped" : String.Empty);
|
||||
}
|
||||
if (description == "")
|
||||
if (description == String.Empty)
|
||||
{
|
||||
description = (diffMode != 0 ? "DiffDAT" : "MergeDAT") + (superdat ? "-SuperDAT" : "") + (dedup ? " - deduped" : "");
|
||||
description = (diffMode != 0 ? "DiffDAT" : "MergeDAT") + (superdat ? "-SuperDAT" : String.Empty) + (dedup ? " - deduped" : String.Empty);
|
||||
if (!bare)
|
||||
{
|
||||
description += " (" + date + ")";
|
||||
}
|
||||
}
|
||||
if (category == "" && diffMode != 0)
|
||||
if (category == String.Empty && diffMode != 0)
|
||||
{
|
||||
category = "DiffDAT";
|
||||
}
|
||||
if (author == "")
|
||||
if (author == String.Empty)
|
||||
{
|
||||
author = "SabreTools";
|
||||
}
|
||||
|
||||
@@ -7,12 +7,12 @@ using System.Runtime.InteropServices;
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("SabreTools")]
|
||||
[assembly: AssemblyDescription("DAT manipulation toolset")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyConfiguration(String.Empty)]
|
||||
[assembly: AssemblyCompany(String.Empty)]
|
||||
[assembly: AssemblyProduct("SabreTools")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: AssemblyTrademark(String.Empty)]
|
||||
[assembly: AssemblyCulture(String.Empty)]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace SabreTools
|
||||
long sgt = -1,
|
||||
slt = -1,
|
||||
seq = -1;
|
||||
string addext = "",
|
||||
string addext = String.Empty,
|
||||
author = null,
|
||||
category = null,
|
||||
comment = null,
|
||||
@@ -126,19 +126,19 @@ namespace SabreTools
|
||||
exta = null,
|
||||
extb = null,
|
||||
filename = null,
|
||||
forcemerge = "",
|
||||
forcend = "",
|
||||
forcepack = "",
|
||||
forcemerge = String.Empty,
|
||||
forcend = String.Empty,
|
||||
forcepack = String.Empty,
|
||||
header = null,
|
||||
homepage = null,
|
||||
name = null,
|
||||
outDir = "",
|
||||
postfix = "",
|
||||
prefix = "",
|
||||
repext = "",
|
||||
root = "",
|
||||
outDir = String.Empty,
|
||||
postfix = String.Empty,
|
||||
prefix = String.Empty,
|
||||
repext = String.Empty,
|
||||
root = String.Empty,
|
||||
rootdir = null,
|
||||
tempDir = "",
|
||||
tempDir = String.Empty,
|
||||
url = null,
|
||||
version = null;
|
||||
List<string> crc = new List<string>();
|
||||
@@ -722,7 +722,7 @@ namespace SabreTools
|
||||
}
|
||||
break;
|
||||
default:
|
||||
string temparg = args[i].Replace("\"", "").Replace("file://", "");
|
||||
string temparg = args[i].Replace("\"", String.Empty).Replace("file://", String.Empty);
|
||||
|
||||
if (temparg.StartsWith("-") && temparg.Contains("="))
|
||||
{
|
||||
@@ -730,7 +730,7 @@ namespace SabreTools
|
||||
string[] split = temparg.Split('=');
|
||||
if (split[1] == null)
|
||||
{
|
||||
split[1] = "";
|
||||
split[1] = String.Empty;
|
||||
}
|
||||
|
||||
switch (split[0])
|
||||
|
||||
Reference in New Issue
Block a user