[ALL] Use params variant for logging

This commit is contained in:
Matt Nadareski
2017-08-26 14:11:10 -07:00
parent 06d9980b9b
commit 47f70838f1
17 changed files with 120 additions and 120 deletions

View File

@@ -35,22 +35,22 @@ namespace RombaSharp
// Total number of CRCs
string query = "SELECT COUNT(*) FROM crc";
SqliteCommand slc = new SqliteCommand(query, dbc);
Globals.Logger.User("Total CRCs: " + (long)slc.ExecuteScalar());
Globals.Logger.User("Total CRCs: {0}", (long)slc.ExecuteScalar());
// Total number of MD5s
query = "SELECT COUNT(*) FROM md5";
slc = new SqliteCommand(query, dbc);
Globals.Logger.User("Total MD5s: " + (long)slc.ExecuteScalar());
Globals.Logger.User("Total MD5s: {0}", (long)slc.ExecuteScalar());
// Total number of SHA1s
query = "SELECT COUNT(*) FROM sha1";
slc = new SqliteCommand(query, dbc);
Globals.Logger.User("Total SHA1s: " + (long)slc.ExecuteScalar());
Globals.Logger.User("Total SHA1s: {0}", (long)slc.ExecuteScalar());
// Total number of DATs
query = "SELECT COUNT(*) FROM dat";
slc = new SqliteCommand(query, dbc);
Globals.Logger.User("Total DATs: " + (long)slc.ExecuteScalar());
Globals.Logger.User("Total DATs: {0}", (long)slc.ExecuteScalar());
slc.Dispose();
dbc.Dispose();
@@ -63,16 +63,16 @@ namespace RombaSharp
{
Process proc = Process.GetCurrentProcess();
Globals.Logger.User("Current Nonpaged Memory: " + Style.GetBytesReadable(proc.NonpagedSystemMemorySize64));
Globals.Logger.User("Current Paged Memory: " + Style.GetBytesReadable(proc.PagedMemorySize64));
Globals.Logger.User("Peak Paged Memory: " + Style.GetBytesReadable(proc.PeakPagedMemorySize64));
Globals.Logger.User("Peak Virtual Memory: " + Style.GetBytesReadable(proc.PeakVirtualMemorySize64));
Globals.Logger.User("Peak Working Memory: " + Style.GetBytesReadable(proc.PeakWorkingSet64));
Globals.Logger.User("Private Memory: " + Style.GetBytesReadable(proc.PrivateMemorySize64));
Globals.Logger.User("Virtual Memory: " + Style.GetBytesReadable(proc.VirtualMemorySize64));
Globals.Logger.User("Working Memory: " + Style.GetBytesReadable(proc.WorkingSet64));
Globals.Logger.User("Total Processor Time: " + proc.TotalProcessorTime);
Globals.Logger.User("User Processor Time: " + proc.UserProcessorTime);
Globals.Logger.User("Current Nonpaged Memory: {0}", Style.GetBytesReadable(proc.NonpagedSystemMemorySize64));
Globals.Logger.User("Current Paged Memory: {0}", Style.GetBytesReadable(proc.PagedMemorySize64));
Globals.Logger.User("Peak Paged Memory: {0}", Style.GetBytesReadable(proc.PeakPagedMemorySize64));
Globals.Logger.User("Peak Virtual Memory: {0}", Style.GetBytesReadable(proc.PeakVirtualMemorySize64));
Globals.Logger.User("Peak Working Memory: {0}", Style.GetBytesReadable(proc.PeakWorkingSet64));
Globals.Logger.User("Private Memory: {0}", Style.GetBytesReadable(proc.PrivateMemorySize64));
Globals.Logger.User("Virtual Memory: {0}", Style.GetBytesReadable(proc.VirtualMemorySize64));
Globals.Logger.User("Working Memory: {0}", Style.GetBytesReadable(proc.WorkingSet64));
Globals.Logger.User("Total Processor Time: {0}", proc.TotalProcessorTime);
Globals.Logger.User("User Processor Time: {0}", proc.UserProcessorTime);
}
/// <summary>
@@ -133,7 +133,7 @@ namespace RombaSharp
}
else
{
Globals.Logger.Warning("The file '" + input + "' could not be found in the DAT root");
Globals.Logger.Warning("The file '{0}' could not be found in the DAT root", input);
}
}
@@ -436,7 +436,7 @@ namespace RombaSharp
}
datroot.BucketBy(SortedBy.Game, false /* mergeroms */, norename: true);
Globals.Logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
Globals.Logger.User("Populating complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
slc.Dispose();
sldr.Dispose();
@@ -452,7 +452,7 @@ namespace RombaSharp
}
}
Globals.Logger.User("Adding complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
Globals.Logger.User("Adding complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
// Now loop through and remove all references to old Dats
Globals.Logger.User("Removing unmatched DAT information");
@@ -465,7 +465,7 @@ namespace RombaSharp
slc.ExecuteNonQuery();
slc.Dispose();
}
Globals.Logger.User("Removing complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
Globals.Logger.User("Removing complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
dbc.Dispose();
}
@@ -495,7 +495,7 @@ namespace RombaSharp
{
foreach (DatItem datItem in tempdat[romkey])
{
Globals.Logger.Verbose("Checking and adding file '" + datItem.Name);
Globals.Logger.Verbose("Checking and adding file '{0}'", datItem.Name);
if (datItem.Type == ItemType.Rom)
{
@@ -587,14 +587,14 @@ namespace RombaSharp
// Check that it's a valid depot first
if (!_depots.ContainsKey(depotname))
{
Globals.Logger.User("'" + depotname + "' is not a recognized depot. Please add it to your configuration file and try again");
Globals.Logger.User("'{0}' is not a recognized depot. Please add it to your configuration file and try again", depotname);
return;
}
// Then check that the depot is online
if (!Directory.Exists(depotname))
{
Globals.Logger.User("'" + depotname + "' does not appear to be online. Please check its status and try again");
Globals.Logger.User("'{0}' does not appear to be online. Please check its status and try again", depotname);
return;
}

View File

@@ -335,11 +335,11 @@ namespace RombaSharp
SqliteDataReader sldr = slc.ExecuteReader();
if (sldr.HasRows)
{
Globals.Logger.User("For hash '" + input + "' there were " + sldr.RecordsAffected + " matches in the database");
Globals.Logger.User("For hash '{0}' there were {1} matches in the database", input, sldr.RecordsAffected);
}
else
{
Globals.Logger.User("Hash '" + input + "' had no matches in the database");
Globals.Logger.User("Hash '{0}' had no matches in the database", input);
}
sldr.Dispose();
@@ -352,11 +352,11 @@ namespace RombaSharp
SqliteDataReader sldr = slc.ExecuteReader();
if (sldr.HasRows)
{
Globals.Logger.User("For hash '" + input + "' there were " + sldr.RecordsAffected + " matches in the database");
Globals.Logger.User("For hash '{0}' there were {1} matches in the database", input, sldr.RecordsAffected);
}
else
{
Globals.Logger.User("Hash '" + input + "' had no matches in the database");
Globals.Logger.User("Hash '{0}' had no matches in the database", input);
}
sldr.Dispose();
@@ -369,11 +369,11 @@ namespace RombaSharp
SqliteDataReader sldr = slc.ExecuteReader();
if (sldr.HasRows)
{
Globals.Logger.User("For hash '" + input + "' there were " + sldr.RecordsAffected + " matches in the database");
Globals.Logger.User("For hash '{0}' there were {1} matches in the database", input, sldr.RecordsAffected);
}
else
{
Globals.Logger.User("Hash '" + input + "' had no matches in the database");
Globals.Logger.User("Hash '{0}' had no matches in the database", input);
}
sldr.Dispose();

View File

@@ -679,14 +679,14 @@ namespace SabreTools.Library.Dats
// If the current item exactly matches the last item, then we don't add it
if ((datItem.GetDuplicateStatus(lastItem) & DupeType.All) != 0)
{
Globals.Logger.Verbose("Exact duplicate found for '" + datItem.Name + "'");
Globals.Logger.Verbose("Exact duplicate found for '{0}'", datItem.Name);
continue;
}
// If the current name matches the previous name, rename the current item
else if (datItem.Name == lastItem.Name)
{
Globals.Logger.Verbose("Name duplicate found for '" + datItem.Name + "'");
Globals.Logger.Verbose("Name duplicate found for '{0}'", datItem.Name);
if (datItem.Type == ItemType.Disk)
{

View File

@@ -670,7 +670,7 @@ namespace SabreTools.Library.Dats
machineType |= MachineType.Mechanical;
break;
default:
Globals.Logger.Warning(gametype + " is not a valid type");
Globals.Logger.Warning("{0} is not a valid type", gametype);
break;
}
@@ -703,7 +703,7 @@ namespace SabreTools.Library.Dats
itemStatus |= ItemStatus.Verified;
break;
default:
Globals.Logger.Warning(status + " is not a valid status");
Globals.Logger.Warning("{0} is not a valid status", status);
break;
}

View File

@@ -115,7 +115,7 @@ namespace SabreTools.Library.Dats
Parallel.For(0, inputs.Count, i =>
{
string input = inputs[i];
Globals.Logger.User("Adding DAT: " + input.Split('¬')[0]);
Globals.Logger.User("Adding DAT: {0}", input.Split('¬')[0]);
datHeaders[i] = new DatFile
{
DatFormat = (DatFormat != 0 ? DatFormat : 0),
@@ -125,7 +125,7 @@ namespace SabreTools.Library.Dats
datHeaders[i].Parse(input.Split('¬')[0], i, 0, splitType, keep: true, clean: clean, remUnicode: remUnicode, descAsName: descAsName);
});
Globals.Logger.User("Processing complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
Globals.Logger.User("Processing complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
Globals.Logger.User("Populating internal DAT");
Parallel.For(0, inputs.Count, i =>
@@ -151,7 +151,7 @@ namespace SabreTools.Library.Dats
// Now that we have a merged DAT, filter it
Filter(filter, single, trim, root);
Globals.Logger.User("Processing and populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
Globals.Logger.User("Processing and populating complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
return datHeaders.ToList();
}
@@ -184,7 +184,7 @@ namespace SabreTools.Library.Dats
Parse(path, 0, 0, keep: true, clean: clean, remUnicode: remUnicode, descAsName: descAsName);
});
Globals.Logger.User("Populating base DAT complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
Globals.Logger.User("Populating base DAT complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
// For comparison's sake, we want to use CRC as the base ordering
BucketBy(SortedBy.CRC, true);
@@ -196,7 +196,7 @@ namespace SabreTools.Library.Dats
// Get the two halves of the path
string[] splitpath = path.Split('¬');
Globals.Logger.User("Comparing '" + splitpath[0] + "' to base DAT");
Globals.Logger.User("Comparing '{0}'' to base DAT", splitpath[0]);
// First we parse in the DAT internally
DatFile intDat = new DatFile();
@@ -294,7 +294,7 @@ namespace SabreTools.Library.Dats
});
outDats = outDatsArray.ToList();
Globals.Logger.User("Initializing complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
Globals.Logger.User("Initializing complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
// Now, loop through the dictionary and populate the correct DATs
start = DateTime.Now;
@@ -316,7 +316,7 @@ namespace SabreTools.Library.Dats
// There's odd cases where there are items with System ID < 0. Skip them for now
if (item.SystemID < 0)
{
Globals.Logger.Warning("Item found with a <0 SystemID: " + item.Name);
Globals.Logger.Warning("Item found with a <0 SystemID: {0}", item.Name);
continue;
}
@@ -324,7 +324,7 @@ namespace SabreTools.Library.Dats
}
});
Globals.Logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
Globals.Logger.User("Populating complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
// Finally, loop through and output each of the DATs
start = DateTime.Now;
@@ -350,7 +350,7 @@ namespace SabreTools.Library.Dats
outDats[j].WriteToFile(path);
});
Globals.Logger.User("Outputting complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
Globals.Logger.User("Outputting complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
}
/// <summary>
@@ -426,7 +426,7 @@ namespace SabreTools.Library.Dats
outDats = outDatsArray.ToList();
}
Globals.Logger.User("Initializing complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
Globals.Logger.User("Initializing complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
// Now, loop through the dictionary and populate the correct DATs
start = DateTime.Now;
@@ -482,7 +482,7 @@ namespace SabreTools.Library.Dats
}
});
Globals.Logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
Globals.Logger.User("Populating complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
// Finally, loop through and output each of the DATs
start = DateTime.Now;
@@ -516,7 +516,7 @@ namespace SabreTools.Library.Dats
outDats[j].WriteToFile(path);
});
}
Globals.Logger.User("Outputting complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
Globals.Logger.User("Outputting complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
}
/// <summary>
@@ -598,7 +598,7 @@ namespace SabreTools.Library.Dats
}
DatFile innerDatdata = new DatFile(this);
Globals.Logger.User("Processing \"" + Path.GetFileName(inputFileName) + "\"");
Globals.Logger.User("Processing '{0}'", Path.GetFileName(inputFileName));
innerDatdata.Parse(inputFileName, 0, 0, splitType, keep: true, clean: clean, remUnicode: remUnicode, descAsName: descAsName,
keepext: ((innerDatdata.DatFormat & DatFormat.TSV) != 0 || (innerDatdata.DatFormat & DatFormat.CSV) != 0));
innerDatdata.Filter(filter, trim, single, root);
@@ -620,7 +620,7 @@ namespace SabreTools.Library.Dats
List<string> subFiles = Directory.EnumerateFiles(inputFileName, "*", SearchOption.AllDirectories).ToList();
Parallel.ForEach(subFiles, file =>
{
Globals.Logger.User("Processing \"" + Path.GetFullPath(file).Remove(0, inputFileName.Length) + "\"");
Globals.Logger.User("Processing '{0}'", Path.GetFullPath(file).Remove(0, inputFileName.Length));
DatFile innerDatdata = new DatFile(this);
innerDatdata.Parse(file, 0, 0, splitType, keep: true, clean: clean, remUnicode: remUnicode, descAsName: descAsName,
keepext: ((innerDatdata.DatFormat & DatFormat.TSV) != 0 || (innerDatdata.DatFormat & DatFormat.CSV) != 0));
@@ -633,7 +633,7 @@ namespace SabreTools.Library.Dats
}
else
{
Globals.Logger.Error("I'm sorry but " + inputFileName + " doesn't exist!");
Globals.Logger.Error("I'm sorry but '{0}' doesn't exist!", inputFileName);
return;
}
});

View File

@@ -62,7 +62,7 @@ namespace SabreTools.Library.Dats
// Process the input
if (Directory.Exists(basePath))
{
Globals.Logger.Verbose("Folder found: " + basePath);
Globals.Logger.Verbose("Folder found: {0}", basePath);
// Process the files in the main folder
List<string> files = Directory.EnumerateFiles(basePath, "*", SearchOption.TopDirectoryOnly).ToList();
@@ -129,7 +129,7 @@ namespace SabreTools.Library.Dats
romname = romname.Substring(0, romname.Length - 1);
}
Globals.Logger.Verbose("Adding blank empty folder: " + gamename);
Globals.Logger.Verbose("Adding blank empty folder: {0}", gamename);
this["null"].Add(new Rom(romname, gamename, omitFromScan));
});
}
@@ -181,11 +181,11 @@ namespace SabreTools.Library.Dats
{
// Add the list if it doesn't exist already
Add(rom.Size + "-" + rom.CRC, rom);
Globals.Logger.User("File added: " + Path.GetFileNameWithoutExtension(item) + Environment.NewLine);
Globals.Logger.User("File added: {0}", Path.GetFileNameWithoutExtension(item) + Environment.NewLine);
}
else
{
Globals.Logger.User("File not added: " + Path.GetFileNameWithoutExtension(item) + Environment.NewLine);
Globals.Logger.User("File not added: {0}", Path.GetFileNameWithoutExtension(item) + Environment.NewLine);
return;
}
@@ -288,7 +288,7 @@ namespace SabreTools.Library.Dats
private void PopulateFromDirProcessFile(string item, string parent, string basePath, Hash omitFromScan,
bool addDate, string headerToCheckAgainst)
{
Globals.Logger.Verbose(Path.GetFileName(item) + " treated like a file");
Globals.Logger.Verbose("'{0}' treated like a file", Path.GetFileName(item));
Rom rom = FileTools.GetFileInfo(item, omitFromScan: omitFromScan, date: addDate, header: headerToCheckAgainst);
PopulateFromDirProcessFileHelper(item, rom, basePath, parent);
@@ -419,7 +419,7 @@ namespace SabreTools.Library.Dats
// Add the file information to the DAT
Add(key, datItem);
Globals.Logger.User("File added: " + romname + Environment.NewLine);
Globals.Logger.User("File added: {0}", romname + Environment.NewLine);
}
catch (IOException ex)
{

View File

@@ -48,7 +48,7 @@ namespace SabreTools.Library.Dats
// Create the temporary dictionary to sort into
SortedDictionary<string, List<DatItem>> sortable = new SortedDictionary<string, List<DatItem>>();
Globals.Logger.User("Organizing roms by " + bucketBy +(mergeroms ? " and merging" : ""));
Globals.Logger.User("Organizing roms by {0}" + (mergeroms ? " and merging" : ""), bucketBy);
// First do the initial sort of all of the roms
List<string> keys = Keys.ToList();

View File

@@ -145,7 +145,7 @@ namespace SabreTools.Library.Dats
}
catch (Exception ex)
{
Globals.Logger.Error("Error with file '" + filename + "': " + ex.ToString());
Globals.Logger.Error("Error with file '{0}': {1}", filename, ex);
}
// If we want to use descriptions as names, update everything
@@ -997,7 +997,7 @@ namespace SabreTools.Library.Dats
// If the line doesn't have the correct number of columns, we log and skip
if (parsedLine.Length != columns.Count)
{
Globals.Logger.Warning("Malformed line found in '" + filename + " at line " + linenum);
Globals.Logger.Warning("Malformed line found in '{0}' at line {1}", filename, linenum);
continue;
}
@@ -1275,7 +1275,7 @@ namespace SabreTools.Library.Dats
int parentcount = parent.Count;
if (parentcount == 0)
{
Globals.Logger.Verbose("Empty parent: " + String.Join("\\", parent) + " found in " + filename);
Globals.Logger.Verbose("Empty parent '{0}' found in '{1}'", String.Join("\\", parent), filename);
empty = true;
}
@@ -2339,7 +2339,7 @@ namespace SabreTools.Library.Dats
}
catch (Exception ex)
{
Globals.Logger.Warning("Exception found while parsing " + filename + ": " + ex.ToString());
Globals.Logger.Warning("Exception found while parsing '{0}': {1}", filename, ex);
// For XML errors, just skip the affected node
xtr?.Read();
@@ -3038,14 +3038,14 @@ namespace SabreTools.Library.Dats
// If there's no name in the rom, we log and skip it
if (item.Name == null)
{
Globals.Logger.Warning(FileName + ": Rom with no name found! Skipping...");
Globals.Logger.Warning("{0}: Rom with no name found! Skipping...", FileName);
return key;
}
// If the name ends with a directory separator, we log and skip it (DOSCenter only?)
if (item.Name.EndsWith("/") || item.Name.EndsWith("\\"))
{
Globals.Logger.Warning(FileName + ": Rom ending with directory separator found: '" + item.Name + "'. Skipping...");
Globals.Logger.Warning("{0}: Rom ending with directory separator found: '{1}'. Skipping...", FileName, item.Name);
return key;
}
@@ -3097,7 +3097,7 @@ namespace SabreTools.Library.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))
{
Globals.Logger.Verbose(FileName + ": Incomplete entry for \"" + itemRom.Name + "\" will be output as nodump");
Globals.Logger.Verbose("{0}: Incomplete entry for '{1}' will be output as nodump", FileName, itemRom.Name);
itemRom.ItemStatus = ItemStatus.Nodump;
}
// If the file has a size but aboslutely no hashes, skip and log
@@ -3110,7 +3110,7 @@ namespace SabreTools.Library.Dats
&& String.IsNullOrEmpty(itemRom.SHA384)
&& String.IsNullOrEmpty(itemRom.SHA512))
{
Globals.Logger.Verbose(FileName + ": Incomplete entry for \"" + itemRom.Name + "\" will be output as nodump");
Globals.Logger.Verbose("{0}: Incomplete entry for '{1}' will be output as nodump", FileName, itemRom.Name);
itemRom.ItemStatus = ItemStatus.Nodump;
}
@@ -3135,7 +3135,7 @@ namespace SabreTools.Library.Dats
&& String.IsNullOrEmpty(itemDisk.SHA384)
&& String.IsNullOrEmpty(itemDisk.SHA512))
{
Globals.Logger.Verbose("Incomplete entry for \"" + itemDisk.Name + "\" will be output as nodump");
Globals.Logger.Verbose("Incomplete entry for '{0}' will be output as nodump", itemDisk.Name);
itemDisk.ItemStatus = ItemStatus.Nodump;
}

