[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
{
/// <summary>
/// Generic console preparation for program output
/// </summary>
public static class Build
{
/// <summary>
/// Returns true if running in a Mono environment
/// </summary>
public static bool MonoEnvironment
{
get { return (Type.GetType("Mono.Runtime") != null); }
}
/// <summary>
/// Generic console preparation for program output
/// </summary>
public static class Build
{
/// <summary>
/// Returns true if running in a Mono environment
/// </summary>
public static bool MonoEnvironment
{
get { return (Type.GetType("Mono.Runtime") != null); }
}
/// <summary>
/// Readies the console and outputs the header
/// </summary>
/// <param name="name">The name to be displayed as the program</param>B
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
int width = Console.WindowWidth - 3;
string border = "+" + new string('-', width) + "+";
string mid = name + " " + Constants.Version;
mid = "|" + mid.PadLeft(((width - mid.Length) / 2) + mid.Length).PadRight(width) + "|";
/// <summary>
/// Readies the console and outputs the header
/// </summary>
/// <param name="name">The name to be displayed as the program</param>B
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
int width = Console.WindowWidth - 3;
string border = "+" + new string('-', width) + "+";
string mid = name + " " + Constants.Version;
mid = "|" + mid.PadLeft(((width - mid.Length) / 2) + mid.Length).PadRight(width) + "|";
// If we're outputting to console, do fancy things
if (!Console.IsOutputRedirected)
{
// Set the console to ready state
ConsoleColor formertext = ConsoleColor.White;
ConsoleColor formerback = ConsoleColor.Black;
if (!MonoEnvironment)
{
Console.SetBufferSize(Console.BufferWidth, 999);
formertext = Console.ForegroundColor;
formerback = Console.BackgroundColor;
Console.ForegroundColor = ConsoleColor.Yellow;
Console.BackgroundColor = ConsoleColor.Blue;
}
// If we're outputting to console, do fancy things
if (!Console.IsOutputRedirected)
{
// Set the console to ready state
ConsoleColor formertext = ConsoleColor.White;
ConsoleColor formerback = ConsoleColor.Black;
if (!MonoEnvironment)
{
Console.SetBufferSize(Console.BufferWidth, 999);
formertext = Console.ForegroundColor;
formerback = Console.BackgroundColor;
Console.ForegroundColor = ConsoleColor.Yellow;
Console.BackgroundColor = ConsoleColor.Blue;
}
Console.Title = name + " " + Constants.Version;
Console.Title = name + " " + Constants.Version;
// Output the header
Console.WriteLine(border);
Console.WriteLine(mid);
Console.WriteLine(border);
Console.WriteLine();
// Output the header
Console.WriteLine(border);
Console.WriteLine(mid);
Console.WriteLine(border);
Console.WriteLine();
// Return the console to the original text and background colors
if (!MonoEnvironment)
{
Console.ForegroundColor = formertext;
Console.BackgroundColor = formerback;
}
}
}
}
// Return the console to the original text and background colors
if (!MonoEnvironment)
{
Console.ForegroundColor = formertext;
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
{
/// <summary>
/// Globally-accessible objects for the library
/// </summary>
public class Globals
{
#region Private implementations
/// <summary>
/// Globally-accessible objects for the library
/// </summary>
public class Globals
{
#region Private implementations
private static Logger _logger = null;
private static int _maxDegreeOfParallelism = System.Environment.ProcessorCount;
private static string _exeName = new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase).LocalPath;
private static string _exeDir = Path.GetDirectoryName(_exeName);
private static string _args = string.Join(" ", Environment.GetCommandLineArgs());
private static Logger _logger = null;
private static int _maxDegreeOfParallelism = System.Environment.ProcessorCount;
private static string _exeName = new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase).LocalPath;
private static string _exeDir = Path.GetDirectoryName(_exeName);
private static string _args = string.Join(" ", Environment.GetCommandLineArgs());
#endregion
#endregion
#region Public accessors
#region Public accessors
public static Logger Logger
{
get
{
if (_logger == null)
{
_logger = new Logger();
}
return _logger;
}
set { _logger = value; }
}
public static int MaxThreads
{
get { return _maxDegreeOfParallelism; }
set { _maxDegreeOfParallelism = value; }
}
public static ParallelOptions ParallelOptions
{
get
{
return new ParallelOptions()
{
MaxDegreeOfParallelism = _maxDegreeOfParallelism
};
}
}
public static string ExeName
{
get
{
return _exeName;
}
}
public static string ExeDir
{
get
{
return _exeDir;
}
}
public static string CommandLineArgs
{
get
{
return _args;
}
}
public static Logger Logger
{
get
{
if (_logger == null)
{
_logger = new Logger();
}
return _logger;
}
set { _logger = value; }
}
public static int MaxThreads
{
get { return _maxDegreeOfParallelism; }
set { _maxDegreeOfParallelism = value; }
}
public static ParallelOptions ParallelOptions
{
get
{
return new ParallelOptions()
{
MaxDegreeOfParallelism = _maxDegreeOfParallelism
};
}
}
public static string ExeName
{
get
{
return _exeName;
}
}
public static string ExeDir
{
get
{
return _exeDir;
}
}
public static string CommandLineArgs
{
get
{
return _args;
}
}
#endregion
}
#endregion
}
}