Temp dir should be global

This commit is contained in:
Matt Nadareski
2020-08-02 13:08:33 -07:00
parent feb21c5ef8
commit 417d2253db
9 changed files with 45 additions and 25 deletions

View File

@@ -20,6 +20,24 @@ namespace SabreTools.Library.Data
#region Public accessors
/// <summary>
/// Command line arguments passed in to the parent program
/// </summary>
public static string CommandLineArgs => string.Join(" ", Environment.GetCommandLineArgs());
/// <summary>
/// Directory path for the current executable
/// </summary>
public static string ExeDir => Path.GetDirectoryName(ExeName);
/// <summary>
/// File path for the current executable
/// </summary>
public static string ExeName => new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase).LocalPath;
/// <summary>
/// Logging object for writing to file and console
/// </summary>
public static Logger Logger
{
get
@@ -32,18 +50,23 @@ namespace SabreTools.Library.Data
set { _logger = value; }
}
/// <summary>
/// Maximum threads to use during parallel operations
/// </summary>
public static int MaxThreads { get; set; } = Environment.ProcessorCount;
/// <summary>
/// ParallelOptions object for use in parallel operations
/// </summary>
public static ParallelOptions ParallelOptions => new ParallelOptions()
{
MaxDegreeOfParallelism = MaxThreads
};
public static string ExeName => new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase).LocalPath;
public static string ExeDir => Path.GetDirectoryName(ExeName);
public static string CommandLineArgs => string.Join(" ", Environment.GetCommandLineArgs());
/// <summary>
/// Temporary directory location
/// </summary>
public static string TempDir { get; set; } = Path.GetTempPath();
#endregion
}