mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Cleanup and overhaul (#21)
* Syntax cleanup * More minor cleanup, use Linq * Fix broken features by using correct values * Feature flags the same * Features are modular * No AlphaFS, more .NET versions * Fix appveyor * Put back identifiers, for some reason * String interpolation, modernization * Better use of GetField * XmlTextWriter to remove possible issues * Fix header for OpenMSX
This commit is contained in:
@@ -17,7 +17,7 @@ namespace SabreTools.Library.Tools
|
||||
/// </summary>
|
||||
public InternalStopwatch()
|
||||
{
|
||||
_subject = "";
|
||||
_subject = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -30,24 +30,13 @@ namespace SabreTools.Library.Tools
|
||||
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);
|
||||
Globals.Logger.User($"{_subject}...");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -60,23 +49,12 @@ namespace SabreTools.Library.Tools
|
||||
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"));
|
||||
Globals.Logger.User($"{_subject} completed in {DateTime.Now.Subtract(_startTime).ToString("hh:mm:ss.fffff")}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user