Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[F] Set ForceAsSserver to default ON #92

Merged
merged 2 commits into from
Nov 30, 2024
Merged

Conversation

Menci
Copy link
Collaborator

@Menci Menci commented Nov 28, 2024

Summary by Sourcery

在版本2中,将“ForceAsServer”配置设置为默认启用,并确保在迁移过程中创建相应的字典。

新功能:

  • 在版本2中,将“ForceAsServer”配置设置为默认启用。

增强功能:

  • 确保在迁移过程中创建“GameSettings.ForceAsServer”字典。
Original summary in English

Summary by Sourcery

Set the 'ForceAsServer' configuration to be enabled by default in version 2 and ensure the corresponding dictionary is created during migration.

New Features:

  • Set 'ForceAsServer' configuration to be enabled by default in version 2.

Enhancements:

  • Ensure the 'GameSettings.ForceAsServer' dictionary is created during migration.

@Menci Menci marked this pull request as ready for review November 28, 2024 13:18
Copy link
Collaborator

@clansty clansty left a comment

Choose a reason for hiding this comment

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

private void MapBooleanTrueOrUndefinedToSectionEnable(IConfigView src, ConfigView dst, string srcKey, string dstKey)
    {
        if(!src.TryGetValue<bool>(srcKey, out var value) || value)
        {
            dst.EnsureDictionary(dstKey);
        }
    }

我是想这么写的
以及改过的迁移脚本貌似也没有判断原先到底是没有写这个选项还是写了 false,应该只有写了 false 才是关

Copy link

sourcery-ai bot commented Nov 29, 2024

审核指南由 Sourcery 提供

此 PR 通过默认启用 ForceAsServer 功能来更改其默认行为。实现涉及修改配置迁移逻辑和更新 ConfigSection 属性。

配置迁移过程的序列图

sequenceDiagram
    participant src as Source Config
    participant dst as Destination Config
    src->>dst: GetValueOrDefault("Fix.ForceAsServer")
    alt ForceAsServer is false
        dst->>dst: SetValue("GameSettings.ForceAsServer.Disabled", true)
    end
    dst->>dst: EnsureDictionary("GameSettings.ForceAsServer")
    note right of dst: ForceAsServer 在 V2 中默认启用
Loading

ForceAsServer 配置的更新类图

classDiagram
    class ForceAsServer {
        +defaultOn: true
        +HarmonyPrefix()
    }
    note for ForceAsServer "defaultOn 属性现在设置为 true,默认启用 ForceAsServer。"
Loading

文件级更改

更改 详情 文件
将 ForceAsServer 更改为默认启用
  • 在 ConfigSection 属性中添加了 defaultOn: true 参数
  • 更新了配置迁移逻辑以处理新的默认状态
AquaMai/AquaMai.Mods/GameSettings/ForceAsServer.cs
更新了 ForceAsServer 的配置迁移逻辑
  • 用显式值设置替换了 MapBooleanTrueToSectionEnable
  • 添加了 ForceAsServer 字典初始化以确保正确的结构
  • 更改逻辑以仅在源配置中明确为 false 时禁用该功能
AquaMai/AquaMai.Config/Migration/ConfigMigration_V1_0_V2_0.cs

提示和命令

与 Sourcery 互动

  • 触发新审核: 在拉取请求上评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审核评论。
  • 从审核评论生成 GitHub 问题: 通过回复审核评论请求 Sourcery 创建一个问题。
  • 生成拉取请求标题: 在拉取请求标题的任何地方写 @sourcery-ai 以随时生成标题。
  • 生成拉取请求摘要: 在拉取请求正文的任何地方写 @sourcery-ai summary 以随时生成 PR 摘要。您也可以使用此命令指定摘要应插入的位置。

自定义您的体验

访问您的仪表板以:

  • 启用或禁用审核功能,例如 Sourcery 生成的拉取请求摘要、审核指南等。
  • 更改审核语言。
  • 添加、删除或编辑自定义审核说明。
  • 调整其他审核设置。

获取帮助

Original review guide in English

Reviewer's Guide by Sourcery

This PR changes the default behavior of the ForceAsServer feature by enabling it by default. The implementation involves modifying the configuration migration logic and updating the ConfigSection attribute.

Sequence diagram for configuration migration process

sequenceDiagram
    participant src as Source Config
    participant dst as Destination Config
    src->>dst: GetValueOrDefault("Fix.ForceAsServer")
    alt ForceAsServer is false
        dst->>dst: SetValue("GameSettings.ForceAsServer.Disabled", true)
    end
    dst->>dst: EnsureDictionary("GameSettings.ForceAsServer")
    note right of dst: ForceAsServer is enabled by default in V2
Loading

Updated class diagram for ForceAsServer configuration

classDiagram
    class ForceAsServer {
        +defaultOn: true
        +HarmonyPrefix()
    }
    note for ForceAsServer "The defaultOn attribute is now set to true, enabling ForceAsServer by default."
Loading

File-Level Changes

Change Details Files
Changed ForceAsServer to be enabled by default
  • Added defaultOn: true parameter to ConfigSection attribute
  • Updated configuration migration logic to handle the new default state
AquaMai/AquaMai.Mods/GameSettings/ForceAsServer.cs
Updated configuration migration logic for ForceAsServer
  • Replaced MapBooleanTrueToSectionEnable with explicit value setting
  • Added ForceAsServer dictionary initialization to ensure proper structure
  • Changed logic to disable the feature only if it was explicitly false in the source configuration
AquaMai/AquaMai.Config/Migration/ConfigMigration_V1_0_V2_0.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.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a 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. You can also use
    this command to specify where the summary should be inserted.

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

@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.

@Menci - 我已经审查了你的更改 - 这里有一些反馈:

总体评论

  • 请在 PR 描述中提供关于为什么需要默认启用 ForceAsServer 的背景信息。
  • 考虑在推出此默认更改时,添加关于对现有部署可能影响的文档。
这是我在审查期间查看的内容
  • 🟢 一般问题:一切看起来都很好
  • 🟢 安全性:一切看起来都很好
  • 🟢 测试:一切看起来都很好
  • 🟢 复杂性:一切看起来都很好
  • 🟢 文档:一切看起来都很好

@Menci! 👋

@sourcery-ai 现在已安装在此存储库中。

我们找到了你最近的这个 PR 并进行了审查,以向你展示 Sourcery 的功能。

如果你想审查另一个 PR,只需评论 @sourcery-ai review

帮助我变得更有用!请对每条评论点击 👍 或 👎,我将使用反馈来改进你的审查。
Original comment in English

Hey @Menci - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Please provide context in the PR description about why ForceAsServer needs to be enabled by default.
  • Consider adding documentation about potential impacts on existing deployments when this default change is rolled out.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Hi @Menci! 👋

@sourcery-ai is now installed on this repository.

We found this recent PR of yours and reviewed it to show you what Sourcery can do.

If you want to review another PR, just comment with @sourcery-ai review

Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@clansty clansty merged commit 6225390 into v1-dev Nov 30, 2024
1 check failed
@clansty clansty deleted the force-as-server-default branch November 30, 2024 06:43
clansty added a commit that referenced this pull request Dec 2, 2024
* Set ForceAsSserver to default ON

* work as origin

---------

Co-authored-by: Clansty <i@gao4.pw>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants