fix(instance-export): 修复漏转换的 VB 代码#2846
Merged
Merged
Conversation
审阅者指南(在小型 PR 中折叠)审阅者指南重构实例导出逻辑中遗漏的 VB 风格代码片段为符合 C# 习惯用法的实现,确保在 RELEASE 构建中启用了导出选项时,PCL 可执行文件能够被正确复制。 实例导出(包含可选 PCL 可执行文件复制)的时序图sequenceDiagram
participant User
participant PageInstanceExport as PageInstanceExport
participant FileSystem
User->>PageInstanceExport: StartExport(sender, e)
activate PageInstanceExport
PageInstanceExport->>FileSystem: ModBase.CopyDirectory(Path.Combine(McInstance.PathInstance, PCL), Path.Combine(OverridesFolder, PCL))
alt [IncludePCL] and [RELEASE]
PageInstanceExport->>FileSystem: File.Copy(ModBase.ExePathWithName, Path.Combine(CacheFolder, Plain_Craft_Launcher_exe), true)
end
alt [IncludePCLCustom]
PageInstanceExport->>FileSystem: ModBase.CopyDirectory(PCL_custom_source, PCL_custom_destination)
end
deactivate PageInstanceExport
文件级变更
提示与命令与 Sourcery 交互
自定义你的体验访问你的 控制面板 以:
获取帮助Original review guide in EnglishReviewer's guide (collapsed on small PRs)Reviewer's GuideRefactors a missed VB-style code fragment in the instance export logic to idiomatic C#, ensuring the PCL executable is copied correctly during export when enabled in RELEASE builds. Sequence diagram for instance export including optional PCL executable copysequenceDiagram
participant User
participant PageInstanceExport as PageInstanceExport
participant FileSystem
User->>PageInstanceExport: StartExport(sender, e)
activate PageInstanceExport
PageInstanceExport->>FileSystem: ModBase.CopyDirectory(Path.Combine(McInstance.PathInstance, PCL), Path.Combine(OverridesFolder, PCL))
alt [IncludePCL] and [RELEASE]
PageInstanceExport->>FileSystem: File.Copy(ModBase.ExePathWithName, Path.Combine(CacheFolder, Plain_Craft_Launcher_exe), true)
end
alt [IncludePCLCustom]
PageInstanceExport->>FileSystem: ModBase.CopyDirectory(PCL_custom_source, PCL_custom_destination)
end
deactivate PageInstanceExport
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - 我给出了一些整体层面的反馈:
- 在
#if RELEASE代码块中,建议使用已有的ModBase.CopyFile辅助方法,而不是直接调用File.Copy,以便在行为(日志记录、错误处理、权限)上与其他导出逻辑保持一致。 - 为了与周围的 C# 代码风格保持一致,即使
if (IncludePCL)的主体只有一条语句,也建议加上花括号。
给 AI Agent 的提示
Please address the comments from this code review:
## Overall Comments
- Within the `#if RELEASE` block, consider using the existing `ModBase.CopyFile` helper instead of `File.Copy` directly to keep behavior (logging, error handling, permissions) consistent with the rest of the export logic.
- For consistency with surrounding C# style, wrap the `if (IncludePCL)` body in braces even though it is a single statement.帮我变得更有用!请对每条评论点 👍 或 👎,我会根据你的反馈改进后续的评审。
Original comment in English
Hey - I've left some high level feedback:
- Within the
#if RELEASEblock, consider using the existingModBase.CopyFilehelper instead ofFile.Copydirectly to keep behavior (logging, error handling, permissions) consistent with the rest of the export logic. - For consistency with surrounding C# style, wrap the
if (IncludePCL)body in braces even though it is a single statement.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Within the `#if RELEASE` block, consider using the existing `ModBase.CopyFile` helper instead of `File.Copy` directly to keep behavior (logging, error handling, permissions) consistent with the rest of the export logic.
- For consistency with surrounding C# style, wrap the `if (IncludePCL)` body in braces even though it is a single statement.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Big-Cake-jpg
previously approved these changes
May 17, 2026
Big-Cake-jpg
approved these changes
May 17, 2026
MoYuan-CN
approved these changes
May 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by Sourcery
Bug Fixes:
Original summary in English
Summary by Sourcery
Bug Fixes: