diff --git a/Plain Craft Launcher 2/Modules/Minecraft/ModModpack.cs b/Plain Craft Launcher 2/Modules/Minecraft/ModModpack.cs index 9c753cb10..55349ff44 100644 --- a/Plain Craft Launcher 2/Modules/Minecraft/ModModpack.cs +++ b/Plain Craft Launcher 2/Modules/Minecraft/ModModpack.cs @@ -70,6 +70,7 @@ public static LoaderCombo ModpackInstall(string file, string instanceNam // 获取整合包种类与关键 Json var packType = -1; + ZipArchiveEntry nestedModpackEntry = null; do { try @@ -117,12 +118,18 @@ public static LoaderCombo ModpackInstall(string file, string instanceNam break; } // HMCL 整合包 - if (archive.GetEntry("modpack.zip") is not null || archive.GetEntry("modpack.mrpack") is not null) + if (archive.GetEntry("modpack.zip") is not null) { packType = 9; break; } // 带启动器的压缩包 + nestedModpackEntry = archive.GetEntry("modpack.mrpack"); + if (nestedModpackEntry is not null) + { + break; + } + // 从一级目录判断整合包类型 var exitTry = false; foreach (var Entry in archive.Entries) @@ -178,12 +185,19 @@ public static LoaderCombo ModpackInstall(string file, string instanceNam break; } // HMCL 整合包 - if (fullNames[1] == "modpack.zip" || fullNames[1] == "modpack.mrpack") + if (fullNames[1] == "modpack.zip") { packType = 9; exitTry = true; break; } // 带启动器的压缩包 + + if (fullNames[1] == "modpack.mrpack") + { + nestedModpackEntry = Entry; + exitTry = true; + break; + } } if (exitTry) break; @@ -199,6 +213,15 @@ public static LoaderCombo ModpackInstall(string file, string instanceNam } } while (false); + if (nestedModpackEntry is not null) + { + var tempFile = Path.Combine(ModMain.RequestTaskTempFolder(), "modpack.mrpack"); + nestedModpackEntry.ExtractToFile(tempFile, overwrite: true); + archive.Dispose(); + archive = null; + return ModpackInstall(tempFile, instanceName, logo, resourceId, isOnlineInstall); + } + // 执行对应的安装方法 switch (packType) {