Skip to content

Commit

Permalink
新增多种操作系统
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed May 27, 2024
1 parent 8a26ef9 commit 1e1346e
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 26 deletions.
39 changes: 28 additions & 11 deletions Stardust/Models/OSKindHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static OSKinds ParseWindows(String osName, String osVersion)
if (osName.StartsWithIgnoreCase("Windows 8.1")) return OSKinds.Win81;
if (osName.StartsWithIgnoreCase("Windows 8")) return OSKinds.Win8;

if (osName.StartsWithIgnoreCase("Windows 7")) return osVersion.StartsWith("6.1.7601") ? OSKinds.Win71 : OSKinds.Win7;
if (osName.StartsWithIgnoreCase("Windows 7")) return osVersion.Contains("7601") ? OSKinds.Win71 : OSKinds.Win7;

if (osName.StartsWithIgnoreCase("Windows Vista")) return OSKinds.WinVista;

Expand All @@ -64,6 +64,8 @@ public static OSKinds ParseWindows(String osName, String osVersion)
{
if (str.StartsWith("5.")) return OSKinds.Win2003;
if (str.StartsWith("6.")) return OSKinds.Win2008;

return OSKinds.WinServer;
}

return str switch
Expand All @@ -89,34 +91,49 @@ public static OSKinds ParseLinux(String osName, String osVersion)

// 优先识别新系统
if (osName.StartsWithIgnoreCase("Alpine") || osName.EndsWithIgnoreCase("(Alpine)")) return OSKinds.Alpine;
if (osName.StartsWithIgnoreCase("Arch")) return OSKinds.ArchLinux;

if (osName.StartsWithIgnoreCase("Ubuntu")) return OSKinds.Ubuntu;
if (osName.StartsWithIgnoreCase("Debian")) return OSKinds.Debian;
if (osName.StartsWithIgnoreCase("Deepin")) return OSKinds.Deepin;
if (osName.Contains("Armbian")) return OSKinds.Armbian;
if (osName.StartsWithIgnoreCase("Raspbian")) return OSKinds.Raspbian;

if (osName.StartsWithIgnoreCase("Red Hat")) return OSKinds.RedHat;
if (osName.StartsWithIgnoreCase("CentOS")) return OSKinds.CentOS;
if (osName.StartsWithIgnoreCase("Alibaba")) return OSKinds.AlibabaLinux;
if (osName.StartsWithIgnoreCase("Anolis")) return OSKinds.Anolis;
if (osName.StartsWithIgnoreCase("Fedora")) return OSKinds.Fedora;

if (osName.StartsWithIgnoreCase("Deepin")) return OSKinds.Deepin;
if (osName.StartsWithIgnoreCase("UOS", "UnionTech OS")) return OSKinds.UOS;
if (osName.StartsWithIgnoreCase("Kylin", "NeoKylin")) return OSKinds.Kylin;
if (osName.StartsWithIgnoreCase("Kylin")) return OSKinds.Kylin;
if (osName.StartsWithIgnoreCase("OpenKylin")) return OSKinds.OpenKylin;
if (osName.StartsWithIgnoreCase("Loongnix")) return OSKinds.Loongnix;
if (osName.StartsWithIgnoreCase("Red Flag")) return OSKinds.RedFlag;
if (osName.StartsWithIgnoreCase("StartOS")) return OSKinds.StartOS;

if (osName.StartsWithIgnoreCase("Alibaba")) return OSKinds.AlibabaLinux;
if (osName.StartsWithIgnoreCase("NeoKylin")) return OSKinds.NeoKylin;
if (osName.StartsWithIgnoreCase("Anolis")) return OSKinds.Anolis;
if (osName.StartsWithIgnoreCase("Linx")) return OSKinds.Linx;
if (osName.StartsWithIgnoreCase("openEuler")) return OSKinds.OpenEuler;
if (osName.Contains("EulerOS")) return OSKinds.EulerOS;
if (osName.StartsWithIgnoreCase("KylinSec")) return OSKinds.KylinSec;
if (osName.StartsWithIgnoreCase("PuhuaOS")) return OSKinds.PuhuaOS;
if (osName.StartsWithIgnoreCase("FangdeOS")) return OSKinds.FangdeOS;
if (osName.StartsWithIgnoreCase("NewStartOS")) return OSKinds.NewStartOS;

if (osName.StartsWithIgnoreCase("LoongOS")) return OSKinds.LoongOS;

