2017-03-30 23:39:38 -07:00
|
|
|
|
using System;
|
|
|
|
|
|
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-03-29 12:49:34 -07:00
|
|
|
|
#if MONO
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
#else
|
|
|
|
|
|
using Alphaleonis.Win32.Filesystem;
|
|
|
|
|
|
#endif
|
2017-03-14 20:28:23 -07:00
|
|
|
|
|
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;
|
|
|
|
|
|
private static int _maxDegreeOfParallelism = System.Environment.ProcessorCount;
|
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();
|
|
|
|
|
|
}
|
|
|
|
|
|
return _logger;
|
|
|
|
|
|
}
|
|
|
|
|
|
set { _logger = value; }
|
|
|
|
|
|
}
|
2020-04-03 13:19:21 -07:00
|
|
|
|
|
2019-02-08 20:32:49 -08:00
|
|
|
|
public static int MaxThreads
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return _maxDegreeOfParallelism; }
|
|
|
|
|
|
set { _maxDegreeOfParallelism = value; }
|
|
|
|
|
|
}
|
2020-04-03 13:19:21 -07:00
|
|
|
|
|
2019-02-08 20:32:49 -08:00
|
|
|
|
public static ParallelOptions ParallelOptions
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return new ParallelOptions()
|
|
|
|
|
|
{
|
|
|
|
|
|
MaxDegreeOfParallelism = _maxDegreeOfParallelism
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-04-03 13:19:21 -07:00
|
|
|
|
|
2019-02-08 20:32:49 -08:00
|
|
|
|
public static string ExeName
|
|
|
|
|
|
{
|
2020-04-03 13:19:21 -07:00
|
|
|
|
get { return new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase).LocalPath; }
|
2019-02-08 20:32:49 -08:00
|
|
|
|
}
|
2020-04-03 13:19:21 -07:00
|
|
|
|
|
2019-02-08 20:32:49 -08:00
|
|
|
|
public static string ExeDir
|
|
|
|
|
|
{
|
2020-04-03 13:19:21 -07:00
|
|
|
|
get { return Path.GetDirectoryName(ExeName); }
|
2019-02-08 20:32:49 -08:00
|
|
|
|
}
|
2020-04-03 13:19:21 -07:00
|
|
|
|
|
2019-02-08 20:32:49 -08:00
|
|
|
|
public static string CommandLineArgs
|
|
|
|
|
|
{
|
2020-04-03 13:19:21 -07:00
|
|
|
|
get { return string.Join(" ", Environment.GetCommandLineArgs()); }
|
2019-02-08 20:32:49 -08:00
|
|
|
|
}
|
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
|
|
|
|
}
|