You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
674 B
28 lines
674 B
using System.Runtime.InteropServices; |
|
using NLog; |
|
|
|
namespace StabilityMatrix.Core.Helper; |
|
|
|
public static class SystemInfo |
|
{ |
|
public const long Gibibyte = 1024 * 1024 * 1024; |
|
public const long Mebibyte = 1024 * 1024; |
|
|
|
[DllImport("UXTheme.dll", SetLastError = true, EntryPoint = "#138")] |
|
public static extern bool ShouldUseDarkMode(); |
|
|
|
public static long? GetDiskFreeSpaceBytes(string path) |
|
{ |
|
try |
|
{ |
|
var drive = new DriveInfo(path); |
|
return drive.AvailableFreeSpace; |
|
} |
|
catch (Exception e) |
|
{ |
|
LogManager.GetCurrentClassLogger().Error(e); |
|
} |
|
|
|
return null; |
|
} |
|
}
|
|
|