mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
* Start removing mixed usages
* Check for directories before opening
* Fix writing
* Kinda fix rebuild
* One more try
* Better internal handling
* Slighty fix a couple more things
* Update RVWorld Compress code to db7d750bba
* Fix build
Co-authored-by: Matt Nadareski <mnadareski@mparticle.com>
77 lines
1.7 KiB
C#
77 lines
1.7 KiB
C#
using System;
|
|
using System.Reflection;
|
|
using System.Threading.Tasks;
|
|
|
|
using SabreTools.Library.Tools;
|
|
|
|
#if MONO
|
|
using System.IO;
|
|
#else
|
|
using Alphaleonis.Win32.Filesystem;
|
|
#endif
|
|
|
|
namespace SabreTools.Library.Data
|
|
{
|
|
/// <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;
|
|
|
|
#endregion
|
|
|
|
#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 new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase).LocalPath; }
|
|
}
|
|
|
|
public static string ExeDir
|
|
{
|
|
get { return Path.GetDirectoryName(ExeName); }
|
|
}
|
|
|
|
public static string CommandLineArgs
|
|
{
|
|
get { return string.Join(" ", Environment.GetCommandLineArgs()); }
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|