View File

@@ -133,7 +133,7 @@ namespace SabreTools.Library.Dats
// Add to the list if the input is a directory
if (Directory.Exists(input))
{
Globals.Logger.Verbose("Adding depot: '" + input + "'");
Globals.Logger.Verbose("Adding depot: {0}", input);
lock (directories)
{
directories.Add(input);
@@ -160,7 +160,7 @@ namespace SabreTools.Library.Dats
continue;
}
Globals.Logger.User("Checking hash '" + hash + "'");
Globals.Logger.User("Checking hash '{0}'", hash);
// Get the extension path for the hash
string subpath = Style.GetRombaPath(hash);
@@ -196,7 +196,7 @@ namespace SabreTools.Library.Dats
updateDat, false /* isZip */, headerToCheckAgainst);
}
Globals.Logger.User("Rebuilding complete in: " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
Globals.Logger.User("Rebuilding complete in: {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
#endregion
@@ -322,7 +322,7 @@ namespace SabreTools.Library.Dats
// If the input is a file
if (File.Exists(input))
{
Globals.Logger.User("Checking file: '" + input + "'");
Globals.Logger.User("Checking file: {0}", input);
RebuildGenericHelper(input, outDir, tempDir, quickScan, date, delete, inverse,
outputFormat, romba, archiveScanLevel, updateDat, headerToCheckAgainst);
}
@@ -330,17 +330,17 @@ namespace SabreTools.Library.Dats
// If the input is a directory
else if (Directory.Exists(input))
{
Globals.Logger.Verbose("Checking directory: '" + input + "'");
Globals.Logger.Verbose("Checking directory: {0}", input);
foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories))
{
Globals.Logger.User("Checking file: '" + file + "'");
Globals.Logger.User("Checking file: {0}", file);
RebuildGenericHelper(file, outDir, tempDir, quickScan, date, delete, inverse,
outputFormat, romba, archiveScanLevel, updateDat, headerToCheckAgainst);
}
}
}
Globals.Logger.User("Rebuilding complete in: " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
Globals.Logger.User("Rebuilding complete in: {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
#endregion
@@ -541,7 +541,7 @@ namespace SabreTools.Library.Dats
// Seek to the beginning of the stream
fileStream.Seek(0, SeekOrigin.Begin);
Globals.Logger.User("Matches found for '" + Style.GetFileName(rom.Name) + "', rebuilding accordingly...");
Globals.Logger.User("Matches found for '{0}', rebuilding accordingly...", Style.GetFileName(rom.Name));
rebuilt = true;
// Now loop through the list and rebuild accordingly
@@ -649,7 +649,7 @@ namespace SabreTools.Library.Dats
item.Machine.UpdateDescription(machinename);
}
Globals.Logger.User("No matches found for '" + Style.GetFileName(rom.Name) + "', rebuilding accordingly from inverse flag...");
Globals.Logger.User("No matches found for '{0}', rebuilding accordingly from inverse flag...", Style.GetFileName(rom.Name));
// Now rebuild to the output file
switch (outputFormat)
@@ -766,7 +766,7 @@ namespace SabreTools.Library.Dats
return rebuilt;
}
Globals.Logger.User("Headerless matches found for '" + Style.GetFileName(rom.Name) + "', rebuilding accordingly...");
Globals.Logger.User("Headerless matches found for '{0}', rebuilding accordingly...", Style.GetFileName(rom.Name));
rebuilt = true;
// Now loop through the list and rebuild accordingly
@@ -872,7 +872,7 @@ namespace SabreTools.Library.Dats
// Add to the list if the input is a directory
if (Directory.Exists(input))
{
Globals.Logger.Verbose("Adding depot: '" + input + "'");
Globals.Logger.Verbose("Adding depot: {0}", input);
directories.Add(input);
}
}
@@ -896,7 +896,7 @@ namespace SabreTools.Library.Dats
continue;
}
Globals.Logger.User("Checking hash '" + hash + "'");
Globals.Logger.User("Checking hash '{0}'", hash);
// Get the extension path for the hash
string subpath = Style.GetRombaPath(hash);
@@ -931,7 +931,7 @@ namespace SabreTools.Library.Dats
fileinfo.GetDuplicates(this, remove: true);
}
Globals.Logger.User("Verifying complete in: " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
Globals.Logger.User("Verifying complete in: {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
// If there are any entries in the DAT, output to the rebuild directory
_fileName = "fixDAT_" + _fileName;

View File

@@ -115,7 +115,7 @@ namespace SabreTools.Library.Dats
BucketBy(SortedBy.Game, false /* mergeRoms */, norename: norename);
// Output the number of items we're going to be writing
Globals.Logger.User("A total of " + Count + " items will be written out to \"" + FileName + "\"");
Globals.Logger.User("A total of {0} items will be written out to '{1}'", Count, FileName);
// Filter the DAT by 1G1R rules, if we're supposed to
// TODO: Create 1G1R logic before write
@@ -140,13 +140,13 @@ namespace SabreTools.Library.Dats
{
string outfile = outfiles[datFormat];
Globals.Logger.User("Opening file for writing: " + outfile);
Globals.Logger.User("Opening file for writing: {0}", outfile);
FileStream fs = FileTools.TryCreate(outfile);
// If we get back null for some reason, just log and return
if (fs == null)
{
Globals.Logger.Warning("File '" + outfile + "' could not be created for writing! Please check to see if the file is writable");
Globals.Logger.Warning("File '{0}' could not be created for writing! Please check to see if the file is writable", outfile);
return;
}
@@ -197,7 +197,7 @@ namespace SabreTools.Library.Dats
&& ((Rom)rom).Size == -1
&& ((Rom)rom).CRC == "null")
{
Globals.Logger.Verbose("Empty folder found: " + rom.Machine.Name);
Globals.Logger.Verbose("Empty folder found: {0}", rom.Machine.Name);
// If we're in a mode that doesn't allow for actual empty folders, add the blank info
if (datFormat != DatFormat.CSV

View File

@@ -343,7 +343,7 @@ namespace SabreTools.Library.Skippers
// If the file doesn't exist, return a blank skipper rule
if (!File.Exists(input))
{
Globals.Logger.Error("The file '" + input + "' does not exist so it cannot be tested");
Globals.Logger.Error("The file '{0}' does not exist so it cannot be tested", input);
return new SkipperRule();
}

View File

@@ -39,7 +39,7 @@ namespace SabreTools.Library.Skippers
// If the input file doesn't exist, fail
if (!File.Exists(input))
{
Globals.Logger.Error("I'm sorry but '" + input + "' doesn't exist!");
Globals.Logger.Error("I'm sorry but '{0}' doesn't exist!", input);
return false;
}
@@ -49,7 +49,7 @@ namespace SabreTools.Library.Skippers
Directory.CreateDirectory(Path.GetDirectoryName(output));
}
Globals.Logger.User("Attempting to apply rule to '" + input + "'");
Globals.Logger.User("Attempting to apply rule to '{0}'", input);
success = TransformStream(FileTools.TryOpenRead(input), FileTools.TryCreate(output));
// If the output file has size 0, delete it

View File

@@ -71,7 +71,7 @@ namespace SabreTools.Library.Tools
// 7-zip
if (at == ArchiveType.SevenZip && (archiveScanLevel & ArchiveScanLevel.SevenZipInternal) != 0)
{
Globals.Logger.Verbose("Found archive of type: " + at);
Globals.Logger.Verbose("Found archive of type: {0}", at);
// Create the temp directory
Directory.CreateDirectory(outDir);
@@ -89,7 +89,7 @@ namespace SabreTools.Library.Tools
// GZip
else if (at == ArchiveType.GZip && (archiveScanLevel & ArchiveScanLevel.GZipInternal) != 0)
{
Globals.Logger.Verbose("Found archive of type: " + at);
Globals.Logger.Verbose("Found archive of type: {0}", at);
// Create the temp directory
Directory.CreateDirectory(outDir);
@@ -109,7 +109,7 @@ namespace SabreTools.Library.Tools
// RAR
else if (at == ArchiveType.Rar && (archiveScanLevel & ArchiveScanLevel.RarInternal) != 0)
{
Globals.Logger.Verbose("Found archive of type: " + at);
Globals.Logger.Verbose("Found archive of type: {0}", at);
// Create the temp directory
Directory.CreateDirectory(outDir);
@@ -127,7 +127,7 @@ namespace SabreTools.Library.Tools
// TAR
else if (at == ArchiveType.Tar && (archiveScanLevel & ArchiveScanLevel.TarInternal) != 0)
{
Globals.Logger.Verbose("Found archive of type: " + at);
Globals.Logger.Verbose("Found archive of type: {0}", at);
// Create the temp directory
Directory.CreateDirectory(outDir);
@@ -145,7 +145,7 @@ namespace SabreTools.Library.Tools
// Zip
else if (at == ArchiveType.Zip && (archiveScanLevel & ArchiveScanLevel.ZipInternal) != 0)
{
Globals.Logger.Verbose("Found archive of type: " + at);
Globals.Logger.Verbose("Found archive of type: {0}", at);
// Create the temp directory
Directory.CreateDirectory(outDir);
@@ -461,7 +461,7 @@ namespace SabreTools.Library.Tools
IReader reader = null;
try
{
Globals.Logger.Verbose("Found archive of type: " + at);
Globals.Logger.Verbose("Found archive of type: {0}", at);
switch (at)
{
@@ -614,7 +614,7 @@ namespace SabreTools.Library.Tools
try
{
Globals.Logger.Verbose("Found archive of type: " + at);
Globals.Logger.Verbose("Found archive of type: {0}", at);
switch (at)
{
@@ -915,21 +915,21 @@ namespace SabreTools.Library.Tools
// If we have the romba depot files, just skip them gracefully
if (datum == ".romba_size" || datum == ".romba_size.backup")
{
Globals.Logger.Verbose("Romba depot file found, skipping: " + input);
Globals.Logger.Verbose("Romba depot file found, skipping: {0}", input);
return null;
}
// Check if the name is the right length
if (!Regex.IsMatch(datum, @"^[0-9a-f]{" + Constants.SHA1Length + @"}\.gz")) // TODO: When updating to SHA-256, this needs to update to Constants.SHA256Length
{
Globals.Logger.Warning("Non SHA-1 filename found, skipping: '" + Path.GetFullPath(input) + "'");
Globals.Logger.Warning("Non SHA-1 filename found, skipping: '{0}'", Path.GetFullPath(input));
return null;
}
// Check if the file is at least the minimum length
if (filesize < 40 /* bytes */)
{
Globals.Logger.Warning("Possibly corrupt file '" + Path.GetFullPath(input) + "' with size " + Style.GetBytesReadable(filesize));
Globals.Logger.Warning("Possibly corrupt file '{0}' with size {1}", Path.GetFullPath(input), Style.GetBytesReadable(filesize));
return null;
}
@@ -1424,7 +1424,7 @@ namespace SabreTools.Library.Tools
}
catch
{
Globals.Logger.Warning("File '" + filename + "' could not be opened");
Globals.Logger.Warning("File '{0}' could not be opened", filename);
ist7z = 0;
}
}
@@ -2253,7 +2253,7 @@ namespace SabreTools.Library.Tools
// Check that the input file exists
if (!File.Exists(inputFile))
{
Globals.Logger.Warning("File " + inputFile + " does not exist!");
Globals.Logger.Warning("File '{0}' does not exist!", inputFile);
return false;
}
inputFile = Path.GetFullPath(inputFile);

View File

@@ -46,7 +46,7 @@ namespace SabreTools.Library.Tools
"'" + header + "', " +
"'" + source + "')";
slc = new SqliteCommand(query, dbc);
Globals.Logger.Verbose("Result of inserting header: " + slc.ExecuteNonQuery());
Globals.Logger.Verbose("Result of inserting header: {0}", slc.ExecuteNonQuery());
}
// Dispose of database objects
@@ -182,7 +182,7 @@ CREATE TABLE IF NOT EXISTS data (
{
while (sldr.Read())
{
Globals.Logger.Verbose("Found match with rom type " + sldr.GetString(1));
Globals.Logger.Verbose("Found match with rom type '{0}'", sldr.GetString(1));
headers.Add(sldr.GetString(0));
}
}

View File

@@ -59,12 +59,12 @@ namespace SabreTools.Library.Tools
}
// Read the input file, if possible
Globals.Logger.Verbose("Attempting to read file to get format: \"" + filename + "\"");
Globals.Logger.Verbose("Attempting to read file to get format: {0}", filename);
// Check if file exists
if (!File.Exists(filename))
{
Globals.Logger.Warning("File '" + filename + "' could not read from!");
Globals.Logger.Warning("File '{0}' could not read from!", filename);
return 0;
}
@@ -367,7 +367,7 @@ namespace SabreTools.Library.Tools
Directory.CreateDirectory(outDir);
}
Globals.Logger.User("\nGetting skipper information for '" + file + "'");
Globals.Logger.User("\nGetting skipper information for '{0}'", file);
// Get the skipper rule that matches the file, if any
SkipperRule rule = Skipper.GetMatchingRule(file, "");
@@ -431,7 +431,7 @@ namespace SabreTools.Library.Tools
}
catch (PathTooLongException)
{
Globals.Logger.Warning("The path for " + file + " was too long");
Globals.Logger.Warning("The path for '{0}' was too long", file);
}
catch (Exception ex)
{
@@ -447,7 +447,7 @@ namespace SabreTools.Library.Tools
}
catch (PathTooLongException)
{
Globals.Logger.Warning("The path for " + input + " was too long");
Globals.Logger.Warning("The path for '{0}' was too long", input);
}
catch (Exception ex)
{
@@ -466,12 +466,12 @@ namespace SabreTools.Library.Tools
/// <returns>The XmlTextReader representing the (possibly converted) file, null otherwise</returns>
public static XmlReader GetXmlTextReader(string filename)
{
Globals.Logger.Verbose("Attempting to read file: \"" + filename + "\"");
Globals.Logger.Verbose("Attempting to read file: {0}", filename);
// Check if file exists
if (!File.Exists(filename))
{
Globals.Logger.Warning("File '" + filename + "' could not read from!");
Globals.Logger.Warning("File '{0}' could not read from!", filename);
return null;
}

View File

@@ -206,7 +206,7 @@ namespace SabreTools
}
else
{
Globals.Logger.Error(input + " is not a valid file or folder!");
Globals.Logger.Error("'{0}' is not a valid file or folder!", input);
Console.WriteLine();
_help.OutputIndividualFeature("Extension Split");
return;
@@ -241,7 +241,7 @@ namespace SabreTools
}
else
{
Globals.Logger.Error(input + " is not a valid file or folder!");
Globals.Logger.Error("'{0}' is not a valid file or folder!", input);
Console.WriteLine();
_help.OutputIndividualFeature("Hash Split");
return;
@@ -302,7 +302,7 @@ namespace SabreTools
}
else
{
Globals.Logger.Error(input + " is not a valid file or folder!");
Globals.Logger.Error("'{0}' is not a valid file or folder!", input);
Console.WriteLine();
_help.OutputIndividualFeature("Level Split");
return;
@@ -349,7 +349,7 @@ namespace SabreTools
{
datdata.Parse(datfile, 99, 99, splitType, keep: true, useTags: true);
}
Globals.Logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
Globals.Logger.User("Populating complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
datdata.RebuildGeneric(inputs, outDir, tempDir, quickScan, date, delete, inverse, outputFormat, romba, asl,
updateDat, headerToCheckAgainst);
@@ -385,7 +385,7 @@ namespace SabreTools
{
datdata.Parse(datfile, 99, 99, splitType, keep: true, useTags: true);
}
Globals.Logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
Globals.Logger.User("Populating complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
datdata.RebuildDepot(inputs, outDir, tempDir, date, delete, inverse, outputFormat, romba,
updateDat, headerToCheckAgainst);
@@ -434,7 +434,7 @@ namespace SabreTools
}
else
{
Globals.Logger.Error(input + " is not a valid file or folder!");
Globals.Logger.Error("{0} is not a valid file or folder!", input);
Console.WriteLine();
_help.OutputIndividualFeature("Type Split");
return;
@@ -577,7 +577,7 @@ namespace SabreTools
fm = ForceMerging.Full;
break;
default:
Globals.Logger.Warning(forcemerge + " is not a valid merge flag");
Globals.Logger.Warning("{0} is not a valid merge flag", forcemerge);
break;
}
}
@@ -600,7 +600,7 @@ namespace SabreTools
fn = ForceNodump.Ignore;
break;
default:
Globals.Logger.Warning(forcend + " is not a valid nodump flag");
Globals.Logger.Warning("{0} is not a valid nodump flag", forcend);
break;
}
}
@@ -620,7 +620,7 @@ namespace SabreTools
fp = ForcePacking.Unzip;
break;
default:
Globals.Logger.Warning(forcepack + " is not a valid packing flag");
Globals.Logger.Warning("{0} is not a valid packing flag", forcepack);
break;
}
}
@@ -758,7 +758,7 @@ namespace SabreTools
{
datdata.Parse(datfile, 99, 99, splitType, keep: true, useTags: true);
}
Globals.Logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
Globals.Logger.User("Populating complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
datdata.VerifyGeneric(inputs, tempDir, hashOnly, quickScan, headerToCheckAgainst);
}
@@ -786,7 +786,7 @@ namespace SabreTools
{
datdata.Parse(datfile, 99, 99, splitType, keep: true, useTags: true);
}
Globals.Logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
Globals.Logger.User("Populating complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
datdata.VerifyDepot(inputs, tempDir, headerToCheckAgainst);
}

View File

@@ -172,7 +172,7 @@ namespace SabreTools
// Verify that the flag is valid
if (!_help.TopLevelFlag(feature))
{
Globals.Logger.User("\"" + feature + "\" is not valid feature flag");
Globals.Logger.User("'{0}' is not valid feature flag", feature);
_help.OutputIndividualFeature(feature);
Globals.Logger.Close();
return;
@@ -267,7 +267,7 @@ namespace SabreTools
// Verify that the current flag is proper for the feature
if (!_help[feature].ValidateInput(args[i]))
{
Globals.Logger.Error("Invalid input detected: " + args[i]);
Globals.Logger.Error("Invalid input detected: {0}", args[i]);
_help.OutputIndividualFeature(feature);
Globals.Logger.Close();
return;
@@ -667,7 +667,7 @@ namespace SabreTools
i++;
if (!File.Exists(args[i]) && !Directory.Exists(args[i]))
{
Globals.Logger.Error("Must be a valid file or folder of DATs: " + args[i]);
Globals.Logger.Error("Must be a valid file or folder of DATs: {0}", args[i]);
Globals.Logger.Close();
return;
}
@@ -953,7 +953,7 @@ namespace SabreTools
case "--dat":
if (!File.Exists(split[1]) && !Directory.Exists(split[1]))
{
Globals.Logger.Error("Must be a valid file or folder of DATs: " + split[1]);
Globals.Logger.Error("Must be a valid file or folder of DATs: {0}", split[1]);
Globals.Logger.Close();
return;
}
@@ -1179,7 +1179,7 @@ namespace SabreTools
}
else
{
Globals.Logger.Error("Invalid input detected: " + args[i]);
Globals.Logger.Error("Invalid input detected: {0}", args[i]);
Globals.Logger.Close();
return;
}
@@ -1192,7 +1192,7 @@ namespace SabreTools
}
else
{
Globals.Logger.Error("Invalid input detected: " + args[i]);
Globals.Logger.Error("Invalid input detected: {0}", args[i]);
Globals.Logger.Close();
return;
}