Skip to content

chore: 删除一些无用代码#2817

Merged
SALTWOOD merged 1 commit into
devfrom
chore/codeclean
May 11, 2026
Merged

chore: 删除一些无用代码#2817
SALTWOOD merged 1 commit into
devfrom
chore/codeclean

Conversation

@LuLu-ling
Copy link
Copy Markdown
Member

@LuLu-ling LuLu-ling commented May 11, 2026

Summary by Sourcery

移除与 HTTP 服务器实现、仅调试用的 CLI 代码路径以及条件编译遗留相关的过时和未使用旧代码,同时清理导出和日志流程中的预处理指令。

Enhancements:

  • 通过将已注释掉的条件编译替换为实际的 #if RELEASE / #if !RELEASE 宏守卫,简化 PageInstance 的导出逻辑。
  • 清理日志代码路径,移除残留的、已失效的仅调试用指令标记。

Chores:

  • 从应用启动和相关模块中删除旧的、未使用的 HTTP 服务器实现以及已禁用的调试/测试代码路径。
Original summary in English

Summary by Sourcery

Remove obsolete and unused legacy code related to HTTP server implementation, debug-only CLI paths, and conditional compilation remnants, while cleaning up preprocessor directives in export and logging flows.

Enhancements:

  • Simplify PageInstance export logic by replacing commented conditional compilation with actual #if RELEASE / #if !RELEASE guards.
  • Clean up logging code paths by removing leftover disabled debug-only directive markers.

Chores:

  • Delete old, unused HTTP server implementation and disabled debug/test code paths from application startup and related modules.

@LuLu-ling LuLu-ling requested a review from a team May 11, 2026 12:27
@pcl-ce-automation pcl-ce-automation Bot added 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 size: L PR 大小评估:大型 labels May 11, 2026
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 11, 2026

审阅者指南(在小型 PR 上折叠)

审阅者指南

此 PR 移除遗留/死代码并清理条件编译遗留物,同时收紧围绕导出逻辑的实际 #if/#endif 使用。

含条件编译的 PCL 导出逻辑流程图

flowchart TD
    Start[StartExport_called] --> PrepPCL[Prepare_PCL_files_region]
    PrepPCL --> CheckIncludePCLDev[Check_IncludePCL_in_non_RELEASE_build]

    CheckIncludePCLDev -->|!RELEASE_build_and_IncludePCL_true| AddDownloadLoader[Add_LoaderTask_to_download_PCL_release_exe]
    CheckIncludePCLDev -->|!RELEASE_build_and_IncludePCL_false| SkipDownloadLoader[Skip_downloading_PCL]

    AddDownloadLoader --> ContinueExport[Continue_export_pipeline]
    SkipDownloadLoader --> ContinueExport

    ContinueExport --> CopyInstanceSettings[Copy_PCL_instance_settings]

    CopyInstanceSettings --> CheckIncludePCLRelease[Check_IncludePCL_in_RELEASE_build]

    CheckIncludePCLRelease -->|RELEASE_build_and_IncludePCL_true| CopyPCLExe[Copy_PCL_executable_into_exported_package]
    CheckIncludePCLRelease -->|RELEASE_build_and_IncludePCL_false| SkipCopyPCLExe[Skip_copying_PCL_executable]

    CopyPCLExe --> CopyCustom[Copy_PCL_customization_files_if_IncludePCLCustom]
    SkipCopyPCLExe --> CopyCustom

    CopyCustom --> End[Export_completed]
Loading

文件级变更

变更 详情 文件
移除处理 NAID OAuth 回调的过时、已注释掉的 HTTP 服务器实现。
  • 删除整个基于 HttpListener 的遗留 HttpServer 类区域,该区域从未被编译(#If False 块)。
Plain Craft Launcher 2/Modules/ModWebServer.cs
清理未使用、已禁用的启动/调试相关代码路径。
  • 从启动参数解析中移除已禁用的 DEBUGRESERVED 编辑/更新打包命令处理器。
  • 移除由恒为 false 的编译条件保护的已禁用单实例限制逻辑。
  • 移除在启动初始化结尾处已禁用的调试 Test() 调用。
Plain Craft Launcher 2/Application.xaml.cs
规范 PCL 导出行为的条件编译。
  • 用合适的 #if !RELEASE / #endif 替换剩余的 TODO/IfDirectiveTrivia 注释,用于可选的 PCL 下载加载器创建。
  • 在导出实例时,为复制 PCL 可执行文件启用干净的 #if RELEASE / #endif 代码块,同时保留周边逻辑。
Plain Craft Launcher 2/Pages/PageInstance/PageInstanceExport.xaml.cs
移除日志中仅用于调试的零散条件编译残余。
  • Log(string, ...)Log(Exception, ...) 两个重载的方法中,删除调试日志分支之后结尾处已禁用的 #End If 残留。
Plain Craft Launcher 2/Modules/Base/ModBase.cs

技巧与命令

与 Sourcery 交互

  • 触发新的审阅: 在 pull request 中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 从审阅评论生成 GitHub Issue: 通过回复某条审阅评论,请求 Sourcery 从该评论创建一个 issue。你也可以回复该审阅评论 @sourcery-ai issue 来从中创建 issue。
  • 生成 pull request 标题: 在 pull request 标题的任意位置写上 @sourcery-ai,即可随时生成标题。你也可以在 pull request 中评论 @sourcery-ai title 来(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 正文的任意位置写上 @sourcery-ai summary,即可在你想要的位置随时生成 PR 摘要。你也可以在 pull request 中评论 @sourcery-ai summary 来(重新)生成摘要。
  • 生成审阅者指南: 在 pull request 中评论 @sourcery-ai guide,即可随时(重新)生成审阅者指南。
  • 解决所有 Sourcery 评论: 在 pull request 中评论 @sourcery-ai resolve,以解决所有 Sourcery 评论。如果你已经处理完所有评论且不想再看到它们,这会很有用。
  • 关闭所有 Sourcery 审阅: 在 pull request 中评论 @sourcery-ai dismiss,以关闭所有现有的 Sourcery 审阅。特别适用于你想从一个全新的审阅开始——别忘了再评论 @sourcery-ai review 来触发新的审阅!

自定义你的体验

访问你的 控制面板 以:

  • 启用或禁用诸如 Sourcery 生成的 pull request 摘要、审阅者指南等审阅功能。
  • 更改审阅语言。
  • 添加、移除或编辑自定义审阅说明。
  • 调整其他审阅设置。

获取帮助

Original review guide in English
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR removes legacy/dead code and cleans up conditional compilation artifacts, while tightening up actual #if/#endif usage around export logic.

Flow diagram for PCL export logic with conditional compilation

flowchart TD
    Start[StartExport_called] --> PrepPCL[Prepare_PCL_files_region]
    PrepPCL --> CheckIncludePCLDev[Check_IncludePCL_in_non_RELEASE_build]

    CheckIncludePCLDev -->|!RELEASE_build_and_IncludePCL_true| AddDownloadLoader[Add_LoaderTask_to_download_PCL_release_exe]
    CheckIncludePCLDev -->|!RELEASE_build_and_IncludePCL_false| SkipDownloadLoader[Skip_downloading_PCL]

    AddDownloadLoader --> ContinueExport[Continue_export_pipeline]
    SkipDownloadLoader --> ContinueExport

    ContinueExport --> CopyInstanceSettings[Copy_PCL_instance_settings]

    CopyInstanceSettings --> CheckIncludePCLRelease[Check_IncludePCL_in_RELEASE_build]

    CheckIncludePCLRelease -->|RELEASE_build_and_IncludePCL_true| CopyPCLExe[Copy_PCL_executable_into_exported_package]
    CheckIncludePCLRelease -->|RELEASE_build_and_IncludePCL_false| SkipCopyPCLExe[Skip_copying_PCL_executable]

    CopyPCLExe --> CopyCustom[Copy_PCL_customization_files_if_IncludePCLCustom]
    SkipCopyPCLExe --> CopyCustom

    CopyCustom --> End[Export_completed]
Loading

File-Level Changes

Change Details Files
Remove obsolete commented-out HTTP server implementation for NAID OAuth callback handling.
  • Delete entire legacy HttpListener-based HttpServer class region that was never compiled (#If False block).
Plain Craft Launcher 2/Modules/ModWebServer.cs
Clean up unused, disabled startup/debug-related code paths.
  • Remove disabled DEBUGRESERVED edit/update packaging command handlers from startup argument parsing.
  • Remove disabled single-instance enforcement logic guarded by a false compilation condition.
  • Remove disabled debug Test() invocation at the end of startup initialization.
Plain Craft Launcher 2/Application.xaml.cs
Normalize conditional compilation for PCL export behavior.
  • Replace leftover TODO/IfDirectiveTrivia comments with proper #if !RELEASE / #endif around optional PCL download loader creation.
  • Enable clean #if RELEASE / #endif block around copying the PCL executable when exporting instances while preserving surrounding logic.
Plain Craft Launcher 2/Pages/PageInstance/PageInstanceExport.xaml.cs
Remove stray debug-only conditional compilation remnants in logging.
  • Delete trailing disabled #End If artifacts after debug logging branches in both Log(string, ...) and Log(Exception, ...) overloads.
Plain Craft Launcher 2/Modules/Base/ModBase.cs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗨,我已经审阅了你的更改,一切看起来都很棒!


Sourcery 对开源项目是免费的——如果你觉得我们的代码审查有帮助,请考虑分享 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进之后的审查。
Original comment in English

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@pcl-ce-automation pcl-ce-automation Bot added 🕑 等待合并 已处理完毕,正在等待代码合并入主分支 and removed 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 labels May 11, 2026
@SALTWOOD SALTWOOD merged commit 5c2c452 into dev May 11, 2026
3 checks passed
@pcl-ce-automation pcl-ce-automation Bot added 👌 完成 相关问题已修复或功能已实现,计划在下次版本更新时正式上线 and removed 🕑 等待合并 已处理完毕,正在等待代码合并入主分支 labels May 11, 2026
@LuLu-ling LuLu-ling deleted the chore/codeclean branch May 11, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: L PR 大小评估:大型 👌 完成 相关问题已修复或功能已实现,计划在下次版本更新时正式上线

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants