From 501f7f6b993ddf386a8d1365aa0b5e57b4598860 Mon Sep 17 00:00:00 2001 From: Coloryr <402067010@qq.com> Date: Sat, 20 Jul 2024 22:07:55 +0800 Subject: [PATCH] =?UTF-8?q?up=20=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ColorMC.Core/CoreMain.cs | 2 +- src/ColorMC.Core/Helpers/AddGameHelper.cs | 4 +++- src/ColorMC.Core/Helpers/GameHelper.cs | 1 + src/ColorMC.Core/LaunchPath/InstancesPath.cs | 5 +++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ColorMC.Core/CoreMain.cs b/src/ColorMC.Core/CoreMain.cs index b05cb59b1..73e44c5b1 100644 --- a/src/ColorMC.Core/CoreMain.cs +++ b/src/ColorMC.Core/CoreMain.cs @@ -15,7 +15,7 @@ namespace ColorMC.Core; public static class ColorMCCore { public const string TopVersion = "A27"; - public const string DateVersion = "20240719"; + public const string DateVersion = "20240720"; /// /// 版本号 diff --git a/src/ColorMC.Core/Helpers/AddGameHelper.cs b/src/ColorMC.Core/Helpers/AddGameHelper.cs index 754678ca4..bce57d963 100644 --- a/src/ColorMC.Core/Helpers/AddGameHelper.cs +++ b/src/ColorMC.Core/Helpers/AddGameHelper.cs @@ -31,6 +31,7 @@ public static async Task AddGame(AddGameArg arg) GameSettingObj? game = null; bool isfind = false; + bool ismmc = false; var file1 = Path.GetFullPath(arg.Local + "/" + "mmc-pack.json"); var file2 = Path.GetFullPath(arg.Local + "/" + "instance.cfg"); @@ -44,6 +45,7 @@ public static async Task AddGame(AddGameArg arg) var mmc1 = PathHelper.ReadText(file2)!; game = mmc.ToColorMC(mmc1, out var icon); game.Icon = icon + ".png"; + ismmc = true; isfind = true; } } @@ -108,7 +110,7 @@ public static async Task AddGame(AddGameArg arg) }; } - await game.CopyFile(arg.Local, arg.Unselect); + await game.CopyFile(arg.Local, arg.Unselect, ismmc); return new GameRes { diff --git a/src/ColorMC.Core/Helpers/GameHelper.cs b/src/ColorMC.Core/Helpers/GameHelper.cs index 1c60e7ee2..4787225ad 100644 --- a/src/ColorMC.Core/Helpers/GameHelper.cs +++ b/src/ColorMC.Core/Helpers/GameHelper.cs @@ -808,6 +808,7 @@ public static List ScanVersions(string dir) { var list = new List(); var dirs = PathHelper.GetDirs(dir); + dirs.Insert(0, new DirectoryInfo(dir)); foreach (var item in dirs) { if (item.Name == "versions") diff --git a/src/ColorMC.Core/LaunchPath/InstancesPath.cs b/src/ColorMC.Core/LaunchPath/InstancesPath.cs index cd9b950db..12b34c3d0 100644 --- a/src/ColorMC.Core/LaunchPath/InstancesPath.cs +++ b/src/ColorMC.Core/LaunchPath/InstancesPath.cs @@ -995,9 +995,10 @@ public static Task Remove(this GameSettingObj obj, ColorMCCore.Request? re /// 游戏实例 /// 目标地址 /// 未选择的文件 + /// 根目录方式复制 /// public static async Task CopyFile(this GameSettingObj obj, - string local, List? unselect) + string local, List? unselect, bool dir) { local = Path.GetFullPath(local); var list = PathHelper.GetAllFile(local); @@ -1006,7 +1007,7 @@ public static async Task CopyFile(this GameSettingObj obj, list.RemoveAll(item => unselect.Contains(item.FullName)); } int basel = local.Length; - var local1 = obj.GetGamePath(); + var local1 = dir ? obj.GetBasePath() : obj.GetGamePath(); await Task.Run(() => { foreach (var item in list)