if (osName.Contains("OpenWrt")) return OSKinds.OpenWrt;
if (osName.Contains("Buildroot")) return OSKinds.Buildroot;
if (osName.Contains("Arch")) return OSKinds.ArchLinux;
if (osName.Contains("Linux")) return OSKinds.Linux;
if (osName.Contains("Buildroot")) return OSKinds.Linux;
if (osName.Contains("OpenWrt")) return OSKinds.Linux;
if (osName.Contains("Armbian")) return OSKinds.Debian;

if (osName.StartsWithIgnoreCase("Orange Pi"))
{
if (osName.EndsWithIgnoreCase("Jammy")) return OSKinds.Ubuntu;
if (osName.EndsWithIgnoreCase("Bullseye")) return OSKinds.Debian;
//if (osName.EndsWithIgnoreCase("Jammy")) return OSKinds.Ubuntu;
//if (osName.EndsWithIgnoreCase("Bullseye")) return OSKinds.Debian;

return OSKinds.Linux;
return OSKinds.Armbian;
}

if (Runtime.Linux) return OSKinds.Linux;
Expand Down
89 changes: 74 additions & 15 deletions Stardust/Models/OSKinds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public enum OSKinds
/// <summary>SmartOS by NewLife</summary>
SmartOS = 40,

#region Windows
/// <summary>WinXP, 5.1.2600</summary>
WinXP = 51,

Expand Down Expand Up @@ -48,63 +49,121 @@ public enum OSKinds
/// <summary>Win2022</summary>
Win2022 = 72,

/// <summary>Windows服务器</summary>
WinServer = 70,

/// <summary>Win10, 10.0.10240</summary>
Win10 = 10,

/// <summary>Win11, 10.0.22000</summary>
Win11 = 11,
#endregion

/// <summary>Alpine</summary>
Alpine = 90,

/// <summary>Linux</summary>
Linux = 100,

/// <summary>ArchLinux</summary>
ArchLinux = 101,

/// <summary>OpenWrt</summary>
OpenWrt = 102,

/// <summary>Buildroot</summary>
Buildroot = 103,

#region Debian系
/// <summary>Ubuntu</summary>
Ubuntu = 110,

/// <summary>Debian</summary>
Debian = 111,

/// <summary>深度</summary>
Deepin = 112,
/// <summary>Armbian</summary>
Armbian = 112,

/// <summary>树莓派</summary>
Raspbian = 113,
#endregion

#region RedHat系
/// <summary>红帽</summary>
RedHat = 120,

/// <summary>Centos</summary>
CentOS = 121,

/// <summary>Alibaba Cloud Linux</summary>
AlibabaLinux = 122,
/// <summary>Fedora</summary>
Fedora = 122,
#endregion

/// <summary>龙蜥</summary>
Anolis = 123,
#region 国产DEB系
/// <summary>深度</summary>
Deepin = 130,

/// <summary>统信UOS</summary>
UOS = 130,
UOS = 131,

/// <summary>麒麟</summary>
Kylin = 140,
/// <summary>银河麒麟</summary>
Kylin = 132,

/// <summary>优麒麟</summary>
OpenKylin = 141,
OpenKylin = 133,

/// <summary>龙芯操作系统</summary>
Loongnix = 134,

/// <summary>红旗Linux</summary>
RedFlag = 135,

/// <summary>起点操作系统</summary>
StartOS = 136,
#endregion

#region 国产RPM系
/// <summary>Alibaba Cloud Linux</summary>
AlibabaLinux = 140,

/// <summary>中标麒麟</summary>
NeoKylin = 141,

/// <summary>龙蜥</summary>
Anolis = 142,

/// <summary>凝思</summary>
Linx = 150,
Linx = 143,

/// <summary>开源欧拉</summary>
OpenEuler = 160,
OpenEuler = 144,

/// <summary>欧拉</summary>
EulerOS = 161,
EulerOS = 145,

/// <summary>麒麟信安</summary>
KylinSec = 146,

/// <summary>普华操作系统</summary>
PuhuaOS = 147,

/// <summary>方德操作系统</summary>
FangdeOS = 148,

/// <summary>新支点操作系统</summary>
NewStartOS = 149,
#endregion

#region 国产独立
/// <summary>龙芯嵌入式OS。具备精简、高效、实时特征的工控类操作系统</summary>
/// <remarks>基于通用Linux内核,利用RT-Linux技术实现实时性</remarks>
LoongOS = 160,

#endregion

/// <summary>MacOS</summary>
MacOSX = 200,
MacOSX = 400,

/// <summary>Android</summary>
Android = 300,
Android = 500,
}

0 comments on commit 1e1346e

Please sign in to comment.