mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[InternalStopwatch] Add an internal stopwatch and use it kinda
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Linq;
|
|||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Mono.Data.Sqlite;
|
using Mono.Data.Sqlite;
|
||||||
|
|
||||||
|
using SabreTools.Library;
|
||||||
using SabreTools.Library.Data;
|
using SabreTools.Library.Data;
|
||||||
using SabreTools.Library.Dats;
|
using SabreTools.Library.Dats;
|
||||||
using SabreTools.Library.Tools;
|
using SabreTools.Library.Tools;
|
||||||
@@ -414,8 +415,7 @@ namespace RombaSharp
|
|||||||
dbc.Open();
|
dbc.Open();
|
||||||
|
|
||||||
// Populate the List from the database
|
// Populate the List from the database
|
||||||
Globals.Logger.User("Populating the list of existing DATs");
|
InternalStopwatch watch = new InternalStopwatch("Populating the list of existing DATs");
|
||||||
DateTime start = DateTime.Now;
|
|
||||||
|
|
||||||
string query = "SELECT DISTINCT hash FROM dat";
|
string query = "SELECT DISTINCT hash FROM dat";
|
||||||
SqliteCommand slc = new SqliteCommand(query, dbc);
|
SqliteCommand slc = new SqliteCommand(query, dbc);
|
||||||
@@ -436,14 +436,13 @@ namespace RombaSharp
|
|||||||
}
|
}
|
||||||
datroot.BucketBy(SortedBy.Game, DedupeType.None, norename: true);
|
datroot.BucketBy(SortedBy.Game, DedupeType.None, norename: true);
|
||||||
|
|
||||||
Globals.Logger.User("Populating complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
|
watch.Stop();
|
||||||
|
|
||||||
slc.Dispose();
|
slc.Dispose();
|
||||||
sldr.Dispose();
|
sldr.Dispose();
|
||||||
|
|
||||||
// Loop through the Dictionary and add all data
|
// Loop through the Dictionary and add all data
|
||||||
Globals.Logger.User("Adding new DAT information");
|
watch.Start("Adding new DAT information");
|
||||||
start = DateTime.Now;
|
|
||||||
foreach (string key in datroot.Keys)
|
foreach (string key in datroot.Keys)
|
||||||
{
|
{
|
||||||
foreach (Rom value in datroot[key])
|
foreach (Rom value in datroot[key])
|
||||||
@@ -452,11 +451,10 @@ namespace RombaSharp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Globals.Logger.User("Adding complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
|
watch.Stop();
|
||||||
|
|
||||||
// Now loop through and remove all references to old Dats
|
// Now loop through and remove all references to old Dats
|
||||||
Globals.Logger.User("Removing unmatched DAT information");
|
watch.Start("Removing unmatched DAT information");
|
||||||
start = DateTime.Now;
|
|
||||||
|
|
||||||
foreach (string dathash in unneeded)
|
foreach (string dathash in unneeded)
|
||||||
{
|
{
|
||||||
@@ -465,7 +463,8 @@ namespace RombaSharp
|
|||||||
slc.ExecuteNonQuery();
|
slc.ExecuteNonQuery();
|
||||||
slc.Dispose();
|
slc.Dispose();
|
||||||
}
|
}
|
||||||
Globals.Logger.User("Removing complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
|
|
||||||
|
watch.Stop();
|
||||||
|
|
||||||
dbc.Dispose();
|
dbc.Dispose();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,8 +108,7 @@ namespace SabreTools.Library.Dats
|
|||||||
string outDir, Filter filter, SplitType splitType, bool trim, bool single, string root)
|
string outDir, Filter filter, SplitType splitType, bool trim, bool single, string root)
|
||||||
{
|
{
|
||||||
DatFile[] datHeaders = new DatFile[inputs.Count];
|
DatFile[] datHeaders = new DatFile[inputs.Count];
|
||||||
DateTime start = DateTime.Now;
|
InternalStopwatch watch = new InternalStopwatch("Processing individual DATs");
|
||||||
Globals.Logger.User("Processing individual DATs");
|
|
||||||
|
|
||||||
// Parse all of the DATs into their own DatFiles in the array
|
// Parse all of the DATs into their own DatFiles in the array
|
||||||
Parallel.For(0, inputs.Count, Globals.ParallelOptions, i =>
|
Parallel.For(0, inputs.Count, Globals.ParallelOptions, i =>
|
||||||
@@ -125,9 +124,9 @@ namespace SabreTools.Library.Dats
|
|||||||
datHeaders[i].Parse(input.Split('¬')[0], i, 0, splitType, keep: true, clean: clean, remUnicode: remUnicode, descAsName: descAsName);
|
datHeaders[i].Parse(input.Split('¬')[0], i, 0, splitType, keep: true, clean: clean, remUnicode: remUnicode, descAsName: descAsName);
|
||||||
});
|
});
|
||||||
|
|
||||||
Globals.Logger.User("Processing complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
|
watch.Stop();
|
||||||
|
|
||||||
Globals.Logger.User("Populating internal DAT");
|
watch.Start("Populating internal DAT");
|
||||||
Parallel.For(0, inputs.Count, Globals.ParallelOptions, i =>
|
Parallel.For(0, inputs.Count, Globals.ParallelOptions, i =>
|
||||||
{
|
{
|
||||||
// Get the list of keys from the DAT
|
// Get the list of keys from the DAT
|
||||||
@@ -148,7 +147,7 @@ namespace SabreTools.Library.Dats
|
|||||||
// Now that we have a merged DAT, filter it
|
// Now that we have a merged DAT, filter it
|
||||||
Filter(filter, single, trim, root);
|
Filter(filter, single, trim, root);
|
||||||
|
|
||||||
Globals.Logger.User("Processing and populating complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
|
watch.Stop();
|
||||||
|
|
||||||
return datHeaders.ToList();
|
return datHeaders.ToList();
|
||||||
}
|
}
|
||||||
@@ -172,8 +171,7 @@ namespace SabreTools.Library.Dats
|
|||||||
bool descAsName, Filter filter, SplitType splitType, bool trim, bool single, string root)
|
bool descAsName, Filter filter, SplitType splitType, bool trim, bool single, string root)
|
||||||
{
|
{
|
||||||
// First we want to parse all of the base DATs into the input
|
// First we want to parse all of the base DATs into the input
|
||||||
DateTime start = DateTime.Now;
|
InternalStopwatch watch = new InternalStopwatch("Populating base DAT for comparison...");
|
||||||
Globals.Logger.User("Populating base DAT for comparison...");
|
|
||||||
|
|
||||||
List<string> baseFileNames = FileTools.GetOnlyFilesFromInputs(basePaths);
|
List<string> baseFileNames = FileTools.GetOnlyFilesFromInputs(basePaths);
|
||||||
Parallel.ForEach(baseFileNames, Globals.ParallelOptions, path =>
|
Parallel.ForEach(baseFileNames, Globals.ParallelOptions, path =>
|
||||||
@@ -181,7 +179,7 @@ namespace SabreTools.Library.Dats
|
|||||||
Parse(path, 0, 0, keep: true, clean: clean, remUnicode: remUnicode, descAsName: descAsName);
|
Parse(path, 0, 0, keep: true, clean: clean, remUnicode: remUnicode, descAsName: descAsName);
|
||||||
});
|
});
|
||||||
|
|
||||||
Globals.Logger.User("Populating base DAT complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
|
watch.Stop();
|
||||||
|
|
||||||
// For comparison's sake, we want to use CRC as the base ordering
|
// For comparison's sake, we want to use CRC as the base ordering
|
||||||
BucketBy(SortedBy.CRC, DedupeType.Full);
|
BucketBy(SortedBy.CRC, DedupeType.Full);
|
||||||
@@ -260,8 +258,7 @@ namespace SabreTools.Library.Dats
|
|||||||
List<DatFile> outDats = new List<DatFile>();
|
List<DatFile> outDats = new List<DatFile>();
|
||||||
|
|
||||||
// Loop through each of the inputs and get or create a new DatData object
|
// Loop through each of the inputs and get or create a new DatData object
|
||||||
DateTime start = DateTime.Now;
|
InternalStopwatch watch = new InternalStopwatch("Initializing all output DATs");
|
||||||
Globals.Logger.User("Initializing all output DATs");
|
|
||||||
|
|
||||||
DatFile[] outDatsArray = new DatFile[inputs.Count];
|
DatFile[] outDatsArray = new DatFile[inputs.Count];
|
||||||
|
|
||||||
@@ -288,11 +285,10 @@ namespace SabreTools.Library.Dats
|
|||||||
});
|
});
|
||||||
|
|
||||||
outDats = outDatsArray.ToList();
|
outDats = outDatsArray.ToList();
|
||||||
Globals.Logger.User("Initializing complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
|
watch.Stop();
|
||||||
|
|
||||||
// Now, loop through the dictionary and populate the correct DATs
|
// Now, loop through the dictionary and populate the correct DATs
|
||||||
start = DateTime.Now;
|
watch.Start("Populating all output DATs");
|
||||||
Globals.Logger.User("Populating all output DATs");
|
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys.ToList();
|
||||||
|
|
||||||
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
||||||
@@ -317,12 +313,11 @@ namespace SabreTools.Library.Dats
|
|||||||
outDats[item.SystemID].Add(key, item);
|
outDats[item.SystemID].Add(key, item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Globals.Logger.User("Populating complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
|
watch.Stop();
|
||||||
|
|
||||||
// Finally, loop through and output each of the DATs
|
// Finally, loop through and output each of the DATs
|
||||||
start = DateTime.Now;
|
watch.Start("Outputting all created DATs");
|
||||||
Globals.Logger.User("Outputting all created DATs");
|
|
||||||
|
|
||||||
Parallel.For((skip ? 1 : 0), inputs.Count, Globals.ParallelOptions, j =>
|
Parallel.For((skip ? 1 : 0), inputs.Count, Globals.ParallelOptions, j =>
|
||||||
{
|
{
|
||||||
@@ -344,7 +339,7 @@ namespace SabreTools.Library.Dats
|
|||||||
outDats[j].WriteToFile(path);
|
outDats[j].WriteToFile(path);
|
||||||
});
|
});
|
||||||
|
|
||||||
Globals.Logger.User("Outputting complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
|
watch.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -355,8 +350,7 @@ namespace SabreTools.Library.Dats
|
|||||||
/// <param name="inputs">List of inputs to write out from</param>
|
/// <param name="inputs">List of inputs to write out from</param>
|
||||||
public void DiffNoCascade(DiffMode diff, string outDir, List<string> inputs)
|
public void DiffNoCascade(DiffMode diff, string outDir, List<string> inputs)
|
||||||
{
|
{
|
||||||
DateTime start = DateTime.Now;
|
InternalStopwatch watch = new InternalStopwatch("Initializing all output DATs");
|
||||||
Globals.Logger.User("Initializing all output DATs");
|
|
||||||
|
|
||||||
// Default vars for use
|
// Default vars for use
|
||||||
string post = "";
|
string post = "";
|
||||||
@@ -420,11 +414,11 @@ namespace SabreTools.Library.Dats
|
|||||||
|
|
||||||
outDats = outDatsArray.ToList();
|
outDats = outDatsArray.ToList();
|
||||||
}
|
}
|
||||||
Globals.Logger.User("Initializing complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
|
|
||||||
|
watch.Stop();
|
||||||
|
|
||||||
// Now, loop through the dictionary and populate the correct DATs
|
// Now, loop through the dictionary and populate the correct DATs
|
||||||
start = DateTime.Now;
|
watch.Start("Populating all output DATs");
|
||||||
Globals.Logger.User("Populating all output DATs");
|
|
||||||
|
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys.ToList();
|
||||||
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
||||||
@@ -476,11 +470,10 @@ namespace SabreTools.Library.Dats
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Globals.Logger.User("Populating complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
|
watch.Stop();
|
||||||
|
|
||||||
// Finally, loop through and output each of the DATs
|
// Finally, loop through and output each of the DATs
|
||||||
start = DateTime.Now;
|
watch.Start("Outputting all created DATs");
|
||||||
Globals.Logger.User("Outputting all created DATs");
|
|
||||||
|
|
||||||
// Output the difflist (a-b)+(b-a) diff
|
// Output the difflist (a-b)+(b-a) diff
|
||||||
if ((diff & DiffMode.NoDupes) != 0)
|
if ((diff & DiffMode.NoDupes) != 0)
|
||||||
@@ -510,7 +503,8 @@ namespace SabreTools.Library.Dats
|
|||||||
outDats[j].WriteToFile(path);
|
outDats[j].WriteToFile(path);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Globals.Logger.User("Outputting complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
|
|
||||||
|
watch.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1038,7 +1038,7 @@ namespace SabreTools.Library.Dats
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion // Instance Methods
|
#endregion // Instance Methods
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,34 +97,36 @@ namespace SabreTools.Library.Dats
|
|||||||
|
|
||||||
#region Rebuild from depots in order
|
#region Rebuild from depots in order
|
||||||
|
|
||||||
|
string format = "";
|
||||||
switch (outputFormat)
|
switch (outputFormat)
|
||||||
{
|
{
|
||||||
case OutputFormat.Folder:
|
case OutputFormat.Folder:
|
||||||
Globals.Logger.User("Rebuilding all files to directory");
|
format = "directory";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.TapeArchive:
|
case OutputFormat.TapeArchive:
|
||||||
Globals.Logger.User("Rebuilding all files to TAR");
|
format = "TAR";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.Torrent7Zip:
|
case OutputFormat.Torrent7Zip:
|
||||||
Globals.Logger.User("Rebuilding all files to Torrent7Z");
|
format = "Torrent7Z";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.TorrentGzip:
|
case OutputFormat.TorrentGzip:
|
||||||
Globals.Logger.User("Rebuilding all files to TorrentGZ");
|
format = "TorrentGZ";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.TorrentLrzip:
|
case OutputFormat.TorrentLrzip:
|
||||||
Globals.Logger.User("Rebuilding all files to TorrentLRZ");
|
format = "TorrentLRZ";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.TorrentRar:
|
case OutputFormat.TorrentRar:
|
||||||
Globals.Logger.User("Rebuilding all files to TorrentRAR");
|
format = "TorrentRAR";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.TorrentXZ:
|
case OutputFormat.TorrentXZ:
|
||||||
Globals.Logger.User("Rebuilding all files to TorrentXZ");
|
format = "TorrentXZ";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.TorrentZip:
|
case OutputFormat.TorrentZip:
|
||||||
Globals.Logger.User("Rebuilding all files to TorrentZip");
|
format = "TorrentZip";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DateTime start = DateTime.Now;
|
|
||||||
|
InternalStopwatch watch = new InternalStopwatch("Rebuilding all files to {0}", format);
|
||||||
|
|
||||||
// Now loop through and get only directories from the input paths
|
// Now loop through and get only directories from the input paths
|
||||||
List<string> directories = new List<string>();
|
List<string> directories = new List<string>();
|
||||||
@@ -196,7 +198,7 @@ namespace SabreTools.Library.Dats
|
|||||||
updateDat, false /* isZip */, headerToCheckAgainst);
|
updateDat, false /* isZip */, headerToCheckAgainst);
|
||||||
}
|
}
|
||||||
|
|
||||||
Globals.Logger.User("Rebuilding complete in: {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
|
watch.Stop();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -287,34 +289,36 @@ namespace SabreTools.Library.Dats
|
|||||||
|
|
||||||
#region Rebuild from sources in order
|
#region Rebuild from sources in order
|
||||||
|
|
||||||
|
string format = "";
|
||||||
switch (outputFormat)
|
switch (outputFormat)
|
||||||
{
|
{
|
||||||
case OutputFormat.Folder:
|
case OutputFormat.Folder:
|
||||||
Globals.Logger.User("Rebuilding all files to directory");
|
format = "directory";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.TapeArchive:
|
case OutputFormat.TapeArchive:
|
||||||
Globals.Logger.User("Rebuilding all files to TAR");
|
format = "TAR";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.Torrent7Zip:
|
case OutputFormat.Torrent7Zip:
|
||||||
Globals.Logger.User("Rebuilding all files to Torrent7Z");
|
format = "Torrent7Z";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.TorrentGzip:
|
case OutputFormat.TorrentGzip:
|
||||||
Globals.Logger.User("Rebuilding all files to TorrentGZ");
|
format = "TorrentGZ";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.TorrentLrzip:
|
case OutputFormat.TorrentLrzip:
|
||||||
Globals.Logger.User("Rebuilding all files to TorrentLRZ");
|
format = "TorrentLRZ";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.TorrentRar:
|
case OutputFormat.TorrentRar:
|
||||||
Globals.Logger.User("Rebuilding all files to TorrentRAR");
|
format = "TorrentRAR";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.TorrentXZ:
|
case OutputFormat.TorrentXZ:
|
||||||
Globals.Logger.User("Rebuilding all files to TorrentXZ");
|
format = "TorrentXZ";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.TorrentZip:
|
case OutputFormat.TorrentZip:
|
||||||
Globals.Logger.User("Rebuilding all files to TorrentZip");
|
format = "TorrentZip";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DateTime start = DateTime.Now;
|
|
||||||
|
InternalStopwatch watch = new InternalStopwatch("Rebuilding all files to {0}", format);
|
||||||
|
|
||||||
// Now loop through all of the files in all of the inputs
|
// Now loop through all of the files in all of the inputs
|
||||||
foreach (string input in inputs)
|
foreach (string input in inputs)
|
||||||
@@ -340,7 +344,7 @@ namespace SabreTools.Library.Dats
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Globals.Logger.User("Rebuilding complete in: {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
|
watch.Stop();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -862,8 +866,7 @@ namespace SabreTools.Library.Dats
|
|||||||
|
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
Globals.Logger.User("Verifying all from supplied depots");
|
InternalStopwatch watch = new InternalStopwatch("Verifying all from supplied depots");
|
||||||
DateTime start = DateTime.Now;
|
|
||||||
|
|
||||||
// Now loop through and get only directories from the input paths
|
// Now loop through and get only directories from the input paths
|
||||||
List<string> directories = new List<string>();
|
List<string> directories = new List<string>();
|
||||||
@@ -931,7 +934,7 @@ namespace SabreTools.Library.Dats
|
|||||||
fileinfo.GetDuplicates(this, remove: true);
|
fileinfo.GetDuplicates(this, remove: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Globals.Logger.User("Verifying complete in: {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
|
watch.Stop();
|
||||||
|
|
||||||
// If there are any entries in the DAT, output to the rebuild directory
|
// If there are any entries in the DAT, output to the rebuild directory
|
||||||
_fileName = "fixDAT_" + _fileName;
|
_fileName = "fixDAT_" + _fileName;
|
||||||
|
|||||||
82
SabreTools.Library/InternalStopwatch.cs
Normal file
82
SabreTools.Library/InternalStopwatch.cs
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
using SabreTools.Library.Data;
|
||||||
|
|
||||||
|
namespace SabreTools.Library
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Stopwatch class for keeping track of duration in the code
|
||||||
|
/// </summary>
|
||||||
|
public class InternalStopwatch
|
||||||
|
{
|
||||||
|
private string _subject;
|
||||||
|
private DateTime _startTime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor that initalizes the stopwatch
|
||||||
|
/// </summary>
|
||||||
|
public InternalStopwatch()
|
||||||
|
{
|
||||||
|
_subject = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor that initalizes the stopwatch with a subject and starts immediately
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="subject">Subject of the stopwatch</param>
|
||||||
|
public InternalStopwatch(string subject)
|
||||||
|
{
|
||||||
|
_subject = subject;
|
||||||
|
Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor that initalizes the stopwatch with a subject and starts immediately
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="subject">Subject of the stopwatch</param>
|
||||||
|
/// <param name="more">Parameters to format the string</param>
|
||||||
|
public InternalStopwatch(string subject, params object[] more)
|
||||||
|
{
|
||||||
|
_subject = string.Format(subject, more);
|
||||||
|
Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Start the stopwatch and display subject text
|
||||||
|
/// </summary>
|
||||||
|
public void Start()
|
||||||
|
{
|
||||||
|
_startTime = DateTime.Now;
|
||||||
|
Globals.Logger.User("{0}...", _subject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Start the stopwatch and display subject text
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="subject">Text to show on stopwatch start</param>
|
||||||
|
public void Start(string subject)
|
||||||
|
{
|
||||||
|
_subject = subject;
|
||||||
|
Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Start the stopwatch and display subject text
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="subject">Text to show on stopwatch start</param>
|
||||||
|
/// <param name="more">Parameters to format the string</param>
|
||||||
|
public void Start(string subject, params object[] more)
|
||||||
|
{
|
||||||
|
_subject = string.Format(subject, more);
|
||||||
|
Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// End the stopwatch and display subject text
|
||||||
|
/// </summary>
|
||||||
|
public void Stop()
|
||||||
|
{
|
||||||
|
Globals.Logger.User("{0} completed in {1}", _subject, DateTime.Now.Subtract(_startTime).ToString(@"hh\:mm\:ss\.fffff"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -159,6 +159,7 @@
|
|||||||
<Compile Include="Help\Help.cs" />
|
<Compile Include="Help\Help.cs" />
|
||||||
<Compile Include="Skippers\Skipper.cs" />
|
<Compile Include="Skippers\Skipper.cs" />
|
||||||
<Compile Include="Skippers\SkipperRule.cs" />
|
<Compile Include="Skippers\SkipperRule.cs" />
|
||||||
|
<Compile Include="InternalStopwatch.cs" />
|
||||||
<Compile Include="Tools\ArchiveTools.cs" />
|
<Compile Include="Tools\ArchiveTools.cs" />
|
||||||
<Compile Include="Tools\FileTools.cs" />
|
<Compile Include="Tools\FileTools.cs" />
|
||||||
<Compile Include="Tools\DatabaseTools.cs" />
|
<Compile Include="Tools\DatabaseTools.cs" />
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
using SabreTools.Library;
|
||||||
using SabreTools.Library.Data;
|
using SabreTools.Library.Data;
|
||||||
using SabreTools.Library.Dats;
|
using SabreTools.Library.Dats;
|
||||||
using SabreTools.Library.Tools;
|
using SabreTools.Library.Tools;
|
||||||
@@ -340,8 +341,7 @@ namespace SabreTools
|
|||||||
// Get a list of files from the input datfiles
|
// Get a list of files from the input datfiles
|
||||||
datfiles = FileTools.GetOnlyFilesFromInputs(datfiles);
|
datfiles = FileTools.GetOnlyFilesFromInputs(datfiles);
|
||||||
|
|
||||||
DateTime start = DateTime.Now;
|
InternalStopwatch watch = new InternalStopwatch("Populating internal DAT");
|
||||||
Globals.Logger.User("Populating internal DAT...");
|
|
||||||
|
|
||||||
// Add all of the input DATs into one huge internal DAT
|
// Add all of the input DATs into one huge internal DAT
|
||||||
DatFile datdata = new DatFile();
|
DatFile datdata = new DatFile();
|
||||||
@@ -349,7 +349,8 @@ namespace SabreTools
|
|||||||
{
|
{
|
||||||
datdata.Parse(datfile, 99, 99, splitType, keep: true, useTags: true);
|
datdata.Parse(datfile, 99, 99, splitType, keep: true, useTags: true);
|
||||||
}
|
}
|
||||||
Globals.Logger.User("Populating complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
|
|
||||||
|
watch.Stop();
|
||||||
|
|
||||||
datdata.RebuildGeneric(inputs, outDir, tempDir, quickScan, date, delete, inverse, outputFormat, romba, asl,
|
datdata.RebuildGeneric(inputs, outDir, tempDir, quickScan, date, delete, inverse, outputFormat, romba, asl,
|
||||||
updateDat, headerToCheckAgainst);
|
updateDat, headerToCheckAgainst);
|
||||||
@@ -373,8 +374,7 @@ namespace SabreTools
|
|||||||
private static void InitSortDepot(List<string> datfiles, List<string> inputs, string outDir, string tempDir, bool date, bool delete,
|
private static void InitSortDepot(List<string> datfiles, List<string> inputs, string outDir, string tempDir, bool date, bool delete,
|
||||||
bool inverse, OutputFormat outputFormat, bool romba, bool updateDat, string headerToCheckAgainst, SplitType splitType)
|
bool inverse, OutputFormat outputFormat, bool romba, bool updateDat, string headerToCheckAgainst, SplitType splitType)
|
||||||
{
|
{
|
||||||
DateTime start = DateTime.Now;
|
InternalStopwatch watch = new InternalStopwatch("Populating internal DAT");
|
||||||
Globals.Logger.User("Populating internal DAT...");
|
|
||||||
|
|
||||||
// Get a list of files from the input datfiles
|
// Get a list of files from the input datfiles
|
||||||
datfiles = FileTools.GetOnlyFilesFromInputs(datfiles);
|
datfiles = FileTools.GetOnlyFilesFromInputs(datfiles);
|
||||||
@@ -385,7 +385,8 @@ namespace SabreTools
|
|||||||
{
|
{
|
||||||
datdata.Parse(datfile, 99, 99, splitType, keep: true, useTags: true);
|
datdata.Parse(datfile, 99, 99, splitType, keep: true, useTags: true);
|
||||||
}
|
}
|
||||||
Globals.Logger.User("Populating complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
|
|
||||||
|
watch.Stop();
|
||||||
|
|
||||||
datdata.RebuildDepot(inputs, outDir, tempDir, date, delete, inverse, outputFormat, romba,
|
datdata.RebuildDepot(inputs, outDir, tempDir, date, delete, inverse, outputFormat, romba,
|
||||||
updateDat, headerToCheckAgainst);
|
updateDat, headerToCheckAgainst);
|
||||||
@@ -749,8 +750,7 @@ namespace SabreTools
|
|||||||
// Get a list of files from the input datfiles
|
// Get a list of files from the input datfiles
|
||||||
datfiles = FileTools.GetOnlyFilesFromInputs(datfiles);
|
datfiles = FileTools.GetOnlyFilesFromInputs(datfiles);
|
||||||
|
|
||||||
DateTime start = DateTime.Now;
|
InternalStopwatch watch = new InternalStopwatch("Populating internal DAT");
|
||||||
Globals.Logger.User("Populating internal DAT...");
|
|
||||||
|
|
||||||
// Add all of the input DATs into one huge internal DAT
|
// Add all of the input DATs into one huge internal DAT
|
||||||
DatFile datdata = new DatFile();
|
DatFile datdata = new DatFile();
|
||||||
@@ -758,7 +758,8 @@ namespace SabreTools
|
|||||||
{
|
{
|
||||||
datdata.Parse(datfile, 99, 99, splitType, keep: true, useTags: true);
|
datdata.Parse(datfile, 99, 99, splitType, keep: true, useTags: true);
|
||||||
}
|
}
|
||||||
Globals.Logger.User("Populating complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
|
|
||||||
|
watch.Stop();
|
||||||
|
|
||||||
datdata.VerifyGeneric(inputs, tempDir, hashOnly, quickScan, headerToCheckAgainst);
|
datdata.VerifyGeneric(inputs, tempDir, hashOnly, quickScan, headerToCheckAgainst);
|
||||||
}
|
}
|
||||||
@@ -774,8 +775,7 @@ namespace SabreTools
|
|||||||
private static void InitVerifyDepot(List<string> datfiles, List<string> inputs, string tempDir,
|
private static void InitVerifyDepot(List<string> datfiles, List<string> inputs, string tempDir,
|
||||||
string headerToCheckAgainst, SplitType splitType)
|
string headerToCheckAgainst, SplitType splitType)
|
||||||
{
|
{
|
||||||
DateTime start = DateTime.Now;
|
InternalStopwatch watch = new InternalStopwatch("Populating internal DAT");
|
||||||
Globals.Logger.User("Populating internal DAT...");
|
|
||||||
|
|
||||||
// Get a list of files from the input datfiles
|
// Get a list of files from the input datfiles
|
||||||
datfiles = FileTools.GetOnlyFilesFromInputs(datfiles);
|
datfiles = FileTools.GetOnlyFilesFromInputs(datfiles);
|
||||||
@@ -786,7 +786,8 @@ namespace SabreTools
|
|||||||
{
|
{
|
||||||
datdata.Parse(datfile, 99, 99, splitType, keep: true, useTags: true);
|
datdata.Parse(datfile, 99, 99, splitType, keep: true, useTags: true);
|
||||||
}
|
}
|
||||||
Globals.Logger.User("Populating complete in {0}", DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
|
|
||||||
|
watch.Stop();
|
||||||
|
|
||||||
datdata.VerifyDepot(inputs, tempDir, headerToCheckAgainst);
|
datdata.VerifyDepot(inputs, tempDir, headerToCheckAgainst);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user