[Data/] Un-tab-ify

This commit is contained in:
Matt Nadareski
2019-02-08 20:32:49 -08:00
parent eee15bbc32
commit f04842851a
3 changed files with 657 additions and 657 deletions

View File

@@ -2,61 +2,61 @@
namespace SabreTools.Library.Data namespace SabreTools.Library.Data
{ {
/// <summary> /// <summary>
/// Generic console preparation for program output /// Generic console preparation for program output
/// </summary> /// </summary>
public static class Build public static class Build
{ {
/// <summary> /// <summary>
/// Returns true if running in a Mono environment /// Returns true if running in a Mono environment
/// </summary> /// </summary>
public static bool MonoEnvironment public static bool MonoEnvironment
{ {
get { return (Type.GetType("Mono.Runtime") != null); } get { return (Type.GetType("Mono.Runtime") != null); }
} }
/// <summary> /// <summary>
/// Readies the console and outputs the header /// Readies the console and outputs the header
/// </summary> /// </summary>
/// <param name="name">The name to be displayed as the program</param>B /// <param name="name">The name to be displayed as the program</param>B
public static void PrepareConsole(string name) public static void PrepareConsole(string name)
{ {
// Dynamically create the header string, adapted from http://stackoverflow.com/questions/8200661/how-to-align-string-in-fixed-length-string // Dynamically create the header string, adapted from http://stackoverflow.com/questions/8200661/how-to-align-string-in-fixed-length-string
int width = Console.WindowWidth - 3; int width = Console.WindowWidth - 3;
string border = "+" + new string('-', width) + "+"; string border = "+" + new string('-', width) + "+";
string mid = name + " " + Constants.Version; string mid = name + " " + Constants.Version;
mid = "|" + mid.PadLeft(((width - mid.Length) / 2) + mid.Length).PadRight(width) + "|"; mid = "|" + mid.PadLeft(((width - mid.Length) / 2) + mid.Length).PadRight(width) + "|";
// If we're outputting to console, do fancy things // If we're outputting to console, do fancy things
if (!Console.IsOutputRedirected) if (!Console.IsOutputRedirected)
{ {
// Set the console to ready state // Set the console to ready state
ConsoleColor formertext = ConsoleColor.White; ConsoleColor formertext = ConsoleColor.White;
ConsoleColor formerback = ConsoleColor.Black; ConsoleColor formerback = ConsoleColor.Black;
if (!MonoEnvironment) if (!MonoEnvironment)
{ {
Console.SetBufferSize(Console.BufferWidth, 999); Console.SetBufferSize(Console.BufferWidth, 999);
formertext = Console.ForegroundColor; formertext = Console.ForegroundColor;
formerback = Console.BackgroundColor; formerback = Console.BackgroundColor;
Console.ForegroundColor = ConsoleColor.Yellow; Console.ForegroundColor = ConsoleColor.Yellow;
Console.BackgroundColor = ConsoleColor.Blue; Console.BackgroundColor = ConsoleColor.Blue;
} }
Console.Title = name + " " + Constants.Version; Console.Title = name + " " + Constants.Version;
// Output the header // Output the header
Console.WriteLine(border); Console.WriteLine(border);
Console.WriteLine(mid); Console.WriteLine(mid);
Console.WriteLine(border); Console.WriteLine(border);
Console.WriteLine(); Console.WriteLine();
// Return the console to the original text and background colors // Return the console to the original text and background colors
if (!MonoEnvironment) if (!MonoEnvironment)
{ {
Console.ForegroundColor = formertext; Console.ForegroundColor = formertext;
Console.BackgroundColor = formerback; Console.BackgroundColor = formerback;
} }
} }
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -12,72 +12,72 @@ using Alphaleonis.Win32.Filesystem;
namespace SabreTools.Library.Data namespace SabreTools.Library.Data
{ {
/// <summary> /// <summary>
/// Globally-accessible objects for the library /// Globally-accessible objects for the library
/// </summary> /// </summary>
public class Globals public class Globals
{ {
#region Private implementations #region Private implementations
private static Logger _logger = null; private static Logger _logger = null;
private static int _maxDegreeOfParallelism = System.Environment.ProcessorCount; private static int _maxDegreeOfParallelism = System.Environment.ProcessorCount;
private static string _exeName = new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase).LocalPath; private static string _exeName = new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase).LocalPath;
private static string _exeDir = Path.GetDirectoryName(_exeName); private static string _exeDir = Path.GetDirectoryName(_exeName);
private static string _args = string.Join(" ", Environment.GetCommandLineArgs()); private static string _args = string.Join(" ", Environment.GetCommandLineArgs());
#endregion #endregion
#region Public accessors #region Public accessors
public static Logger Logger public static Logger Logger
{ {
get get
{ {
if (_logger == null) if (_logger == null)
{ {
_logger = new Logger(); _logger = new Logger();
} }
return _logger; return _logger;
} }
set { _logger = value; } set { _logger = value; }
} }
public static int MaxThreads public static int MaxThreads
{ {
get { return _maxDegreeOfParallelism; } get { return _maxDegreeOfParallelism; }
set { _maxDegreeOfParallelism = value; } set { _maxDegreeOfParallelism = value; }
} }
public static ParallelOptions ParallelOptions public static ParallelOptions ParallelOptions
{ {
get get
{ {
return new ParallelOptions() return new ParallelOptions()
{ {
MaxDegreeOfParallelism = _maxDegreeOfParallelism MaxDegreeOfParallelism = _maxDegreeOfParallelism
}; };
} }
} }
public static string ExeName public static string ExeName
{ {
get get
{ {
return _exeName; return _exeName;
} }
} }
public static string ExeDir public static string ExeDir
{ {
get get
{ {
return _exeDir; return _exeDir;
} }
} }
public static string CommandLineArgs public static string CommandLineArgs
{ {
get get
{ {
return _args; return _args;
} }
} }
#endregion #endregion
} }
} }