Skip to content

Commit

Permalink
up 修复导入问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Coloryr committed Jul 20, 2024
1 parent c3d5d5b commit 501f7f6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/ColorMC.Core/CoreMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

/// <summary>
/// 版本号
Expand Down
4 changes: 3 additions & 1 deletion src/ColorMC.Core/Helpers/AddGameHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public static async Task<GameRes> 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");
Expand All @@ -44,6 +45,7 @@ public static async Task<GameRes> AddGame(AddGameArg arg)
var mmc1 = PathHelper.ReadText(file2)!;
game = mmc.ToColorMC(mmc1, out var icon);
game.Icon = icon + ".png";
ismmc = true;
isfind = true;
}
}
Expand Down Expand Up @@ -108,7 +110,7 @@ public static async Task<GameRes> AddGame(AddGameArg arg)
};
}

await game.CopyFile(arg.Local, arg.Unselect);
await game.CopyFile(arg.Local, arg.Unselect, ismmc);

return new GameRes
{
Expand Down
1 change: 1 addition & 0 deletions src/ColorMC.Core/Helpers/GameHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,7 @@ public static List<string> ScanVersions(string dir)
{
var list = new List<string>();
var dirs = PathHelper.GetDirs(dir);
dirs.Insert(0, new DirectoryInfo(dir));
foreach (var item in dirs)
{
if (item.Name == "versions")
Expand Down
5 changes: 3 additions & 2 deletions src/ColorMC.Core/LaunchPath/InstancesPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -995,9 +995,10 @@ public static Task<bool> Remove(this GameSettingObj obj, ColorMCCore.Request? re
/// <param name="obj">游戏实例</param>
/// <param name="local">目标地址</param>
/// <param name="unselect">未选择的文件</param>
/// <param name="dir">根目录方式复制</param>
/// <returns></returns>
public static async Task CopyFile(this GameSettingObj obj,
string local, List<string>? unselect)
string local, List<string>? unselect, bool dir)
{
local = Path.GetFullPath(local);
var list = PathHelper.GetAllFile(local);
Expand All @@ -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)
Expand Down

0 comments on commit 501f7f6

Please sign in to comment.