mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Reflection;
|
|
using System.Threading.Tasks;
|
|
|
|
using SabreTools.Library.Logging;
|
|
|
|
namespace SabreTools.Library.Data
|
|
{
|
|
/// <summary>
|
|
/// Globally-accessible objects for the library
|
|
/// </summary>
|
|
public class Globals
|
|
{
|
|
#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>
|
|
/// 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
|
|
};
|
|
|
|
/// <summary>
|
|
/// Temporary directory location
|
|
/// </summary>
|
|
public static string TempDir { get; set; } = Path.GetTempPath();
|
|
|
|
#endregion
|
|
}
|
|
}
|