diff --git a/RombaSharp/Partials/RombaSharp_Helpers.cs b/RombaSharp/Partials/RombaSharp_Helpers.cs index ede46f75..15bfd74b 100644 --- a/RombaSharp/Partials/RombaSharp_Helpers.cs +++ b/RombaSharp/Partials/RombaSharp_Helpers.cs @@ -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 = String.Empty; + connectionString = ""; Dictionary> depots = new Dictionary>(); // 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.Empty; + string root = ""; 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" ? String.Empty : dat.Machine.Name), dat.Name); + string fullpath = Path.Combine(_dats, (dat.Machine.Name == "dats" ? "" : 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 hashes = new List(); - 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.Empty" + String.Join("\","", hashes) + "\")"; +WHERE sha1.sha1 IN (""" + String.Join("\",\"", hashes) + "\")"; slc = new SqliteCommand(query, dbc); slc.ExecuteNonQuery(); diff --git a/RombaSharp/Partials/RombaSharp_Inits.cs b/RombaSharp/Partials/RombaSharp_Inits.cs index fa185e8f..2d74bcbf 100644 --- a/RombaSharp/Partials/RombaSharp_Inits.cs +++ b/RombaSharp/Partials/RombaSharp_Inits.cs @@ -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(String.Empty, logger); + datdata.WriteToFile("", logger); } logger.Close(); } @@ -287,11 +287,11 @@ namespace SabreTools List sha1 = new List(); foreach (string input in inputs) { - string temp = String.Empty; + string temp = ""; if (input.Length == Constants.CRCLength) { temp = Style.CleanHashData(input, Constants.CRCLength); - if (temp != String.Empty) + if (temp != "") { crc.Add(temp); } @@ -299,7 +299,7 @@ namespace SabreTools else if (input.Length == Constants.MD5Length) { temp = Style.CleanHashData(input, Constants.MD5Length); - if (temp != String.Empty) + if (temp != "") { md5.Add(temp); } @@ -307,7 +307,7 @@ namespace SabreTools else if (input.Length == Constants.SHA1Length) { temp = Style.CleanHashData(input, Constants.SHA1Length); - if (temp != String.Empty) + if (temp != "") { 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) diff --git a/RombaSharp/Properties/AssemblyInfo.cs b/RombaSharp/Properties/AssemblyInfo.cs index f73d8200..77f5f3c0 100644 --- a/RombaSharp/Properties/AssemblyInfo.cs +++ b/RombaSharp/Properties/AssemblyInfo.cs @@ -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(String.Empty)] -[assembly: AssemblyConfiguration(String.Empty)] -[assembly: AssemblyCompany(String.Empty)] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RombaSharp")] [assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark(String.Empty)] -[assembly: AssemblyCulture(String.Empty)] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] // 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 diff --git a/RombaSharp/RombaSharp.cs b/RombaSharp/RombaSharp.cs index ff465194..bc1ccd2e 100644 --- a/RombaSharp/RombaSharp.cs +++ b/RombaSharp/RombaSharp.cs @@ -93,8 +93,8 @@ namespace SabreTools onlyNeeded = false; // User inputs - string newdat =String.Empty, - outdat = String.Empty; + string newdat ="", + outdat = ""; List inputs = new List(); // 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(""", String.Empty).Replace("file://", String.Empty); + string temparg = args[i].Replace("\"", "").Replace("file://", ""); if (temparg.StartsWith("-") && temparg.Contains("=")) { @@ -186,7 +186,7 @@ namespace SabreTools string[] split = temparg.Split('='); if (split[1] == null) { - split[1] = String.Empty; + split[1] = ""; } switch (split[0]) diff --git a/SabreTools.Helper/Data/Build.cs b/SabreTools.Helper/Data/Build.cs index 82b31697..0323efe2 100644 --- a/SabreTools.Helper/Data/Build.cs +++ b/SabreTools.Helper/Data/Build.cs @@ -74,7 +74,7 @@ namespace SabreTools.Helper.Data helptext.Add(barrier); helptext.Add("Credits"); helptext.Add(barrier); - helptext.Add(String.Empty); + helptext.Add(""); 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(String.Empty); + helptext.Add(""); 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(String.Empty); + helptext.Add(""); 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(String.Empty); + helptext.Add(""); 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(String.Empty); + helptext.Add(""); 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(String.Empty); + helptext.Add(""); helptext.Add("Filter parameters for size can use postfixes for inputs:"); helptext.Add(" e.g. 8kb => 8000 or 8kib => 8192"); - helptext.Add(String.Empty); + helptext.Add(""); helptext.Add("Most of the filter parameters allow for multiple inputs:"); helptext.Add(" e.g. --game-name=foo --game-name=bar"); break; diff --git a/SabreTools.Helper/Dats/Archive.cs b/SabreTools.Helper/Dats/Archive.cs index aba26c34..82961a05 100644 --- a/SabreTools.Helper/Dats/Archive.cs +++ b/SabreTools.Helper/Dats/Archive.cs @@ -12,7 +12,7 @@ namespace SabreTools.Helper.Dats /// public Archive() { - _name = String.Empty; + _name = ""; _itemType = ItemType.Archive; } diff --git a/SabreTools.Helper/Dats/BiosSet.cs b/SabreTools.Helper/Dats/BiosSet.cs index 1a7a7a9f..26f5c6bd 100644 --- a/SabreTools.Helper/Dats/BiosSet.cs +++ b/SabreTools.Helper/Dats/BiosSet.cs @@ -34,7 +34,7 @@ namespace SabreTools.Helper.Dats /// public BiosSet() { - _name = String.Empty; + _name = ""; _itemType = ItemType.BiosSet; } diff --git a/SabreTools.Helper/Dats/DatItem.cs b/SabreTools.Helper/Dats/DatItem.cs index 5f758d85..18f931ce 100644 --- a/SabreTools.Helper/Dats/DatItem.cs +++ b/SabreTools.Helper/Dats/DatItem.cs @@ -247,7 +247,7 @@ namespace SabreTools.Helper.Dats } // Get the correct dictionary based on what is available - string key = String.Empty; + string key = ""; 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.Empty; + string key = ""; if (_itemType == ItemType.Rom && ((Rom)this).CRC != null) { key = ((Rom)this).CRC; diff --git a/SabreTools.Helper/Dats/Disk.cs b/SabreTools.Helper/Dats/Disk.cs index 4ee53be7..1f31f5ab 100644 --- a/SabreTools.Helper/Dats/Disk.cs +++ b/SabreTools.Helper/Dats/Disk.cs @@ -44,7 +44,7 @@ namespace SabreTools.Helper.Dats /// public Disk() { - _name = String.Empty; + _name = ""; _itemType = ItemType.Disk; _dupeType = 0x00; _itemStatus = ItemStatus.None; diff --git a/SabreTools.Helper/Dats/Filter.cs b/SabreTools.Helper/Dats/Filter.cs index c3259eda..46c78d0e 100644 --- a/SabreTools.Helper/Dats/Filter.cs +++ b/SabreTools.Helper/Dats/Filter.cs @@ -188,21 +188,21 @@ namespace SabreTools.Helper.Dats { if (crc.StartsWith("*") && crc.EndsWith("*")) { - if (!rom.CRC.ToLowerInvariant().Contains(crc.ToLowerInvariant().Replace("*", String.Empty))) + if (!rom.CRC.ToLowerInvariant().Contains(crc.ToLowerInvariant().Replace("*", ""))) { found = false; } } else if (crc.StartsWith("*")) { - if (!rom.CRC.EndsWith(crc.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (!rom.CRC.EndsWith(crc.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase)) { found = false; } } else if (crc.EndsWith("*")) { - if (!rom.CRC.StartsWith(crc.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (!rom.CRC.StartsWith(crc.Replace("*", ""), 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("*", String.Empty))) + if (rom.CRC.ToLowerInvariant().Contains(crc.ToLowerInvariant().Replace("*", ""))) { found = false; } } else if (crc.StartsWith("*")) { - if (rom.CRC.EndsWith(crc.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (rom.CRC.EndsWith(crc.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase)) { found = false; } } else if (crc.EndsWith("*")) { - if (rom.CRC.StartsWith(crc.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (rom.CRC.StartsWith(crc.Replace("*", ""), 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("*", String.Empty))) + if (!rom.MD5.ToLowerInvariant().Contains(md5.ToLowerInvariant().Replace("*", ""))) { found = false; } } else if (md5.StartsWith("*")) { - if (!rom.MD5.EndsWith(md5.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (!rom.MD5.EndsWith(md5.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase)) { found = false; } } else if (md5.EndsWith("*")) { - if (!rom.MD5.StartsWith(md5.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (!rom.MD5.StartsWith(md5.Replace("*", ""), 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("*", String.Empty))) + if (rom.MD5.ToLowerInvariant().Contains(md5.ToLowerInvariant().Replace("*", ""))) { found = false; } } else if (md5.StartsWith("*")) { - if (rom.MD5.EndsWith(md5.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (rom.MD5.EndsWith(md5.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase)) { found = false; } } else if (md5.EndsWith("*")) { - if (rom.MD5.StartsWith(md5.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (rom.MD5.StartsWith(md5.Replace("*", ""), 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("*", String.Empty))) + if (!rom.SHA1.ToLowerInvariant().Contains(sha1.ToLowerInvariant().Replace("*", ""))) { found = false; } } else if (sha1.StartsWith("*")) { - if (!rom.SHA1.EndsWith(sha1.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (!rom.SHA1.EndsWith(sha1.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase)) { found = false; } } else if (sha1.EndsWith("*")) { - if (!rom.SHA1.StartsWith(sha1.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (!rom.SHA1.StartsWith(sha1.Replace("*", ""), 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("*", String.Empty))) + if (rom.SHA1.ToLowerInvariant().Contains(sha1.ToLowerInvariant().Replace("*", ""))) { found = false; } } else if (sha1.StartsWith("*")) { - if (rom.SHA1.EndsWith(sha1.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (rom.SHA1.EndsWith(sha1.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase)) { found = false; } } else if (sha1.EndsWith("*")) { - if (rom.SHA1.StartsWith(sha1.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (rom.SHA1.StartsWith(sha1.Replace("*", ""), 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("*", String.Empty))) + if (!rom.MD5.ToLowerInvariant().Contains(md5.ToLowerInvariant().Replace("*", ""))) { found = false; } } else if (md5.StartsWith("*")) { - if (!rom.MD5.EndsWith(md5.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (!rom.MD5.EndsWith(md5.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase)) { found = false; } } else if (md5.EndsWith("*")) { - if (!rom.MD5.StartsWith(md5.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (!rom.MD5.StartsWith(md5.Replace("*", ""), 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("*", String.Empty))) + if (rom.MD5.ToLowerInvariant().Contains(md5.ToLowerInvariant().Replace("*", ""))) { found = false; } } else if (md5.StartsWith("*")) { - if (rom.MD5.EndsWith(md5.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (rom.MD5.EndsWith(md5.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase)) { found = false; } } else if (md5.EndsWith("*")) { - if (rom.MD5.StartsWith(md5.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (rom.MD5.StartsWith(md5.Replace("*", ""), 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("*", String.Empty))) + if (!rom.SHA1.ToLowerInvariant().Contains(sha1.ToLowerInvariant().Replace("*", ""))) { found = false; } } else if (sha1.StartsWith("*")) { - if (!rom.SHA1.EndsWith(sha1.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (!rom.SHA1.EndsWith(sha1.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase)) { found = false; } } else if (sha1.EndsWith("*")) { - if (!rom.SHA1.StartsWith(sha1.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (!rom.SHA1.StartsWith(sha1.Replace("*", ""), 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("*", String.Empty))) + if (rom.SHA1.ToLowerInvariant().Contains(sha1.ToLowerInvariant().Replace("*", ""))) { found = false; } } else if (sha1.StartsWith("*")) { - if (rom.SHA1.EndsWith(sha1.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (rom.SHA1.EndsWith(sha1.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase)) { found = false; } } else if (sha1.EndsWith("*")) { - if (rom.SHA1.StartsWith(sha1.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (rom.SHA1.StartsWith(sha1.Replace("*", ""), 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("*", String.Empty))) + if (!item.Machine.Name.ToLowerInvariant().Contains(name.ToLowerInvariant().Replace("*", ""))) { found = false; } } else if (name.StartsWith("*")) { - if (!item.Machine.Name.EndsWith(name.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (!item.Machine.Name.EndsWith(name.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase)) { found = false; } } else if (name.EndsWith("*")) { - if (!item.Machine.Name.StartsWith(name.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (!item.Machine.Name.StartsWith(name.Replace("*", ""), 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("*", String.Empty))) + if (item.Machine.Name.ToLowerInvariant().Contains(name.ToLowerInvariant().Replace("*", ""))) { found = false; } } else if (name.StartsWith("*")) { - if (item.Machine.Name.EndsWith(name.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (item.Machine.Name.EndsWith(name.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase)) { found = false; } } else if (name.EndsWith("*")) { - if (item.Machine.Name.StartsWith(name.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (item.Machine.Name.StartsWith(name.Replace("*", ""), 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("*", String.Empty))) + if (!item.Name.ToLowerInvariant().Contains(name.ToLowerInvariant().Replace("*", ""))) { found = false; } } else if (name.StartsWith("*")) { - if (!item.Name.EndsWith(name.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (!item.Name.EndsWith(name.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase)) { found = false; } } else if (name.EndsWith("*")) { - if (!item.Name.StartsWith(name.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (!item.Name.StartsWith(name.Replace("*", ""), 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("*", String.Empty))) + if (item.Name.ToLowerInvariant().Contains(name.ToLowerInvariant().Replace("*", ""))) { found = false; } } else if (name.StartsWith("*")) { - if (item.Name.EndsWith(name.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (item.Name.EndsWith(name.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase)) { found = false; } } else if (name.EndsWith("*")) { - if (item.Name.StartsWith(name.Replace("*", String.Empty), StringComparison.InvariantCultureIgnoreCase)) + if (item.Name.StartsWith(name.Replace("*", ""), StringComparison.InvariantCultureIgnoreCase)) { found = false; } diff --git a/SabreTools.Helper/Dats/Machine.cs b/SabreTools.Helper/Dats/Machine.cs index ab9740c1..fefd5d06 100644 --- a/SabreTools.Helper/Dats/Machine.cs +++ b/SabreTools.Helper/Dats/Machine.cs @@ -110,8 +110,8 @@ namespace SabreTools.Helper.Dats /// public Machine() { - _name = String.Empty; - _description = String.Empty; + _name = ""; + _description = ""; _runnable = true; } diff --git a/SabreTools.Helper/Dats/Partials/DatFile.Bucketing.cs b/SabreTools.Helper/Dats/Partials/DatFile.Bucketing.cs index 4a35b6d5..b2faf356 100644 --- a/SabreTools.Helper/Dats/Partials/DatFile.Bucketing.cs +++ b/SabreTools.Helper/Dats/Partials/DatFile.Bucketing.cs @@ -33,7 +33,7 @@ namespace SabreTools.Helper.Dats SortedDictionary> sortable = new SortedDictionary>(); long count = 0; - logger.User("Organizing " + (mergeroms ? "and merging " : String.Empty) + "roms by CRC"); + logger.User("Organizing " + (mergeroms ? "and merging " : "") + "roms by CRC"); // Process each all of the roms List keys = Keys.ToList(); @@ -102,7 +102,7 @@ namespace SabreTools.Helper.Dats SortedDictionary> sortable = new SortedDictionary>(); long count = 0; - logger.User("Organizing " + (mergeroms ? "and merging " : String.Empty) + "roms by game"); + logger.User("Organizing " + (mergeroms ? "and merging " : "") + "roms by game"); // Process each all of the roms List keys = Keys.ToList(); @@ -120,7 +120,7 @@ namespace SabreTools.Helper.Dats foreach (DatItem rom in roms) { count++; - string newkey = (norename ? String.Empty + string newkey = (norename ? "" : rom.SystemID.ToString().PadLeft(10, '0') + "-" + rom.SourceID.ToString().PadLeft(10, '0') + "-") @@ -188,7 +188,7 @@ namespace SabreTools.Helper.Dats SortedDictionary> sortable = new SortedDictionary>(); long count = 0; - logger.User("Organizing " + (mergeroms ? "and merging " : String.Empty) + "roms by MD5"); + logger.User("Organizing " + (mergeroms ? "and merging " : "") + "roms by MD5"); // Process each all of the roms List keys = Keys.ToList(); @@ -259,7 +259,7 @@ namespace SabreTools.Helper.Dats SortedDictionary> sortable = new SortedDictionary>(); long count = 0; - logger.User("Organizing " + (mergeroms ? "and merging " : String.Empty) + "roms by SHA-1"); + logger.User("Organizing " + (mergeroms ? "and merging " : "") + "roms by SHA-1"); // Process each all of the roms List keys = Keys.ToList(); @@ -330,7 +330,7 @@ namespace SabreTools.Helper.Dats SortedDictionary> sortable = new SortedDictionary>(); long count = 0; - logger.User("Organizing " + (mergeroms ? "and merging " : String.Empty) + "roms by size"); + logger.User("Organizing " + (mergeroms ? "and merging " : "") + "roms by size"); // Process each all of the roms List keys = Keys.ToList(); @@ -1083,7 +1083,7 @@ namespace SabreTools.Helper.Dats /// SortedDictionary bucketed by game name public static SortedDictionary> BucketListByGame(List list, bool mergeroms, bool norename, Logger logger, bool output = true) { - logger.User("Organizing " + (mergeroms ? "and merging " : String.Empty) + "roms for output"); + logger.User("Organizing " + (mergeroms ? "and merging " : "") + "roms for output"); SortedDictionary> sortable = new SortedDictionary>(); long count = 0; @@ -1109,7 +1109,7 @@ namespace SabreTools.Helper.Dats } count++; - string newkey = (norename ? String.Empty + string newkey = (norename ? "" : rom.SystemID.ToString().PadLeft(10, '0') + "-" + rom.SourceID.ToString().PadLeft(10, '0') + "-") diff --git a/SabreTools.Helper/Dats/Partials/DatFile.ConvertUpdate.cs b/SabreTools.Helper/Dats/Partials/DatFile.ConvertUpdate.cs index 6908f489..9883327b 100644 --- a/SabreTools.Helper/Dats/Partials/DatFile.ConvertUpdate.cs +++ b/SabreTools.Helper/Dats/Partials/DatFile.ConvertUpdate.cs @@ -152,7 +152,7 @@ namespace SabreTools.Helper.Dats logger.User("Initializing all output DATs"); // Default vars for use - string post = String.Empty; + string post = ""; DatFile outerDiffData = new DatFile(); DatFile dupeData = new DatFile(); @@ -313,7 +313,7 @@ namespace SabreTools.Helper.Dats /// Logging object for console and file output public void DiffCascade(string outDir, bool inplace, List inputs, List datHeaders, bool skip, Logger logger) { - string post = String.Empty; + string post = ""; // Create a list of DatData objects representing output files List outDats = new List(); @@ -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.Empty; + string path = ""; 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 == String.Empty ? String.Empty : Path.DirectorySeparatorChar.ToString()); + rootpath += (rootpath == "" ? "" : 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 != String.Empty) + if (inputFileName != "") { 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 == String.Empty ? Path.GetDirectoryName(inputFileName) : outDir), logger, overwrite: (outDir != String.Empty)); + innerDatdata.WriteToFile((outDir == "" ? Path.GetDirectoryName(inputFileName) : outDir), logger, overwrite: (outDir != "")); } } 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 == String.Empty ? Path.GetDirectoryName(file) : outDir + Path.GetDirectoryName(file).Remove(0, inputFileName.Length - 1)), logger, overwrite: (outDir != String.Empty)); + innerDatdata.WriteToFile((outDir == "" ? Path.GetDirectoryName(file) : outDir + Path.GetDirectoryName(file).Remove(0, inputFileName.Length - 1)), logger, overwrite: (outDir != "")); } }); } diff --git a/SabreTools.Helper/Dats/Partials/DatFile.DFD.cs b/SabreTools.Helper/Dats/Partials/DatFile.DFD.cs index 7b55f982..6082b698 100644 --- a/SabreTools.Helper/Dats/Partials/DatFile.DFD.cs +++ b/SabreTools.Helper/Dats/Partials/DatFile.DFD.cs @@ -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 ? String.Empty : " (" + Date + ")"); + Description = Name + (bare ? "" : " (" + 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 ? String.Empty : " (" + Date + ")"); + Description = Name + (bare ? "" : " (" + Date + ")"); } // Process the input @@ -107,8 +107,8 @@ namespace SabreTools.Helper.Dats string fulldir = Path.GetFullPath(dir); // Set the temporary variables - string gamename = String.Empty; - string romname = String.Empty; + string gamename = ""; + string romname = ""; // 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, String.Empty, newBasePath, noMD5, noSHA1, addDate, headerToCheckAgainst, logger); + PopulateFromDirProcessFile(newItem, "", 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, String.Empty, newBasePath, noMD5, noSHA1, addDate, headerToCheckAgainst, logger); + PopulateFromDirProcessFile(newItem, "", newBasePath, noMD5, noSHA1, addDate, headerToCheckAgainst, logger); } } @@ -342,7 +342,7 @@ namespace SabreTools.Helper.Dats return; } - string key = String.Empty; + string key = ""; 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.Empty; - string romname = String.Empty; + string gamename = ""; + string romname = ""; // If the parent is blank, then we have a non-archive file - if (parent == String.Empty) + if (parent == "") { // 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") diff --git a/SabreTools.Helper/Dats/Partials/DatFile.Parsers.cs b/SabreTools.Helper/Dats/Partials/DatFile.Parsers.cs index 2d2eec9d..049e57bb 100644 --- a/SabreTools.Helper/Dats/Partials/DatFile.Parsers.cs +++ b/SabreTools.Helper/Dats/Partials/DatFile.Parsers.cs @@ -36,7 +36,7 @@ namespace SabreTools.Helper.Dats /// True if original extension should be kept, false otherwise (default) 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, String.Empty, logger, keep, clean, softlist, keepext); + Parse(filename, sysid, srcid, new Filter(), SplitType.None, false, false, "", logger, keep, clean, softlist, keepext); } /// @@ -229,7 +229,7 @@ namespace SabreTools.Helper.Dats }; // Now process and add the rom - string key = String.Empty; + string key = ""; 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 = String.Empty, tempgamename = String.Empty, gamedesc = String.Empty, cloneof = String.Empty, - romof = String.Empty, sampleof = String.Empty, year = String.Empty, manufacturer = String.Empty; + string blockname = "", tempgamename = "", gamedesc = "", cloneof = "", + romof = "", sampleof = "", year = "", manufacturer = ""; 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.Empty; + string key = ""; // If we have a sample, treat it special if (temptype == ItemType.Sample) { - line = line.Trim().Remove(0, 6).Trim().Replace(""", String.Empty); // Remove "sample" from the input string + line = line.Trim().Remove(0, 6).Trim().Replace("\"", ""); // Remove "sample" from the input string item.Name = line; // Now process and add the sample - key = String.Empty; + key = ""; 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(""", String.Empty) + " " + gc[i + 1].Replace(""", String.Empty); + ((Rom)item).Date = gc[i].Replace("\"", "") + " " + gc[i + 1].Replace("\"", ""); i += 3; } @@ -429,12 +429,12 @@ namespace SabreTools.Helper.Dats else if (gc[i] == "crc") { i++; - ((Rom)item).CRC = gc[i].Replace(""", String.Empty).ToLowerInvariant(); + ((Rom)item).CRC = gc[i].Replace("\"", "").ToLowerInvariant(); } } // Now process and add the rom - key = String.Empty; + key = ""; 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.Empty); + string quoteless = gc[i].Replace("\"", ""); switch (quoteless) { //If the item is empty, we automatically skip it because it's a fluke - case String.Empty: + case "": continue; // Special cases for standalone item statuses @@ -495,14 +495,14 @@ namespace SabreTools.Helper.Dats // Regular attributes case "name": i++; - quoteless = gc[i].Replace(""", String.Empty); + quoteless = gc[i].Replace("\"", ""); item.Name = quoteless; break; case "size": if (item.Type == ItemType.Rom) { i++; - quoteless = gc[i].Replace(""", String.Empty); + quoteless = gc[i].Replace("\"", ""); 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(""", String.Empty); + quoteless = gc[i].Replace("\"", ""); ((Rom)item).CRC = quoteless.ToLowerInvariant(); } break; @@ -523,13 +523,13 @@ namespace SabreTools.Helper.Dats if (item.Type == ItemType.Rom) { i++; - quoteless = gc[i].Replace(""", String.Empty); + quoteless = gc[i].Replace("\"", ""); ((Rom)item).MD5 = quoteless.ToLowerInvariant(); } else if (item.Type == ItemType.Disk) { i++; - quoteless = gc[i].Replace(""", String.Empty); + quoteless = gc[i].Replace("\"", ""); ((Disk)item).MD5 = quoteless.ToLowerInvariant(); } break; @@ -537,20 +537,20 @@ namespace SabreTools.Helper.Dats if (item.Type == ItemType.Rom) { i++; - quoteless = gc[i].Replace(""", String.Empty); + quoteless = gc[i].Replace("\"", ""); ((Rom)item).SHA1 = quoteless.ToLowerInvariant(); } else if (item.Type == ItemType.Disk) { i++; - quoteless = gc[i].Replace(""", String.Empty); + quoteless = gc[i].Replace("\"", ""); ((Disk)item).SHA1 = quoteless.ToLowerInvariant(); } break; case "status": case "flags": i++; - quoteless = gc[i].Replace(""", String.Empty); + quoteless = gc[i].Replace("\"", ""); 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(""", String.Empty) + " " + gc[i + 1].Replace(""", String.Empty); + quoteless = gc[i].Replace("\"", "") + " " + gc[i + 1].Replace("\"", ""); ((Rom)item).Date = quoteless; } i++; @@ -609,7 +609,7 @@ namespace SabreTools.Helper.Dats } // Now process and add the rom - key = String.Empty; + key = ""; 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.Empty); + string itemval = gc[2].Value.Replace("\"", ""); switch (gc[1].Value) { case "name": @@ -648,7 +648,7 @@ namespace SabreTools.Helper.Dats } else { - string itemval = gc[2].Value.Replace(""", String.Empty); + string itemval = gc[2].Value.Replace("\"", ""); if (line.Trim().StartsWith("Name:")) { @@ -768,8 +768,8 @@ namespace SabreTools.Helper.Dats else if (Regex.IsMatch(line, Constants.EndPatternCMP) && block) { block = false; - blockname = String.Empty; tempgamename = String.Empty; gamedesc = String.Empty; cloneof = String.Empty; - romof = String.Empty; sampleof = String.Empty; year = String.Empty; manufacturer = String.Empty; + blockname = ""; tempgamename = ""; gamedesc = ""; cloneof = ""; + romof = ""; sampleof = ""; year = ""; manufacturer = ""; } } @@ -813,7 +813,7 @@ namespace SabreTools.Helper.Dats // Prepare all internal variables XmlReader subreader, headreader, flagreader; bool superdat = false, empty = true; - string key = String.Empty, date = String.Empty; + string key = "", date = ""; long size = -1; ItemStatus its = ItemStatus.None; List parent = new List(); @@ -970,7 +970,7 @@ namespace SabreTools.Helper.Dats } // Get all header items (ONLY OVERWRITE IF THERE'S NO DATA) - string content = String.Empty; + string content = ""; 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.Empty; + string content = ""; switch (headreader.Name) { case "name": @@ -1236,7 +1236,7 @@ namespace SabreTools.Helper.Dats case "machine": case "game": case "software": - string temptype = xtr.Name, publisher = String.Empty, partname = String.Empty, partinterface = String.Empty, areaname = String.Empty; + string temptype = xtr.Name, publisher = "", partname = "", partinterface = "", areaname = ""; bool? supported = null; long? areasize = null; List> infos = new List>(); @@ -1264,9 +1264,9 @@ namespace SabreTools.Helper.Dats Name = xtr.GetAttribute("name"), Description = xtr.GetAttribute("name"), - RomOf = xtr.GetAttribute("romof") ?? String.Empty, - CloneOf = xtr.GetAttribute("cloneof") ?? String.Empty, - SampleOf = xtr.GetAttribute("sampleof") ?? String.Empty, + RomOf = xtr.GetAttribute("romof") ?? "", + CloneOf = xtr.GetAttribute("cloneof") ?? "", + SampleOf = xtr.GetAttribute("sampleof") ?? "", Devices = new List(), MachineType = @@ -1294,7 +1294,7 @@ namespace SabreTools.Helper.Dats if (superdat && !keep) { string tempout = Regex.Match(machine.Name, @".*?\\(.*)").Groups[1].Value; - if (tempout != String.Empty) + if (tempout != "") { machine.Name = tempout; } @@ -1306,8 +1306,8 @@ namespace SabreTools.Helper.Dats } // Special offline list parts - string ext = String.Empty; - string releaseNumber = String.Empty; + string ext = ""; + string releaseNumber = ""; while (software || !subreader.EOF) { @@ -1318,13 +1318,13 @@ namespace SabreTools.Helper.Dats { if (subreader.NodeType == XmlNodeType.EndElement && subreader.Name == "part") { - partname = String.Empty; - partinterface = String.Empty; + partname = ""; + partinterface = ""; features = new List>(); } if (subreader.NodeType == XmlNodeType.EndElement && (subreader.Name == "dataarea" || subreader.Name == "diskarea")) { - areaname = String.Empty; + areaname = ""; areasize = null; } @@ -1351,7 +1351,7 @@ namespace SabreTools.Helper.Dats case "romCRC": empty = false; - ext = (subreader.GetAttribute("extension") != null ? subreader.GetAttribute("extension") : String.Empty); + ext = (subreader.GetAttribute("extension") != null ? subreader.GetAttribute("extension") : ""); 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") != String.Empty ? """ + xtr.GetAttribute("name") + """ : "ROM NAME NOT FOUND")); + (subreader.GetAttribute("name") != null && subreader.GetAttribute("name") != "" ? "\"" + 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") != String.Empty ? """ + xtr.GetAttribute("name") + """ : "ROM NAME NOT FOUND")); + (subreader.GetAttribute("name") != null && subreader.GetAttribute("name") != "" ? "\"" + 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 = String.Empty; + date = ""; if (subreader.GetAttribute("date") != null) { DateTime dateTime = DateTime.Now; @@ -1717,11 +1717,11 @@ namespace SabreTools.Helper.Dats superdat = true; if (keep) { - Type = (Type == String.Empty ? "SuperDAT" : Type); + Type = (Type == "" ? "SuperDAT" : Type); } - string foldername = (xtr.GetAttribute("name") == null ? String.Empty : xtr.GetAttribute("name")); - if (foldername != String.Empty) + string foldername = (xtr.GetAttribute("name") == null ? "" : xtr.GetAttribute("name")); + if (foldername != "") { 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") != String.Empty ? - """ + xtr.GetAttribute("name") + """ : "ROM NAME NOT FOUND")); + logger.Verbose("Bad dump detected: " + (xtr.GetAttribute("name") != null && xtr.GetAttribute("name") != "" ? + "\"" + xtr.GetAttribute("name") + "\"" : "ROM NAME NOT FOUND")); its = ItemStatus.BadDump; break; case "nodump": - logger.Verbose("Nodump detected: " + (xtr.GetAttribute("name") != null && xtr.GetAttribute("name") != String.Empty ? - """ + xtr.GetAttribute("name") + """ : "ROM NAME NOT FOUND")); + logger.Verbose("Nodump detected: " + (xtr.GetAttribute("name") != null && xtr.GetAttribute("name") != "" ? + "\"" + 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 = String.Empty; + date = ""; 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 != String.Empty) + if (tempout != "") { dir.Name = tempout; } @@ -1948,7 +1948,7 @@ namespace SabreTools.Helper.Dats }; // Now process and add the rom - string key = String.Empty; + string key = ""; 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.Empty; + string key = ""; 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.Empty; + string key = ""; 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.Empty; + string blocktype = ""; 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", String.Empty) + "¬¬"; + line = line.Replace("¬N¬O", "") + "¬¬"; } /* @@ -2248,7 +2248,7 @@ namespace SabreTools.Helper.Dats }; // Now process and add the rom - string key = String.Empty; + string key = ""; ParseAddHelper(rom, filter, trim, single, root, clean, logger, out key); } } @@ -2268,7 +2268,7 @@ namespace SabreTools.Helper.Dats /// Logger object for console and/or file output private void ParseAddHelper(DatItem item, Filter filter, bool trim, bool single, string root, bool clean, Logger logger, out string key) { - key = String.Empty; + key = ""; // 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; } diff --git a/SabreTools.Helper/Dats/Partials/DatFile.Rebuild.cs b/SabreTools.Helper/Dats/Partials/DatFile.Rebuild.cs index 7d3143aa..6ea8e897 100644 --- a/SabreTools.Helper/Dats/Partials/DatFile.Rebuild.cs +++ b/SabreTools.Helper/Dats/Partials/DatFile.Rebuild.cs @@ -655,7 +655,7 @@ namespace SabreTools.Helper.Dats // Now output the fixdat to the main folder if (found) { - matched.WriteToFile(String.Empty, logger, stats: true); + matched.WriteToFile("", logger, stats: true); } else { diff --git a/SabreTools.Helper/Dats/Partials/DatFile.Splitters.cs b/SabreTools.Helper/Dats/Partials/DatFile.Splitters.cs index d26d11a9..b26799cc 100644 --- a/SabreTools.Helper/Dats/Partials/DatFile.Splitters.cs +++ b/SabreTools.Helper/Dats/Partials/DatFile.Splitters.cs @@ -105,7 +105,7 @@ namespace SabreTools.Helper.Dats } // Get the output directory - if (outDir != String.Empty) + if (outDir != "") { 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 != String.Empty) + if (outDir != "") { 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 != String.Empty) + if (outDir != "") { outDir = outDir + Path.GetDirectoryName(this.FileName).Remove(0, basepath.Length - 1); } diff --git a/SabreTools.Helper/Dats/Partials/DatFile.Statistics.cs b/SabreTools.Helper/Dats/Partials/DatFile.Statistics.cs index 49a88bb8..e78ae747 100644 --- a/SabreTools.Helper/Dats/Partials/DatFile.Statistics.cs +++ b/SabreTools.Helper/Dats/Partials/DatFile.Statistics.cs @@ -133,7 +133,7 @@ namespace SabreTools.Helper.Dats logger.User(results); // Now write it out to file as well - string line = String.Empty; + string line = ""; 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"" : String.Empty) + (nodumpCol ? ",\"Nodumps"" : String.Empty) + "\n"); + outputs[StatDatFormat.CSV].Write("\"File Name\",\"Total Size\",\"Games\",\"Roms\",\"Disks\",\"# with CRC\",\"# with MD5\",\"# with SHA-1\"" + + (baddumpCol ? ",\"BadDumps\"" : "") + (nodumpCol ? ",\"Nodumps\"" : "") + "\n"); } if (outputs.ContainsKey(StatDatFormat.HTML)) { @@ -553,13 +553,13 @@ Please check the log folder if the stats scrolled offscreen", false);

