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;
|
|
|
|
|
|
|
|
|
|
|
|
#if MONO
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
#else
|
|
|
|
|
|
using Alphaleonis.Win32.Filesystem;
|
|
|
|
|
|
#endif
|
2017-03-14 20:28:23 -07:00
|
|
|
|
|
|
|
|
|
|
namespace SabreTools.Helper.Data
|
2017-03-01 21:26:27 -08:00
|
|
|
|
{
|
|
|
|
|
|
public class Globals
|
|
|
|
|
|
{
|
|
|
|
|
|
#region Private implementations
|
|
|
|
|
|
|
|
|
|
|
|
private static Logger _logger = null;
|
|
|
|
|
|
private static int _maxDegreeOfParallelism = 4;
|
2017-03-30 23:39:38 -07:00
|
|
|
|
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());
|
2017-03-01 21:26:27 -08:00
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Public accessors
|
|
|
|
|
|
|
|
|
|
|
|
public static Logger Logger
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_logger == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_logger = new Logger();
|
|
|
|
|
|
}
|
|
|
|
|
|
return _logger;
|
|
|
|
|
|
}
|
|
|
|
|
|
set { _logger = value; }
|
|
|
|
|
|
}
|
|
|
|
|
|
public static int MaxDegreeOfParallelism
|
|
|
|
|
|
{
|
|
|
|
|
|
set { _maxDegreeOfParallelism = value; }
|
|
|
|
|
|
}
|
2017-03-14 20:28:23 -07:00
|
|
|
|
public static ParallelOptions ParallelOptions
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return new ParallelOptions()
|
|
|
|
|
|
{
|
|
|
|
|
|
MaxDegreeOfParallelism = _maxDegreeOfParallelism
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-03-30 23:39:38 -07:00
|
|
|
|
public static string ExeName
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return _exeName;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-03-29 12:49:34 -07:00
|
|
|
|
public static string ExeDir
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return _exeDir;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-03-30 23:39:38 -07:00
|
|
|
|
public static string CommandLineArgs
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return _args;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-03-01 21:26:27 -08:00
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|