2017-03-30 23:39:38 -07:00
|
|
|
|
using System;
|
2020-06-10 22:37:19 -07:00
|
|
|
|
using System.IO;
|
2017-03-30 23:39:38 -07:00
|
|
|
|
using System.Reflection;
|
2017-03-29 12:49:34 -07:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
2017-10-06 20:46:43 -07:00
|
|
|
|
using SabreTools.Library.Tools;
|
|
|
|
|
|
|
2017-05-04 02:41:11 -07:00
|
|
|
|
namespace SabreTools.Library.Data
|
2017-03-01 21:26:27 -08:00
|
|
|
|
{
|
2019-02-08 20:32:49 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Globally-accessible objects for the library
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class Globals
|
|
|
|
|
|
{
|
|
|
|
|
|
#region Private implementations
|
2017-03-01 21:26:27 -08:00
|
|
|
|
|
2019-02-08 20:32:49 -08:00
|
|
|
|
private static Logger _logger = null;
|
2017-03-01 21:26:27 -08:00
|
|
|
|
|
2019-02-08 20:32:49 -08:00
|
|
|
|
#endregion
|
2017-03-01 21:26:27 -08:00
|
|
|
|
|
2019-02-08 20:32:49 -08:00
|
|
|
|
#region Public accessors
|
2017-03-01 21:26:27 -08:00
|
|
|
|
|
2019-02-08 20:32:49 -08:00
|
|
|
|
public static Logger Logger
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_logger == null)
|
|
|
|
|
|
_logger = new Logger();
|
2020-06-10 22:37:19 -07:00
|
|
|
|
|
2019-02-08 20:32:49 -08:00
|
|
|
|
return _logger;
|
|
|
|
|
|
}
|
|
|
|
|
|
set { _logger = value; }
|
|
|
|
|
|
}
|
2020-04-03 13:19:21 -07:00
|
|
|
|
|
2020-07-19 21:59:34 -07:00
|
|
|
|
public static int MaxThreads { get; set; } = Environment.ProcessorCount;
|
2020-04-03 13:19:21 -07:00
|
|
|
|
|
2020-07-19 21:59:34 -07:00
|
|
|
|
public static ParallelOptions ParallelOptions => new ParallelOptions()
|
2019-02-08 20:32:49 -08:00
|
|
|
|
{
|
2020-07-19 21:59:34 -07:00
|
|
|
|
MaxDegreeOfParallelism = MaxThreads
|
|
|
|
|
|
};
|
2020-04-03 13:19:21 -07:00
|
|
|
|
|
2020-07-19 21:59:34 -07:00
|
|
|
|
public static string ExeName => new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase).LocalPath;
|
2020-04-03 13:19:21 -07:00
|
|
|
|
|
2020-07-19 21:59:34 -07:00
|
|
|
|
public static string ExeDir => Path.GetDirectoryName(ExeName);
|
2020-04-03 13:19:21 -07:00
|
|
|
|
|
2020-07-19 21:59:34 -07:00
|
|
|
|
public static string CommandLineArgs => string.Join(" ", Environment.GetCommandLineArgs());
|
2017-03-01 21:26:27 -08:00
|
|
|
|
|
2019-02-08 20:32:49 -08:00
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
2017-03-01 21:26:27 -08:00
|
|
|
|
}
|