56 lines
1.1 KiB
C#
56 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace NetPanel.Help
|
|
{
|
|
public class SystemHelp
|
|
{
|
|
/// <summary>
|
|
/// 是否 win系统
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static bool IsWindows()
|
|
{
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 是否 linux 系统
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static bool IsLinux()
|
|
{
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 是否MacOs环境
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static bool IsOSX()
|
|
{
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|