feat: 带启动器的压缩包含 .mrpack 时自动提取并作为 MR 整合包安装 - #3446
Conversation
审阅者指南(在小型 PR 上折叠)审阅者指南此 PR 更改了整合包(modpack)检测逻辑:对于同时包含启动器和 更新后的 ModpackInstall 处理嵌入式 modpack.mrpack 的流程图flowchart TD
A[ModpackInstall file] --> B[Open archive]
B --> C{Archive contains modpack.zip?}
C -->|Yes| D[set packType 9 for launcher_bundle]
C -->|No| E{Archive contains modpack.mrpack?}
E -->|Yes| F[Path.Combine Paths.Temp, Guid.NewGuid plus .mrpack]
F --> G[ExtractToFile tempFile, overwrite true]
G --> H[ModpackInstall tempFile and return]
E -->|No| I[Continue existing pack type detection]
文件级更改
可能关联的问题
提示与命令与 Sourcery 交互
自定义你的使用体验访问你的控制面板 来:
获取帮助Original review guide in EnglishReviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR changes the modpack detection logic so that archives containing a launcher and a Flow diagram for updated ModpackInstall handling of embedded modpack.mrpackflowchart TD
A[ModpackInstall file] --> B[Open archive]
B --> C{Archive contains modpack.zip?}
C -->|Yes| D[set packType 9 for launcher_bundle]
C -->|No| E{Archive contains modpack.mrpack?}
E -->|Yes| F[Path.Combine Paths.Temp, Guid.NewGuid plus .mrpack]
F --> G[ExtractToFile tempFile, overwrite true]
G --> H[ModpackInstall tempFile and return]
E -->|No| I[Continue existing pack type detection]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
嗨,我在这里给出了一些总体反馈:
.mrpack的解压逻辑在根目录检查和一级子目录检查中都有重复;建议将这部分逻辑抽取成一个小的辅助方法,以减少重复并保持行为的一致性。- 在写入临时
.mrpack文件时,建议使用作用域清理机制(例如在ModpackInstall完成后删除该临时文件),以避免在Paths.Temp中留下未使用的文件。
给 AI 代理的提示
请根据本次代码审查中的评论进行修改:
## 总体评论
- `.mrpack` 的解压逻辑在根目录检查和一级子目录检查中都有重复;建议将这部分逻辑抽取成一个小的辅助方法,以减少重复并保持行为的一致性。
- 在写入临时 `.mrpack` 文件时,建议使用作用域清理机制(例如在 `ModpackInstall` 完成后删除该临时文件),以避免在 `Paths.Temp` 中留下未使用的文件。帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据你的反馈改进后续审查。
Original comment in English
Hey - I've left some high level feedback:
- The
.mrpackextraction logic is duplicated in both the root and first-level directory checks; consider factoring this into a small helper method to reduce repetition and keep behavior consistent. - When writing the temporary
.mrpackfile, consider using a scoped cleanup mechanism (e.g., deleting the temp file afterModpackInstallcompletes) to avoid leaving unused files inPaths.Temp.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `.mrpack` extraction logic is duplicated in both the root and first-level directory checks; consider factoring this into a small helper method to reduce repetition and keep behavior consistent.
- When writing the temporary `.mrpack` file, consider using a scoped cleanup mechanism (e.g., deleting the temp file after `ModpackInstall` completes) to avoid leaving unused files in `Paths.Temp`.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 71b762fd44
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
此 PR 旨在使打包了启动器且包含 .mrpack 的整合包绕过问题重重的 InstallPackLauncherPack 方法直接提取 .mrpack 并作为正常的 MR 整合包进行安装(modpack.zip 因为无法完整确定其具体情况不敢贸然进行修改故仍然保持原样)
Summary by Sourcery
增强功能:
modpack.zip的检测与对modpack.mrpack的检测分离,当存在modpack.mrpack时,直接采用正常的 MR 整合包安装流程进行短路处理。Original summary in English
Summary by Sourcery
Enhancements: