using System; using System.IO; using System.Reflection; using System.Threading.Tasks; using SabreTools.Library.Logging; namespace SabreTools.Library.Data { /// /// Globally-accessible objects for the library /// public class Globals { #region Public accessors /// /// Command line arguments passed in to the parent program /// public static string CommandLineArgs => string.Join(" ", Environment.GetCommandLineArgs()); /// /// 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 /// public static string TempDir { get; set; } = Path.GetTempPath(); #endregion } }