Skip to content

Commit

Permalink
up 修复macos启动问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Coloryr committed Aug 8, 2024
1 parent 524c0ca commit 3ff51f4
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 16 deletions.
1 change: 1 addition & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
⚫计划中

⚫2024.8.8
√ 修复macos启动问题
√ 修改文件打开方式
√ 添加窗口状态保存

Expand Down
2 changes: 2 additions & 0 deletions src/ColorMC.Core/CoreMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ public static void Init(CoreInitArg arg)
WebClient.Init();

Logs.Info(LanguageHelper.Get("Core.Info1"));
Logs.Info(SystemInfo.SystemName);
Logs.Info(SystemInfo.System);
}

/// <summary>
Expand Down
5 changes: 3 additions & 2 deletions src/ColorMC.Core/Game/GameLaunch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,10 @@ public static List<string> MakeV2JvmArg(this GameSettingObj obj)
{
arg.Add(item2!);
}
else if (obj2.value is List<string> list)
else if (obj2.value is JArray list)
{
arg.AddRange(list);
var list1 = list.ToObject<List<string>>()!;
arg.AddRange(list1);
}
}
}
Expand Down
36 changes: 24 additions & 12 deletions src/ColorMC.Core/Helpers/CheckHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static class CheckHelpers
/// </summary>
public static bool CheckAllow(List<GameArgObj.Libraries.Rules> list)
{
bool download = true;
bool allow = true;
if (list == null)
{
return true;
Expand All @@ -34,57 +34,69 @@ public static bool CheckAllow(List<GameArgObj.Libraries.Rules> list)
{
if (item2.os == null)
{
download = true;
allow = true;
continue;
}
var os = item2.os.name;

if (os == "osx" && SystemInfo.Os == OsType.MacOS)
{
download = true;
allow = true;
}
else if (os == "windows" && SystemInfo.Os == OsType.Windows)
{
download = true;
allow = true;
}
else if (os == "linux" && SystemInfo.Os == OsType.Linux)
{
download = true;
allow = true;
}
else
{
download = false;
allow = false;
}

var arch = item2.os.arch;
if (arch == "x86" && !SystemInfo.IsArm)
{
allow = true;
}
}
else if (action == "disallow")
{
if (item2.os == null)
{
download = false;
allow = false;
continue;
}
var os = item2.os.name;

if (os == "osx" && SystemInfo.Os == OsType.MacOS)
{
download = false;
allow = false;
}
else if (os == "windows" && SystemInfo.Os == OsType.Windows)
{
download = false;
allow = false;
}
else if (os == "linux" && SystemInfo.Os == OsType.Linux)
{
download = false;
allow = false;
}
else
{
download = true;
allow = true;
}

var arch = item2.os.arch;
if (arch == "x86" && !SystemInfo.IsArm)
{
allow = false;
}
}
}

return download;
return allow;
}

public static bool IsGameVersionV2(this GameSettingObj obj)
Expand Down
1 change: 1 addition & 0 deletions src/ColorMC.Core/Objs/Minecraft/GameArgObj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public record OS
{
public string name { get; set; }
public string version { get; set; }
public string arch { get; set; }
}
public string action { get; set; }
public OS os { get; set; }
Expand Down
2 changes: 0 additions & 2 deletions src/ColorMC.Gui/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ public App()
}
}

//public static TopLevel? TopLevel { get; set; }

public static readonly SelfCrossFade CrossFade300 = new(TimeSpan.FromMilliseconds(300));
public static readonly SelfCrossFade CrossFade200 = new(TimeSpan.FromMilliseconds(200));
public static readonly SelfCrossFade CrossFade100 = new(TimeSpan.FromMilliseconds(100));
Expand Down

0 comments on commit 3ff51f4

Please sign in to comment.