mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-25 03:51:30 -07:00
38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
namespace Bloxstrap
|
|
{
|
|
static class Utilities
|
|
{
|
|
public static long GetFreeDiskSpace(string path)
|
|
{
|
|
foreach (DriveInfo drive in DriveInfo.GetDrives())
|
|
{
|
|
if (path.StartsWith(drive.Name))
|
|
return drive.AvailableFreeSpace;
|
|
}
|
|
|
|
return -1;
|
|
}
|
|
|
|
public static void ShellExecute(string website) => Process.Start(new ProcessStartInfo { FileName = website, UseShellExecute = true });
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="versionStr1"></param>
|
|
/// <param name="versionStr2"></param>
|
|
/// <returns>
|
|
/// Result of System.Version.CompareTo <br />
|
|
/// -1: version1 < version2 <br />
|
|
/// 0: version1 == version2 <br />
|
|
/// 1: version1 > version2
|
|
/// </returns>
|
|
public static int CompareVersions(string versionStr1, string versionStr2)
|
|
{
|
|
var version1 = new Version(versionStr1.Replace("v", ""));
|
|
var version2 = new Version(versionStr2.Replace("v", ""));
|
|
|
|
return version1.CompareTo(version2);
|
|
}
|
|
}
|
|
}
|