Skip to content

Commit

Permalink
remove unused APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
laolarou726 committed Oct 23, 2023
1 parent b5c66e5 commit 5843a3e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 269 deletions.
104 changes: 0 additions & 104 deletions ProjBobcat/ProjBobcat/Class/Helper/SystemInfo/SystemArch.cs

This file was deleted.

161 changes: 0 additions & 161 deletions ProjBobcat/ProjBobcat/Class/Helper/SystemInfo/WindowsSystemVersion.cs

This file was deleted.

12 changes: 12 additions & 0 deletions ProjBobcat/ProjBobcat/Class/Helper/SystemInfoHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using Microsoft.Extensions.Configuration;
using ProjBobcat.Class.Model;

Expand All @@ -12,6 +13,17 @@ namespace ProjBobcat.Class.Helper;
/// </summary>
public static class SystemInfoHelper
{
public static string GetSystemArch()
{
return RuntimeInformation.OSArchitecture switch
{
Architecture.X86 => "x86",
Architecture.X64 => "x64",
Architecture.Arm64 => "arm64",
var arch => throw new Exception($"Unknown system arch: {arch}")
};
}

public static bool IsRunningUnderTranslation()
{
#if WINDOWS
Expand Down
4 changes: 2 additions & 2 deletions ProjBobcat/ProjBobcat/Class/Model/JvmRulesModel.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Text.Json.Serialization;
using ProjBobcat.Class.Helper.SystemInfo;
using ProjBobcat.Class.Helper;

namespace ProjBobcat.Class.Model;

Expand All @@ -16,7 +16,7 @@ public bool IsAllow()
{
if (!string.IsNullOrEmpty(Name) &&
!Name.Equals(Constants.OsSymbol, StringComparison.OrdinalIgnoreCase)) return false;
if (!string.IsNullOrEmpty(Arch) && Arch != SystemArch.CurrentArch.ToString()) return false;
if (!string.IsNullOrEmpty(Arch) && Arch != SystemInfoHelper.GetSystemArch()) return false;
#if WINDOWS
if (!string.IsNullOrEmpty(Version) && Version != $"^{WindowsSystemVersion.CurrentVersion}\\.") return false;

Check failure on line 21 in ProjBobcat/ProjBobcat/Class/Model/JvmRulesModel.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The name 'WindowsSystemVersion' does not exist in the current context

Check failure on line 21 in ProjBobcat/ProjBobcat/Class/Model/JvmRulesModel.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The name 'WindowsSystemVersion' does not exist in the current context

Check failure on line 21 in ProjBobcat/ProjBobcat/Class/Model/JvmRulesModel.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The name 'WindowsSystemVersion' does not exist in the current context

Check failure on line 21 in ProjBobcat/ProjBobcat/Class/Model/JvmRulesModel.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The name 'WindowsSystemVersion' does not exist in the current context

Check failure on line 21 in ProjBobcat/ProjBobcat/Class/Model/JvmRulesModel.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The name 'WindowsSystemVersion' does not exist in the current context

Check failure on line 21 in ProjBobcat/ProjBobcat/Class/Model/JvmRulesModel.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The name 'WindowsSystemVersion' does not exist in the current context
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Text.Json;
using ProjBobcat.Class;
using ProjBobcat.Class.Helper;
using ProjBobcat.Class.Helper.SystemInfo;
using ProjBobcat.Class.Model;
using ProjBobcat.Class.Model.JsonContexts;
using ProjBobcat.Class.Model.LauncherProfile;
Expand Down Expand Up @@ -199,7 +198,7 @@ public override (List<NativeFileInfo>, List<FileInfo>) GetNatives(IEnumerable<Li

if(!lib.Natives!.TryGetValue(Constants.OsSymbol, out var value)) continue;

var key = value.Replace("${arch}", SystemArch.CurrentArch.ToString("{0}"));
var key = value.Replace("${arch}", SystemInfoHelper.GetSystemArch());

FileInfo libFi;
if (lib.Downloads?.Classifiers?.ContainsKey(key) ?? false)
Expand Down

0 comments on commit 5843a3e

Please sign in to comment.