using System;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;
namespace SabreTools.Core
{
///
/// Globally-accessible objects for the library
///
public class Globals
{
#region Public accessors
///
/// Directory path for the current executable
///
public static string ExeDir => Path.GetDirectoryName(ExeName);
///
/// File path for the current executable
///
public static string ExeName => new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase).LocalPath;
///
/// Maximum threads to use during parallel operations
///
public static int MaxThreads { get; set; } = Environment.ProcessorCount;
///
/// ParallelOptions object for use in parallel operations
///
public static ParallelOptions ParallelOptions => new ParallelOptions()
{
MaxDegreeOfParallelism = MaxThreads
};
///
/// Temporary directory location
///
/// TODO: Find a way to get rid of this as a global variable and put it in DatFile
public static string TempDir { get; set; } = Path.GetTempPath();
#endregion
}
}