DAT Statistics Report (" + DateTime.Now.ToShortDateString() + @")

- +
"); } 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"" : String.Empty) + (nodumpCol ? "\t\"Nodumps"" : String.Empty) + "\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\"" : "") + (nodumpCol ? "\t\"Nodumps\"" : "") + "\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(@" " -+ @"" -+ (baddumpCol ? "" : String.Empty) + (nodumpCol ? "" : String.Empty) + "\n"); + outputs[StatDatFormat.HTML].Write(@" " ++ @"" ++ (baddumpCol ? "" : "") + (nodumpCol ? "" : "") + "\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("
File NameTotal SizeGamesRomsDisks# with CRC# with MD5# with SHA-1BaddumpsNodumps
File NameTotal SizeGamesRomsDisks# with CRC# with MD5# with SHA-1BaddumpsNodumps
\n" + "\t\t" + HttpUtility.HtmlEncode(Name) + "\n" + "\t\t" + HttpUtility.HtmlEncode(Description) + "\n" + - (!String.IsNullOrEmpty(RootDir) ? "\t\t" + HttpUtility.HtmlEncode(RootDir) + "\n" : String.Empty) + - (!String.IsNullOrEmpty(Category) ? "\t\t" + HttpUtility.HtmlEncode(Category) + "\n" : String.Empty) + + (!String.IsNullOrEmpty(RootDir) ? "\t\t" + HttpUtility.HtmlEncode(RootDir) + "\n" : "") + + (!String.IsNullOrEmpty(Category) ? "\t\t" + HttpUtility.HtmlEncode(Category) + "\n" : "") + "\t\t" + HttpUtility.HtmlEncode(Version) + "\n" + - (!String.IsNullOrEmpty(Date) ? "\t\t" + HttpUtility.HtmlEncode(Date) + "\n" : String.Empty) + + (!String.IsNullOrEmpty(Date) ? "\t\t" + HttpUtility.HtmlEncode(Date) + "\n" : "") + "\t\t" + HttpUtility.HtmlEncode(Author) + "\n" + - (!String.IsNullOrEmpty(Email) ? "\t\t" + HttpUtility.HtmlEncode(Email) + "\n" : String.Empty) + - (!String.IsNullOrEmpty(Homepage) ? "\t\t" + HttpUtility.HtmlEncode(Homepage) + "\n" : String.Empty) + - (!String.IsNullOrEmpty(Url) ? "\t\t" + HttpUtility.HtmlEncode(Url) + "\n" : String.Empty) + - (!String.IsNullOrEmpty(Comment) ? "\t\t" + HttpUtility.HtmlEncode(Comment) + "\n" : String.Empty) + - (!String.IsNullOrEmpty(Type) ? "\t\t" + HttpUtility.HtmlEncode(Type) + "\n" : String.Empty) + + (!String.IsNullOrEmpty(Email) ? "\t\t" + HttpUtility.HtmlEncode(Email) + "\n" : "") + + (!String.IsNullOrEmpty(Homepage) ? "\t\t" + HttpUtility.HtmlEncode(Homepage) + "\n" : "") + + (!String.IsNullOrEmpty(Url) ? "\t\t" + HttpUtility.HtmlEncode(Url) + "\n" : "") + + (!String.IsNullOrEmpty(Comment) ? "\t\t" + HttpUtility.HtmlEncode(Comment) + "\n" : "") + + (!String.IsNullOrEmpty(Type) ? "\t\t" + HttpUtility.HtmlEncode(Type) + "\n" : "") + (ForcePacking != ForcePacking.None || ForceMerging != ForceMerging.None || ForceNodump != ForceNodump.None ? "\t\t\n" - : String.Empty) + + : "") + "\t\n"; break; case DatFormat.TSV: @@ -371,24 +371,24 @@ namespace SabreTools.Helper.Dats "\t
\n" + "\t\t" + HttpUtility.HtmlEncode(Name) + "\n" + "\t\t" + HttpUtility.HtmlEncode(Description) + "\n" + - (!String.IsNullOrEmpty(RootDir) ? "\t\t" + HttpUtility.HtmlEncode(RootDir) + "\n" : String.Empty) + - (!String.IsNullOrEmpty(Category) ? "\t\t" + HttpUtility.HtmlEncode(Category) + "\n" : String.Empty) + + (!String.IsNullOrEmpty(RootDir) ? "\t\t" + HttpUtility.HtmlEncode(RootDir) + "\n" : "") + + (!String.IsNullOrEmpty(Category) ? "\t\t" + HttpUtility.HtmlEncode(Category) + "\n" : "") + "\t\t" + HttpUtility.HtmlEncode(Version) + "\n" + - (!String.IsNullOrEmpty(Date) ? "\t\t" + HttpUtility.HtmlEncode(Date) + "\n" : String.Empty) + + (!String.IsNullOrEmpty(Date) ? "\t\t" + HttpUtility.HtmlEncode(Date) + "\n" : "") + "\t\t" + HttpUtility.HtmlEncode(Author) + "\n" + - (!String.IsNullOrEmpty(Comment) ? "\t\t" + HttpUtility.HtmlEncode(Comment) + "\n" : String.Empty) + + (!String.IsNullOrEmpty(Comment) ? "\t\t" + HttpUtility.HtmlEncode(Comment) + "\n" : "") + (!String.IsNullOrEmpty(Type) || ForcePacking != ForcePacking.None || ForceMerging != ForceMerging.None || ForceNodump != ForceNodump.None ? "\t\t\n" + - (!String.IsNullOrEmpty(Type) ? "\t\t\t\n" : String.Empty) + - (ForcePacking == ForcePacking.Unzip ? "\t\t\t\n" : String.Empty) + - (ForcePacking == ForcePacking.Zip ? "\t\t\t\n" : String.Empty) + - (ForceMerging == ForceMerging.Full ? "\t\t\t\n" : String.Empty) + - (ForceMerging == ForceMerging.Split ? "\t\t\t\n" : String.Empty) + - (ForceNodump == ForceNodump.Ignore ? "\t\t\t\n" : String.Empty) + - (ForceNodump == ForceNodump.Obsolete ? "\t\t\t\n" : String.Empty) + - (ForceNodump == ForceNodump.Required ? "\t\t\t\n" : String.Empty) + + (!String.IsNullOrEmpty(Type) ? "\t\t\t\n" : "") + + (ForcePacking == ForcePacking.Unzip ? "\t\t\t\n" : "") + + (ForcePacking == ForcePacking.Zip ? "\t\t\t\n" : "") + + (ForceMerging == ForceMerging.Full ? "\t\t\t\n" : "") + + (ForceMerging == ForceMerging.Split ? "\t\t\t\n" : "") + + (ForceNodump == ForceNodump.Ignore ? "\t\t\t\n" : "") + + (ForceNodump == ForceNodump.Obsolete ? "\t\t\t\n" : "") + + (ForceNodump == ForceNodump.Required ? "\t\t\t\n" : "") + "\t\t\n" - : String.Empty) + + : "") + "\t
\n" + "\t\n"; break; @@ -397,13 +397,13 @@ namespace SabreTools.Helper.Dats "\n\n" + "\n\n"; break; } @@ -443,7 +443,7 @@ namespace SabreTools.Helper.Dats rom.Machine.Name = rom.Machine.Name.Substring(1); } - string state = String.Empty; + string state = ""; 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.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") + (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") ) + "\tdescription \"" + (String.IsNullOrEmpty(rom.Machine.Description) ? rom.Machine.Name : rom.Machine.Description) + "\"\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"); + (String.IsNullOrEmpty(rom.Machine.Year) ? "" : "\tyear " + rom.Machine.Year + "\n") + + (String.IsNullOrEmpty(rom.Machine.Manufacturer) ? "" : "\tmanufacturer \"" + rom.Machine.Manufacturer + "\"\n"); break; case DatFormat.DOSCenter: state += "game (\n\tname \"" + rom.Machine.Name + ".zip\"\n"; break; case DatFormat.Logiqx: state += "\t\n" + - (String.IsNullOrEmpty(rom.Machine.Comment) ? String.Empty : "\t\t" + HttpUtility.HtmlEncode(rom.Machine.Comment) + "\n") + + (String.IsNullOrEmpty(rom.Machine.Comment) ? "" : "\t\t" + HttpUtility.HtmlEncode(rom.Machine.Comment) + "\n") + "\t\t" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.Machine.Description) ? rom.Machine.Name : rom.Machine.Description)) + "\n" + - (String.IsNullOrEmpty(rom.Machine.Year) ? String.Empty : "\t\t" + HttpUtility.HtmlEncode(rom.Machine.Year) + "\n") + - (String.IsNullOrEmpty(rom.Machine.Manufacturer) ? String.Empty : "\t\t" + HttpUtility.HtmlEncode(rom.Machine.Manufacturer) + "\n"); + (String.IsNullOrEmpty(rom.Machine.Year) ? "" : "\t\t" + HttpUtility.HtmlEncode(rom.Machine.Year) + "\n") + + (String.IsNullOrEmpty(rom.Machine.Manufacturer) ? "" : "\t\t" + HttpUtility.HtmlEncode(rom.Machine.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\n" + "\t\t" + HttpUtility.HtmlEncode(rom.Machine.Description) + "\n" - + (rom.Machine.Year != null ? "\t\t" + HttpUtility.HtmlEncode(rom.Machine.Year) + "\n" : String.Empty) - + (rom.Publisher != null ? "\t\t" + HttpUtility.HtmlEncode(rom.Publisher) + "\n" : String.Empty); + + (rom.Machine.Year != null ? "\t\t" + HttpUtility.HtmlEncode(rom.Machine.Year) + "\n" : "") + + (rom.Publisher != null ? "\t\t" + HttpUtility.HtmlEncode(rom.Publisher) + "\n" : ""); foreach (Tuple kvp in rom.Infos) { @@ -570,13 +570,13 @@ namespace SabreTools.Helper.Dats try { - string state = String.Empty; + string state = ""; switch (datFormat) { case DatFormat.ClrMamePro: case DatFormat.DOSCenter: - state += (String.IsNullOrEmpty(rom.Machine.SampleOf) ? String.Empty : "\tsampleof \"" + rom.Machine.SampleOf + "\"\n") + ")\n"; + state += (String.IsNullOrEmpty(rom.Machine.SampleOf) ? "" : "\tsampleof \"" + rom.Machine.SampleOf + "\"\n") + ")\n"; break; case DatFormat.Logiqx: state += "\t\n"; @@ -654,7 +654,7 @@ namespace SabreTools.Helper.Dats try { - string state = String.Empty, name = String.Empty, pre = String.Empty, post = String.Empty; + string state = "", name = "", pre = "", post = ""; 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.Empty) + + (!String.IsNullOrEmpty(((BiosSet)rom).Description) ? " description \"" + ((BiosSet)rom).Description + "\"" : "") + (((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.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) + + (!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() : "") + " )\n"; break; case ItemType.Release: state += "\trelease ( name\"" + rom.Name + "\"" - + (!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) + + (!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 + "\"" : "") + (((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.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) + + (((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() : "") + " )\n"; break; case ItemType.Sample: @@ -713,8 +713,8 @@ namespace SabreTools.Helper.Dats return true; } - pre = Prefix + (Quotes ? "\"" : String.Empty); - post = (Quotes ? "\"" : String.Empty) + Postfix; + pre = Prefix + (Quotes ? "\"" : ""); + post = (Quotes ? "\"" : "") + 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.Empty) - + (!String.IsNullOrEmpty(((Rom)rom).Date) ? " date " + ((Rom)rom).Date : String.Empty) - + (!String.IsNullOrEmpty(((Rom)rom).CRC) ? " crc " + ((Rom)rom).CRC.ToLowerInvariant() : String.Empty) + + (((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() : "") + " )\n"; break; } @@ -812,37 +812,37 @@ namespace SabreTools.Helper.Dats break; case ItemType.BiosSet: state += "\t\t\n"; break; case ItemType.Disk: state += "\t\t\n"; break; case ItemType.Release: state += "\t\t\n"; break; case ItemType.Rom: state += "\t\t\n"; break; case ItemType.Sample: @@ -858,8 +858,8 @@ namespace SabreTools.Helper.Dats return true; } - pre = Prefix + (Quotes ? "\"" : String.Empty); - post = (Quotes ? "\"" : String.Empty) + Postfix; + pre = Prefix + (Quotes ? "\"" : ""); + post = (Quotes ? "\"" : "") + 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 != String.Empty) + if (((Rom)rom).SHA1 != "") { 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 != String.Empty) + if (((Disk)rom).SHA1 != "") { 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 != String.Empty || RemExt) + if (RepExt != "" || RemExt) { if (RemExt) { - RepExt = String.Empty; + RepExt = ""; } 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 != String.Empty) + if (AddExt != "") { 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 : String.Empty) + rom.Name + "\n"; + state += ((Rom)rom).MD5 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; } else if (rom.Type == ItemType.Disk) { - state += ((Disk)rom).MD5 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : String.Empty) + rom.Name + "\n"; + state += ((Disk)rom).MD5 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; } break; case DatFormat.RedumpSFV: if (rom.Type == ItemType.Rom) { - state += (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : String.Empty) + rom.Name + " " + ((Rom)rom).CRC + "\n"; + state += (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + 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 : String.Empty) + rom.Name + "\n"; + state += ((Rom)rom).SHA1 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; } else if (rom.Type == ItemType.Disk) { - state += ((Disk)rom).SHA1 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : String.Empty) + rom.Name + "\n"; + state += ((Disk)rom).SHA1 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; } break; case DatFormat.RomCenter: if (rom.Type == ItemType.Rom) { - 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)) + + state += "¬" + (String.IsNullOrEmpty(rom.Machine.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.Machine.CloneOf)) + + "¬" + (String.IsNullOrEmpty(rom.Machine.CloneOf) ? "" : 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() : String.Empty) + "¬¬¬\n"; + "¬" + (((Rom)rom).Size != -1 ? ((Rom)rom).Size.ToString() : "") + "¬¬¬\n"; } else if (rom.Type == ItemType.Disk) { - 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)) + + state += "¬" + (String.IsNullOrEmpty(rom.Machine.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.Machine.CloneOf)) + + "¬" + (String.IsNullOrEmpty(rom.Machine.CloneOf) ? "" : 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.Empty; + string prefix = ""; for (int i = 0; i < depth; i++) { prefix += "\t"; @@ -1069,16 +1069,16 @@ namespace SabreTools.Helper.Dats break; case ItemType.BiosSet: state += "\n"; break; case ItemType.Disk: state += "\n" + prefix + "\t\n" + prefix + "\t\t\n" + prefix + "\t\n" + @@ -1086,21 +1086,21 @@ namespace SabreTools.Helper.Dats break; case ItemType.Release: state += "\n"; break; case ItemType.Rom: state += "\n" + prefix + "\t\n" + prefix + "\t\t\n" + prefix + "\t\n" + @@ -1124,61 +1124,61 @@ namespace SabreTools.Helper.Dats { case ItemType.Archive: state += "\t\t\t\n" + + (rom.AreaSize != null ? " size=\"" + rom.AreaSize + "\"" : "") + ">\n" + "\t\t\t\t\n" + "\t\t\t\n"; break; case ItemType.BiosSet: state += "\t\t\t\n" + + (rom.AreaSize != null ? " size=\"" + rom.AreaSize + "\"" : "") + ">\n" + "\t\t\t\t\n" + "\t\t\t\n"; break; case ItemType.Disk: state += "\t\t\t\n" + + (rom.AreaSize != null ? " size=\"" + rom.AreaSize + "\"" : "") + ">\n" + "\t\t\t\t\n" + "\t\t\t\n"; break; case ItemType.Release: state += "\t\t\t\n" + + (rom.AreaSize != null ? " size=\"" + rom.AreaSize + "\"" : "") + ">\n" + "\t\t\t\t\n" + "\t\t\t\n"; break; case ItemType.Rom: state += "\t\t\t\n" + + (rom.AreaSize != null ? " size=\"" + rom.AreaSize + "\"" : "") + ">\n" + "\t\t\t\t\n" + "\t\t\t\n"; break; case ItemType.Sample: state += "\t\t\t\n" + + (rom.AreaSize != null ? " size=\"" + rom.AreaSize + "\"" : "") + ">\n" + "\t\t\t\t\n" + "\t\t\t\n"; @@ -1194,8 +1194,8 @@ namespace SabreTools.Helper.Dats return true; } - pre = Prefix + (Quotes ? "\"" : String.Empty); - post = (Quotes ? "\"" : String.Empty) + Postfix; + pre = Prefix + (Quotes ? "\"" : ""); + post = (Quotes ? "\"" : "") + Postfix; if (rom.Type == ItemType.Rom) { @@ -1291,7 +1291,7 @@ namespace SabreTools.Helper.Dats { try { - string footer = String.Empty; + string footer = ""; // If we have roms, output the full footer if (Count > 0) diff --git a/SabreTools.Helper/Dats/Release.cs b/SabreTools.Helper/Dats/Release.cs index 186fca34..c3c6d560 100644 --- a/SabreTools.Helper/Dats/Release.cs +++ b/SabreTools.Helper/Dats/Release.cs @@ -47,11 +47,11 @@ namespace SabreTools.Helper.Dats /// public Release() { - _name = String.Empty; + _name = ""; _itemType = ItemType.Release; - _region = String.Empty; - _language = String.Empty; - _date = String.Empty; + _region = ""; + _language = ""; + _date = ""; _default = null; } diff --git a/SabreTools.Helper/Dats/Rom.cs b/SabreTools.Helper/Dats/Rom.cs index e2710b96..aace1b4e 100644 --- a/SabreTools.Helper/Dats/Rom.cs +++ b/SabreTools.Helper/Dats/Rom.cs @@ -43,11 +43,11 @@ namespace SabreTools.Helper.Dats /// public Rom() { - _name = String.Empty; + _name = ""; _itemType = ItemType.Rom; _dupeType = 0x00; _itemStatus = ItemStatus.None; - _date = String.Empty; + _date = ""; } /// diff --git a/SabreTools.Helper/Dats/Sample.cs b/SabreTools.Helper/Dats/Sample.cs index ef38b9c3..c69f12ca 100644 --- a/SabreTools.Helper/Dats/Sample.cs +++ b/SabreTools.Helper/Dats/Sample.cs @@ -13,7 +13,7 @@ namespace SabreTools.Helper.Dats /// public Sample() { - _name = String.Empty; + _name = ""; _itemType = ItemType.Sample; } diff --git a/SabreTools.Helper/External/NaturalSort/NaturalComparer.cs b/SabreTools.Helper/External/NaturalSort/NaturalComparer.cs index 52e3ec2b..c735f393 100644 --- a/SabreTools.Helper/External/NaturalSort/NaturalComparer.cs +++ b/SabreTools.Helper/External/NaturalSort/NaturalComparer.cs @@ -42,14 +42,14 @@ namespace NaturalSort string[] x1, y1; if (!table.TryGetValue(x, out x1)) { - //x1 = Regex.Split(x.Replace(" ", String.Empty), "([0-9]+)"); - x1 = Regex.Split(x, "([0-9]+)").Where(s => s != String.Empty).ToArray(); + //x1 = Regex.Split(x.Replace(" ", ""), "([0-9]+)"); + x1 = Regex.Split(x, "([0-9]+)").Where(s => s != "").ToArray(); table.Add(x, x1); } if (!table.TryGetValue(y, out y1)) { - //y1 = Regex.Split(y.Replace(" ", String.Empty), "([0-9]+)"); - y1 = Regex.Split(y, "([0-9]+)").Where(s => s != String.Empty).ToArray(); + //y1 = Regex.Split(y.Replace(" ", ""), "([0-9]+)"); + y1 = Regex.Split(y, "([0-9]+)").Where(s => s != "").ToArray(); table.Add(y, y1); } diff --git a/SabreTools.Helper/External/NaturalSort/NaturalReversedComparer.cs b/SabreTools.Helper/External/NaturalSort/NaturalReversedComparer.cs index c9726033..705acf93 100644 --- a/SabreTools.Helper/External/NaturalSort/NaturalReversedComparer.cs +++ b/SabreTools.Helper/External/NaturalSort/NaturalReversedComparer.cs @@ -42,14 +42,14 @@ namespace NaturalSort string[] x1, y1; if (!table.TryGetValue(x, out x1)) { - //x1 = Regex.Split(x.Replace(" ", String.Empty), "([0-9]+)"); - x1 = Regex.Split(x, "([0-9]+)").Where(s => s != String.Empty).ToArray(); + //x1 = Regex.Split(x.Replace(" ", ""), "([0-9]+)"); + x1 = Regex.Split(x, "([0-9]+)").Where(s => s != "").ToArray(); table.Add(x, x1); } if (!table.TryGetValue(y, out y1)) { - //y1 = Regex.Split(y.Replace(" ", String.Empty), "([0-9]+)"); - y1 = Regex.Split(y, "([0-9]+)").Where(s => s != String.Empty).ToArray(); + //y1 = Regex.Split(y.Replace(" ", ""), "([0-9]+)"); + y1 = Regex.Split(y, "([0-9]+)").Where(s => s != "").ToArray(); table.Add(y, y1); } diff --git a/SabreTools.Helper/External/SupportedFiles/ZipFile.cs b/SabreTools.Helper/External/SupportedFiles/ZipFile.cs index b9e29e18..cf92746c 100644 --- a/SabreTools.Helper/External/SupportedFiles/ZipFile.cs +++ b/SabreTools.Helper/External/SupportedFiles/ZipFile.cs @@ -49,7 +49,7 @@ namespace ROMVault2.SupportedFiles.Zip public string ZipFilename { - get { return (_zipFileInfo != null ? _zipFileInfo.FullName : String.Empty); } + get { return (_zipFileInfo != null ? _zipFileInfo.FullName : ""); } } public long TimeStamp { @@ -944,7 +944,7 @@ namespace ROMVault2.SupportedFiles.Zip switch (zr) { case ZipReturn.ZipGood: - ret = String.Empty; + ret = ""; break; case ZipReturn.ZipFileCountError: ret = "The number of file in the Zip does not mach the number of files in the Zips Centeral Directory"; diff --git a/SabreTools.Helper/External/Zlib/Deflate.cs b/SabreTools.Helper/External/Zlib/Deflate.cs index 69dd0d3c..87e68dfc 100644 --- a/SabreTools.Helper/External/Zlib/Deflate.cs +++ b/SabreTools.Helper/External/Zlib/Deflate.cs @@ -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 diff --git a/SabreTools.Helper/Logger.cs b/SabreTools.Helper/Logger.cs index c92b39a4..f6488074 100644 --- a/SabreTools.Helper/Logger.cs +++ b/SabreTools.Helper/Logger.cs @@ -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() + " " : String.Empty) + output); + Console.WriteLine((loglevel == LogLevel.ERROR && appendPrefix ? loglevel.ToString() + " " : "") + 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 + " - " : String.Empty ) + output); + _log.WriteLine((appendPrefix ? loglevel.ToString() + " - " + DateTime.Now + " - " : "" ) + output); } catch { diff --git a/SabreTools.Helper/Resources/Resources.de-DE.resx b/SabreTools.Helper/Resources/Resources.de-DE.resx index c333b7cc..7446e8b4 100644 --- a/SabreTools.Helper/Resources/Resources.de-DE.resx +++ b/SabreTools.Helper/Resources/Resources.de-DE.resx @@ -59,7 +59,7 @@ : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> - + diff --git a/SabreTools.Helper/Resources/Resources.es-ES.resx b/SabreTools.Helper/Resources/Resources.es-ES.resx index db79e4b5..4b6d5e3a 100644 --- a/SabreTools.Helper/Resources/Resources.es-ES.resx +++ b/SabreTools.Helper/Resources/Resources.es-ES.resx @@ -59,7 +59,7 @@ : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> - + diff --git a/SabreTools.Helper/Resources/Resources.fr-FR.resx b/SabreTools.Helper/Resources/Resources.fr-FR.resx index eb1999fe..dee186d4 100644 --- a/SabreTools.Helper/Resources/Resources.fr-FR.resx +++ b/SabreTools.Helper/Resources/Resources.fr-FR.resx @@ -59,7 +59,7 @@ : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> - + diff --git a/SabreTools.Helper/Resources/Resources.resx b/SabreTools.Helper/Resources/Resources.resx index 9f37e96e..c1c30dfa 100644 --- a/SabreTools.Helper/Resources/Resources.resx +++ b/SabreTools.Helper/Resources/Resources.resx @@ -59,7 +59,7 @@ : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> - + diff --git a/SabreTools.Helper/Skippers/Skipper.cs b/SabreTools.Helper/Skippers/Skipper.cs index 5ae57959..278bd4df 100644 --- a/SabreTools.Helper/Skippers/Skipper.cs +++ b/SabreTools.Helper/Skippers/Skipper.cs @@ -55,11 +55,11 @@ namespace SabreTools.Helper.Skippers /// public Skipper() { - Name = String.Empty; - Author = String.Empty; - Version = String.Empty; + Name = ""; + Author = ""; + Version = ""; Rules = new List(); - SourceFile = String.Empty; + SourceFile = ""; } /// diff --git a/SabreTools.Helper/Tools/ArchiveTools.cs b/SabreTools.Helper/Tools/ArchiveTools.cs index f38bbc2b..962c6811 100644 --- a/SabreTools.Helper/Tools/ArchiveTools.cs +++ b/SabreTools.Helper/Tools/ArchiveTools.cs @@ -221,7 +221,7 @@ namespace SabreTools.Helper.Tools /// Name of the extracted file, null on error public static string ExtractItem(string input, string entryName, string tempDir, Logger logger) { - string realEntry = String.Empty; + string realEntry = ""; 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 = String.Empty; + realEntry = ""; // 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.Empty; + string crc = ""; switch (at) { @@ -445,14 +445,14 @@ namespace SabreTools.Helper.Tools { logger.Verbose("Entry found: '" + entry.Key + "': " + (size == 0 ? entry.Size : size) + ", " - + (crc == String.Empty ? entry.Crc.ToString("X").ToLowerInvariant() : crc)); + + (crc == "" ? entry.Crc.ToString("X").ToLowerInvariant() : crc)); roms.Add(new Rom { Type = ItemType.Rom, Name = entry.Key, Size = (size == 0 ? entry.Size : size), - CRC = (crc == String.Empty ? entry.Crc.ToString("X").ToLowerInvariant() : crc), + CRC = (crc == "" ? 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 == String.Empty ? entry.Crc.ToString("X").ToLowerInvariant() : crc)); + + (crc == "" ? entry.Crc.ToString("X").ToLowerInvariant() : crc)); roms.Add(new Rom { Type = ItemType.Rom, Name = entry.Key, Size = (size == 0 ? entry.Size : size), - CRC = (crc == String.Empty ? entry.Crc.ToString("X").ToLowerInvariant() : crc), + CRC = (crc == "" ? 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 == String.Empty ? entry.Crc.ToString("X").ToLowerInvariant() : crc)); + + (crc == "" ? entry.Crc.ToString("X").ToLowerInvariant() : crc)); roms.Add(new Rom { Type = ItemType.Rom, Name = entry.Key, Size = (size == 0 ? entry.Size : size), - CRC = (crc == String.Empty ? entry.Crc.ToString("X").ToLowerInvariant() : crc), + CRC = (crc == "" ? 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") ? String.Empty : ".tar")); + string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(roms[0].Machine.Name) + (roms[0].Machine.Name.EndsWith(".tar") ? "" : ".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") ? String.Empty : ".zip")); + string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(roms[0].Machine.Name) + (roms[0].Machine.Name.EndsWith(".zip") ? "" : ".zip")); // Set internal variables Stream writeStream = null; diff --git a/SabreTools.Helper/Tools/FileTools.cs b/SabreTools.Helper/Tools/FileTools.cs index 6ee430a3..77c1944b 100644 --- a/SabreTools.Helper/Tools/FileTools.cs +++ b/SabreTools.Helper/Tools/FileTools.cs @@ -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") : String.Empty); + rom.Date = (date ? new FileInfo(input).LastWriteTime.ToString("yyyy/MM/dd HH:mm:ss") : ""); 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 != String.Empty && !Directory.Exists(outDir)) + if (outDir != "" && !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, String.Empty, logger); + SkipperRule rule = Skipper.GetMatchingRule(file, "", 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 == String.Empty ? Path.GetFullPath(file) + ".new" : Path.Combine(outDir, Path.GetFileName(file))); + string newfile = (outDir == "" ? 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) : String.Empty)); + outputs.Add(Path.GetFullPath(file) + (appendparent ? "¬" + Path.GetFullPath(input) : "")); } catch (PathTooLongException) { @@ -401,7 +401,7 @@ namespace SabreTools.Helper.Tools { try { - outputs.Add(Path.GetFullPath(input) + (appendparent ? "¬" + Path.GetFullPath(input) : String.Empty)); + outputs.Add(Path.GetFullPath(input) + (appendparent ? "¬" + Path.GetFullPath(input) : "")); } catch (PathTooLongException) { @@ -437,7 +437,7 @@ namespace SabreTools.Helper.Tools /// The XmlTextReader representing the (possibly converted) file, null otherwise 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 != String.Empty && !Directory.Exists(outDir)) + if (outDir != "" && !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 == String.Empty ? Path.GetFullPath(file) + ".new" : Path.Combine(outDir, Path.GetFileName(file))) + i); + (outDir == "" ? Path.GetFullPath(file) + ".new" : Path.Combine(outDir, Path.GetFileName(file))) + i); AppendBytesToFile(file, - (outDir == String.Empty ? Path.GetFullPath(file) + ".new" : Path.Combine(outDir, Path.GetFileName(file))) + i, headers[i], string.Empty); + (outDir == "" ? 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("-", String.Empty).ToLowerInvariant(); + rom.MD5 = BitConverter.ToString(md5.Hash).Replace("-", "").ToLowerInvariant(); } if (!noSHA1) { sha1.TransformFinalBlock(buffer, 0, 0); - rom.SHA1 = BitConverter.ToString(sha1.Hash).Replace("-", String.Empty).ToLowerInvariant(); + rom.SHA1 = BitConverter.ToString(sha1.Hash).Replace("-", "").ToLowerInvariant(); } // Dispose of the hashers diff --git a/SabreTools.Helper/Tools/Style.cs b/SabreTools.Helper/Tools/Style.cs index 282c15f2..b81bcc97 100644 --- a/SabreTools.Helper/Tools/Style.cs +++ b/SabreTools.Helper/Tools/Style.cs @@ -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) ? String.Empty : hash.Trim()); + hash = (String.IsNullOrEmpty(hash) ? "" : hash.Trim()); hash = (hash.StartsWith("0x") ? hash.Remove(0, 2) : hash); - hash = (hash == "-" ? String.Empty : hash); - hash = (String.IsNullOrEmpty(hash) ? String.Empty : hash.PadLeft(padding, '0')); + hash = (hash == "-" ? "" : hash); + hash = (String.IsNullOrEmpty(hash) ? "" : 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 = String.Empty; + hash = ""; } return hash; @@ -418,15 +418,15 @@ namespace SabreTools.Helper.Tools { // Preprocess the string s = s.Trim(); - s = Regex.Replace(s, @"^\S* \(", String.Empty); // Remove item identifier and opening brace - s = Regex.Replace(s, @"\)\S*#.*$", String.Empty); // Remove trailing comments + s = Regex.Replace(s, @"^\S* \(", ""); // Remove item identifier and opening brace + s = Regex.Replace(s, @"\)\S*#.*$", ""); // 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]*String.Empty[^String.Empty]+String.Empty[^\s]*)|[^String.Empty]?\w+[^String.Empty]?") - .Matches(s, @"[^\sString.Empty]+|String.Empty[^String.Empty]*String.Empty") + //.Matches(s, @"([^\s]*""[^""]+""[^\s]*)|[^""]?\w+[^""]?") + .Matches(s, @"[^\s""]+|""[^""]*""") .Cast() .Select(m => m.Groups[0].Value) .ToArray(); @@ -448,7 +448,7 @@ namespace SabreTools.Helper.Tools { if (s == null) { - return String.Empty; + return ""; } if (s.Contains("/")) @@ -462,7 +462,7 @@ namespace SabreTools.Helper.Tools return String.Join("\\", tempkey.Take(tempkey.Length - 1)); } - return String.Empty; + return ""; } /// @@ -475,7 +475,7 @@ namespace SabreTools.Helper.Tools { if (s == null) { - return String.Empty; + return ""; } 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" }, { "Ъ", String.Empty }, { "Ы", "y" }, { "Ь", String.Empty }, + { "Ш", "Sh" }, { "Щ", "Sch" }, { "Ъ", "" }, { "Ы", "y" }, { "Ь", "" }, { "Э", "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" }, - { "ъ", String.Empty }, { "ы", "y" }, { "ь", String.Empty }, { "э", "e" }, { "ю", "yu" }, + { "ъ", "" }, { "ы", "y" }, { "ь", "" }, { "э", "e" }, { "ю", "yu" }, { "я", "ya" }, }; @@ -715,7 +715,7 @@ namespace SabreTools.Helper.Tools { if (hexString.Contains("-")) { - hexString = hexString.Replace("-", String.Empty); + hexString = hexString.Replace("-", ""); } StringBuilder sb = new StringBuilder(); @@ -734,7 +734,7 @@ namespace SabreTools.Helper.Tools /// public static string ConvertAsciiToHex(string asciiString) { - string hexOutput = String.Empty; + string hexOutput = ""; foreach (char _eachChar in asciiString.ToCharArray()) { // Get the integral value of the character. diff --git a/SabreTools/Partials/SabreTools.Inits.cs b/SabreTools/Partials/SabreTools.Inits.cs index 4b0c09fb..4a5b56e5 100644 --- a/SabreTools/Partials/SabreTools.Inits.cs +++ b/SabreTools/Partials/SabreTools.Inits.cs @@ -101,7 +101,7 @@ namespace SabreTools DatFormat = (datFormat == 0 ? DatFormat.Logiqx : datFormat), Romba = romba, ExcludeOf = excludeOf, - Type = (superdat ? "SuperDAT" : String.Empty), + Type = (superdat ? "SuperDAT" : ""), }; // Clean the temp directory @@ -707,34 +707,34 @@ namespace SabreTools } // Normalize the extensions - addext = (addext == String.Empty || addext.StartsWith(".") ? addext : "." + addext); - repext = (repext == String.Empty || repext.StartsWith(".") ? repext : "." + repext); + addext = (addext == "" || addext.StartsWith(".") ? addext : "." + addext); + repext = (repext == "" || 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 == String.Empty) + if (date == "") { date = DateTime.Now.ToString("yyyy-MM-dd"); } - if (name == String.Empty) + if (name == "") { - name = (diffMode != 0 ? "DiffDAT" : "MergeDAT") + (superdat ? "-SuperDAT" : String.Empty) + (dedup ? "-deduped" : String.Empty); + name = (diffMode != 0 ? "DiffDAT" : "MergeDAT") + (superdat ? "-SuperDAT" : "") + (dedup ? "-deduped" : ""); } - if (description == String.Empty) + if (description == "") { - description = (diffMode != 0 ? "DiffDAT" : "MergeDAT") + (superdat ? "-SuperDAT" : String.Empty) + (dedup ? " - deduped" : String.Empty); + description = (diffMode != 0 ? "DiffDAT" : "MergeDAT") + (superdat ? "-SuperDAT" : "") + (dedup ? " - deduped" : ""); if (!bare) { description += " (" + date + ")"; } } - if (category == String.Empty && diffMode != 0) + if (category == "" && diffMode != 0) { category = "DiffDAT"; } - if (author == String.Empty) + if (author == "") { author = "SabreTools"; } diff --git a/SabreTools/Properties/AssemblyInfo.cs b/SabreTools/Properties/AssemblyInfo.cs index fbaf0bde..89cd2b66 100644 --- a/SabreTools/Properties/AssemblyInfo.cs +++ b/SabreTools/Properties/AssemblyInfo.cs @@ -7,12 +7,12 @@ using System.Runtime.InteropServices; // associated with an assembly. [assembly: AssemblyTitle("SabreTools")] [assembly: AssemblyDescription("DAT manipulation toolset")] -[assembly: AssemblyConfiguration(String.Empty)] -[assembly: AssemblyCompany(String.Empty)] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SabreTools")] [assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark(String.Empty)] -[assembly: AssemblyCulture(String.Empty)] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] // 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 diff --git a/SabreTools/SabreTools.cs b/SabreTools/SabreTools.cs index 0446c086..09cdbddf 100644 --- a/SabreTools/SabreTools.cs +++ b/SabreTools/SabreTools.cs @@ -116,7 +116,7 @@ namespace SabreTools long sgt = -1, slt = -1, seq = -1; - string addext = String.Empty, + string addext = "", author = null, category = null, comment = null, @@ -126,19 +126,19 @@ namespace SabreTools exta = null, extb = null, filename = null, - forcemerge = String.Empty, - forcend = String.Empty, - forcepack = String.Empty, + forcemerge = "", + forcend = "", + forcepack = "", header = null, homepage = null, name = null, - outDir = String.Empty, - postfix = String.Empty, - prefix = String.Empty, - repext = String.Empty, - root = String.Empty, + outDir = "", + postfix = "", + prefix = "", + repext = "", + root = "", rootdir = null, - tempDir = String.Empty, + tempDir = "", url = null, version = null; List crc = new List(); @@ -722,7 +722,7 @@ namespace SabreTools } break; default: - string temparg = args[i].Replace("\"", String.Empty).Replace("file://", String.Empty); + string temparg = args[i].Replace("\"", "").Replace("file://", ""); if (temparg.StartsWith("-") && temparg.Contains("=")) { @@ -730,7 +730,7 @@ namespace SabreTools string[] split = temparg.Split('='); if (split[1] == null) { - split[1] = String.Empty; + split[1] = ""; } switch (split[0])