Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe2fd5d67c |
No files matched your search
@@ -1,274 +0,0 @@
|
||||
---
|
||||
name: "release-note-generator"
|
||||
description: "基于 BetterGI 本地 git 历史和实际 diff,按 GitHub 已发布 Releases 的中文更新日志风格生成发布说明。用于生成 Release Note、版本更新日志、从上一个非 alpha 正式版本到 HEAD 的变更汇总;不得使用 git tag 作为版本依据。"
|
||||
---
|
||||
|
||||
# Release Note Generator
|
||||
|
||||
基于本地 git 历史和实际代码 diff 生成 BetterGI 发布说明。发布说明的结构、分类和措辞应贴近 GitHub 已发布 Releases 的历史风格;生成具体内容时不依赖网络,所有变更信息从本地仓库获取。
|
||||
|
||||
## 历史 Release 风格
|
||||
|
||||
已发布日志的稳定特征:
|
||||
|
||||
- 标题通常为 `## <version> <简短主题>`,例如 `0.61.0 原神6.6`、`0.61.2 优化`、`0.60.1 修复老问题`、`0.59 自动烹饪与BUG修复`。
|
||||
- 大版本或内容较多时,标题下可有一句总览;补丁版本或内容很少时可以直接列 bullet。
|
||||
- 分类标题使用产品主功能语义,而不是 Conventional Commits 类型。历史分类可以作为参考,但不是固定枚举;`实时任务`、`独立任务`、`新功能`等组织性名称不能替代更准确的主功能名称。
|
||||
- 版本适配类通常放在最前面,包含新角色识别、新地图、传送点/锚点、七圣召唤元数据等。
|
||||
- `其他` 分类保留,用于 UI、通知、配置、稳定性、OCR、启动器、仓库、文档等无法归入核心模块的内容。
|
||||
- 条目语言偏简洁直白,可以用“新增/修复/优化/支持/更新/回滚/适配”,不需要营销化。
|
||||
- PR 号与作者使用纯文本,例如 `(#3132) @haokaiyang`;多个 PR 可以写在同一括号组里,例如 `(#3101 #3108)`。
|
||||
- 不输出 GitHub 自动生成的 `Contributors`、`Assets`、reaction 等区块。
|
||||
|
||||
## 版本边界
|
||||
|
||||
禁止执行或参考 `git tag`、`git describe --tags`。版本边界和输出版本号都不能使用 tag 作为依据。
|
||||
|
||||
从 HEAD 向后遍历提交历史,匹配**明确以版本号发布为主题的提交**:
|
||||
|
||||
- 提交消息必须匹配以下模式之一(大小写不敏感):
|
||||
- `Update version to X.Y.Z`
|
||||
- `bump version to X.Y.Z`
|
||||
- `release X.Y.Z`
|
||||
- `vX.Y.Z`
|
||||
- 版本号正则:`\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?`
|
||||
- 版本号**必须是提交消息的核心主题**,不能只是顺带提及(如 "fix: update package version to 1.0.19" 这种子包更新不算)
|
||||
- 排除包含 `alpha` 的提交
|
||||
- 排除仅更新子包/依赖版本的提交
|
||||
|
||||
### 通用规则
|
||||
|
||||
- 统计区间:`(boundary_commit, HEAD]`,边界提交本身不计入
|
||||
- 如果 HEAD 附近已经存在当前目标版本的正式版本提交,不要把它作为边界;继续向父提交方向寻找上一个正式版本提交
|
||||
- 若未找到边界版本,明确说明并使用兜底范围
|
||||
|
||||
## 信息采集
|
||||
|
||||
### 提交列表
|
||||
|
||||
- 使用 `git -c i18n.logOutputEncoding=utf8 -c core.quotepath=false log` 获取提交序列
|
||||
- 普通提交使用 `--no-merges`,合并提交使用 `--merges` 单独获取;两组提交均限制在完全相同的统计区间内
|
||||
- 格式:`--pretty=format:"%H%x00%h%x00%P%x00%an%x00%ae%x00%s%x00%b%x1e"`,字段用 `\x00` 分隔,commit 用 `\x1e` 分隔
|
||||
- 分别使用 `git rev-list --count --no-merges` 和 `git rev-list --count --merges` 校验采集数量
|
||||
- 读取 commit body,用于提取 `Co-authored-by`、PR、Issue、其他关联编号和补充说明
|
||||
|
||||
### Diff 查阅(必须)
|
||||
|
||||
- 对每个普通 commit 必须查阅实际 diff:`git diff <sha>^..<sha>`
|
||||
- 不要把 merge commit 当作普通 commit 再次统计。对 merge commit 使用 `git show --cc --stat <sha>` 和 `git show --cc <sha>`,只识别合并时额外产生的冲突解决或手工修改
|
||||
- 纯合并且没有额外用户可见改动的 merge commit 不生成日志条目;被合并分支中的普通 commit 仍按各自 diff 检查
|
||||
- **不允许仅基于 commit 消息生成说明**,必须结合实际代码改动理解变更内容
|
||||
- 同一功能的新增 + 后续优化/修复应合并为一条,只记"新增 xxx"
|
||||
|
||||
### 作者信息
|
||||
|
||||
- 所有作者名前统一加 `@` 前缀
|
||||
- 从 commit 的 `author email` 解析标识:
|
||||
- `数字[email protected]` → `@login`
|
||||
- `[email protected]` → `@login`
|
||||
- `[email protected]` 等非 noreply 邮箱 → `@author name`(即提交中的 `an` 字段值前加 `@`)
|
||||
- 从 commit body 的 `Co-authored-by: name <email>` 提取共同作者,并按同样规则解析
|
||||
- 当作者为 `huiyadanli`(含邮箱 `[email protected]`)时省略 `@author`(项目维护者,无需标注)
|
||||
- 不需要调用 GitHub API,纯本地解析
|
||||
- 如果存在下面箭头左侧的作者信息,请替换为右侧的作者名
|
||||
- mno -> Bedrockx
|
||||
- 秋云 -> physligl
|
||||
- darkflamemaster -> 1004452714
|
||||
|
||||
## 内容提炼规则
|
||||
|
||||
### 强制处理顺序
|
||||
|
||||
必须先完成全部分析,再开始写 Release Note。禁止一边遍历 commit 一边直接生成条目,否则会把同一功能的后续提交拆成多条。
|
||||
|
||||
1. 查阅统计区间内所有 commit 的实际 diff,不生成最终文案
|
||||
2. 将 commit 按用户可感知的功能对象归并为**功能簇**
|
||||
3. 对每个功能簇还原 HEAD 时的最终状态,删除已被后续提交取代、回滚或修复的中间状态
|
||||
4. 以整个功能簇为单位确定唯一分类
|
||||
5. 最后才生成标题、总览和条目
|
||||
|
||||
commit 数量、PR 数量和作者数量都不等于日志条目数量。一个功能簇可以包含多个 commit、多个 PR 和多个作者。
|
||||
|
||||
### 合并策略
|
||||
|
||||
- 后续 commit 若是在补全、修复、优化或重构本周期内刚新增的功能,必须并入该新增功能,只描述 HEAD 时的最终能力
|
||||
- 即使 PR 号、作者、提交日期或 commit 前缀不同,只要服务于同一个用户工作流、配置项、API、窗口或任务,就应合并
|
||||
- 同一 issue/PR 的多个 commit 必须合并;不同 issue/PR 只要属于同一功能演进,也必须合并
|
||||
- 多个 commit 修改相同核心类型、配置、入口或调用链,并且用户无法把它们视为独立功能时,必须合并
|
||||
- 后续提交推翻或替代前一提交的实现时,不单列旧行为;条目使用最终行为,并合并保留相关编号与作者
|
||||
- 为新功能提供输入、通信、错误提示、配置界面、兼容修复和稳定性修复的配套提交,归入该新功能,不拆成“支持”“错误提示”“协议升级”等独立条目
|
||||
- 只有两项改动能够独立使用、独立描述且删除其中一项不影响另一项成立时,才允许拆成两条
|
||||
- 可省略纯内部重构、CI、调试日志清理、无用户影响的格式化,但这些 commit 仍必须被检查并纳入内部覆盖记录
|
||||
|
||||
合并校准示例:
|
||||
|
||||
| 同一周期内的提交 | 正确处理 |
|
||||
|------------------|----------|
|
||||
| 新增桌面分身、增加 RawInput、补充 RDP 错误提示、增加组合键切换、升级通信协议 | 合并为一条“新增桌面分身”,描述最终支持的能力 |
|
||||
| 新增战技赶路、修复体力判断、优化下车角度、修复按键残留 | 合并为一条“新增角色战技赶路”,不要再列三条修复或优化 |
|
||||
| 指标栏快捷键先绑定日志快捷键,后改为独立快捷键 | 只描述最终的独立快捷键,并合并相关提交 |
|
||||
| 重构截图与识别区域,后续修复裁剪区域导致的点击偏移 | 合并为一条识别基础设施改进,不跨分类拆成两条 |
|
||||
| 页面布局统一、随后补充导航选中动画和 Footer 菜单兼容 | 合并为一条界面体验优化 |
|
||||
|
||||
### 分类
|
||||
|
||||
分类不是固定枚举,也不由目录表机械决定。先完成 commit 合并,再由 AI 根据实际 diff 判断每个功能簇所属的**产品主功能**。历史 Release 中出现过的分类只是命名参考,不是白名单。
|
||||
|
||||
#### 分类粒度
|
||||
|
||||
- 分类应对应用户能够识别的产品主功能,通常具有独立入口、独立开关、独立配置根节点、独立任务生命周期或完整工作流
|
||||
- 子能力、算法、处理器、配置项和实现步骤归入其上级主功能,不单独提升为分类
|
||||
- `地图追踪`是主功能;战技赶路、路径执行、地图传送、下车判定和传送识别都是其下的条目,不能分别建立分类
|
||||
- `自动战斗`是主功能;战斗策略、角色识别、技能释放、战后拾取等紧密服务于战斗流程的内容归入其中
|
||||
- `遮罩窗口`是主功能;准星、指标栏、日志框和窗口行为归入其中
|
||||
- `自动拾取`、`自动吃药`、`自动剧情`、`秘境`、`首领讨伐`、`钓鱼`等具有独立入口或独立工作流,应直接使用自身功能名,不能统一塞入`实时任务`或`独立任务`
|
||||
- 单个主功能即使只有一条日志,也允许单独建立分类;不要为了减少分类数量而使用大杂烩分类
|
||||
- 不要过度细分:若某项改动离开上级功能无法独立使用或无法被用户单独识别,就保留在上级功能分类中
|
||||
|
||||
以下名称通常只是组织容器,不应作为默认分类:`实时任务`、`独立任务`、`新功能`、`功能优化`、`问题修复`。只有用户界面或项目历史确实把它作为独立产品概念时才允许使用。
|
||||
|
||||
对所有功能簇统一使用“最近的独立上级主功能”原则:从具体改动向上追溯,选择距离最近、同时具备独立产品入口或完整用户工作流的上级功能作为分类。不要选择更高层的组织容器,也不要停留在更低层的实现或子功能。
|
||||
|
||||
| 具体改动 | 应归入的上级主功能 | 不应使用的分类 |
|
||||
|----------|--------------------|----------------|
|
||||
| 战技赶路、传送定位、路径处理器 | `地图追踪` | `战技赶路`、`地图传送`、`独立任务` |
|
||||
| 自动拾取黑名单、拾取触发和拾取识别 | `自动拾取` | `黑名单`、`实时任务` |
|
||||
| 首领路线、首领配置和战前等待 | `首领讨伐` | `路线优化`、`独立任务` |
|
||||
| 遮罩准星、指标栏和日志框 | `遮罩窗口` | `准星`、`指标栏`、`其他` |
|
||||
| 桌面分身的 RawInput、RDP 错误提示和通信协议 | `桌面分身` | `RawInput`、`RDP`、`其他` |
|
||||
|
||||
此表只用于说明层级关系,不是分类白名单。其他功能必须由 AI 按同一原则从代码、界面和调用关系中判断。
|
||||
|
||||
#### AI 判定依据
|
||||
|
||||
按以下证据从强到弱确定主功能,允许 AI 创建历史中未出现过但符合项目语义的新分类:
|
||||
|
||||
1. 用户界面中的页面、卡片、设置分组、开关和任务名称
|
||||
2. 独立配置对象、任务入口、服务生命周期和用户操作流程
|
||||
3. 主要调用方、API 使用者和最终受影响功能
|
||||
4. 类型名、命名空间和代码目录
|
||||
5. commit 标题和正文
|
||||
|
||||
- 目录只提供线索,不能覆盖功能语义;`GameTask/Common`、共享 ViewModel、设置页和 `.csproj` 均不能直接决定分类
|
||||
- 直接面向脚本开发者的 `genshin.*`、`dispatcher.*` 等公共 API 归入`JS脚本`,即使底层实现位于战斗、地图或通用目录
|
||||
- 仅更新资源包或数据包版本时,根据提交说明、包用途和相邻变更判断实际主功能,不按 `.csproj` 路径归入`其他`,也不得编造本地无法确认的细节
|
||||
- 横跨多个主功能的截图、识别资源、OCR、基础 UI 和捕获接口重构归入`其他`;明确服务于单一主功能时跟随该主功能
|
||||
- 当一个 commit 同时包含两个能够独立使用的主功能改动时,可以拆成两条并分别分类;否则以整个功能簇的主要用户工作流为准
|
||||
|
||||
分类完成后反向检查:分类名必须能自然回答“这是哪个主功能的更新?”。若答案只能是一个组织容器或技术层,重新判断。
|
||||
|
||||
#### 遮罩相关变更的分类边界
|
||||
|
||||
只有变更的核心行为与**地图位置或地图标点在遮罩窗口中的展示和交互**直接相关时,才归入`地图遮罩`。通常至少需要一项地图专属证据:
|
||||
|
||||
- 修改 `GameTask/MapMask`、`Model/MaskMap`、`MaskMapPointService` 等地图遮罩专属模块
|
||||
- diff 中的核心对象是地图坐标、地图数据源、地图标点、标签筛选、点位隐藏、小地图资源点或地图点位交互
|
||||
- 修改 `MaskWindow`、`MaskWindowViewModel` 等共享文件时,同时能从属性、命令、调用链或配套文件确认改动服务于地图标点展示
|
||||
|
||||
以下内容即使名称或文件中含有 `Mask` / “遮罩”,也**不能仅因此**归入`地图遮罩`:
|
||||
|
||||
- 通用遮罩窗口能力:日志框、指标栏、准星、窗口位置、透明度、DPI、置顶、点击穿透、快捷键、UID 遮盖等,归入`遮罩窗口`
|
||||
- JS 的 HTML 遮罩、`HtmlMaskWindow`、`Core/Script/Dependence/HtmlMask*`,归入`JS脚本`
|
||||
- OCR、模板匹配、图像识别中的 mask/掩膜,归入其所属业务分类;无明确业务归属时放入`其他`
|
||||
- 自动战斗、独立任务、实时任务内部用于识别或显示的遮罩,归入对应任务分类
|
||||
- 只修改 `View/MaskWindow*`、`ViewModel/MaskWindow*`、`Core/Config/MaskWindowConfig*`、设置页或快捷键配置,不构成`地图遮罩`的充分证据
|
||||
|
||||
冲突时使用以下优先顺序:专属业务模块和调用链 > diff 中的功能对象 > 配置项/命令语义 > 共享文件路径 > 提交标题关键词。证据不足时放入`其他`,不要猜测为`地图遮罩`。
|
||||
|
||||
校准示例:
|
||||
|
||||
| 变更 | 正确分类 | 原因 |
|
||||
|------|----------|------|
|
||||
| 为遮罩窗口新增准星样式 | `遮罩窗口` | 修改的是通用遮罩窗口显示能力,与地图位置或标点无关 |
|
||||
| 为遮罩指标栏增加独立快捷键 | `遮罩窗口` | 修改的是指标栏和快捷键配置,不能因“遮罩”一词归入地图遮罩 |
|
||||
| 修改 HTML 遮罩资源拦截或 JS 响应 | `JS脚本` | HTML 遮罩是脚本 API 能力 |
|
||||
| 增加地图遮罩标点的隐藏、筛选或数据源隔离 | `地图遮罩` | 核心对象是地图标点及其数据 |
|
||||
| 为模板匹配增加颜色掩膜 | 所属业务分类或`其他` | 这是图像识别掩膜,不是地图遮罩 |
|
||||
|
||||
- 版本适配类命名:若能从变更或用户要求明确对应原神版本/月之版本,可用 `<月之X适配>`;否则使用 `版本适配`
|
||||
- 禁止用`新功能`、`实时任务`或`独立任务`代替能够识别出的上级主功能
|
||||
- 历史分类未覆盖时,由 AI 根据独立入口、配置和工作流创建新的主功能分类,分类名必须使用项目中的用户语义,不要使用 `feat/fix/refactor`
|
||||
- 只有无法对应到任何独立主功能的跨模块基础设施和通用改动才放入`其他`
|
||||
|
||||
每条记录格式:
|
||||
```
|
||||
描述内容 (#编号) @author
|
||||
```
|
||||
|
||||
- 编号和作者名均使用纯文本,不加超链接
|
||||
- 当作者为 `huiyadanli` 时省略 `@author`(项目维护者,无需标注)
|
||||
- 描述用自然语言,不直接复制 commit 原文
|
||||
- 移除 `feat:`、`fix:` 等 Conventional Commits 前缀
|
||||
- 只有 `(#3111)`、`Merge pull request #3111` 或明确的 `/pull/3111` 链接可以判定为 PR 号
|
||||
- `fixes #3111`、`closes #3111`、`resolved #3111` 或明确的 `/issues/3111` 链接按 Issue 关联处理
|
||||
- 无法从本地信息判断类型的裸 `#3111` 只称为“关联编号”,不得擅自标记为 PR
|
||||
- 同一个编号在 subject、body 和合并信息中重复出现时只保留一次
|
||||
- 多人参与的记录:`@id1 @id2`
|
||||
- 合并多个 PR、Issue 或关联编号时格式为 `(#3101 #3108)`,不要写成多个分散条目
|
||||
|
||||
### 描述质量与长度
|
||||
|
||||
- 每条日志默认只写一句,正文控制在约 25~60 个中文字符;复杂的核心新增功能最多约 90 个中文字符
|
||||
- 合并多个 commit 后先概括最终用户效果,不得把每个 commit 的描述用分号拼接成长句
|
||||
- 每条只保留最终效果和最多 2 个关键能力;省略实现算法、内部协议、重试次数、完整配置列表和穷举式支持对象
|
||||
- 描述必须准确,不缩小也不夸大;只改一个配置项时不能写成整个功能重构
|
||||
- 面向用户使用功能、体验和问题现象描述;只有脚本 API 或开发者功能保留必要的技术标识符
|
||||
- 纯内部重构、CI、依赖整理和无用户影响的格式化可以省略
|
||||
- 总览句控制在约 60 个中文字符内,只概括最重要的 2~4 个变化
|
||||
|
||||
## 输出格式
|
||||
|
||||
输出到 `.claude/documents/ReleaseNotes-<version>.md`(文件名 ASCII)。
|
||||
|
||||
输出文件的版本号规则:取边界版本号的**次版本号(minor)加 1**,补丁版本归零。即 `major.(minor+1).0`。例如边界为 `0.60.1`,输出版本号为 `0.61.0`。
|
||||
|
||||
若用户明确指定版本号或发布主题,以用户指定为准;否则按上述规则推导。
|
||||
|
||||
```markdown
|
||||
## <version> <版本主题>
|
||||
<一句话版本主题>
|
||||
|
||||
### 分类名1
|
||||
- 变更描述 (#PR号) @author
|
||||
- 变更描述 @author
|
||||
|
||||
### 分类名2
|
||||
- 变更描述 (#PR号) @author
|
||||
|
||||
### 其他
|
||||
- 变更描述 @author
|
||||
```
|
||||
|
||||
补丁版本或少量修复可以不分分类,直接输出 bullet;但如果使用分类,仍必须保留 `其他` 分类。
|
||||
|
||||
## 兜底验证(必须)
|
||||
|
||||
初稿不能直接输出。依次执行以下验证;任一项失败都必须退回功能簇合并、分类或文案阶段重写,然后重新验证。
|
||||
|
||||
### 分类验证
|
||||
|
||||
- 出现`实时任务`、`独立任务`或`新功能`时,逐条检查是否存在更准确的独立上级主功能;存在则判定失败
|
||||
- `其他`中的条目只要能识别出自动拾取、钓鱼、一条龙、进入游戏等具体主功能,就判定失败并重新分类
|
||||
- `其他`达到 4 条或超过全部条目的 25% 时,强制逐条重新检查;只有确属跨模块基础设施的内容才能保留
|
||||
- 分类名若是子功能、算法、配置项或实现技术,而代码中存在独立上级主功能,判定失败
|
||||
- 同一 commit 或功能簇包含两个独立主功能时,必须拆条;不可在一个分类中混写另一个主功能的修复
|
||||
|
||||
### 合并验证
|
||||
|
||||
- 跨分类比较全部条目;相同入口、配置、核心类型或用户工作流出现两次时,判定为未合并
|
||||
- 本周期新增功能若同时存在独立的修复、优化、v2、错误提示、输入支持或协议升级条目,判定为未合并
|
||||
- 后续提交只是补全新功能时,必须并入新增条目;不得因 PR、作者或提交时间不同而拆分
|
||||
- merge commit 的汇总 diff 不得与其中的普通 commit 重复生成条目
|
||||
|
||||
### 精简验证
|
||||
|
||||
- 普通条目超过约 60 个中文字符、核心新增条目超过约 90 个中文字符时,重新压缩
|
||||
- 一个条目出现多句、超过 2 个关键能力或明显罗列实现细节时,重新概括
|
||||
- 总览句超过约 60 个中文字符或机械罗列所有分类时,重新压缩
|
||||
|
||||
### 最终确认
|
||||
|
||||
- 统计区间内所有 commit 均已检查实际 diff;无用户影响的 commit 可以不输出
|
||||
- 每条内容描述 HEAD 时的最终状态,不保留被回滚、替换或修复的中间状态
|
||||
- 所有相关编号和作者已合并去重,`地图遮罩`条目具备地图坐标、标点或数据源等专属证据
|
||||
- `其他`分类必须存在;全部信息仅从本地 git 获取,不依赖网络
|
||||
@@ -1,27 +0,0 @@
|
||||
main:
|
||||
# 自定义按钮可触发的事件
|
||||
web_trigger_one:
|
||||
- docker:
|
||||
image: python:3.11
|
||||
imports:
|
||||
- https://cnb.cool/bettergi/secret/-/blob/main/env.yml
|
||||
stages:
|
||||
- name: 下载构建物并上传
|
||||
script: |
|
||||
cd .github/workflows
|
||||
pip install -r requirements.txt
|
||||
python github_download_and_cnb_upload.py --cnb-token $CNB_TOKEN --github-token $GITHUB_TOKEN
|
||||
echo done!
|
||||
api_trigger_one:
|
||||
- docker:
|
||||
image: python:3.11
|
||||
imports:
|
||||
- https://cnb.cool/bettergi/secret/-/blob/main/env.yml
|
||||
stages:
|
||||
- name: API触发上传
|
||||
script: |
|
||||
echo run id: $RUN_ID
|
||||
cd .github/workflows
|
||||
pip install -r requirements.txt
|
||||
python github_download_and_cnb_upload.py --cnb-token $CNB_TOKEN --github-token $GITHUB_TOKEN --run-id $RUN_ID
|
||||
echo api done!
|
||||
@@ -1,5 +0,0 @@
|
||||
branch:
|
||||
- buttons:
|
||||
- name: 触发上传
|
||||
description: 上传测试版或者正式版
|
||||
event: web_trigger_one
|
||||
@@ -1,4 +0,0 @@
|
||||
###############################################################################
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
###############################################################################
|
||||
* text=auto
|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
name: Bug report / 错误报告
|
||||
about: Create a report to help us improve / 创建报告以帮助我们改进
|
||||
title: "[bug] "
|
||||
labels: bug
|
||||
---
|
||||
|
||||
<!--
|
||||
请提供下述完整信息以便快速定位问题 / Please provide the following information to quickly locate the problem
|
||||
-->
|
||||
|
||||
- 系统环境 / System Environment:
|
||||
|
||||
|
||||
- BetterGI版本号 / BetterGI Version:
|
||||
|
||||
|
||||
- 问题描述 / Description of the issue:
|
||||
|
||||
|
||||
- 复现步骤 / Reproduction steps:
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
name: Bug report / 错误报告
|
||||
description: 提交可复现的问题,帮助我们定位错误 / Report a reproducible problem
|
||||
title: "[bug] "
|
||||
type: Bug
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: 提交确认 / Checklist
|
||||
description: Checklist before submitting
|
||||
options:
|
||||
- label: 我已经搜索过现有 issue,确认这不是重复问题 / I have searched existing issues and confirmed this is not a duplicate
|
||||
required: true
|
||||
- label: "我已阅读过[文档](https://www.bettergi.com/doc.html),确认文档的内容无法解决我的问题 / I have read the [documentation](https://www.bettergi.com/doc.html) and confirmed it does not solve my problem"
|
||||
required: true
|
||||
- label: 我愿意为了解决这个问题尽自己所能 / I am willing to do my part to help resolve this issue
|
||||
- type: textarea
|
||||
id: environment
|
||||
attributes:
|
||||
label: 系统环境
|
||||
description: System environment,例如操作系统版本、运行时版本、显卡驱动版本
|
||||
placeholder: Windows 11 24H2 (26100.3775) / .NET Desktop Runtime 8.0.15 / NVIDIA 572.83
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: BetterGI 版本号
|
||||
description: BetterGI Version
|
||||
placeholder: e.g. 0.58.0
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: 问题描述
|
||||
description: Describe the actual behavior and impact
|
||||
placeholder: 请描述实际出现的问题,以及这个问题对使用造成了什么影响 / Describe the actual behavior and impact
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: expected
|
||||
attributes:
|
||||
label: 期望结果
|
||||
description: Expected behavior
|
||||
placeholder: 请描述你期望出现的正确行为或结果 / Describe the expected behavior or result
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: steps
|
||||
attributes:
|
||||
label: 复现步骤
|
||||
description: Reproduction steps
|
||||
placeholder: |-
|
||||
1. 打开…… / Open ...
|
||||
2. 点击…… / Click ...
|
||||
3. 出现…… / Observe ...
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: 日志与附件
|
||||
description: Logs and attachments,可直接拖拽上传日志文件、压缩包、截图或视频
|
||||
placeholder: |-
|
||||
可在这里补充日志和附件说明 / Add logs and attachment notes here:
|
||||
- 可直接粘贴关键日志片段 / Paste key log snippets directly
|
||||
- 可拖拽上传日志文件或压缩包 / Drag and drop log files or archives
|
||||
- 可拖拽上传截图、录屏或演示视频 / Drag and drop screenshots or videos
|
||||
- 若附件较多,请说明对应的时间点、任务名称或异常现象 / If there are many files, explain the relevant timestamps or symptoms
|
||||
- 提交前请注意移除账号、路径等隐私信息 / Remove private information before submitting
|
||||
validations:
|
||||
required: false
|
||||
@@ -1,9 +1,9 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: 官方文档 / Document
|
||||
url: https://www.bettergi.com/doc.html
|
||||
url: https://bgi.huiyadan.com/doc.html
|
||||
about: 请在提出问题前阅读文档 / Read the document before submit the issue
|
||||
|
||||
- name: 常见问题 / FAQ
|
||||
url: https://www.bettergi.com/faq.html
|
||||
url: https://bgi.huiyadan.com/faq.html
|
||||
about: 常见的用户提出的问题 / Common questions asked by users
|
||||
@@ -1,51 +0,0 @@
|
||||
name: I have feature requesting / 我有功能需求
|
||||
description: 提出新的功能想法 / Share a feature request
|
||||
title: "[feature] "
|
||||
type: Feature
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: 提交确认 / Checklist
|
||||
description: Please confirm the following before submitting
|
||||
options:
|
||||
- label: 我已经搜索过现有 issue,确认这不是重复建议 / I have searched existing issues and confirmed this is not a duplicate request
|
||||
required: true
|
||||
- label: 我已确认当前版本中尚未提供该功能,或至少没有等价实现 / I have confirmed this feature, or an equivalent one, is not already available in the current version
|
||||
required: true
|
||||
- label: 我认为这个需求能为更多用户带来明确收益,而不仅仅是个人偏好 / I believe this request provides clear value to a broader group of users, not just my personal preference
|
||||
required: true
|
||||
- label: 我理解这个需求可能因实现成本、维护成本或项目方向而暂不采纳 / I understand this request may not be accepted due to implementation cost, maintenance cost, or project direction
|
||||
required: true
|
||||
- type: textarea
|
||||
id: request
|
||||
attributes:
|
||||
label: 功能请求
|
||||
description: Feature Request
|
||||
placeholder: 请简要说明你希望新增什么能力 / Briefly describe the capability you want to add
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: scenario
|
||||
attributes:
|
||||
label: 使用场景
|
||||
description: Use Case
|
||||
placeholder: 这个功能要解决什么问题?在哪些场景下使用? / What problem does this feature solve, and when would it be used?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: impact
|
||||
attributes:
|
||||
label: 潜在影响
|
||||
description: Potential Impact
|
||||
placeholder: 请说明这个功能是否可能带来新的问题、维护成本、使用门槛或兼容性影响;如果没有,请填写“无” / Describe any potential downsides such as new issues, maintenance cost, usability barriers, or compatibility impact. Write "None" if there are no obvious downsides.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: extra
|
||||
attributes:
|
||||
label: 补充信息
|
||||
description: Optional
|
||||
placeholder: "可选,补充示意图、交互草图、参考链接或相关背景信息 / Optional: add mockups, interaction sketches, reference links, or other background information"
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
name: Feel free to express / 随便写写
|
||||
about: Record something / 简单写写记录记录
|
||||
---
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
name: Feel free to express / 自由描述
|
||||
description: 记录你想反馈的内容 / Share general feedback
|
||||
title: "[feedback] "
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: 提交确认 / Checklist
|
||||
description: Please confirm the following before submitting
|
||||
options:
|
||||
- label: 我已经搜索过现有 issue,确认这不是重复反馈 / I have searched existing issues and confirmed this is not duplicate feedback
|
||||
required: true
|
||||
- label: "我已阅读过[文档](https://www.bettergi.com/doc.html),确认文档的内容无法解决我的问题或覆盖我的反馈 / I have read the [documentation](https://www.bettergi.com/doc.html) and confirmed it does not solve my problem or cover my feedback"
|
||||
required: true
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: 描述
|
||||
description: Description
|
||||
placeholder: 请描述你想反馈的内容 / Describe what you want to share
|
||||
validations:
|
||||
required: true
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
name: I have a question / 我有疑问
|
||||
about: Solve your problem / 解决你的疑问
|
||||
title: "[question] "
|
||||
labels: question
|
||||
---
|
||||
|
||||
- Problem Description / 问题描述
|
||||
- 请尽量提供问题相关的截图/日志等内容
|
||||
@@ -1,31 +0,0 @@
|
||||
name: I have a question / 我有疑问
|
||||
description: 提交你的问题,我们会尽量帮助你解决 / Ask a question
|
||||
title: "[question] "
|
||||
type: Question
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: 提交确认 / Checklist
|
||||
description: Please confirm the following before submitting
|
||||
options:
|
||||
- label: 我已经搜索过现有 issue,确认这不是重复问题 / I have searched existing issues and confirmed this is not a duplicate question
|
||||
required: true
|
||||
- label: "我已阅读过[文档](https://www.bettergi.com/doc.html),确认文档的内容无法解决我的问题 / I have read the [documentation](https://www.bettergi.com/doc.html) and confirmed it does not solve my problem"
|
||||
required: true
|
||||
- type: textarea
|
||||
id: question
|
||||
attributes:
|
||||
label: 问题描述
|
||||
description: Problem Description
|
||||
placeholder: 请清楚描述你的问题 / Clearly describe your question
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: tried
|
||||
attributes:
|
||||
label: 已尝试内容
|
||||
description: Screenshots / logs / what you already tried
|
||||
placeholder: 可附上截图、日志,以及你已经尝试过的排查过程 / Add screenshots, logs, and what you have already tried
|
||||
validations:
|
||||
required: true
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
name: I have suggestions / 我有建议
|
||||
about: Your suggestions may benefit everyone / 你的建议可能让所有人受益
|
||||
title: "[suggestion] "
|
||||
labels: suggestion
|
||||
---
|
||||
|
||||
- Your suggestions / 你的建议
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
name: I have suggestions / 我有建议
|
||||
description: 分享对项目的改进建议 / Share an improvement suggestion
|
||||
title: "[suggestion] "
|
||||
type: Suggestions
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: 提交确认 / Checklist
|
||||
description: Please confirm the following before submitting
|
||||
options:
|
||||
- label: 我已经搜索过现有 issue,确认这不是重复建议 / I have searched existing issues and confirmed this is not a duplicate suggestion
|
||||
required: true
|
||||
- label: "我已阅读过[文档](https://www.bettergi.com/doc.html),确认文档的内容无法解决我的问题或覆盖我的建议 / I have read the [documentation](https://www.bettergi.com/doc.html) and confirmed it does not solve my problem or cover my suggestion"
|
||||
required: true
|
||||
- type: textarea
|
||||
id: suggestion
|
||||
attributes:
|
||||
label: 建议内容
|
||||
description: Suggestion
|
||||
placeholder: 请描述你的建议内容 / Describe your suggestion
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: benefit
|
||||
attributes:
|
||||
label: 预期收益
|
||||
description: Expected Benefit
|
||||
placeholder: 这个建议会给用户或项目带来什么帮助? / What benefits would this suggestion bring to users or the project?
|
||||
validations:
|
||||
required: true
|
||||
@@ -1,78 +0,0 @@
|
||||
<!--
|
||||
感谢你的贡献!提交前请先阅读以下说明 / Thanks for contributing! Please read this before submitting:
|
||||
1. 请按模板逐项填写,请勿删除模板中的标题,否则内容无法被正确识别 / Fill in every section and do not delete the headings.
|
||||
2. 未填写关键信息(解决的需求、是否在游戏内实际运行、代码是否纯手工编写)的 PR 可能会被直接关闭 / PRs missing key information may be closed directly.
|
||||
3. 请保持改动聚焦,避免在一次 PR 中混入与需求无关的大规模改动 / Keep the change focused.
|
||||
-->
|
||||
|
||||
## 提交确认 / Checklist
|
||||
|
||||
- [ ] 我已经搜索过现有 Issue 与 PR,确认这不是重复内容 / I have searched existing issues and PRs and confirmed this is not a duplicate
|
||||
- [ ] 我已经阅读过[文档](https://www.bettergi.com/doc.html),确认改动符合项目的使用方式 / I have read the [documentation](https://www.bettergi.com/doc.html) and confirmed the change matches the project's usage
|
||||
- [ ] 本次改动可以通过 `dotnet build BetterGenshinImpact.sln -c Debug` 编译 / This change compiles with `dotnet build BetterGenshinImpact.sln -c Debug`
|
||||
- [ ] 我理解未经过实际验证的改动,可能被要求补充证据后再合并 / I understand unverified changes may require more evidence before merging
|
||||
|
||||
## 关联 Issue / Related Issue
|
||||
|
||||
<!-- 例:close #1234 / Fixes #1234;没有关联 Issue 可填写“无” / Write "None" if there is no related issue -->
|
||||
|
||||
## 解决的需求 / Problem Solved
|
||||
|
||||
> 请说明这个 PR 要解决什么问题,而不是只描述改了哪些代码 / Explain the problem this PR solves, not just which code was changed.
|
||||
|
||||
**要解决的需求或问题是什么?/ What problem does this PR solve?**
|
||||
|
||||
**在什么场景下会触发或需要它?/ In which scenarios is it needed?**
|
||||
|
||||
**实现方案简述 / Implementation summary**
|
||||
|
||||
## 是否在游戏内实际运行 / Verified In-Game
|
||||
|
||||
> BetterGI 的行为高度依赖真实游戏环境(分辨率、帧率、任务状态、网络延迟等),因此请如实填写本项,以下两项请只勾选一项。/ BetterGI's behavior heavily depends on the real game environment, so please answer this honestly. Check only one of the following.
|
||||
|
||||
- [ ] 已在游戏内实际运行并验证本次改动 / Yes, I actually ran and verified this change in the game
|
||||
- [ ] 未在游戏内实际运行 / No, I have not run it in the game
|
||||
|
||||
**若已在游戏内运行,请补充验证信息 / If yes, please provide details:**
|
||||
|
||||
| 项目 / Item | 内容 / Detail |
|
||||
| --- | --- |
|
||||
| 游戏版本 / Game version | |
|
||||
| 分辨率与窗口模式 / Resolution & window mode | |
|
||||
| 验证的功能或任务 / Verified feature or task | |
|
||||
| 验证次数与运行时长 / Runs & duration | |
|
||||
| 结果 / Result | 符合预期 / 存在问题(请说明) |
|
||||
|
||||
**若未在游戏内运行,请说明原因与替代验证方式(例如仅文档、仅 UI 调整、仅重构、单元测试)/ If not, explain why and what alternative verification was done:**
|
||||
|
||||
## 代码是否纯手工编写 / Hand-Written Code
|
||||
|
||||
> 本项目推荐使用 AI 辅助编写代码,但要求提交者完全理解并验证自己提交的每一行代码,并对最终结果负责。以下三项请只勾选一项。/ AI-assisted coding is recommended, but you must fully understand and verify every line you submit, and you are responsible for the result. Check only one of the following.
|
||||
|
||||
- [ ] 本次代码完全由我手工编写,未使用 AI 生成 / Entirely hand-written, no AI generation
|
||||
- [ ] 部分代码由 AI 辅助生成,我已逐行阅读、理解并验证 / Partly AI-assisted; I have read, understood and verified it line by line
|
||||
- [ ] 本次代码完全由 AI 生成,我已逐行阅读、理解并验证 / Fully AI-generated; I have read, understood and verified it line by line
|
||||
|
||||
**AI 参与的部分及我的验证方式(未使用 AI 请填“无”)/ AI-involved parts and how I verified them (write "None" if no AI was used):**
|
||||
|
||||
**我确认 / I confirm:**
|
||||
|
||||
- [ ] 我理解本次改动的全部逻辑,能够解释每一处修改的原因 / I understand the entire change and can explain every modification
|
||||
- [ ] 提交的代码不包含来源不明、我无法解释的代码片段 / No unexplained code from unknown sources is included
|
||||
|
||||
## 改动类型 / Type of Change
|
||||
|
||||
- [ ] 新功能 / New feature
|
||||
- [ ] 问题修复 / Bug fix
|
||||
- [ ] 重构或性能优化 / Refactor or performance
|
||||
- [ ] 文档或其他杂项 / Docs or chores
|
||||
|
||||
## 影响范围 / Impact
|
||||
|
||||
**涉及的模块或功能 / Affected modules or features:**
|
||||
|
||||
**可能带来的风险、兼容性影响或行为变化 / Potential risks, compatibility impact, or behavior changes:**
|
||||
|
||||
## 补充信息 / Additional Information
|
||||
|
||||
<!-- 截图、录屏、日志、参考链接等,可选 / Screenshots, recordings, logs, references (optional) -->
|
||||
@@ -1,252 +0,0 @@
|
||||
runtime:
|
||||
languageMode: auto
|
||||
dryRun: false
|
||||
|
||||
providers:
|
||||
openAiCompatible:
|
||||
enabled: true
|
||||
baseUrl: https://api.openai.com/v1
|
||||
model: gpt-5.6-luna
|
||||
apiStyle: responses
|
||||
timeoutMs: 30000
|
||||
|
||||
issues:
|
||||
autoProcessing:
|
||||
skipCreatedBefore: auto
|
||||
validation:
|
||||
enabled: true
|
||||
fallbackTemplateKey: normal
|
||||
commentAnchor: issue-bot:validation
|
||||
templates:
|
||||
- key: bug
|
||||
issueType: Bug
|
||||
detect:
|
||||
markers:
|
||||
- bug
|
||||
titlePrefixes:
|
||||
- "[bug]"
|
||||
formSignatures:
|
||||
- 我已经搜索过现有 issue,确认这不是重复问题
|
||||
- 确认文档的内容无法解决我的问题
|
||||
- 我愿意为了解决这个问题尽自己所能
|
||||
requiredSections:
|
||||
- id: environment
|
||||
aliases:
|
||||
- 系统环境
|
||||
- System Environment
|
||||
- 运行环境与关键配置
|
||||
- id: version
|
||||
aliases:
|
||||
- BetterGI 版本号
|
||||
- BetterGI Version
|
||||
- id: description
|
||||
aliases:
|
||||
- 问题描述
|
||||
- Description of the issue
|
||||
- id: steps
|
||||
aliases:
|
||||
- 复现步骤
|
||||
- Reproduction steps
|
||||
labels:
|
||||
whenValid: []
|
||||
whenInvalid:
|
||||
- 需要更多信息
|
||||
- key: feature
|
||||
issueType: Feature
|
||||
detect:
|
||||
markers:
|
||||
- feature
|
||||
titlePrefixes:
|
||||
- "[feature]"
|
||||
formSignatures:
|
||||
- 我已经搜索过现有 issue,确认这不是重复建议
|
||||
- 我已确认当前版本中尚未提供该功能,或至少没有等价实现
|
||||
- 我认为这个需求能为更多用户带来明确收益,而不仅仅是个人偏好
|
||||
- 我理解这个需求可能因实现成本、维护成本或项目方向而暂不采纳
|
||||
requiredSections:
|
||||
- id: request
|
||||
aliases:
|
||||
- 功能请求
|
||||
- Feature Request
|
||||
- 需求或建议
|
||||
- id: scenario
|
||||
aliases:
|
||||
- 使用场景
|
||||
- Use Case
|
||||
labels:
|
||||
whenValid: []
|
||||
whenInvalid:
|
||||
- 需要更多信息
|
||||
- key: suggestion
|
||||
issueType: Suggestions
|
||||
detect:
|
||||
markers:
|
||||
- suggestion
|
||||
titlePrefixes:
|
||||
- "[suggestion]"
|
||||
formSignatures:
|
||||
- 我已经搜索过现有 issue,确认这不是重复建议
|
||||
- 确认文档的内容无法解决我的问题或覆盖我的建议
|
||||
requiredSections:
|
||||
- id: suggestion
|
||||
aliases:
|
||||
- 建议内容
|
||||
- Suggestion
|
||||
- id: benefit
|
||||
aliases:
|
||||
- 预期收益
|
||||
- Expected Benefit
|
||||
labels:
|
||||
whenValid: []
|
||||
whenInvalid:
|
||||
- 需要更多信息
|
||||
- key: question
|
||||
issueType: Question
|
||||
detect:
|
||||
markers:
|
||||
- question
|
||||
titlePrefixes:
|
||||
- "[question]"
|
||||
formSignatures:
|
||||
- 我已经搜索过现有 issue,确认这不是重复问题
|
||||
- 确认文档的内容无法解决我的问题
|
||||
requiredSections:
|
||||
- id: question
|
||||
aliases:
|
||||
- 问题描述
|
||||
- Problem Description
|
||||
- id: tried
|
||||
aliases:
|
||||
- 已尝试内容
|
||||
- What I Tried
|
||||
labels:
|
||||
whenValid: []
|
||||
whenInvalid:
|
||||
- 需要更多信息
|
||||
- key: normal
|
||||
detect:
|
||||
markers:
|
||||
- normal
|
||||
titlePrefixes:
|
||||
- "[feedback]"
|
||||
- "[normal]"
|
||||
formSignatures:
|
||||
- 我已经搜索过现有 issue,确认这不是重复反馈
|
||||
- 确认文档的内容无法解决我的问题或覆盖我的反馈
|
||||
requiredSections:
|
||||
- id: description
|
||||
aliases:
|
||||
- 描述
|
||||
- Description
|
||||
labels:
|
||||
whenValid: []
|
||||
whenInvalid:
|
||||
- 需要更多信息
|
||||
duplicateDetection:
|
||||
enabled: true
|
||||
bypassLabels:
|
||||
- 跳过重复检测
|
||||
duplicateLabel: 重复
|
||||
searchResultLimit: 50
|
||||
candidateLimit: 20
|
||||
aiReviewMaxCandidates: 3
|
||||
thresholds:
|
||||
exact: 0.995
|
||||
highConfidence: 0.93
|
||||
reviewMin: 0.82
|
||||
similarityComment:
|
||||
enabled: false
|
||||
commentAnchor: issue-bot:similar-issues
|
||||
minScore: 0.3
|
||||
maxCandidates: 3
|
||||
labeling:
|
||||
enabled: true
|
||||
autoCreateMissing: true
|
||||
managed:
|
||||
- 需要更多信息
|
||||
- 重复
|
||||
definitions:
|
||||
BUG:
|
||||
color: d73a4a
|
||||
description: 程序存在缺陷或异常行为。
|
||||
功能建议:
|
||||
color: a2eeef
|
||||
description: 新功能建议或现有功能改进。
|
||||
问题咨询:
|
||||
color: d876e3
|
||||
description: 使用问题、求助或咨询。
|
||||
# 需要更多信息:
|
||||
# color: fbca04
|
||||
# description: 当前 Issue 缺少必要信息。
|
||||
重复:
|
||||
color: cfd3d7
|
||||
description: 已存在相同或高度相似的问题。
|
||||
keywordRules: []
|
||||
aiClassification:
|
||||
enabled: false
|
||||
maxLabels: 3
|
||||
minConfidence: 0.65
|
||||
include: []
|
||||
exclude:
|
||||
- BUG
|
||||
- 功能请求
|
||||
- 重复
|
||||
- 不会修复
|
||||
- 使用问题
|
||||
- 需要帮助
|
||||
- 已完成
|
||||
- 未解决
|
||||
- 待确认
|
||||
- P0
|
||||
- P1
|
||||
- 需要文档
|
||||
- 优化点
|
||||
- 急急急
|
||||
prompt: 优先给 BetterGI Issue 选择能反映具体功能模块、子系统或使用场景的标签,例如一条龙、调度器、脚本、设置项、地图追踪;避免只选择宽泛的流程或状态标签。
|
||||
sourceRepository:
|
||||
owner: babalae
|
||||
repo: better-genshin-impact
|
||||
aiHelp:
|
||||
enabled: true
|
||||
triggerLabels: []
|
||||
commentAnchor: issue-bot:ai
|
||||
projectContext:
|
||||
enabled: true
|
||||
includeRepositoryMetadata: true
|
||||
includeReadme: true
|
||||
readmeMaxChars: 3000
|
||||
profile:
|
||||
name: BetterGI
|
||||
aliases:
|
||||
- BGI
|
||||
- Better Genshin Impact
|
||||
summary: BetterGI is a desktop automation assistant for Genshin Impact.
|
||||
techStack:
|
||||
- C#
|
||||
- WPF
|
||||
- .NET
|
||||
commands:
|
||||
enabled: true
|
||||
mentions:
|
||||
- "@bot"
|
||||
- "@bettergi-repo-bot"
|
||||
access: collaborators
|
||||
fix:
|
||||
enabled: true
|
||||
commentAnchor: issue-bot:fix
|
||||
refresh:
|
||||
enabled: true
|
||||
|
||||
pullRequests:
|
||||
review:
|
||||
enabled: false
|
||||
labeling:
|
||||
enabled: false
|
||||
summary:
|
||||
enabled: false
|
||||
issueLink:
|
||||
enabled: true
|
||||
commentAnchor: pull-bot:issue-link
|
||||
appendCloseKeyword: true
|
||||
closeKeywordTemplate: "close #{number}"
|
||||
requireSameRepository: true
|
||||
@@ -1,452 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
CNB Release Uploader
|
||||
|
||||
依赖:
|
||||
- requests
|
||||
- tqdm
|
||||
|
||||
安装依赖:
|
||||
pip install requests tqdm
|
||||
"""
|
||||
|
||||
import os
|
||||
import json
|
||||
import requests
|
||||
import time
|
||||
import sys
|
||||
import argparse
|
||||
from typing import List, Dict, Optional
|
||||
from pathlib import Path
|
||||
from tqdm import tqdm
|
||||
|
||||
|
||||
class CNBReleaseUploader:
|
||||
def __init__(self, token: str, base_url: str = "https://api.cnb.cool"):
|
||||
"""
|
||||
初始化CNB Release上传器
|
||||
|
||||
Args:
|
||||
token: 认证token
|
||||
base_url: API基础URL
|
||||
"""
|
||||
self.token = token
|
||||
self.base_url = base_url
|
||||
self.headers = {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': f'Bearer {token}',
|
||||
'Content-Type': 'application/json',
|
||||
'User-Agent': 'CNB-Release-Uploader/1.0.0',
|
||||
'Host': 'api.cnb.cool',
|
||||
'Connection': 'keep-alive'
|
||||
}
|
||||
|
||||
def create_release(self, project_path: str, release_data: Dict) -> Optional[Dict]:
|
||||
"""
|
||||
创建一个新的release
|
||||
|
||||
Args:
|
||||
project_path: 项目路径 (例如: "bettergi/better-genshin-impact")
|
||||
release_data: release数据
|
||||
|
||||
Returns:
|
||||
创建的release信息或None
|
||||
"""
|
||||
url = f"{self.base_url}/{project_path}/-/releases"
|
||||
|
||||
# 打印请求信息
|
||||
print("\n📋 请求头 (Headers):")
|
||||
for key, value in self.headers.items():
|
||||
print(f" {key}: {value}")
|
||||
|
||||
try:
|
||||
response = requests.post(url, headers=self.headers, json=release_data)
|
||||
response.raise_for_status()
|
||||
|
||||
release_info = response.json()
|
||||
print(f"✅ Release创建成功: {release_info.get('name', 'N/A')}")
|
||||
print(f" Release ID: {release_info.get('id', 'N/A')}")
|
||||
print(f" Tag Name: {release_info.get('tag_name', 'N/A')}")
|
||||
print(f" Created At: {release_info.get('created_at', 'N/A')}")
|
||||
print(f" Is Latest: {release_info.get('is_latest', False)}")
|
||||
return release_info
|
||||
|
||||
except requests.exceptions.RequestException as e:
|
||||
print(f"❌ 创建release失败: {e}")
|
||||
if hasattr(e, 'response') and e.response is not None:
|
||||
print(f" 状态码: {e.response.status_code}")
|
||||
print(f" 响应内容: {e.response.text}")
|
||||
return None
|
||||
|
||||
def get_asset_upload_url(self, project_path: str, release_id: str, asset_name: str,
|
||||
file_size: int, overwrite: bool = True) -> Optional[Dict]:
|
||||
"""
|
||||
获取asset上传URL
|
||||
|
||||
Args:
|
||||
project_path: 项目路径
|
||||
release_id: release ID
|
||||
asset_name: asset名称
|
||||
file_size: 文件大小
|
||||
overwrite: 是否覆盖现有文件
|
||||
|
||||
Returns:
|
||||
包含upload_url等信息的字典或None
|
||||
"""
|
||||
url = f"{self.base_url}/{project_path}/-/releases/{release_id}/asset-upload-url"
|
||||
|
||||
data = {
|
||||
"asset_name": asset_name,
|
||||
"overwrite": overwrite,
|
||||
"size": file_size
|
||||
}
|
||||
|
||||
try:
|
||||
response = requests.post(url, headers=self.headers, json=data)
|
||||
response.raise_for_status()
|
||||
|
||||
upload_info = response.json()
|
||||
print(f"✅ 获取上传URL成功")
|
||||
return upload_info
|
||||
|
||||
except requests.exceptions.RequestException as e:
|
||||
print(f"❌ 获取上传URL失败 ({asset_name}): {e}")
|
||||
if hasattr(e, 'response') and e.response is not None:
|
||||
print(f" 状态码: {e.response.status_code}")
|
||||
print(f" 响应内容: {e.response.text}")
|
||||
return None
|
||||
|
||||
def upload_asset(self, upload_url: str, file_path: str, show_progress: bool = True) -> bool:
|
||||
"""
|
||||
上传asset文件
|
||||
|
||||
Args:
|
||||
upload_url: 上传URL
|
||||
file_path: 本地文件路径
|
||||
show_progress: 是否显示上传进度条
|
||||
|
||||
Returns:
|
||||
是否上传成功
|
||||
"""
|
||||
if not os.path.exists(file_path):
|
||||
print(f"❌ 文件不存在: {file_path}")
|
||||
return False
|
||||
|
||||
upload_headers = {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': f'Bearer {self.token}',
|
||||
}
|
||||
|
||||
file_size = os.path.getsize(file_path)
|
||||
file_name = os.path.basename(file_path)
|
||||
|
||||
try:
|
||||
with open(file_path, 'rb') as file:
|
||||
if show_progress and file_size > 0:
|
||||
# 创建进度条
|
||||
progress_bar = tqdm(
|
||||
total=file_size,
|
||||
unit='B',
|
||||
unit_scale=True,
|
||||
unit_divisor=1024,
|
||||
desc=f"📤 上传 {file_name}",
|
||||
ncols=80,
|
||||
bar_format='{desc}: {percentage:3.0f}%|{bar}| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, {rate_fmt}]'
|
||||
)
|
||||
|
||||
# 创建一个包装器来更新进度条
|
||||
class ProgressFileWrapper:
|
||||
def __init__(self, file_obj, progress_bar):
|
||||
self.file_obj = file_obj
|
||||
self.progress_bar = progress_bar
|
||||
|
||||
def read(self, size=-1):
|
||||
data = self.file_obj.read(size)
|
||||
if data:
|
||||
self.progress_bar.update(len(data))
|
||||
return data
|
||||
|
||||
def __getattr__(self, name):
|
||||
return getattr(self.file_obj, name)
|
||||
|
||||
wrapped_file = ProgressFileWrapper(file, progress_bar)
|
||||
response = requests.put(upload_url, headers=upload_headers, data=wrapped_file)
|
||||
progress_bar.close()
|
||||
else:
|
||||
response = requests.put(upload_url, headers=upload_headers, data=file)
|
||||
|
||||
response.raise_for_status()
|
||||
|
||||
print(f"📤 上传到 {upload_url} 返回结果: {response.status_code}")
|
||||
|
||||
try:
|
||||
response_data = response.json()
|
||||
print(f" 响应内容 (JSON): {json.dumps(response_data, indent=2, ensure_ascii=False)}")
|
||||
except (json.JSONDecodeError, ValueError):
|
||||
print(f" 响应内容 (文本): {response.text}")
|
||||
|
||||
return True
|
||||
|
||||
except requests.exceptions.RequestException as e:
|
||||
print(f"❌ 文件上传失败 ({os.path.basename(file_path)}): {e}")
|
||||
if hasattr(e, 'response') and e.response is not None:
|
||||
print(f" 响应状态码: {e.response.status_code}")
|
||||
print(f" 响应内容: {e.response.text}")
|
||||
return False
|
||||
|
||||
def verify_upload(self, verify_url: str) -> bool:
|
||||
"""
|
||||
验证上传是否成功
|
||||
|
||||
Args:
|
||||
verify_url: 验证URL
|
||||
|
||||
Returns:
|
||||
是否验证成功
|
||||
"""
|
||||
try:
|
||||
response = requests.post(verify_url, headers=self.headers)
|
||||
response.raise_for_status()
|
||||
|
||||
print(f"🔍 验证请求返回状态: {response.status_code}")
|
||||
|
||||
try:
|
||||
response_data = response.json()
|
||||
print(f" 响应内容 (JSON): {json.dumps(response_data, indent=2, ensure_ascii=False)}")
|
||||
except (json.JSONDecodeError, ValueError):
|
||||
print(f" 响应内容 (文本): {response.text}")
|
||||
|
||||
return True
|
||||
|
||||
except requests.exceptions.RequestException as e:
|
||||
print(f"❌ 验证上传失败: {e}")
|
||||
if hasattr(e, 'response') and e.response is not None:
|
||||
print(f" 验证状态码: {e.response.status_code}")
|
||||
print(f" 验证响应内容: {e.response.text}")
|
||||
return False
|
||||
|
||||
def upload_multiple_assets(self, project_path: str, release_id: str,
|
||||
asset_files: List[str], overwrite: bool = True, show_progress: bool = True) -> List[bool]:
|
||||
"""
|
||||
上传多个assets
|
||||
|
||||
Args:
|
||||
project_path: 项目路径
|
||||
release_id: release ID
|
||||
asset_files: asset文件路径列表
|
||||
overwrite: 是否覆盖现有文件
|
||||
show_progress: 是否显示进度条
|
||||
|
||||
Returns:
|
||||
每个文件的上传结果列表
|
||||
"""
|
||||
results = []
|
||||
|
||||
print(f"\n📦 开始上传 {len(asset_files)} 个文件到release {release_id}...")
|
||||
|
||||
# 计算总文件大小用于整体进度显示
|
||||
total_size = 0
|
||||
valid_files = []
|
||||
for file_path in asset_files:
|
||||
if os.path.exists(file_path):
|
||||
total_size += os.path.getsize(file_path)
|
||||
valid_files.append(file_path)
|
||||
|
||||
if show_progress and valid_files:
|
||||
print(f"📊 总计 {len(valid_files)} 个有效文件,总大小: {total_size / 1024 / 1024:.2f} MB")
|
||||
print("" + "=" * 60)
|
||||
|
||||
for i, file_path in enumerate(asset_files, 1):
|
||||
if not os.path.exists(file_path):
|
||||
print(f"❌ [{i}/{len(asset_files)}] 跳过不存在的文件: {file_path}")
|
||||
results.append(False)
|
||||
continue
|
||||
|
||||
file_size = os.path.getsize(file_path)
|
||||
asset_name = os.path.basename(file_path)
|
||||
|
||||
print(f"\n📁 [{i}/{len(asset_files)}] 处理文件: {asset_name}")
|
||||
print(f" 文件大小: {file_size:,} bytes ({file_size / 1024 / 1024:.2f} MB)")
|
||||
|
||||
# 1. 获取上传URL
|
||||
upload_info = self.get_asset_upload_url(
|
||||
project_path, release_id, asset_name, file_size, overwrite
|
||||
)
|
||||
|
||||
if not upload_info:
|
||||
results.append(False)
|
||||
continue
|
||||
|
||||
# 2. 上传文件
|
||||
upload_success = self.upload_asset(upload_info['upload_url'], file_path, show_progress)
|
||||
time.sleep(1)
|
||||
|
||||
# 3. 验证上传(如果有验证URL)
|
||||
final_success = upload_success
|
||||
if upload_success and 'verify_url' in upload_info:
|
||||
verify_success = self.verify_upload(upload_info['verify_url'])
|
||||
final_success = verify_success
|
||||
if verify_success:
|
||||
print(f"✅ 文件 {asset_name} 上传并验证成功")
|
||||
else:
|
||||
print(f"❌ 文件 {asset_name} 上传成功但验证失败")
|
||||
elif upload_success:
|
||||
print(f"✅ 文件 {asset_name} 上传成功(无需验证)")
|
||||
|
||||
results.append(final_success)
|
||||
|
||||
# 避免请求过快
|
||||
if i < len(asset_files):
|
||||
time.sleep(1)
|
||||
|
||||
return results
|
||||
|
||||
|
||||
def load_config_from_json(json_input: str) -> Dict:
|
||||
"""
|
||||
从JSON字符串或文件路径加载配置
|
||||
|
||||
Args:
|
||||
json_input: JSON字符串或JSON文件路径
|
||||
|
||||
Returns:
|
||||
配置字典
|
||||
"""
|
||||
try:
|
||||
# 首先尝试作为JSON字符串解析
|
||||
config = json.loads(json_input)
|
||||
print("✅ 从JSON字符串加载配置成功")
|
||||
return config
|
||||
except json.JSONDecodeError:
|
||||
# 如果失败,尝试作为文件路径
|
||||
try:
|
||||
if os.path.exists(json_input):
|
||||
with open(json_input, 'r', encoding='utf-8') as f:
|
||||
config = json.load(f)
|
||||
print(f"✅ 从文件 {json_input} 加载配置成功")
|
||||
return config
|
||||
else:
|
||||
raise FileNotFoundError(f"配置文件不存在: {json_input}")
|
||||
except Exception as e:
|
||||
raise ValueError(f"无法解析JSON配置: {e}")
|
||||
|
||||
|
||||
def validate_config(config: Dict) -> None:
|
||||
"""
|
||||
验证配置的必需字段
|
||||
|
||||
Args:
|
||||
config: 配置字典
|
||||
|
||||
Raises:
|
||||
ValueError: 如果配置无效
|
||||
"""
|
||||
required_fields = ['token', 'project_path', 'release_data']
|
||||
for field in required_fields:
|
||||
if field not in config:
|
||||
raise ValueError(f"缺少必需字段: {field}")
|
||||
|
||||
# 验证release_data必需字段
|
||||
release_required = ['tag_name', 'name']
|
||||
for field in release_required:
|
||||
if field not in config['release_data']:
|
||||
raise ValueError(f"release_data缺少必需字段: {field}")
|
||||
|
||||
# 验证asset_files
|
||||
if 'asset_files' in config and not isinstance(config['asset_files'], list):
|
||||
raise ValueError("asset_files必须是数组")
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='CNB Release Uploader - JSON配置版本')
|
||||
parser.add_argument('config', help='JSON配置字符串或JSON配置文件路径')
|
||||
parser.add_argument('--dry-run', action='store_true', help='只验证配置,不执行上传')
|
||||
parser.add_argument('--no-progress', action='store_true', help='禁用上传进度条显示')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
try:
|
||||
# 加载配置
|
||||
print("🔧 加载配置...")
|
||||
config = load_config_from_json(args.config)
|
||||
|
||||
# 验证配置
|
||||
print("🔍 验证配置...")
|
||||
validate_config(config)
|
||||
|
||||
# 打印配置信息
|
||||
print("\n📋 配置信息:")
|
||||
print(f" Token: {'*' * 20}")
|
||||
print(f" 项目路径: {config['project_path']}")
|
||||
print(f" Release名称: {config['release_data']['name']}")
|
||||
print(f" Tag名称: {config['release_data']['tag_name']}")
|
||||
print(f" Asset文件数量: {len(config.get('asset_files', []))}")
|
||||
|
||||
if args.dry_run:
|
||||
print("\n🧪 Dry-run模式,配置验证通过,退出程序")
|
||||
return 0
|
||||
|
||||
# 创建上传器实例
|
||||
uploader = CNBReleaseUploader(
|
||||
token=config['token'],
|
||||
base_url=config.get('base_url', 'https://api.cnb.cool')
|
||||
)
|
||||
|
||||
# 1. 创建release
|
||||
print("\n🚀 开始创建release...")
|
||||
release_info = uploader.create_release(config['project_path'], config['release_data'])
|
||||
|
||||
if not release_info:
|
||||
print("❌ 创建release失败,退出程序")
|
||||
return 1
|
||||
|
||||
release_id = release_info.get('id')
|
||||
if not release_id:
|
||||
print("❌ 无法获取release ID,退出程序")
|
||||
return 1
|
||||
|
||||
# 2. 上传assets(如果有)
|
||||
asset_files = config.get('asset_files', [])
|
||||
if asset_files:
|
||||
overwrite = config.get('overwrite', True)
|
||||
show_progress = not args.no_progress # 默认显示进度条,除非指定 --no-progress
|
||||
results = uploader.upload_multiple_assets(
|
||||
config['project_path'], release_id, asset_files, overwrite, show_progress
|
||||
)
|
||||
|
||||
# 3. 显示结果
|
||||
print("\n" + "=" * 50)
|
||||
print("📊 上传结果汇总:")
|
||||
print("=" * 50)
|
||||
|
||||
success_count = sum(results)
|
||||
total_count = len(results)
|
||||
|
||||
for i, (file_path, success) in enumerate(zip(asset_files, results)):
|
||||
status = "✅ 成功" if success else "❌ 失败"
|
||||
print(f" [{i + 1}] {status} - {os.path.basename(file_path)}")
|
||||
|
||||
print(f"\n🎉 完成! 成功上传 {success_count}/{total_count} 个文件")
|
||||
|
||||
if success_count == total_count:
|
||||
print("🎊 所有文件都上传成功!")
|
||||
return 0
|
||||
elif success_count > 0:
|
||||
print("⚠️ 部分文件上传成功,请检查失败的文件")
|
||||
return 2
|
||||
else:
|
||||
print("💥 所有文件上传失败,请检查配置和网络")
|
||||
return 1
|
||||
else:
|
||||
print("\n📦 没有指定asset文件,只创建了release")
|
||||
return 0
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ 程序执行失败: {e}")
|
||||
return 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
exit_code = main()
|
||||
sys.exit(exit_code)
|
||||
@@ -1,94 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Better Genshin Impact Build Trigger Script
|
||||
用于触发CNB构建的Python脚本
|
||||
"""
|
||||
|
||||
import requests
|
||||
import json
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
def trigger_build(token, branch="main", event="api_trigger_one", runid=None):
|
||||
"""
|
||||
触发构建请求
|
||||
|
||||
Args:
|
||||
token (str): 授权token
|
||||
branch (str): 分支名称,默认为main
|
||||
event (str): 事件类型,默认为api_trigger_one
|
||||
runid (str): 运行ID,可选参数
|
||||
|
||||
Returns:
|
||||
dict: API响应结果
|
||||
"""
|
||||
url = "https://api.cnb.cool/bettergi/better-genshin-impact/-/build/start"
|
||||
|
||||
headers = {
|
||||
"Accept": "application/json",
|
||||
"Authorization": f"Bearer {token}",
|
||||
"Content-Type": "application/json",
|
||||
"Host": "api.cnb.cool",
|
||||
"Connection": "keep-alive"
|
||||
}
|
||||
|
||||
data = {
|
||||
"branch": branch,
|
||||
"event": event
|
||||
}
|
||||
|
||||
# 如果提供了runid,则添加到env中
|
||||
if runid:
|
||||
data["env"] = {
|
||||
"RUN_ID": runid
|
||||
}
|
||||
|
||||
try:
|
||||
print(f"正在发起构建请求...")
|
||||
print(f"URL: {url}")
|
||||
|
||||
print(f"请求体: {json.dumps(data, indent=2, ensure_ascii=False)}")
|
||||
|
||||
response = requests.post(url, headers=headers, json=data)
|
||||
|
||||
print(f"响应状态码: {response.status_code}")
|
||||
|
||||
if response.status_code == 200:
|
||||
result = response.json()
|
||||
print("构建触发成功!")
|
||||
print(f"响应内容: {json.dumps(result, indent=2, ensure_ascii=False)}")
|
||||
return result
|
||||
else:
|
||||
print(f"请求失败: {response.status_code}")
|
||||
print(f"错误信息: {response.text}")
|
||||
return None
|
||||
|
||||
except requests.exceptions.RequestException as e:
|
||||
print(f"请求异常: {e}")
|
||||
return None
|
||||
except json.JSONDecodeError as e:
|
||||
print(f"JSON解析错误: {e}")
|
||||
print(f"响应内容: {response.text}")
|
||||
return None
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="触发Better Genshin Impact构建")
|
||||
parser.add_argument("token", help="授权token")
|
||||
parser.add_argument("--branch", default="main", help="分支名称 (默认: main)")
|
||||
parser.add_argument("--event", default="api_trigger_one", help="事件类型 (默认: api_trigger_one)")
|
||||
parser.add_argument("--runid", help="运行ID (可选)")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if not args.token:
|
||||
print("错误: 必须提供token参数")
|
||||
sys.exit(1)
|
||||
|
||||
result = trigger_build(args.token, args.branch, args.event, args.runid)
|
||||
|
||||
if result is None:
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,507 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
GitHub Actions 构建物下载和上传脚本
|
||||
|
||||
该脚本用于:
|
||||
1. 从 GitHub Actions 下载最新的构建物 (BetterGI_7z 和 BetterGI_Install)
|
||||
2. 解压构建物到本地
|
||||
3. 调用 cnb_release.py 上传文件到 CNB
|
||||
|
||||
使用方法:
|
||||
python github_download_and_cnb_upload.py --cnb-token YOUR_CNB_TOKEN [--github-token YOUR_GITHUB_TOKEN] [--run-id RUN_ID]
|
||||
|
||||
参数说明:
|
||||
--cnb-token: CNB API Token (必需)
|
||||
--github-token: GitHub Personal Access Token (可选,用于提高API限制)
|
||||
--run-id: 指定 GitHub Actions 运行 ID (可选,默认获取最新运行)
|
||||
|
||||
依赖:
|
||||
- requests: HTTP 请求库
|
||||
- tqdm: 进度条显示库
|
||||
|
||||
安装依赖:pip install -r requirements.txt
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import requests
|
||||
import zipfile
|
||||
import tempfile
|
||||
import shutil
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import List, Dict, Optional
|
||||
from tqdm import tqdm
|
||||
|
||||
# 导入 CNBReleaseUploader
|
||||
from cnb_release import CNBReleaseUploader
|
||||
|
||||
|
||||
class GitHubActionsDownloader:
|
||||
def __init__(self, token: Optional[str] = None):
|
||||
"""
|
||||
初始化 GitHub Actions 下载器
|
||||
|
||||
Args:
|
||||
token: GitHub Personal Access Token (可选,用于提高API限制)
|
||||
"""
|
||||
self.token = token
|
||||
self.headers = {
|
||||
'Accept': 'application/vnd.github.v3+json',
|
||||
'User-Agent': 'BetterGI-Downloader/1.0.0'
|
||||
}
|
||||
if token:
|
||||
self.headers['Authorization'] = f'token {token}'
|
||||
|
||||
def get_latest_workflow_run(self, owner: str, repo: str, workflow_file: str) -> Optional[Dict]:
|
||||
"""
|
||||
获取最新的工作流运行
|
||||
|
||||
Args:
|
||||
owner: 仓库所有者
|
||||
repo: 仓库名称
|
||||
workflow_file: 工作流文件名
|
||||
|
||||
Returns:
|
||||
最新的工作流运行信息或None
|
||||
"""
|
||||
url = f'https://api.github.com/repos/{owner}/{repo}/actions/workflows/{workflow_file}/runs'
|
||||
params = {
|
||||
'status': 'completed',
|
||||
'conclusion': 'success',
|
||||
'per_page': 1
|
||||
}
|
||||
|
||||
try:
|
||||
response = requests.get(url, headers=self.headers, params=params)
|
||||
response.raise_for_status()
|
||||
|
||||
data = response.json()
|
||||
runs = data.get('workflow_runs', [])
|
||||
|
||||
if not runs:
|
||||
print("❌ 没有找到成功完成的工作流运行")
|
||||
return None
|
||||
|
||||
latest_run = runs[0]
|
||||
print(f"✅ 找到最新的工作流运行:")
|
||||
print(f" Run ID: {latest_run['id']}")
|
||||
print(f" 创建时间: {latest_run['created_at']}")
|
||||
print(f" 状态: {latest_run['status']} / {latest_run['conclusion']}")
|
||||
print(f" 分支: {latest_run['head_branch']}")
|
||||
|
||||
return latest_run
|
||||
|
||||
except requests.exceptions.RequestException as e:
|
||||
print(f"❌ 获取工作流运行失败: {e}")
|
||||
return None
|
||||
|
||||
def get_artifacts(self, owner: str, repo: str, run_id: int) -> List[Dict]:
|
||||
"""
|
||||
获取指定运行的构建物列表
|
||||
|
||||
Args:
|
||||
owner: 仓库所有者
|
||||
repo: 仓库名称
|
||||
run_id: 运行ID
|
||||
|
||||
Returns:
|
||||
构建物列表
|
||||
"""
|
||||
url = f'https://api.github.com/repos/{owner}/{repo}/actions/runs/{run_id}/artifacts'
|
||||
|
||||
try:
|
||||
response = requests.get(url, headers=self.headers)
|
||||
response.raise_for_status()
|
||||
|
||||
data = response.json()
|
||||
artifacts = data.get('artifacts', [])
|
||||
|
||||
print(f"📦 找到 {len(artifacts)} 个构建物:")
|
||||
for artifact in artifacts:
|
||||
print(f" - {artifact['name']} ({artifact['size_in_bytes']:,} bytes)")
|
||||
|
||||
return artifacts
|
||||
|
||||
except requests.exceptions.RequestException as e:
|
||||
print(f"❌ 获取构建物列表失败: {e}")
|
||||
return []
|
||||
|
||||
def download_artifact(self, owner: str, repo: str, artifact_id: int,
|
||||
artifact_name: str, download_dir: str) -> Optional[str]:
|
||||
"""
|
||||
下载指定的构建物
|
||||
|
||||
Args:
|
||||
owner: 仓库所有者
|
||||
repo: 仓库名称
|
||||
artifact_id: 构建物ID
|
||||
artifact_name: 构建物名称
|
||||
download_dir: 下载目录
|
||||
|
||||
Returns:
|
||||
下载的文件路径或None
|
||||
"""
|
||||
url = f'https://api.github.com/repos/{owner}/{repo}/actions/artifacts/{artifact_id}/zip'
|
||||
|
||||
try:
|
||||
print(f"📥 开始下载构建物: {artifact_name}")
|
||||
response = requests.get(url, headers=self.headers, stream=True)
|
||||
response.raise_for_status()
|
||||
|
||||
# 获取文件总大小
|
||||
total_size = int(response.headers.get('content-length', 0))
|
||||
|
||||
# 保存到临时文件
|
||||
zip_path = os.path.join(download_dir, f"{artifact_name}.zip")
|
||||
|
||||
# 使用 tqdm 创建进度条
|
||||
chunk_size = 8192
|
||||
with open(zip_path, 'wb') as f:
|
||||
with tqdm(
|
||||
total=total_size,
|
||||
unit='B',
|
||||
unit_scale=True,
|
||||
unit_divisor=1024,
|
||||
desc=f"下载 {artifact_name}",
|
||||
ncols=80,
|
||||
bar_format='{desc}: {percentage:3.0f}%|{bar}| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, {rate_fmt}]'
|
||||
) as pbar:
|
||||
for chunk in response.iter_content(chunk_size=chunk_size):
|
||||
if chunk:
|
||||
f.write(chunk)
|
||||
pbar.update(len(chunk))
|
||||
|
||||
print(f"✅ 下载完成: {zip_path}")
|
||||
return zip_path
|
||||
|
||||
except requests.exceptions.RequestException as e:
|
||||
print(f"❌ 下载构建物失败 ({artifact_name}): {e}")
|
||||
return None
|
||||
|
||||
|
||||
|
||||
def extract_artifact(self, zip_path: str, extract_dir: str) -> List[str]:
|
||||
"""
|
||||
解压构建物
|
||||
|
||||
Args:
|
||||
zip_path: ZIP文件路径
|
||||
extract_dir: 解压目录
|
||||
|
||||
Returns:
|
||||
解压出的文件列表
|
||||
"""
|
||||
extracted_files = []
|
||||
|
||||
try:
|
||||
print(f"📂 解压构建物: {os.path.basename(zip_path)}")
|
||||
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
|
||||
zip_ref.extractall(extract_dir)
|
||||
extracted_files = [os.path.join(extract_dir, name) for name in zip_ref.namelist()]
|
||||
|
||||
print(f"✅ 解压完成,共 {len(extracted_files)} 个文件")
|
||||
for file_path in extracted_files:
|
||||
if os.path.isfile(file_path):
|
||||
size = os.path.getsize(file_path)
|
||||
print(f" - {os.path.basename(file_path)} ({size:,} bytes)")
|
||||
|
||||
return extracted_files
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ 解压失败: {e}")
|
||||
return []
|
||||
|
||||
|
||||
def extract_version_from_filename(filename: str) -> Optional[str]:
|
||||
"""
|
||||
从文件名中提取版本号
|
||||
|
||||
Args:
|
||||
filename: 文件名
|
||||
|
||||
Returns:
|
||||
版本号或None
|
||||
"""
|
||||
# 去除扩展名
|
||||
import os
|
||||
filename_without_ext = os.path.splitext(filename)[0]
|
||||
|
||||
# 匹配版本号模式,如 v1.2.3, 1.2.3-alpha.1 等
|
||||
patterns = [
|
||||
r'v?([0-9]+\.[0-9]+\.[0-9]+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?)',
|
||||
r'_v?([0-9]+\.[0-9]+\.[0-9]+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?)',
|
||||
]
|
||||
|
||||
for pattern in patterns:
|
||||
match = re.search(pattern, filename_without_ext)
|
||||
if match:
|
||||
return match.group(1)
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def create_cnb_config(files: List[str], version: str, token: str) -> Dict:
|
||||
"""
|
||||
创建CNB上传配置
|
||||
|
||||
Args:
|
||||
files: 要上传的文件列表
|
||||
version: 版本号
|
||||
token: CNB token
|
||||
|
||||
Returns:
|
||||
CNB配置字典
|
||||
"""
|
||||
# 判断是否为预发布版本
|
||||
is_prerelease = '-' in version
|
||||
make_latest = "false" if is_prerelease else "true"
|
||||
|
||||
config = {
|
||||
"token": token,
|
||||
"project_path": "bettergi/better-genshin-impact",
|
||||
"base_url": "https://api.cnb.cool",
|
||||
"overwrite": True,
|
||||
"release_data": {
|
||||
"tag_name": f"v{version}",
|
||||
"name": f"BetterGI v{version}",
|
||||
"body": f"BetterGI v{version} 自动发布",
|
||||
"draft": False,
|
||||
"prerelease": is_prerelease,
|
||||
"target_commitish": "main",
|
||||
"make_latest": make_latest
|
||||
},
|
||||
"asset_files": files
|
||||
}
|
||||
|
||||
return config
|
||||
|
||||
|
||||
def main():
|
||||
import argparse
|
||||
|
||||
# 解析命令行参数
|
||||
parser = argparse.ArgumentParser(description='BetterGI 构建物下载和上传工具')
|
||||
parser.add_argument('--run-id', type=str, help='指定 GitHub Actions 运行 ID,如果提供则不会获取最新运行')
|
||||
parser.add_argument('--github-token', type=str, help='GitHub Personal Access Token')
|
||||
parser.add_argument('--cnb-token', type=str, required=True, help='CNB API Token (必需)')
|
||||
args = parser.parse_args()
|
||||
|
||||
print("🚀 BetterGI 构建物下载和上传工具")
|
||||
print("=" * 50)
|
||||
|
||||
# 获取 token,优先使用命令行参数,其次使用环境变量
|
||||
github_token = args.github_token or os.getenv('GITHUB_TOKEN')
|
||||
cnb_token = args.cnb_token or os.getenv('CNB_TOKEN')
|
||||
|
||||
if not cnb_token:
|
||||
print("❌ 错误: 请设置 CNB_TOKEN 环境变量")
|
||||
return 1
|
||||
|
||||
if not github_token:
|
||||
print("⚠️ 警告: 未设置 GITHUB_TOKEN,可能会遇到API限制")
|
||||
|
||||
# 确定运行 ID
|
||||
if args.run_id:
|
||||
print(f"\n🎯 使用指定的运行 ID: {args.run_id}")
|
||||
run_id = args.run_id
|
||||
else:
|
||||
# 创建下载器来获取最新运行 ID
|
||||
downloader = GitHubActionsDownloader(github_token)
|
||||
print("\n🔍 查找最新的工作流运行...")
|
||||
latest_run = downloader.get_latest_workflow_run('babalae', 'better-genshin-impact', 'publish.yml')
|
||||
if not latest_run:
|
||||
return 1
|
||||
run_id = str(latest_run['id'])
|
||||
|
||||
# 使用当前目录下的固定目录,以action运行ID命名
|
||||
work_dir = os.path.join(os.getcwd(), 'github_actions_cache', run_id)
|
||||
download_dir = os.path.join(work_dir, 'downloads')
|
||||
extract_dir = os.path.join(work_dir, 'extracted')
|
||||
|
||||
print(f"\n📁 使用工作目录: {work_dir}")
|
||||
|
||||
# 检查是否已存在解压后的文件
|
||||
all_files = []
|
||||
version = None
|
||||
|
||||
# 检查解压目录是否已存在且包含文件
|
||||
if os.path.exists(extract_dir):
|
||||
print("🔍 检查已存在的构建物...")
|
||||
existing_files = []
|
||||
# 预期的构建物名称
|
||||
expected_artifacts = ['BetterGI_7z', 'BetterGI_Install']
|
||||
|
||||
for artifact_name in expected_artifacts:
|
||||
artifact_extract_dir = os.path.join(extract_dir, artifact_name)
|
||||
if os.path.exists(artifact_extract_dir):
|
||||
for root, dirs, files in os.walk(artifact_extract_dir):
|
||||
for file in files:
|
||||
file_path = os.path.join(root, file)
|
||||
existing_files.append(file_path)
|
||||
|
||||
# 尝试从文件名提取版本号
|
||||
if not version:
|
||||
filename = os.path.basename(file_path)
|
||||
extracted_version = extract_version_from_filename(filename)
|
||||
if extracted_version:
|
||||
version = extracted_version
|
||||
|
||||
if existing_files and version:
|
||||
print(f"✅ 发现已存在的构建物 ({len(existing_files)} 个文件),跳过下载")
|
||||
print(f"📋 检测到版本号: {version}")
|
||||
all_files = existing_files
|
||||
else:
|
||||
print("⚠️ 已存在目录但未找到有效文件,将重新下载")
|
||||
|
||||
# 如果没有找到已存在的文件,则进行下载和解压
|
||||
if not all_files:
|
||||
print("📥 需要下载构建物,正在获取构建物信息...")
|
||||
|
||||
# 如果还没有创建下载器,现在创建
|
||||
if 'downloader' not in locals():
|
||||
downloader = GitHubActionsDownloader(github_token)
|
||||
|
||||
# 获取构建物列表
|
||||
print("\n📦 获取构建物列表...")
|
||||
artifacts = downloader.get_artifacts('babalae', 'better-genshin-impact', int(run_id))
|
||||
if not artifacts:
|
||||
return 1
|
||||
|
||||
# 筛选需要的构建物
|
||||
target_artifacts = []
|
||||
for artifact in artifacts:
|
||||
if artifact['name'] in ['BetterGI_7z', 'BetterGI_Install']:
|
||||
target_artifacts.append(artifact)
|
||||
|
||||
if len(target_artifacts) != 2:
|
||||
print(f"❌ 错误: 期望找到2个构建物,实际找到 {len(target_artifacts)} 个")
|
||||
return 1
|
||||
|
||||
print("📥 开始下载和解压构建物...")
|
||||
os.makedirs(download_dir, exist_ok=True)
|
||||
os.makedirs(extract_dir, exist_ok=True)
|
||||
|
||||
for artifact in target_artifacts:
|
||||
# 下载
|
||||
zip_path = downloader.download_artifact(
|
||||
'babalae', 'better-genshin-impact',
|
||||
artifact['id'], artifact['name'], download_dir
|
||||
)
|
||||
|
||||
if not zip_path:
|
||||
continue
|
||||
|
||||
# 解压
|
||||
artifact_extract_dir = os.path.join(extract_dir, artifact['name'])
|
||||
os.makedirs(artifact_extract_dir, exist_ok=True)
|
||||
|
||||
extracted_files = downloader.extract_artifact(zip_path, artifact_extract_dir)
|
||||
|
||||
# 收集文件并提取版本号
|
||||
for file_path in extracted_files:
|
||||
if os.path.isfile(file_path):
|
||||
all_files.append(file_path)
|
||||
|
||||
# 尝试从文件名提取版本号
|
||||
if not version:
|
||||
filename = os.path.basename(file_path)
|
||||
extracted_version = extract_version_from_filename(filename)
|
||||
if extracted_version:
|
||||
version = extracted_version
|
||||
print(f"📋 检测到版本号: {version}")
|
||||
|
||||
if not all_files:
|
||||
print("❌ 错误: 没有找到可上传的文件")
|
||||
return 1
|
||||
|
||||
if not version:
|
||||
print("❌ 错误: 无法从文件名中提取版本号")
|
||||
return 1
|
||||
|
||||
print(f"\n📋 准备上传 {len(all_files)} 个文件:")
|
||||
for file_path in all_files:
|
||||
size = os.path.getsize(file_path)
|
||||
print(f" - {os.path.basename(file_path)} ({size:,} bytes)")
|
||||
|
||||
# 创建CNB配置
|
||||
print("\n⚙️ 创建CNB配置...")
|
||||
cnb_config = create_cnb_config(all_files, version, cnb_token)
|
||||
|
||||
# 保存配置文件
|
||||
config_path = os.path.join(work_dir, 'cnb_config.json')
|
||||
with open(config_path, 'w', encoding='utf-8') as f:
|
||||
json.dump(cnb_config, f, indent=2, ensure_ascii=False)
|
||||
|
||||
print(f"✅ 配置文件已保存: {config_path}")
|
||||
|
||||
# 直接调用 CNBReleaseUploader
|
||||
print("\n🚀 开始上传到CNB...")
|
||||
|
||||
try:
|
||||
# 创建 CNBReleaseUploader 实例
|
||||
uploader = CNBReleaseUploader(
|
||||
token=cnb_config['token'],
|
||||
base_url=cnb_config.get('base_url', 'https://api.cnb.cool')
|
||||
)
|
||||
|
||||
# 创建 release
|
||||
print(f"📝 创建 release: {cnb_config['release_data']['name']}")
|
||||
release_result = uploader.create_release(
|
||||
project_path=cnb_config['project_path'],
|
||||
release_data=cnb_config['release_data']
|
||||
)
|
||||
|
||||
if not release_result:
|
||||
print("❌ 创建 release 失败")
|
||||
return 1
|
||||
|
||||
print(f"✅ Release 创建成功: {release_result['name']}")
|
||||
|
||||
# 上传文件
|
||||
print(f"📤 开始上传 {len(cnb_config['asset_files'])} 个文件...")
|
||||
upload_results = uploader.upload_multiple_assets(
|
||||
project_path=cnb_config['project_path'],
|
||||
release_id=release_result['id'],
|
||||
asset_files=cnb_config['asset_files'],
|
||||
overwrite=cnb_config.get('overwrite', True)
|
||||
)
|
||||
|
||||
# 检查上传结果
|
||||
success_count = sum(1 for result in upload_results if result)
|
||||
total_count = len(upload_results)
|
||||
|
||||
print(f"\n📊 上传结果汇总:")
|
||||
print(f" ✅ 成功: {success_count}/{total_count}")
|
||||
|
||||
if success_count < total_count:
|
||||
print(f" ❌ 失败: {total_count - success_count}/{total_count}")
|
||||
for i, result in enumerate(upload_results):
|
||||
if not result:
|
||||
file_name = os.path.basename(cnb_config['asset_files'][i])
|
||||
print(f" - {file_name}: 上传失败")
|
||||
|
||||
if success_count == total_count:
|
||||
print("\n🎉 所有文件上传完成!")
|
||||
return 0
|
||||
else:
|
||||
print("\n❌ 部分文件上传失败")
|
||||
return 1
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ CNB上传失败: {e}")
|
||||
return 1
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
exit_code = main()
|
||||
sys.exit(exit_code)
|
||||
except KeyboardInterrupt:
|
||||
print("\n⚠️ 用户中断操作")
|
||||
sys.exit(1)
|
||||
except Exception as e:
|
||||
print(f"\n💥 程序异常: {e}")
|
||||
sys.exit(1)
|
||||
@@ -1,20 +0,0 @@
|
||||
name: mirrorchyan_release_note
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types: [edited, released]
|
||||
|
||||
jobs:
|
||||
mirrorchyan_release_note:
|
||||
if: github.repository_owner == 'babalae'
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- id: uploading
|
||||
uses: MirrorChyan/release-note-action@v1
|
||||
with:
|
||||
mirrorchyan_rid: BGI
|
||||
|
||||
upload_token: ${{ secrets.MirrorChyanUploadToken }}
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -1,89 +0,0 @@
|
||||
name: mirrorchyan_uploading
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types: [released]
|
||||
|
||||
jobs:
|
||||
mirrorchyan:
|
||||
if: github.repository_owner == 'babalae'
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: 📥 Download release
|
||||
uses: robinraju/[email protected]
|
||||
with:
|
||||
latest: true
|
||||
fileName: "*"
|
||||
|
||||
- name: 📥 Download kachina-builder release
|
||||
uses: robinraju/[email protected]
|
||||
with:
|
||||
repository: "YuehaiTeam/kachina-installer"
|
||||
latest: true
|
||||
fileName: "kachina-builder.exe"
|
||||
|
||||
- name: Embed Dotnet and VCRedist
|
||||
shell: bash
|
||||
run: |
|
||||
# dotnet
|
||||
VERSION_URL="https://builds.dotnet.microsoft.com/dotnet/WindowsDesktop/8.0/latest.version"
|
||||
VERSION=$(curl -fsSL "$VERSION_URL" | tr -d '\r\n')
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Cannot get the latest version from $VERSION_URL"
|
||||
exit 1
|
||||
fi
|
||||
INSTALLER_URL="https://builds.dotnet.microsoft.com/dotnet/WindowsDesktop/${VERSION}/windowsdesktop-runtime-${VERSION}-win-x64.exe"
|
||||
OUTPUT="windowsdesktop-runtime-${VERSION}-win-x64.exe"
|
||||
echo "Downloading Windows Desktop Runtime version $VERSION from $INSTALLER_URL"
|
||||
curl -fSL -o "$OUTPUT" "$INSTALLER_URL"
|
||||
# vcredist
|
||||
echo "Downloading VCRedist"
|
||||
curl -fSL -o "vc_redist.x64.exe" "https://aka.ms/vs/17/release/vc_redist.x64.exe"
|
||||
# embed
|
||||
echo "Embedding runtimes"
|
||||
./kachina-builder.exe append -o ./BetterGI.Install.*.exe -f "$OUTPUT" -n "Microsoft.DotNet.DesktopRuntime.8" -f "vc_redist.x64.exe" -n "Microsoft.VCRedist.2015+.x64"
|
||||
./kachina-builder.exe extract -i ./BetterGI.Install.*.exe -f ./metadata.json -n "\0META"
|
||||
|
||||
- name: Extract 7z and create zip
|
||||
shell: bash
|
||||
run: |
|
||||
7z a -tzip BetterGI.Install.zip ./BetterGI.Install.*.exe -mx=1 -r -y
|
||||
choco install wget --no-progress
|
||||
7z x BetterGI_v*.7z -oun7z
|
||||
mv ./metadata.json ./un7z/BetterGI/.metadata.json
|
||||
cd un7z
|
||||
7z a -tzip ../BetterGI.zip ./BetterGI -mx=5 -r -y
|
||||
|
||||
- name: Determine version number
|
||||
id: get-version
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "release" ]; then
|
||||
echo "version=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
LATEST_TAG=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
|
||||
https://api.github.com/repos/${{ github.repository }}/releases/latest \
|
||||
| jq -r '.tag_name')
|
||||
echo "version=$LATEST_TAG" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Upload Zip
|
||||
uses: MirrorChyan/uploading-action@v1
|
||||
with:
|
||||
filetype: local
|
||||
mirrorchyan_rid: BGI
|
||||
filename: "BetterGI.zip"
|
||||
version_name: ${{ steps.get-version.outputs.version }}
|
||||
upload_token: ${{ secrets.MirrorChyanUploadToken }}
|
||||
os: win
|
||||
arch: x64
|
||||
- name: Upload Exe
|
||||
uses: MirrorChyan/uploading-action@v1
|
||||
with:
|
||||
filetype: local
|
||||
mirrorchyan_rid: BGI
|
||||
filename: "BetterGI.Install.zip"
|
||||
version_name: ${{ steps.get-version.outputs.version }}
|
||||
upload_token: ${{ secrets.MirrorChyanUploadToken }}
|
||||
|
||||
@@ -1,596 +0,0 @@
|
||||
name: BetterGI Publish
|
||||
run-name: "BetterGI ${{ inputs.version }}"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'BetterGI Version (eg: 0.35.1, 0.36.5-alpha.1)'
|
||||
required: true
|
||||
type: string
|
||||
kachina-channel:
|
||||
type: choice
|
||||
description: 'Kachina Installer Channel'
|
||||
required: true
|
||||
default: 'release'
|
||||
options:
|
||||
- release
|
||||
- dev
|
||||
create-release:
|
||||
type: boolean
|
||||
description: '创建 GitHub Release 草稿'
|
||||
required: true
|
||||
default: false
|
||||
upload-to-steambird:
|
||||
type: boolean
|
||||
description: '上传到 Steambird'
|
||||
required: true
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
# Add validation job to check version format
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version: ${{ steps.set-version.outputs.version }}
|
||||
steps:
|
||||
- name: Set version from input or tag
|
||||
id: set-version
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
||||
# Validate manual input version format
|
||||
if ! [[ "${{ github.event.inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$ ]]; then
|
||||
echo "❌ 错误:版本格式必须符合语义化版本规范 (例如: 1.2.3, 1.2.3-alpha, 1.2.3+build.123)"
|
||||
exit 1
|
||||
fi
|
||||
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
|
||||
echo "✨ 手动触发构建,版本号:${{ github.event.inputs.version }}"
|
||||
else
|
||||
# Extract version from tag name (remove 'v' prefix)
|
||||
VERSION=${GITHUB_REF#refs/tags/v}
|
||||
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||
echo "🏷️ 从 tag 触发构建,版本号:${VERSION}"
|
||||
fi
|
||||
|
||||
build_web_map_editor:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: huiyadanli/bettergi-map
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: 'npm'
|
||||
- run: npm install
|
||||
- run: npm run build:single
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: web_map_editor
|
||||
path: dist/
|
||||
|
||||
build_web_scripts_list:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: zaodonganqi/bettergi-script-web
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: 'npm'
|
||||
- run: npm install
|
||||
- run: npm run build:single
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: web_scripts_list
|
||||
path: dist/
|
||||
|
||||
build_dist:
|
||||
runs-on: windows-latest
|
||||
needs: [validate, build_web_map_editor, build_web_scripts_list]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.x
|
||||
- name: 更新 csproj 文件版本号
|
||||
run: |
|
||||
$version = '${{ needs.validate.outputs.version }}'
|
||||
(Get-Content BetterGenshinImpact/BetterGenshinImpact.csproj) -replace '<Version>.*</Version>', "<Version>$version</Version>" | Set-Content BetterGenshinImpact/BetterGenshinImpact.csproj
|
||||
- name: 自动提交更改
|
||||
if: github.repository_owner == 'babalae'
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "Update version to ${{ needs.validate.outputs.version }}"
|
||||
branch: main
|
||||
file_pattern: BetterGenshinImpact/BetterGenshinImpact.csproj
|
||||
- name: Cache NuGet packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.nuget/packages
|
||||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/BetterGenshinImpact.csproj') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nuget-
|
||||
- name: 🛠️ Build application
|
||||
run: dotnet publish BetterGenshinImpact/BetterGenshinImpact.csproj -c Release -p:PublishProfile=FolderProfile -p:Version=${{ needs.validate.outputs.version }}
|
||||
continue-on-error: true
|
||||
- name: 🧹 Clear & Move Files
|
||||
run: |
|
||||
$sourceDir = ".\BetterGenshinImpact\bin\x64\Release\net8.0-windows10.0.22621.0\publish\win-x64"
|
||||
Get-ChildItem -Path $sourceDir -Recurse -Filter "*.lib" | Remove-Item -Force
|
||||
Get-ChildItem -Path $sourceDir -Recurse -Filter "*ffmpeg*.dll" | Remove-Item -Force
|
||||
Get-ChildItem -Path $sourceDir -Recurse -Filter "*.pdb" | Remove-Item -Force
|
||||
New-Item -Path "dist/BetterGI" -ItemType Directory
|
||||
xcopy "$sourceDir\*" ".\dist\BetterGI\" /E /H /I /Y
|
||||
# 下载前面构建好的web内容
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: web_map_editor
|
||||
path: dist/BetterGI/Assets/Map/Editor
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: web_scripts_list
|
||||
path: dist/BetterGI/Assets/Web/ScriptRepo
|
||||
# 下载构建 repo 的内容补充数据
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: babalae/bettergi-publish
|
||||
path: publish
|
||||
# - name: 🗜️ Extract Map
|
||||
# run: |
|
||||
# cd publish
|
||||
# # Extract zst files
|
||||
# Get-ChildItem -Filter *.zst | ForEach-Object {
|
||||
# if ($_.PSIsContainer -eq $false) {
|
||||
# $file = $_.Name
|
||||
# $output_file = "..\dist\BetterGI\Assets\Map\$($file -replace '.zst$', '')"
|
||||
# & zstd -d $file -o $output_file
|
||||
# Write-Host "$file -> $output_file"
|
||||
# }
|
||||
# }
|
||||
# # Extract zip files
|
||||
# Get-ChildItem -Filter *.zip | ForEach-Object {
|
||||
# if ($_.PSIsContainer -eq $false) {
|
||||
# $file = $_.FullName
|
||||
# $destination = "..\dist\BetterGI\Assets\Map"
|
||||
# Expand-Archive -Path $file -DestinationPath $destination -Force
|
||||
# Write-Host "$file -> $destination"
|
||||
# }
|
||||
# }
|
||||
# 生成更新器
|
||||
- name: 📥 Download kachina-builder release
|
||||
if: ${{ github.event.inputs.kachina-channel == 'release' }}
|
||||
uses: robinraju/[email protected]
|
||||
with:
|
||||
repository: "YuehaiTeam/kachina-installer"
|
||||
latest: true
|
||||
fileName: "kachina-builder.exe"
|
||||
|
||||
- name: 📥 Download kachina-builder dev
|
||||
if: ${{ github.event.inputs.kachina-channel == 'dev' }}
|
||||
uses: dawidd6/action-download-artifact@v8
|
||||
with:
|
||||
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||
repo: "YuehaiTeam/kachina-installer"
|
||||
workflow: "build.yml"
|
||||
name: artifact
|
||||
branch: main
|
||||
event: push
|
||||
workflow_conclusion: success
|
||||
- name: 📦 Gen Updater by kachina-builder
|
||||
run: |
|
||||
cd dist
|
||||
..\kachina-builder.exe pack -c ..\Build\kachina.config.json -o BetterGI/BetterGI.update.exe
|
||||
# 打包上传
|
||||
- name: 📦 Generate archive
|
||||
run: |
|
||||
cd dist
|
||||
7z a "BetterGI_v${{ needs.validate.outputs.version }}.7z" BetterGI -t7z -mx=5 -mf=BCJ2 -r -y
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: BetterGI_7z
|
||||
path: dist/BetterGI_*.7z
|
||||
|
||||
build_installer:
|
||||
runs-on: windows-latest
|
||||
needs: [validate, build_dist]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: BetterGI_7z
|
||||
path: dist
|
||||
- name: Unpack BetterGI_*.7z
|
||||
run: |
|
||||
cd dist
|
||||
7z x "BetterGI_v${{ needs.validate.outputs.version }}.7z"
|
||||
- name: 📥 Download kachina-builder release
|
||||
if: ${{ github.event.inputs.kachina-channel == 'release' }}
|
||||
uses: robinraju/[email protected]
|
||||
with:
|
||||
repository: "YuehaiTeam/kachina-installer"
|
||||
latest: true
|
||||
fileName: "kachina-builder.exe"
|
||||
- name: 📥 Download kachina-builder dev
|
||||
if: ${{ github.event.inputs.kachina-channel == 'dev' }}
|
||||
uses: dawidd6/action-download-artifact@v8
|
||||
with:
|
||||
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||
repo: "YuehaiTeam/kachina-installer"
|
||||
workflow: "build.yml"
|
||||
name: artifact
|
||||
branch: main
|
||||
event: push
|
||||
workflow_conclusion: success
|
||||
- name: 📥 Download last release
|
||||
uses: robinraju/[email protected]
|
||||
with:
|
||||
repository: "babalae/better-genshin-impact"
|
||||
latest: true
|
||||
fileName: "BetterGI_v*.7z"
|
||||
out-file-path: 'last'
|
||||
- name: 📥 Get 2nd and 3rd release
|
||||
id: release_tags
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
$releasesUrl = "https://api.github.com/repos/babalae/better-genshin-impact/releases"
|
||||
$headers = @{
|
||||
"Authorization" = "Bearer $env:GITHUB_TOKEN"
|
||||
"Accept" = "application/vnd.github.v3+json"
|
||||
}
|
||||
$releases = Invoke-RestMethod -Uri $releasesUrl -Headers $headers -Method Get
|
||||
$validReleases = $releases |
|
||||
Where-Object { -not $_.draft -and -not $_.prerelease } |
|
||||
Sort-Object { [DateTime]$_.published_at } -Descending
|
||||
if ($validReleases.Count -lt 3) {
|
||||
Write-Error "至少需要 3 个正式 Release(当前找到 $($validReleases.Count) 个)"
|
||||
exit 1
|
||||
}
|
||||
"second_release_tag=$($validReleases[1].tag_name)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
|
||||
"third_release_tag=$($validReleases[2].tag_name)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
|
||||
|
||||
- name: 📥 Download 2nd last release
|
||||
uses: robinraju/[email protected]
|
||||
with:
|
||||
repository: "babalae/better-genshin-impact"
|
||||
tag: ${{ steps.release_tags.outputs.second_release_tag }}
|
||||
fileName: "BetterGI_v*.7z"
|
||||
out-file-path: '2nd'
|
||||
- name: 📥 Download 3rd last release
|
||||
uses: robinraju/[email protected]
|
||||
with:
|
||||
repository: "babalae/better-genshin-impact"
|
||||
tag: ${{ steps.release_tags.outputs.third_release_tag }}
|
||||
fileName: "BetterGI_v*.7z"
|
||||
out-file-path: '3rd'
|
||||
- name: Unpack releases
|
||||
run: |
|
||||
cd last
|
||||
7z x "BetterGI*.7z" -otemp
|
||||
if (Test-Path -Path ".\temp\BetterGI" -PathType Container) {
|
||||
Move-Item -Path ".\temp\BetterGI" -Destination ".\BetterGI"
|
||||
} else {
|
||||
Rename-Item -Path ".\temp" -NewName ".\BetterGI"
|
||||
}
|
||||
cd ..
|
||||
cd 2nd
|
||||
7z x "BetterGI*.7z" -otemp
|
||||
if (Test-Path -Path ".\temp\BetterGI" -PathType Container) {
|
||||
Move-Item -Path ".\temp\BetterGI" -Destination ".\BetterGI"
|
||||
} else {
|
||||
Rename-Item -Path ".\temp" -NewName ".\BetterGI"
|
||||
}
|
||||
cd ..
|
||||
cd 3rd
|
||||
7z x "BetterGI*.7z" -otemp
|
||||
if (Test-Path -Path ".\temp\BetterGI" -PathType Container) {
|
||||
Move-Item -Path ".\temp\BetterGI" -Destination ".\BetterGI"
|
||||
} else {
|
||||
Rename-Item -Path ".\temp" -NewName ".\BetterGI"
|
||||
}
|
||||
cd ..
|
||||
ls .\last
|
||||
ls .\2nd
|
||||
ls .\3rd
|
||||
- name: 📦 Pack kachina-builder
|
||||
run: |
|
||||
cd dist
|
||||
..\kachina-builder.exe gen -j 6 -i BetterGI -m metadata.json -o hashed -r babalae/bettergi -t ${{ needs.validate.outputs.version }} --diff-vers ..\last\BetterGI --diff-vers ..\2nd\BetterGI --diff-vers ..\3rd\BetterGI --diff-ignore *[.txt,.onnx] -u .\BetterGI\BetterGI.update.exe
|
||||
..\kachina-builder.exe pack -c ../Build/kachina.config.json -m metadata.json -d hashed -o BetterGI.Install.${{ needs.validate.outputs.version }}.exe
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: BetterGI_Install
|
||||
path: dist/BetterGI.Install.*.exe
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: BetterGI_OnlineInst
|
||||
path: dist/BetterGI/BetterGI.update.exe
|
||||
|
||||
build_setup:
|
||||
runs-on: windows-latest
|
||||
needs: [validate, build_dist]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: BetterGI_7z
|
||||
path: dist
|
||||
- name: Unpack BetterGI_*.7z & Repack
|
||||
run: |
|
||||
cd dist
|
||||
7z x "BetterGI_v${{ needs.validate.outputs.version }}.7z"
|
||||
cd BetterGI
|
||||
7z a -t7z "..\..\publish.7z" *
|
||||
- name: 📥 Download MicaSetup
|
||||
uses: robinraju/[email protected]
|
||||
with:
|
||||
repository: "lemutec/MicaSetup"
|
||||
latest: true
|
||||
fileName: "MicaSetup_v*.7z"
|
||||
- name: 📦 Pack MicaSetup
|
||||
run: |
|
||||
$archiveFiles = Get-ChildItem -Path . -Filter "MicaSetup_v*.7z"
|
||||
foreach ($archive in $archiveFiles) {
|
||||
& 7z x $archive.FullName
|
||||
}
|
||||
Copy-Item -Path "Build\micasetup.json" -Destination "."
|
||||
Copy-Item -Path "Build\micasetup" -Destination "." -Recurse -Force
|
||||
.\makemica.exe micasetup.json
|
||||
ren BetterGI_Setup.exe BetterGI_Setup_v${{ needs.validate.outputs.version }}.exe
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: BetterGI_Setup
|
||||
path: BetterGI_Setup*.exe
|
||||
|
||||
# 创建 GitHub Release
|
||||
create_release:
|
||||
if: github.event.inputs.create-release == 'true'
|
||||
needs: [validate, build_dist, build_installer]
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{ needs.validate.outputs.version }}
|
||||
name: BetterGI v${{ needs.validate.outputs.version }}
|
||||
draft: true
|
||||
prerelease: ${{ contains(needs.validate.outputs.version, '-') }}
|
||||
fail_on_unmatched_files: true
|
||||
files: |
|
||||
artifacts/BetterGI_7z/*.7z
|
||||
artifacts/BetterGI_Install/*.exe
|
||||
|
||||
mirrorchyan_uploading:
|
||||
if: github.repository_owner == 'babalae' && contains(needs.validate.outputs.version, '-')
|
||||
needs: [validate, build_dist, build_installer]
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: downloads
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: 📥 Download kachina-builder release
|
||||
if: ${{ github.event.inputs.kachina-channel == 'release' }}
|
||||
uses: robinraju/[email protected]
|
||||
with:
|
||||
repository: "YuehaiTeam/kachina-installer"
|
||||
latest: true
|
||||
fileName: "kachina-builder.exe"
|
||||
- name: 📥 Download kachina-builder dev
|
||||
if: ${{ github.event.inputs.kachina-channel == 'dev' }}
|
||||
uses: dawidd6/action-download-artifact@v8
|
||||
with:
|
||||
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||
repo: "YuehaiTeam/kachina-installer"
|
||||
workflow: "build.yml"
|
||||
name: artifact
|
||||
branch: main
|
||||
event: push
|
||||
workflow_conclusion: success
|
||||
|
||||
- name: Embed Dotnet and VCRedist
|
||||
shell: bash
|
||||
run: |
|
||||
# dotnet
|
||||
VERSION_URL="https://builds.dotnet.microsoft.com/dotnet/WindowsDesktop/8.0/latest.version"
|
||||
VERSION=$(curl -fsSL "$VERSION_URL" | tr -d '\r\n')
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Cannot get the latest version from $VERSION_URL"
|
||||
exit 1
|
||||
fi
|
||||
INSTALLER_URL="https://builds.dotnet.microsoft.com/dotnet/WindowsDesktop/${VERSION}/windowsdesktop-runtime-${VERSION}-win-x64.exe"
|
||||
OUTPUT="windowsdesktop-runtime-${VERSION}-win-x64.exe"
|
||||
echo "Downloading Windows Desktop Runtime version $VERSION from $INSTALLER_URL"
|
||||
curl -fSL -o "$OUTPUT" "$INSTALLER_URL"
|
||||
# vcredist
|
||||
echo "Downloading VCRedist"
|
||||
curl -fSL -o "vc_redist.x64.exe" "https://aka.ms/vs/17/release/vc_redist.x64.exe"
|
||||
# embed
|
||||
echo "Embedding runtimes"
|
||||
./kachina-builder.exe append -o ./downloads/BetterGI_Install/BetterGI.Install.*.exe -f "$OUTPUT" -n "Microsoft.DotNet.DesktopRuntime.8" -f "vc_redist.x64.exe" -n "Microsoft.VCRedist.2015+.x64"
|
||||
./kachina-builder.exe extract -i ./downloads/BetterGI_Install/BetterGI.Install.*.exe -f ./metadata.json -n "\0META"
|
||||
- name: Extract 7z and create zip
|
||||
shell: bash
|
||||
run: |
|
||||
choco install wget --no-progress
|
||||
7z a -tzip BetterGI.Install.${{ needs.validate.outputs.version }}.zip ./downloads/BetterGI_Install/BetterGI.Install.${{ needs.validate.outputs.version }}.exe -mx=1 -r -y
|
||||
cd downloads/BetterGI_7z
|
||||
7z x BetterGI_v*.7z -oun7z
|
||||
mv ../../metadata.json ./un7z/BetterGI/.metadata.json
|
||||
cd un7z
|
||||
7z a -tzip ../BetterGI.zip ./BetterGI -mx=5 -r -y
|
||||
|
||||
- name: Upload Zip
|
||||
uses: MirrorChyan/uploading-action@v1
|
||||
with:
|
||||
filetype: local
|
||||
mirrorchyan_rid: BGI
|
||||
filename: "downloads/BetterGI_7z/BetterGI.zip"
|
||||
version_name: ${{ needs.validate.outputs.version }}
|
||||
upload_token: ${{ secrets.MirrorChyanUploadToken }}
|
||||
os: win
|
||||
arch: x64
|
||||
|
||||
- name: Upload Install.exe
|
||||
uses: MirrorChyan/uploading-action@v1
|
||||
with:
|
||||
filetype: local
|
||||
mirrorchyan_rid: BGI
|
||||
filename: "BetterGI.Install.${{ needs.validate.outputs.version }}.zip"
|
||||
version_name: ${{ needs.validate.outputs.version }}
|
||||
upload_token: ${{ secrets.MirrorChyanUploadToken }}
|
||||
|
||||
cnb_uploading:
|
||||
if: github.repository_owner == 'babalae' && false
|
||||
needs: [validate, build_dist, build_installer]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r .github/workflows/requirements.txt
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Prepare files for upload
|
||||
run: |
|
||||
mkdir -p upload_files
|
||||
# 只复制 7z 文件和 Install.exe 文件
|
||||
find artifacts -name "*.7z" -exec cp {} upload_files/ \;
|
||||
find artifacts -name "BetterGI.Install.*.exe" -exec cp {} upload_files/ \;
|
||||
echo "📦 准备上传的文件:"
|
||||
ls -la upload_files/
|
||||
|
||||
- name: Copy CNB uploader script
|
||||
run: |
|
||||
# 复制 CNB 上传脚本到当前目录
|
||||
cp .github/workflows/cnb_release.py ./cnb_release.py
|
||||
|
||||
- name: Upload to CNB
|
||||
env:
|
||||
CNB_TOKEN: ${{ secrets.CNB_TOKEN }}
|
||||
VERSION: ${{ needs.validate.outputs.version }}
|
||||
run: |
|
||||
# 生成文件列表数组
|
||||
FILE_LIST=""
|
||||
for file in upload_files/*; do
|
||||
if [ -f "$file" ]; then
|
||||
if [ -n "$FILE_LIST" ]; then
|
||||
FILE_LIST="$FILE_LIST,"
|
||||
fi
|
||||
FILE_LIST="$FILE_LIST\"$file\""
|
||||
fi
|
||||
done
|
||||
|
||||
# 判断是否为预发布版本
|
||||
if [[ "$VERSION" == *"-"* ]]; then
|
||||
IS_PRERELEASE="true"
|
||||
MAKE_LATEST="false"
|
||||
else
|
||||
IS_PRERELEASE="false"
|
||||
MAKE_LATEST="true"
|
||||
fi
|
||||
|
||||
# 创建 JSON 配置
|
||||
cat > cnb_config.json << EOF
|
||||
{
|
||||
"token": "$CNB_TOKEN",
|
||||
"project_path": "bettergi/better-genshin-impact",
|
||||
"base_url": "https://api.cnb.cool",
|
||||
"overwrite": true,
|
||||
"release_data": {
|
||||
"tag_name": "v$VERSION",
|
||||
"name": "BetterGI v$VERSION",
|
||||
"body": "BetterGI v$VERSION 自动发布",
|
||||
"draft": false,
|
||||
"prerelease": $IS_PRERELEASE,
|
||||
"target_commitish": "main",
|
||||
"make_latest": "$MAKE_LATEST"
|
||||
},
|
||||
"asset_files": [
|
||||
$FILE_LIST
|
||||
]
|
||||
}
|
||||
EOF
|
||||
|
||||
# 检查配置文件内容
|
||||
echo "📋 CNB 配置内容:"
|
||||
cat cnb_config.json
|
||||
|
||||
# 验证 JSON 格式
|
||||
python -c "import json; print('✅ JSON 格式验证通过'); json.load(open('cnb_config.json'))"
|
||||
|
||||
# 执行上传
|
||||
python cnb_release.py cnb_config.json
|
||||
|
||||
cnb_trigger:
|
||||
if: github.repository_owner == 'babalae'
|
||||
needs: [validate, build_dist, build_installer]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r .github/workflows/requirements.txt
|
||||
|
||||
- name: Trigger CNB Build
|
||||
env:
|
||||
CNB_TOKEN: ${{ secrets.CNB_TOKEN }}
|
||||
run: |
|
||||
python .github/workflows/cnb_trigger.py "$CNB_TOKEN" --runid ${{ github.run_id }}
|
||||
|
||||
upload_to_steambird:
|
||||
if: ${{ inputs.upload-to-steambird && github.repository_owner == 'babalae' }}
|
||||
needs: [validate, build_dist, build_installer]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Prepare files for upload
|
||||
run: |
|
||||
mkdir -p upload_files
|
||||
# 只复制 7z 文件和 Install.exe 文件
|
||||
find artifacts -name "*.7z" -exec cp {} upload_files/ \;
|
||||
find artifacts -name "BetterGI.Install.*.exe" -exec cp {} upload_files/ \;
|
||||
echo "📦 准备上传的文件:"
|
||||
ls -la upload_files/
|
||||
|
||||
- name: Upload to Steambird
|
||||
env:
|
||||
TUS_USER: "bgi"
|
||||
TUS_PASS: ${{ secrets.TUS_PASS }}
|
||||
run: |
|
||||
wget https://uploads.steambird.pub/upload.sh
|
||||
chmod +x upload.sh
|
||||
./upload.sh https://uploads.steambird.pub/dav/bgi/ upload_files/BetterGI.Install.*.exe
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
name: Repo Bot
|
||||
run-name: "Repo Bot #${{ github.event.issue.number || github.event.pull_request.number }} - ${{ github.event_name }}/${{ github.event.action }} - @${{ github.actor }}"
|
||||
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- opened
|
||||
- edited
|
||||
- reopened
|
||||
- labeled
|
||||
issue_comment:
|
||||
types:
|
||||
- created
|
||||
- edited
|
||||
# pull_request_target (not pull_request) is required so that pull requests opened from
|
||||
# forks can be labelled/commented. Never check out or execute the pull request head here.
|
||||
pull_request_target:
|
||||
types:
|
||||
- opened
|
||||
- edited
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
|
||||
jobs:
|
||||
repo-bot:
|
||||
if: >-
|
||||
github.event.sender.type != 'Bot' &&
|
||||
(
|
||||
github.event_name != 'issue_comment' ||
|
||||
contains(github.event.comment.body, '/fix') ||
|
||||
contains(github.event.comment.body, '/refresh')
|
||||
)
|
||||
uses: ddaodan/bettergi-github-bot/.github/workflows/repo-bot.yml@v1
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
contents: read
|
||||
secrets:
|
||||
REPO_BOT_AI_API_KEY: ${{ secrets.REPO_BOT_AI_API_KEY }}
|
||||
REPO_BOT_GITHUB_APP_PRIVATE_KEY: ${{ secrets.REPO_BOT_GITHUB_APP_PRIVATE_KEY }}
|
||||
with:
|
||||
config-path: .github/repo-bot.yml
|
||||
# pull_request_target: only fetch the configuration from the base branch.
|
||||
# Never check out the pull request head (it would execute untrusted code).
|
||||
checkout-mode: config-only
|
||||
config-overrides-json: ${{ vars.REPO_BOT_CONFIG_OVERRIDES_JSON }}
|
||||
ai-enabled: ${{ vars.REPO_BOT_AI_ENABLED }}
|
||||
ai-base-url: ${{ vars.REPO_BOT_AI_BASE_URL }}
|
||||
ai-model: ${{ vars.REPO_BOT_AI_MODEL }}
|
||||
ai-api-style: ${{ vars.REPO_BOT_AI_API_STYLE }}
|
||||
ai-timeout-ms: ${{ vars.REPO_BOT_AI_TIMEOUT_MS }}
|
||||
action-ref: v1
|
||||
github-app-id: ${{ vars.REPO_BOT_GITHUB_APP_ID }}
|
||||
@@ -1,3 +0,0 @@
|
||||
# CNB Release Uploader 依赖
|
||||
requests>=2.25.0
|
||||
tqdm>=4.60.0
|
||||
+1
-27
@@ -9,14 +9,6 @@
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
Build/
|
||||
!Build/
|
||||
Build/*
|
||||
!Build/BetterGenshinImpact.I18nSync/
|
||||
!Build/BetterGenshinImpact.I18nSync/**
|
||||
!Build/Scripts/
|
||||
Build/Scripts/*
|
||||
!Build/Scripts/i18n-sync.ps1
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
@@ -29,29 +21,11 @@ bld/
|
||||
[Ll]og/
|
||||
|
||||
# Mine
|
||||
/Tmp/
|
||||
|
||||
# AI temporary design docs
|
||||
Docs/tmp/*
|
||||
!Docs/tmp/README.md
|
||||
Tmp/
|
||||
/packages/
|
||||
node_modules/
|
||||
github_actions_cache/
|
||||
|
||||
*.zip
|
||||
|
||||
# Rider
|
||||
.idea
|
||||
|
||||
__pycache__/
|
||||
|
||||
|
||||
# Trae
|
||||
.trae/*
|
||||
!.trae/rules/
|
||||
!.trae/rules/**
|
||||
!.trae/skills/
|
||||
!.trae/skills/**
|
||||
|
||||
# Claude
|
||||
.claude/*
|
||||
@@ -1,3 +0,0 @@
|
||||
[submodule "Test/BetterGenshinImpact.UnitTest/Assets"]
|
||||
path = Test/BetterGenshinImpact.UnitTest/Assets
|
||||
url = https://github.com/huiyadanli/BetterGI.UnitTest.Assets.git
|
||||
@@ -1,121 +0,0 @@
|
||||
本项目使用了 WPF-UI、 CommunityToolkit.Mvvm、Microsoft.Xaml.Behaviors.Wpf 来实现 MVVM 架构。在编写代码的时候请注意:
|
||||
|
||||
### 主要依赖框架
|
||||
#### UI 框架
|
||||
- **WPF-UI (4.0.2)** - 现代化 WPF UI 框架
|
||||
- **gong-wpf-dragdrop(3.2.1)** - 拖拽框架
|
||||
|
||||
#### MVVM 框架
|
||||
- **CommunityToolkit.Mvvm (8.2.2)** - 微软官方 MVVM 工具包
|
||||
- 所有 ViewModel 必须继承自 `ObservableObject`
|
||||
- 使用 `[ObservableProperty]` 特性自动生成属性
|
||||
- 使用 `[RelayCommand]` 特性自动生成命令
|
||||
- **Microsoft.Xaml.Behaviors.Wpf(1.1.122)** - WPF 行为扩展库
|
||||
- 请尽量使用 Behaviors 库来实现交互,避免不符合 MVVM 规范的交互事件触发方式。
|
||||
|
||||
### 其他框架使用要求
|
||||
1. 请优先使用 Newtonsoft.Json 作为json序列化工具,但是如果这个模型已经被System.Text.Json序列化过了,那么就直接使用System.Text.Json反序列化。
|
||||
2. 所有简单的对话框弹出需求优先使用 ThemedMessageBox 弹出。而不是 WPF 自带的 MessageBox。
|
||||
|
||||
## MVVM 架构规则
|
||||
|
||||
### 基础架构
|
||||
|
||||
### ViewModel 编写规范
|
||||
|
||||
1. **继承规则**
|
||||
```csharp
|
||||
public partial class ExampleViewModel : ViewModel
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string _title = "";
|
||||
|
||||
[RelayCommand]
|
||||
private void DoSomething()
|
||||
{
|
||||
// 实现逻辑
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
2. **属性命名**
|
||||
- 私有字段使用下划线前缀: `_fieldName`
|
||||
- 公共属性使用 PascalCase: `PropertyName`
|
||||
- 使用 `[ObservableProperty]` 自动生成属性
|
||||
|
||||
3. **命令实现**
|
||||
- 使用 `[RelayCommand]` 特性
|
||||
- 异步命令使用 `[RelayCommand]` + `async Task`
|
||||
|
||||
### View 编写规范
|
||||
|
||||
1. **代码后置**
|
||||
```csharp
|
||||
public partial class ExamplePage : UserControl
|
||||
{
|
||||
public ExampleViewModel ViewModel { get; }
|
||||
|
||||
public ExamplePage(ExampleViewModel viewModel)
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
DataContext = this;
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
2. **XAML 绑定**
|
||||
- 使用 `{Binding}` 语法绑定 ViewModel 属性
|
||||
- 命令绑定: `Command="{Binding ExampleCommand}"`
|
||||
- 避免在 XAML 中编写复杂逻辑
|
||||
|
||||
### 依赖注入规范
|
||||
|
||||
1. **服务注册**
|
||||
```csharp
|
||||
// 在 App.xaml.cs 中注册
|
||||
services.AddView<ExamplePage, ExampleViewModel>();
|
||||
services.AddSingleton<IExampleService, ExampleService>();
|
||||
```
|
||||
|
||||
最后,程序能够编译就认为成功,无需实际运行程序。
|
||||
|
||||
编译指令参考,如果出现程序占用场景,直接放弃编译验证即可
|
||||
```
|
||||
dotnet build BetterGenshinImpact.sln -c Debug
|
||||
```
|
||||
|
||||
禁止 新增 BetterGenshinImpact\Assets 目录,这里的资源已经被 BetterGI.Assets.* 的外部资源给占用了。如果要新增资源,需要人工去修改对应 nuget 包的资源。
|
||||
|
||||
## 识别与模拟操作
|
||||
|
||||
在进行键鼠操作后再识图的时候,必须添加适当的延时!因为游戏内对键鼠的响应是有 30~60ms 的延迟的,截图的来源图也是有延迟的。
|
||||
|
||||
键鼠操作本身也不宜过快,在 30 fps 的游戏中,过快的操作可能会丢失。
|
||||
|
||||
## Code Review Rules
|
||||
|
||||
### Output language
|
||||
|
||||
- 必须使用简体中文输出代码审查结果。
|
||||
- 问题标题、问题描述、影响分析和修复建议必须使用中文。
|
||||
- 类名、方法名、变量名、文件路径、代码片段和错误消息保持原文。
|
||||
- 专业术语第一次出现时可以采用“中文(English)”格式。
|
||||
|
||||
### Review priorities
|
||||
|
||||
- 优先检查可能造成崩溃、死锁、资源泄漏和数据竞争的问题。
|
||||
- 重点检查异步任务、CancellationToken、线程切换和 STA UI 线程使用。
|
||||
- 重点检查 Mat、Bitmap、Stream、CancellationTokenSource 等 IDisposable 对象是否正确释放。
|
||||
- 检查游戏输入、截图和多实例场景是否存在共享状态冲突。
|
||||
- 不要只提出风格问题,除非它会影响正确性、可维护性或性能。
|
||||
|
||||
### Finding format
|
||||
|
||||
每个问题按以下结构输出:
|
||||
|
||||
1. 严重程度
|
||||
2. 问题位置
|
||||
3. 问题原因
|
||||
4. 可能造成的影响
|
||||
5. 推荐修复方案
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net7.0-windows10.0.22621.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="OxyPlot.Wpf" Version="2.1.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BetterGenshinImpact\BetterGenshinImpact.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
+15
-32
@@ -7,33 +7,24 @@ namespace BetterGenshinImpact.Test.Dataset;
|
||||
public class AvatarClassifyGen
|
||||
{
|
||||
// 基础图像文件夹
|
||||
private const string BaseDir = @"E:\HuiTask\更好的原神\侧面头像\side_src";
|
||||
|
||||
// 产出文件夹
|
||||
private const string OutputDir = @"E:\HuiTask\更好的原神\侧面头像\dateset";
|
||||
private const string BaseDir = @"E:\HuiTask\更好的原神\自动秘境\自动战斗\队伍识别\分类器\";
|
||||
|
||||
// 背景图像文件夹
|
||||
private static readonly string BackgroundDir = @"E:\HuiTask\更好的原神\侧面头像\background";
|
||||
private static readonly string BackgroundDir = Path.Combine(BaseDir, "background");
|
||||
|
||||
private static readonly Random Rd = new Random();
|
||||
|
||||
// public static readonly List<string> ImgNames = ["UI_AvatarIcon_Side_Aino.png","UI_AvatarIcon_Side_Flins.png", "UI_AvatarIcon_Side_Nefer.png", "UI_AvatarIcon_Side_Nefer.png", "UI_AvatarIcon_Side_Lauma.png"];
|
||||
|
||||
public static void GenAll()
|
||||
{
|
||||
// 读取基础图像
|
||||
List<string> sideImageFiles = Directory.GetFiles(BaseDir, "*.png", SearchOption.TopDirectoryOnly).ToList();
|
||||
// List<string> sideImageFiles = Directory.GetFiles(Path.Combine(BaseDir, "side_src"), "*.png", SearchOption.TopDirectoryOnly).ToList();
|
||||
// 只用一个图像
|
||||
// List<string> sideImageFiles = [];
|
||||
//
|
||||
// foreach (string imgName in ImgNames)
|
||||
// {
|
||||
// sideImageFiles.Add(Path.Combine(BaseDir, imgName));
|
||||
// }
|
||||
List<string> sideImageFiles = Directory.GetFiles(Path.Combine(BaseDir, "side_src"), "UI_AvatarIcon_Side_Arlecchino.png", SearchOption.TopDirectoryOnly).ToList();
|
||||
|
||||
// 生成训练集
|
||||
GenTo(sideImageFiles, Path.Combine(OutputDir, @"dateset\train"), 200);
|
||||
GenTo(sideImageFiles, Path.Combine(BaseDir, @"dateset\train"), 200);
|
||||
// 生成测试集
|
||||
GenTo(sideImageFiles, Path.Combine(OutputDir, @"dateset\test"), 40);
|
||||
GenTo(sideImageFiles, Path.Combine(BaseDir, @"dateset\test"), 40);
|
||||
// GenTo(new List<string> { sideImageFiles[1] }, Path.Combine(BaseDir, @"dateset\test"), 1);
|
||||
}
|
||||
|
||||
@@ -71,14 +62,11 @@ public class AvatarClassifyGen
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
// 随机挑选一张背景图像
|
||||
string backgroundImageFile = Path.Combine(BackgroundDir,
|
||||
Directory.GetFiles(BackgroundDir, "*.png")[
|
||||
Rd.Next(Directory.GetFiles(BackgroundDir, "*.png").Length)]);
|
||||
string backgroundImageFile = Path.Combine(BackgroundDir, Directory.GetFiles(BackgroundDir, "*.png")[Rd.Next(Directory.GetFiles(BackgroundDir, "*.png").Length)]);
|
||||
|
||||
// 从背景图像中随机取一块 128x128 的区域
|
||||
Mat backgroundImage = Cv2.ImRead(backgroundImageFile, ImreadModes.Color);
|
||||
Rect backgroundRect = new Rect(Rd.Next(backgroundImage.Width - 128),
|
||||
new Random().Next(backgroundImage.Height - 128), 128, 128);
|
||||
Rect backgroundRect = new Rect(Rd.Next(backgroundImage.Width - 128), new Random().Next(backgroundImage.Height - 128), 128, 128);
|
||||
Mat backgroundImageRegion = backgroundImage[backgroundRect];
|
||||
|
||||
// 随机平移、缩放保留区域
|
||||
@@ -95,11 +83,9 @@ public class AvatarClassifyGen
|
||||
// Cv2.ImShow("resizedSideImage", resizedSideImage);
|
||||
var resizedMaskImage = new Mat();
|
||||
// Cv2.Threshold(alphaChannel, alphaChannel, 200, 255, ThresholdTypes.Otsu);
|
||||
Cv2.Resize(~alphaChannel, resizedMaskImage, new Size(128 * scale, 128 * scale), 0, 0,
|
||||
InterpolationFlags.Cubic);
|
||||
Cv2.Resize(255 - alphaChannel, resizedMaskImage, new Size(128 * scale, 128 * scale), 0, 0, InterpolationFlags.Cubic);
|
||||
var resizedAlphaChannel = new Mat();
|
||||
Cv2.Resize(alphaChannel, resizedAlphaChannel, new Size(128 * scale, 128 * scale), 0, 0,
|
||||
InterpolationFlags.Cubic);
|
||||
Cv2.Resize(alphaChannel, resizedAlphaChannel, new Size(128 * scale, 128 * scale), 0, 0, InterpolationFlags.Cubic);
|
||||
|
||||
// Cv2.ImShow("resizedMaskImage", resizedMaskImage);
|
||||
// generatedImage[transformedRect] = resizedSideImage;
|
||||
@@ -116,8 +102,7 @@ public class AvatarClassifyGen
|
||||
int offsetY = Rd.Next(-ySpace, 0);
|
||||
Debug.WriteLine($"{sideImageFileName} 缩放{scale}大于1 偏移 ({offsetX},{offsetY})");
|
||||
|
||||
var roi = new Rect((resizedSideImage.Width - 128) / 2 + offsetX,
|
||||
(resizedSideImage.Height - 128) + offsetY, 128, 128);
|
||||
var roi = new Rect((resizedSideImage.Width - 128) / 2 + offsetX, (resizedSideImage.Height - 128) + offsetY, 128, 128);
|
||||
// result = new Mat();
|
||||
// Cv2.BitwiseAnd(backgroundImageRegionClone, backgroundImageRegionClone, result, resizedMaskImage[roi]);
|
||||
result = Mul(backgroundImageRegionClone, resizedAlphaChannel[roi]);
|
||||
@@ -131,8 +116,7 @@ public class AvatarClassifyGen
|
||||
int offsetY = Rd.Next(-ySpace, 0);
|
||||
Debug.WriteLine($"{sideImageFileName} 缩放{scale}小于等于1 偏移 ({offsetX},{offsetY})");
|
||||
|
||||
var roi = new Rect((128 - resizedSideImage.Width) / 2 + offsetX,
|
||||
(128 - resizedSideImage.Height) + offsetY, resizedSideImage.Width, resizedSideImage.Height);
|
||||
var roi = new Rect((128 - resizedSideImage.Width) / 2 + offsetX, (128 - resizedSideImage.Height) + offsetY, resizedSideImage.Width, resizedSideImage.Height);
|
||||
var res = new Mat();
|
||||
// Cv2.BitwiseAnd(backgroundImageRegionClone[roi], backgroundImageRegionClone[roi], res, resizedMaskImage);
|
||||
res = Mul(backgroundImageRegionClone[roi], resizedAlphaChannel);
|
||||
@@ -152,12 +136,11 @@ public class AvatarClassifyGen
|
||||
var channels = background.Split();
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Cv2.Multiply(channels[i], ~ alphaChannel, channels[i], 1 / 255.0);
|
||||
Cv2.Multiply(channels[i], 255 - alphaChannel, channels[i], 1 / 255.0);
|
||||
}
|
||||
|
||||
Mat result = new Mat();
|
||||
Cv2.Merge(channels[..3], result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<Window x:Class="BetterGenshinImpact.Test.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="Test"
|
||||
Width="120"
|
||||
Height="450"
|
||||
mc:Ignorable="d">
|
||||
<Canvas>
|
||||
<Button Canvas.Left="10"
|
||||
Canvas.Top="10"
|
||||
Width="100"
|
||||
Height="23"
|
||||
Click="ShowCameraRecWindow"
|
||||
Content="视角识别测试" />
|
||||
<Button Canvas.Left="10"
|
||||
Canvas.Top="40"
|
||||
Width="100"
|
||||
Height="23"
|
||||
Click="ShowHsvTestWindow"
|
||||
Content="Hsv拉条" />
|
||||
<Button Canvas.Left="10"
|
||||
Canvas.Top="70"
|
||||
Width="100"
|
||||
Height="23"
|
||||
Click="DoMapPuzzle"
|
||||
Content="拼接超大地图" />
|
||||
<Button Canvas.Left="10"
|
||||
Canvas.Top="100"
|
||||
Width="100"
|
||||
Height="23"
|
||||
Click="DoMatchTest"
|
||||
Content="特征匹配测试" />
|
||||
<Button Canvas.Left="10"
|
||||
Canvas.Top="130"
|
||||
Width="100"
|
||||
Height="23"
|
||||
Click="DoMatchTemplateTest"
|
||||
Content="模板匹配测试" />
|
||||
<Button Canvas.Left="10"
|
||||
Canvas.Top="160"
|
||||
Width="100"
|
||||
Height="23"
|
||||
Click="MapDrawTeleportPoint"
|
||||
Content="超大地图标点" />
|
||||
<Button Canvas.Left="10"
|
||||
Canvas.Top="190"
|
||||
Width="100"
|
||||
Height="23"
|
||||
Click="GenAvatarData"
|
||||
Content="生成侧面头像数据集" />
|
||||
<Button Canvas.Left="10"
|
||||
Canvas.Top="190"
|
||||
Width="100"
|
||||
Height="23"
|
||||
Click="AutoCookTestCase"
|
||||
Content="自动烹饪图像测试" />
|
||||
</Canvas>
|
||||
</Window>
|
||||
@@ -0,0 +1,68 @@
|
||||
using System.Windows;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.GameTask.Common.Map;
|
||||
using BetterGenshinImpact.Test.Dataset;
|
||||
using BetterGenshinImpact.Test.Simple;
|
||||
using BetterGenshinImpact.Test.Simple.AllMap;
|
||||
using BetterGenshinImpact.Test.View;
|
||||
|
||||
namespace BetterGenshinImpact.Test;
|
||||
|
||||
/// <summary>
|
||||
/// MainWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
Global.StartUpPath = @"D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\bin\x64\Debug\net7.0-windows10.0.22621.0";
|
||||
}
|
||||
|
||||
private void ShowCameraRecWindow(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
new CameraRecWindow().Show();
|
||||
}
|
||||
|
||||
private void ShowHsvTestWindow(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
new HsvTestWindow().Run();
|
||||
}
|
||||
|
||||
private void DoMapPuzzle(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
MapPuzzle.Put();
|
||||
}
|
||||
|
||||
private void DoOcrTest(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
OcrTest.TestYap();
|
||||
}
|
||||
|
||||
private void DoMatchTemplateTest(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
MatchTemplateTest.Test();
|
||||
}
|
||||
|
||||
private void DoMatchTest(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
// KeyPointMatchTest.Test();
|
||||
// EntireMapTest.Test();
|
||||
EntireMapTest.Storage();
|
||||
}
|
||||
|
||||
private void MapDrawTeleportPoint(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MapTeleportPointDraw.Draw();
|
||||
}
|
||||
|
||||
private void GenAvatarData(object sender, RoutedEventArgs e)
|
||||
{
|
||||
AvatarClassifyGen.GenAll();
|
||||
}
|
||||
|
||||
private void AutoCookTestCase(object sender, RoutedEventArgs e)
|
||||
{
|
||||
AutoCookTest.Test();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using BetterGenshinImpact.Core.Recognition.OpenCv.FeatureMatch;
|
||||
using BetterGenshinImpact.GameTask.Common.Element.Assets;
|
||||
using BetterGenshinImpact.Helpers;
|
||||
using OpenCvSharp;
|
||||
using OpenCvSharp.Detail;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace BetterGenshinImpact.Test.Simple.AllMap;
|
||||
|
||||
public class EntireMapTest
|
||||
{
|
||||
public static void Test()
|
||||
{
|
||||
SpeedTimer speedTimer = new();
|
||||
var mainMap1024BlockMat = new Mat(@"E:\HuiTask\更好的原神\地图匹配\有用的素材\mainMap1024Block.png", ImreadModes.Grayscale);
|
||||
var surfMatcher = new FeatureMatcher(mainMap1024BlockMat);
|
||||
var queryMat = new Mat(@"E:\HuiTask\更好的原神\地图匹配\比较\小地图\Clip_20240323_183119.png", ImreadModes.Grayscale);
|
||||
|
||||
speedTimer.Record("初始化特征");
|
||||
|
||||
var pArray = surfMatcher.Match(queryMat);
|
||||
speedTimer.Record("匹配1");
|
||||
if (pArray != null)
|
||||
{
|
||||
var rect = Cv2.BoundingRect(pArray);
|
||||
Debug.WriteLine($"Matched rect 1: {rect}");
|
||||
Cv2.Rectangle(mainMap1024BlockMat, rect, Scalar.Red, 2);
|
||||
// Cv2.ImWrite(@"E:\HuiTask\更好的原神\地图匹配\b1.png", mainMap1024BlockMat);
|
||||
|
||||
var pArray2 = surfMatcher.Match(queryMat, rect.X + rect.Width / 2, rect.Y + rect.Height / 2);
|
||||
speedTimer.Record("匹配2");
|
||||
if (pArray2 != null)
|
||||
{
|
||||
var rect2 = Cv2.BoundingRect(pArray2);
|
||||
Debug.WriteLine($"Matched rect 2: {rect2}");
|
||||
Cv2.Rectangle(mainMap1024BlockMat, rect2, Scalar.Yellow, 1);
|
||||
// Cv2.ImWrite(@"E:\HuiTask\更好的原神\地图匹配\b2.png", mainMap1024BlockMat);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.WriteLine("No match 2");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.WriteLine("No match 1");
|
||||
}
|
||||
speedTimer.DebugPrint();
|
||||
}
|
||||
|
||||
public static void Storage()
|
||||
{
|
||||
var featureMatcher = new FeatureMatcher(MapAssets.Instance.MainMap2048BlockMat.Value, new FeatureStorage("mainMap2048Block"));
|
||||
MessageBox.Show("特征点生成完成");
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -281,10 +281,10 @@ public class KeyPointMatchTest
|
||||
writer.Write(image.Rows);
|
||||
writer.Write(image.Cols);
|
||||
int depth = image.Depth();
|
||||
MatType type = image.Type();
|
||||
int type = image.Type();
|
||||
int channels = image.Channels();
|
||||
writer.Write(depth);
|
||||
writer.Write(type.Value);
|
||||
writer.Write(type);
|
||||
writer.Write(channels);
|
||||
int sizeInBytes = (int)image.Step() * image.Rows;
|
||||
writer.Write(sizeInBytes);
|
||||
@@ -0,0 +1,194 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text.RegularExpressions;
|
||||
using OpenCvSharp;
|
||||
|
||||
namespace BetterGenshinImpact.Test.Simple.AllMap;
|
||||
|
||||
public class MapPuzzle
|
||||
{
|
||||
public static readonly int block = 2048;
|
||||
|
||||
public static List<string> PicWhiteHashList = new List<string>
|
||||
{
|
||||
"25E23B0D18C2CBEA19D28E5E399D42FA",
|
||||
"3B4847FEA7D506EAF3B75D4F4541E867",
|
||||
"CCCAF02768432A46AA0001E51DC5991B",
|
||||
"F80C609208063B289A05B8A1E0351226",
|
||||
"06767779699056515930D0597072AB7D",
|
||||
"04F757BD57FBB5FA74A6C9C0634BB122",
|
||||
"04C1EDFCD89249209D1DD885DD2F2129",
|
||||
"01B8641F5F58BBDE6E10F53D56EA7288",
|
||||
"AF56BDE27BDF534317A9FB34E08165C0",
|
||||
"05F4EAB8C6BFBADD60B8A5CCDD614F83"
|
||||
};
|
||||
|
||||
public static MD5 Md5Service = MD5.Create();
|
||||
|
||||
public static void Put()
|
||||
{
|
||||
string folderPath = @"E:\HuiTask\更好的原神\地图匹配\UI_Map"; // 图片文件夹路径
|
||||
string pattern = @"UI_MapBack_([-+]?\d+)_([-+]?\d+)(.*)";
|
||||
var images = Directory.GetFiles(folderPath, "*.png", SearchOption.TopDirectoryOnly); // 获取所有图片文件路径
|
||||
|
||||
// 解析图片位置信息并存储到字典中
|
||||
var imageLocations = new Dictionary<(int row, int col), ImgInfo>();
|
||||
foreach (var imagePath in images)
|
||||
{
|
||||
// 获取文件大小
|
||||
var fileInfo = new FileInfo(imagePath);
|
||||
|
||||
// 解析图片名称中的行列信息
|
||||
var name = Path.GetFileNameWithoutExtension(imagePath);
|
||||
var match = Regex.Match(name, pattern);
|
||||
int row, col;
|
||||
if (match.Success)
|
||||
{
|
||||
// Debug.WriteLine($"已匹配 ({match.Groups[1].Value}, {match.Groups[2].Value}) {name}");
|
||||
row = int.Parse(match.Groups[1].Value);
|
||||
col = int.Parse(match.Groups[2].Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Debug.WriteLine($"未匹配 {name}");
|
||||
continue;
|
||||
}
|
||||
|
||||
// 排除指定行列的图片
|
||||
if ((row, col) == (4, 6) || (row, col) == (5, 6) || (row, col) == (5, 5) || (row, col) == (5, 2) || (row, col) == (5, 1) || (row, col) == (4, 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// 读取图片并计算hash值
|
||||
Mat img = Cv2.ImRead(imagePath);
|
||||
var hashBytes = Md5Service.ComputeHash(File.ReadAllBytes(imagePath));
|
||||
var hash = BitConverter.ToString(hashBytes).Replace("-", "").ToUpperInvariant();
|
||||
|
||||
if (img.Width < 8)
|
||||
{
|
||||
Debug.WriteLine($"太小的不要 ({row}, {col}) {img.Width} {img.Height} {name}");
|
||||
continue;
|
||||
}
|
||||
|
||||
// 如果只要城市拼接,取消注释这段
|
||||
// if (block == 2048 && img.Width != 2048)
|
||||
// {
|
||||
// Debug.WriteLine($"不是2048的不要 ({row}, {col}) {img.Width} {img.Height} {name}");
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// 如果当前位置已经有图片了,保留尺寸较大的图片
|
||||
if (imageLocations.ContainsKey((row, col)))
|
||||
{
|
||||
// 如果当前位置的图片已经被hash锁定,跳过
|
||||
if (imageLocations[(row, col)].Locked)
|
||||
{
|
||||
Debug.WriteLine($"已锁定 ({row}, {col}) {name}");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (img.Width > imageLocations[(row, col)].Img.Width || fileInfo.Length > imageLocations[(row, col)].FileLength || PicWhiteHashList.Contains(hash))
|
||||
{
|
||||
imageLocations[(row, col)] = new ImgInfo(img, name, fileInfo.Length, PicWhiteHashList.Contains(hash));
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.WriteLine($"重复 ({row}, {col}) {img.Width} {img.Height} {name}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
imageLocations[(row, col)] = new ImgInfo(img, name, fileInfo.Length, PicWhiteHashList.Contains(hash));
|
||||
}
|
||||
}
|
||||
|
||||
int minRow = imageLocations.Keys.Min(key => key.row);
|
||||
int minCol = imageLocations.Keys.Min(key => key.col);
|
||||
|
||||
// 确定大图的行数和列数
|
||||
int maxRow = imageLocations.Keys.Max(key => key.row);
|
||||
int maxCol = imageLocations.Keys.Max(key => key.col);
|
||||
|
||||
// 计算大图的总宽度和高度
|
||||
var lenCol = maxCol - minCol;
|
||||
var lenRow = maxRow - minRow;
|
||||
int totalWidth = (lenCol + 1) * block;
|
||||
int totalHeight = (lenRow + 1) * block;
|
||||
|
||||
// 创建空白大图
|
||||
Mat largeImage = new Mat(totalHeight, totalWidth, MatType.CV_8UC3, new Scalar(0, 0, 0));
|
||||
|
||||
// 拼接图片
|
||||
int[,] arr = new int[lenRow + 1, lenCol + 1];
|
||||
foreach (var location in imageLocations)
|
||||
{
|
||||
int row = location.Key.row - minRow;
|
||||
int col = location.Key.col - minCol;
|
||||
Mat img = location.Value.Img;
|
||||
|
||||
arr[row, col] = 1;
|
||||
|
||||
// 计算当前图片在大图中的左上角位置
|
||||
int x = (lenCol - col) * block; // 顺序倒过来了,屮
|
||||
int y = (lenRow - row) * block; // 顺序倒过来了,屮
|
||||
|
||||
// 将图片粘贴到大图上
|
||||
if (img.Width != block || img.Height != block)
|
||||
{
|
||||
img = img.Resize(new Size(block, block), 0, 0, InterpolationFlags.Nearest);
|
||||
}
|
||||
|
||||
// 添加位置标识
|
||||
// img.PutText($"{location.Key.row} , {location.Key.col}", new Point(50, 50), HersheyFonts.HersheyComplex, 2, Scalar.Red, 2, LineTypes.Link8);
|
||||
|
||||
img.CopyTo(new Mat(largeImage, new Rect(x, y, img.Width, img.Height)));
|
||||
}
|
||||
|
||||
// 康康二维数组的拼接结果
|
||||
for (int i = 0; i < arr.GetLength(0); i++)
|
||||
{
|
||||
for (int j = 0; j < arr.GetLength(1); j++)
|
||||
{
|
||||
Debug.Write(arr[i, j] + " ");
|
||||
}
|
||||
|
||||
Debug.WriteLine("");
|
||||
}
|
||||
|
||||
// 保存大图
|
||||
Cv2.ImWrite(@"E:\HuiTask\更好的原神\地图匹配\map_46_2048.png", largeImage);
|
||||
// Cv2.ImWrite(@"E:\HuiTask\更好的原神\地图匹配\combined_image_sd4x.png", largeImage.Resize(new Size(largeImage.Width / 4, largeImage.Height / 4), 0, 0, InterpolationFlags.Cubic));
|
||||
// Cv2.ImWrite(@"E:\HuiTask\更好的原神\地图匹配\combined_image_small.png", largeImage.Resize(new Size(1400, 1300), 0, 0, InterpolationFlags.Cubic));
|
||||
|
||||
// 释放资源
|
||||
largeImage.Dispose();
|
||||
foreach (var img in imageLocations.Values)
|
||||
{
|
||||
img.Img.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public class ImgInfo
|
||||
{
|
||||
public Mat Img { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文件大小
|
||||
/// </summary>
|
||||
public long FileLength { get; set; }
|
||||
|
||||
public bool Locked { get; set; }
|
||||
|
||||
public ImgInfo(Mat mat, string name, long fileLength, bool locked = false)
|
||||
{
|
||||
Img = mat;
|
||||
Name = name;
|
||||
FileLength = fileLength;
|
||||
Locked = locked;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using BetterGenshinImpact.Service;
|
||||
using OpenCvSharp;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BetterGenshinImpact.Test.Simple.AllMap;
|
||||
|
||||
public class MapTeleportPointDraw
|
||||
{
|
||||
public static void Draw()
|
||||
{
|
||||
var pList = LoadTeleportPoint(@"E:\HuiTask\更好的原神\地图匹配\地图点位\Json_Integration\锚点&神像\");
|
||||
var map = new Mat(@"E:\HuiTask\更好的原神\地图匹配\genshin_map_带标记.png");
|
||||
DrawTeleportPoint(map, pList.ToArray());
|
||||
Cv2.ImWrite(@"E:\HuiTask\更好的原神\地图匹配\genshin_map_带标记_传送点.png", map);
|
||||
}
|
||||
|
||||
public static void DrawTeleportPoint(Mat map, Point[] points)
|
||||
{
|
||||
foreach (var point in points)
|
||||
{
|
||||
Cv2.Circle(map, new Point(point.X, point.Y), 10, Scalar.Red, 2);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Point> LoadTeleportPoint(string folderPath)
|
||||
{
|
||||
string[] files = Directory.GetFiles(folderPath, "*.*", SearchOption.AllDirectories);
|
||||
List<Point> points = new();
|
||||
foreach (var file in files)
|
||||
{
|
||||
var gamePoint = JsonSerializer.Deserialize<GamePoint>(File.ReadAllText(file), ConfigService.JsonOptions);
|
||||
if (gamePoint == null)
|
||||
{
|
||||
Debug.WriteLine($"{file} json is null");
|
||||
continue;
|
||||
}
|
||||
|
||||
points.Add(Transform(gamePoint.Position));
|
||||
}
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 坐标系转换
|
||||
/// </summary>
|
||||
/// <param name="position">[a,b,c]</param>
|
||||
/// <returns></returns>
|
||||
public static Point Transform(decimal[] position)
|
||||
{
|
||||
// 四舍六入五取偶
|
||||
var a = (int)Math.Round(position[0]); // 上
|
||||
var c = (int)Math.Round(position[2]); // 左
|
||||
|
||||
// 转换1024区块坐标,大地图坐标系正轴是往左上方向的
|
||||
// 这里写最左上角的区块坐标(m,n)/(上,左),截止4.5版本,最左上角的区块坐标是(5,7)
|
||||
|
||||
int m = 5, n = 7;
|
||||
return new Point((n + 1) * 1024 - c, (m + 1) * 1024 - a);
|
||||
}
|
||||
|
||||
class GamePoint
|
||||
{
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public decimal[] Position { get; set; } = new decimal[3];
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
+1
-1
@@ -61,7 +61,7 @@ internal class HsvTestWindow
|
||||
Cv2.CreateTrackbar("High S", _windowDetectionName, ref _highS, MaxValue, on_high_S_thresh_trackbar);
|
||||
Cv2.CreateTrackbar("Low V", _windowDetectionName, ref _lowV, MaxValue, on_low_V_thresh_trackbar);
|
||||
Cv2.CreateTrackbar("High V", _windowDetectionName, ref _highV, MaxValue, on_high_V_thresh_trackbar);
|
||||
var frame = Cv2.ImRead(@"E:\HuiTask\更好的原神\自动秘境\Q识别\拼图\2.png", ImreadModes.Color);
|
||||
var frame = Cv2.ImRead(@"E:\HuiTask\更好的原神\自动秘境\自动战斗\队伍识别\bsz1.png", ImreadModes.Color);
|
||||
Mat frameHsv = new Mat();
|
||||
// Convert from BGR to HSV colorspace
|
||||
Cv2.CvtColor(frame, frameHsv, ColorConversionCodes.BGR2HSV);
|
||||
File renamed without changes.
+1
-1
@@ -282,7 +282,7 @@ public class CharacterOrientationTest
|
||||
|
||||
if (contours.Length > 0)
|
||||
{
|
||||
Rect maxRect = default;
|
||||
var maxRect = Rect.Empty;
|
||||
var maxIndex = 0;
|
||||
for (int i = 0; i < contours.Length; i++)
|
||||
{
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.Diagnostics;
|
||||
using BetterGenshinImpact.Core.Recognition.OCR;
|
||||
using BetterGenshinImpact.Core.Recognition.ONNX.SVTR;
|
||||
using BetterGenshinImpact.Core.Recognition.OpenCv;
|
||||
using OpenCvSharp;
|
||||
|
||||
namespace BetterGenshinImpact.Test.Simple;
|
||||
|
||||
public class OcrTest
|
||||
{
|
||||
public static void TestYap()
|
||||
{
|
||||
Mat mat = Cv2.ImRead(@"E:\HuiTask\更好的原神\临时文件\fuben_jueyuan.png", ImreadModes.Grayscale);
|
||||
var text = TextInferenceFactory.Pick.Inference(PreProcessForInference(mat));
|
||||
Debug.WriteLine(text);
|
||||
|
||||
Mat mat2 = Cv2.ImRead(@"E:\HuiTask\更好的原神\临时文件\fuben_jueyuan.png", ImreadModes.Grayscale);
|
||||
var text2 = OcrFactory.Paddle.Ocr(mat2);
|
||||
Debug.WriteLine(text2);
|
||||
}
|
||||
|
||||
private static Mat PreProcessForInference(Mat mat)
|
||||
{
|
||||
// Yap 已经改用灰度图了 https://github.com/Alex-Beng/Yap/commit/c2ad1e7b1442aaf2d80782a032e00876cd1c6c84
|
||||
// 二值化
|
||||
// Cv2.Threshold(mat, mat, 0, 255, ThresholdTypes.Otsu | ThresholdTypes.Binary);
|
||||
//Cv2.AdaptiveThreshold(mat, mat, 255, AdaptiveThresholdTypes.GaussianC, ThresholdTypes.Binary, 31, 3); // 效果不错 但是和模型不搭
|
||||
//mat = OpenCvCommonHelper.Threshold(mat, Scalar.FromRgb(235, 235, 235), Scalar.FromRgb(255, 255, 255)); // 识别物品不太行
|
||||
// 不知道为什么要强制拉伸到 221x32
|
||||
mat = ResizeHelper.ResizeTo(mat, 221, 32);
|
||||
// 填充到 384x32
|
||||
var padded = new Mat(new Size(384, 32), MatType.CV_8UC1, Scalar.Black);
|
||||
padded[new Rect(0, 0, mat.Width, mat.Height)] = mat;
|
||||
//Cv2.ImWrite(Global.Absolute("padded.png"), padded);
|
||||
return padded;
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,21 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Platforms>x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="NativeMethods.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.46-beta">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/microsoft/CsWin32/main/src/Microsoft.Windows.CsWin32/settings.schema.json",
|
||||
"allowMarshaling": true,
|
||||
"useSafeHandles": false,
|
||||
"emitSingleFile": true,
|
||||
"public": true,
|
||||
"comInterop": {
|
||||
"useIntPtrForComOutPointers": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// D3D11
|
||||
CreateDirect3D11DeviceFromDXGIDevice
|
||||
CreateDirect3D11SurfaceFromDXGISurface
|
||||
|
||||
// GDI32
|
||||
BitBlt
|
||||
CreateCompatibleBitmap
|
||||
CreateCompatibleDC
|
||||
DeleteDC
|
||||
GetDeviceCaps
|
||||
SelectObject
|
||||
|
||||
// User32
|
||||
GetClientRect
|
||||
GetDC
|
||||
GetForegroundWindow
|
||||
GetSystemMetrics
|
||||
GetWindowDC
|
||||
GetWindowRect
|
||||
GetWindowThreadProcessId
|
||||
mouse_event
|
||||
PostMessage
|
||||
ReleaseDC
|
||||
EnumWindows
|
||||
GetWindowText
|
||||
IsWindowVisible
|
||||
GetWindowTextLength
|
||||
|
||||
// COM & WinRT
|
||||
D3D11CreateDevice
|
||||
ID3D11Device3
|
||||
IDirect3DDxgiInterfaceAccess
|
||||
|
||||
// Constants
|
||||
D3D11_SDK_VERSION
|
||||
DXGI_ERROR_UNSUPPORTED
|
||||
WM_LBUTTONDOWN
|
||||
WM_LBUTTONUP
|
||||
+71
-34
@@ -5,22 +5,28 @@ VisualStudioVersion = 17.6.33815.320
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BetterGenshinImpact", "BetterGenshinImpact\BetterGenshinImpact.csproj", "{75EC89E2-413D-4725-BCEA-AFAC57708F07}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vision.WindowCapture", "Vision.WindowCapture\Vision.WindowCapture.csproj", "{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BetterGenshinImpact.Win32", "BetterGenshinImpact.Win32\BetterGenshinImpact.Win32.csproj", "{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fischless.GameCapture", "Fischless.GameCapture\Fischless.GameCapture.csproj", "{6B0A3D96-D88D-48DD-8112-4CD5BA5D27CE}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vision.WindowCapture.Test", "Vision.WindowCapture.Test\Vision.WindowCapture.Test.csproj", "{D35CB953-C666-4E57-9A9A-3AAE5BF78402}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fischless.HotkeyCapture", "Fischless.HotkeyCapture\Fischless.HotkeyCapture.csproj", "{08152E44-2564-46C5-B5B2-54DD43C01A79}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BetterGenshinImpact.Test", "Test\BetterGenshinImpact.Test\BetterGenshinImpact.Test.csproj", "{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fischless.KeyboardCapture", "Fischless.KeyboardCapture\Fischless.KeyboardCapture.csproj", "{10A48327-7E58-4B51-B1FC-55506C703C8F}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Deploy", "Deploy", "{458E1106-43A4-47E6-B11B-D243035D4C76}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MicaSetup", "Build\MicaSetup\MicaSetup.csproj", "{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MicaSetup.Uninst", "Build\MicaSetup\MicaSetup.Uninst.csproj", "{673344BC-B860-44AE-AD88-D33465BDE25B}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BetterGenshinImpact.Test", "BetterGenshinImpact.Test\BetterGenshinImpact.Test.csproj", "{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fischless.WindowsInput", "Fischless.WindowsInput\Fischless.WindowsInput.csproj", "{9D00BC7A-9280-4AC9-8951-4502EDB71B76}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{02CEA57F-C24B-40F9-AF31-F1D4F3BDB4BF}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BetterGenshinImpact.UnitTest", "Test\BetterGenshinImpact.UnitTest\BetterGenshinImpact.UnitTest.csproj", "{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{DB7D66B7-B4DA-4A16-8BBF-3DDA83654C53}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BetterGenshinImpact.I18nSync", "Build\BetterGenshinImpact.I18nSync\BetterGenshinImpact.I18nSync.csproj", "{B63FC99D-3C56-4F95-A80B-8AAFD8482C76}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -37,6 +43,22 @@ Global
|
||||
{75EC89E2-413D-4725-BCEA-AFAC57708F07}.Release|Any CPU.Build.0 = Release|x64
|
||||
{75EC89E2-413D-4725-BCEA-AFAC57708F07}.Release|x64.ActiveCfg = Release|x64
|
||||
{75EC89E2-413D-4725-BCEA-AFAC57708F07}.Release|x64.Build.0 = Release|x64
|
||||
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Debug|x64.Build.0 = Debug|x64
|
||||
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Release|Any CPU.Build.0 = Release|x64
|
||||
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Release|x64.ActiveCfg = Release|x64
|
||||
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Release|x64.Build.0 = Release|x64
|
||||
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Debug|x64.Build.0 = Debug|x64
|
||||
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Release|Any CPU.Build.0 = Release|x64
|
||||
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Release|x64.ActiveCfg = Release|x64
|
||||
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Release|x64.Build.0 = Release|x64
|
||||
{6B0A3D96-D88D-48DD-8112-4CD5BA5D27CE}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{6B0A3D96-D88D-48DD-8112-4CD5BA5D27CE}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{6B0A3D96-D88D-48DD-8112-4CD5BA5D27CE}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -45,6 +67,14 @@ Global
|
||||
{6B0A3D96-D88D-48DD-8112-4CD5BA5D27CE}.Release|Any CPU.Build.0 = Release|x64
|
||||
{6B0A3D96-D88D-48DD-8112-4CD5BA5D27CE}.Release|x64.ActiveCfg = Release|x64
|
||||
{6B0A3D96-D88D-48DD-8112-4CD5BA5D27CE}.Release|x64.Build.0 = Release|x64
|
||||
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Debug|x64.Build.0 = Debug|x64
|
||||
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Release|Any CPU.Build.0 = Release|x64
|
||||
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Release|x64.ActiveCfg = Release|x64
|
||||
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Release|x64.Build.0 = Release|x64
|
||||
{08152E44-2564-46C5-B5B2-54DD43C01A79}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{08152E44-2564-46C5-B5B2-54DD43C01A79}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{08152E44-2564-46C5-B5B2-54DD43C01A79}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -53,14 +83,38 @@ Global
|
||||
{08152E44-2564-46C5-B5B2-54DD43C01A79}.Release|Any CPU.Build.0 = Release|x64
|
||||
{08152E44-2564-46C5-B5B2-54DD43C01A79}.Release|x64.ActiveCfg = Release|x64
|
||||
{08152E44-2564-46C5-B5B2-54DD43C01A79}.Release|x64.Build.0 = Release|x64
|
||||
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Debug|x64.Build.0 = Debug|x64
|
||||
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Release|Any CPU.Build.0 = Release|x64
|
||||
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Release|x64.ActiveCfg = Release|x64
|
||||
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Release|x64.Build.0 = Release|x64
|
||||
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Debug|x64.Build.0 = Debug|x64
|
||||
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Release|x64.ActiveCfg = Release|x64
|
||||
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Release|x64.Build.0 = Release|x64
|
||||
{673344BC-B860-44AE-AD88-D33465BDE25B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{673344BC-B860-44AE-AD88-D33465BDE25B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{673344BC-B860-44AE-AD88-D33465BDE25B}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{673344BC-B860-44AE-AD88-D33465BDE25B}.Debug|x64.Build.0 = Debug|x64
|
||||
{673344BC-B860-44AE-AD88-D33465BDE25B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{673344BC-B860-44AE-AD88-D33465BDE25B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{673344BC-B860-44AE-AD88-D33465BDE25B}.Release|x64.ActiveCfg = Release|x64
|
||||
{673344BC-B860-44AE-AD88-D33465BDE25B}.Release|x64.Build.0 = Release|x64
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Debug|x64.Build.0 = Debug|x64
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|Any CPU.Build.0 = Release|x64
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|x64.ActiveCfg = Release|x64
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|x64.Build.0 = Release|x64
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|x64.Build.0 = Release|Any CPU
|
||||
{9D00BC7A-9280-4AC9-8951-4502EDB71B76}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{9D00BC7A-9280-4AC9-8951-4502EDB71B76}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{9D00BC7A-9280-4AC9-8951-4502EDB71B76}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -69,30 +123,13 @@ Global
|
||||
{9D00BC7A-9280-4AC9-8951-4502EDB71B76}.Release|Any CPU.Build.0 = Release|x64
|
||||
{9D00BC7A-9280-4AC9-8951-4502EDB71B76}.Release|x64.ActiveCfg = Release|x64
|
||||
{9D00BC7A-9280-4AC9-8951-4502EDB71B76}.Release|x64.Build.0 = Release|x64
|
||||
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Debug|x64.Build.0 = Debug|x64
|
||||
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Release|Any CPU.Build.0 = Release|x64
|
||||
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Release|x64.ActiveCfg = Release|x64
|
||||
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Release|x64.Build.0 = Release|x64
|
||||
{B63FC99D-3C56-4F95-A80B-8AAFD8482C76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B63FC99D-3C56-4F95-A80B-8AAFD8482C76}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B63FC99D-3C56-4F95-A80B-8AAFD8482C76}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{B63FC99D-3C56-4F95-A80B-8AAFD8482C76}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{B63FC99D-3C56-4F95-A80B-8AAFD8482C76}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B63FC99D-3C56-4F95-A80B-8AAFD8482C76}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B63FC99D-3C56-4F95-A80B-8AAFD8482C76}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{B63FC99D-3C56-4F95-A80B-8AAFD8482C76}.Release|x64.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE} = {02CEA57F-C24B-40F9-AF31-F1D4F3BDB4BF}
|
||||
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98} = {02CEA57F-C24B-40F9-AF31-F1D4F3BDB4BF}
|
||||
{B63FC99D-3C56-4F95-A80B-8AAFD8482C76} = {DB7D66B7-B4DA-4A16-8BBF-3DDA83654C53}
|
||||
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15} = {458E1106-43A4-47E6-B11B-D243035D4C76}
|
||||
{673344BC-B860-44AE-AD88-D33465BDE25B} = {458E1106-43A4-47E6-B11B-D243035D4C76}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {352D8B78-9DE3-4E58-985F-FADD22594DB4}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=chyan/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=enkanomiya/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Kongying/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=mirrorchan/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=onslaugh/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=retcode/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=serenitea/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=steambird/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Teyvat/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
@@ -1 +0,0 @@
|
||||
/Assets/Strings/*.html linguist-vendored
|
||||
@@ -1,49 +1,19 @@
|
||||
<Application x:Class="BetterGenshinImpact.App"
|
||||
<Application x:Class="BetterGenshinImpact.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:behavior="clr-namespace:BetterGenshinImpact.View.Behavior"
|
||||
xmlns:bgivc="clr-namespace:BetterGenshinImpact.View.Converters"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:vio="http://schemas.lepo.co/wpfui/2022/xaml/violeta">
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ui:ThemesDictionary Theme="Dark" />
|
||||
<ui:ControlsDictionary />
|
||||
<vio:ControlsDictionary />
|
||||
<ResourceDictionary Source="/View/Controls/WpfUi/FaFontIconStyle.xaml" />
|
||||
<ResourceDictionary Source="/View/Controls/Drawer/DrawerStyles.xaml" />
|
||||
<ResourceDictionary Source="/View/Controls/Markdown/Resources/MarkdownStyles.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<!-- ===== 字体 ===== -->
|
||||
<FontFamily x:Key="TextThemeFontFamily">/Resources/Fonts/MiSans-Regular.ttf#MiSans</FontFamily>
|
||||
<FontFamily x:Key="DigitalThemeFontFamily">/Resources/Fonts/deluge-led.ttf#Deluge LED</FontFamily>
|
||||
|
||||
<!-- ===== 设计令牌 ===== -->
|
||||
<CornerRadius x:Key="ControlCornerRadius">6</CornerRadius>
|
||||
<Thickness x:Key="PagePadding">48,20,48,28</Thickness>
|
||||
|
||||
<!-- ===== 全局 Converter ===== -->
|
||||
<bgivc:DomainNameToCascadingItemConverter x:Key="DomainNameConverter" />
|
||||
<bgivc:AutoBossNameToCascadingItemConverter x:Key="AutoBossNameConverter" />
|
||||
<FontFamily x:Key="TextThemeFontFamily">/Assets/Fonts/MiSans-Regular.ttf#MiSans</FontFamily>
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||
<bgivc:BooleanToVisibilityRevertConverter x:Key="BooleanToVisibilityRevertConverter" />
|
||||
<bgivc:BooleanToEnableTextConverter x:Key="BooleanToEnableTextConverter" />
|
||||
<bgivc:InverseBooleanConverter x:Key="InverseBooleanConverter" />
|
||||
<bgivc:NotNullConverter x:Key="NotNullConverter" />
|
||||
<bgivc:EnumToKVPConverter x:Key="EnumToKVPConverter" />
|
||||
<bgivc:CultureInfoNameToKVPConverter x:Key="CultureInfoNameToKVPConverter" />
|
||||
<bgivc:StringToColorConverter x:Key="StringToColorConverter" />
|
||||
<bgivc:AdaptiveUniformGridColumnsConverter x:Key="AdaptiveUniformGridColumnsConverter" />
|
||||
|
||||
<!-- ===== 全局 TextBox 安全剪贴板 ===== -->
|
||||
<Style BasedOn="{StaticResource DefaultTextBoxStyle}" TargetType="{x:Type TextBox}">
|
||||
<Setter Property="behavior:ClipboardInterceptor.EnableSafeClipboard" Value="True" />
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource DefaultTextBoxStyle}" TargetType="{x:Type ui:TextBox}">
|
||||
<Setter Property="behavior:ClipboardInterceptor.EnableSafeClipboard" Value="True" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
+29
-392
@@ -1,55 +1,25 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
using BetterGenshinImpact.Core.Mask;
|
||||
using BetterGenshinImpact.Core.Recognition.OCR;
|
||||
using BetterGenshinImpact.Core.Recognition.ONNX;
|
||||
using BetterGenshinImpact.Core.Monitor;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.GameTask.AutoSkip.Audio;
|
||||
using BetterGenshinImpact.GameTask.Music.Service;
|
||||
using BetterGenshinImpact.GameTask.Runtime;
|
||||
using BetterGenshinImpact.GameTask.Runtime.Win32;
|
||||
using BetterGenshinImpact.GameTask.Runtime.WebPage;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.Helpers;
|
||||
using BetterGenshinImpact.Helpers.Extensions;
|
||||
using BetterGenshinImpact.Helpers.Win32;
|
||||
using BetterGenshinImpact.Service;
|
||||
using BetterGenshinImpact.Service.ChildSession;
|
||||
using BetterGenshinImpact.Service.Instance;
|
||||
using BetterGenshinImpact.Service.I18n;
|
||||
using BetterGenshinImpact.Service.Interface;
|
||||
using BetterGenshinImpact.Service.Notification;
|
||||
using BetterGenshinImpact.Service.Notifier;
|
||||
using BetterGenshinImpact.View;
|
||||
using BetterGenshinImpact.View.Mask;
|
||||
using BetterGenshinImpact.View.Pages;
|
||||
using BetterGenshinImpact.View.Windows;
|
||||
using BetterGenshinImpact.ViewModel;
|
||||
using BetterGenshinImpact.ViewModel.Pages;
|
||||
using BetterGenshinImpact.ViewModel.Pages.View;
|
||||
using BetterGenshinImpact.ViewModel.Windows;
|
||||
using LazyCache;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
using Serilog.Sinks.RichTextBox.Abstraction;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using Wpf.Ui;
|
||||
using Wpf.Ui.DependencyInjection;
|
||||
using Wpf.Ui.Violeta.Appearance;
|
||||
using Wpf.Ui.Violeta.Controls;
|
||||
|
||||
// Wine 平台适配
|
||||
using BetterGenshinImpact.Platform.Wine;
|
||||
using BetterGenshinImpact.Service.Tavern;
|
||||
|
||||
namespace BetterGenshinImpact;
|
||||
|
||||
@@ -61,11 +31,10 @@ public partial class App : Application
|
||||
// https://docs.microsoft.com/dotnet/core/extensions/configuration
|
||||
// https://docs.microsoft.com/dotnet/core/extensions/logging
|
||||
private static readonly IHost _host = Host.CreateDefaultBuilder()
|
||||
.CheckIntegration()
|
||||
.UseElevated()
|
||||
.UseInstanceIpc()
|
||||
.ConfigureLogging(builder => { builder.ClearProviders(); })
|
||||
.ConfigureServices((context, services) =>
|
||||
.UseSingleInstance("BetterGI")
|
||||
.ConfigureServices(
|
||||
(context, services) =>
|
||||
{
|
||||
// 提前初始化配置
|
||||
var configService = new ConfigService();
|
||||
@@ -75,106 +44,35 @@ public partial class App : Application
|
||||
var logFolder = Path.Combine(AppContext.BaseDirectory, "log");
|
||||
Directory.CreateDirectory(logFolder);
|
||||
var logFile = Path.Combine(logFolder, "better-genshin-impact.log");
|
||||
var instanceContext = InstanceBootstrap.Current.Context;
|
||||
// 网页版实例带上实例名,例如 WebView(小号A):S1:P1234:T…
|
||||
var instanceTypeLabel = instanceContext.InstanceName is { } instanceName
|
||||
? $"{instanceContext.InstanceType}({instanceName})"
|
||||
: instanceContext.InstanceType.ToString();
|
||||
var instanceIdentity =
|
||||
$"{instanceTypeLabel}:S{instanceContext.WindowsSessionId}:P{instanceContext.ProcessId}:T{instanceContext.StartedAt.ToUnixTimeMilliseconds()}";
|
||||
|
||||
var richTextBox = new RichTextBoxImpl();
|
||||
services.AddSingleton<IRichTextBox>(richTextBox);
|
||||
var maskWindow = new MaskWindow();
|
||||
services.AddSingleton(maskWindow);
|
||||
|
||||
var loggerConfiguration = new LoggerConfiguration()
|
||||
.WriteTo.Logger(fileLoggerConfiguration => fileLoggerConfiguration
|
||||
.Enrich.WithProperty("BgiInstance", instanceIdentity)
|
||||
.WriteTo.File(logFile,
|
||||
outputTemplate:
|
||||
"[{Timestamp:HH:mm:ss.fff}] [{Level:u3}] [{BgiInstance}] {SourceContext}{NewLine}{Message}{NewLine}{Exception}{NewLine}",
|
||||
rollingInterval: RollingInterval.Day,
|
||||
shared: true,
|
||||
retainedFileCountLimit: 31,
|
||||
retainedFileTimeLimit: TimeSpan.FromDays(21)))
|
||||
.WriteTo.Console(outputTemplate:
|
||||
"[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}")
|
||||
.WriteTo.File(path: logFile, outputTemplate: "[{Timestamp:HH:mm:ss.fff}] [{Level:u3}] {SourceContext}{NewLine}{Message}{NewLine}{Exception}{NewLine}", rollingInterval: RollingInterval.Day)
|
||||
.MinimumLevel.Debug()
|
||||
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
|
||||
.MinimumLevel.Override("Microsoft.Hosting.Lifetime", LogEventLevel.Warning);
|
||||
// 日志遮罩输出:仅当“遮罩启用且日志框可见”时才真正写入,隐藏时避免不必要的 UI 开销(#3161)。
|
||||
// 条件改为运行时每次写入时动态判断,因此启动后通过快捷键切换 ShowLogBox 也能即时恢复日志(#3357)。
|
||||
loggerConfiguration.WriteTo.Sink(
|
||||
new ConditionalLogEventSink(
|
||||
new LoggerConfiguration()
|
||||
.WriteTo.RichTextBox(richTextBox, LogEventLevel.Information,
|
||||
"[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}")
|
||||
.CreateLogger(),
|
||||
() => all.MaskWindowConfig is { MaskEnabled: true, ShowLogBox: true }),
|
||||
LogEventLevel.Information);
|
||||
if (all.MaskWindowConfig.MaskEnabled)
|
||||
{
|
||||
loggerConfiguration.WriteTo.RichTextBox(maskWindow.LogBox, LogEventLevel.Information, outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}");
|
||||
}
|
||||
|
||||
Log.Logger = loggerConfiguration.CreateLogger();
|
||||
services.AddLogging(c => c.AddSerilog());
|
||||
|
||||
// 配置和日志已经就绪,在任何推理服务或会话初始化前选定原生运行库。
|
||||
all.HardwareAccelerationConfig ??= new();
|
||||
var inferenceStartupStatus = InferenceRuntimeService.PrepareStartup(all.HardwareAccelerationConfig, InstanceBootstrap.Current.Context.IsRoot);
|
||||
// 只规范配置并绑定运行库;待验证状态在主窗口实际开始验证时才落盘。
|
||||
configService.Save();
|
||||
services.AddSingleton(inferenceStartupStatus);
|
||||
var onnxRuntimeLoader = new OnnxRuntimeLoader(all.HardwareAccelerationConfig, AppContext.BaseDirectory);
|
||||
services.AddSingleton(onnxRuntimeLoader);
|
||||
services.AddSingleton<IOnnxRuntimeSelection>(onnxRuntimeLoader);
|
||||
var onnxRuntimeInstaller = new OnnxRuntimeInstaller(AppContext.BaseDirectory);
|
||||
services.AddSingleton(onnxRuntimeInstaller);
|
||||
services.AddSingleton<IOnnxRuntimeInstaller>(onnxRuntimeInstaller);
|
||||
services.AddSingleton<IInferenceDeviceDiscovery, InferenceDeviceDiscovery>();
|
||||
services.AddSingleton<IInferenceBenchmarkLeaseProvider>(sp => new InferenceBenchmarkCoordinator(
|
||||
BetterGenshinImpact.GameTask.Common.TaskControl.TaskSemaphore,
|
||||
() => sp.GetRequiredService<TaskTriggerDispatcher>().PauseForInference()));
|
||||
services.AddSingleton<InferenceModelDiagnostics>();
|
||||
services.AddSingleton<IInferenceModelDiagnostics>(sp => sp.GetRequiredService<InferenceModelDiagnostics>());
|
||||
services.AddSingleton<InferenceRuntimeService>();
|
||||
services.AddSingleton<HardwareAccelerationViewModelFactory>();
|
||||
services.AddSingleton<IInferenceSettingsInteraction, InferenceSettingsInteraction>();
|
||||
|
||||
services.AddLocalization();
|
||||
var i18nService = I18nService.Instance;
|
||||
var uiLanguage = all.OtherConfig.UiCultureInfoName switch
|
||||
{
|
||||
"zh-CN" => "zh-Hans",
|
||||
"en-US" => "en",
|
||||
"ja-JP" => "ja",
|
||||
_ => all.OtherConfig.UiCultureInfoName,
|
||||
};
|
||||
if (uiLanguage != all.OtherConfig.UiCultureInfoName)
|
||||
{
|
||||
all.OtherConfig.UiCultureInfoName = uiLanguage;
|
||||
configService.Save();
|
||||
}
|
||||
|
||||
i18nService.ChangeLanguage(uiLanguage);
|
||||
services.AddSingleton(i18nService);
|
||||
|
||||
services.AddNavigationViewPageProvider();
|
||||
services.AddSingleton(InstanceBootstrap.Current);
|
||||
services.AddSingleton<InstanceService>();
|
||||
services.AddHostedService(sp => sp.GetRequiredService<InstanceService>());
|
||||
// App Host
|
||||
services.AddHostedService<ApplicationHostService>();
|
||||
|
||||
// Page resolver service
|
||||
services.AddSingleton<INavigationService, NavigationService>();
|
||||
services.AddSingleton<IUpdateService, UpdateService>();
|
||||
services.AddSingleton<IPageService, PageService>();
|
||||
|
||||
// Service containing navigation, same as INavigationWindow... but without window
|
||||
services.AddSingleton<INavigationService, NavigationService>();
|
||||
services.AddSingleton<ISnackbarService, SnackbarService>();
|
||||
|
||||
// Main window with navigation
|
||||
services.AddView<INavigationWindow, MainWindow, MainWindowViewModel>();
|
||||
services.AddSingleton<NotifyIconViewModel>();
|
||||
services.AddSingleton<ChildSessionService>();
|
||||
services.AddTransient<ChildSessionWindowViewModel>();
|
||||
services.AddTransient<ChildSessionWindow>();
|
||||
|
||||
// Views
|
||||
services.AddView<HomePage, HomePageViewModel>();
|
||||
@@ -185,99 +83,19 @@ public partial class App : Application
|
||||
services.AddView<TaskSettingsPage, TaskSettingsPageViewModel>();
|
||||
services.AddView<HotKeyPage, HotKeyPageViewModel>();
|
||||
services.AddView<NotificationSettingsPage, NotificationSettingsPageViewModel>();
|
||||
services.AddView<KeyMouseRecordPage, KeyMouseRecordPageViewModel>();
|
||||
services.AddView<JsListPage, JsListViewModel>();
|
||||
services.AddView<MapPathingPage, MapPathingViewModel>();
|
||||
services.AddView<OneDragonFlowPage, OneDragonFlowViewModel>();
|
||||
services.AddView<MusicPage, MusicPageViewModel>();
|
||||
services.AddSingleton<PathingConfigViewModel>();
|
||||
services.AddSingleton<IBannerImageService, BannerImageService>();
|
||||
services.AddTransient<WebImageInputViewModel>();
|
||||
// services.AddView<PathingConfigView, PathingConfigViewModel>();
|
||||
services.AddView<KeyBindingsSettingsPage, KeyBindingsSettingsPageViewModel>();
|
||||
|
||||
// 一条龙 ViewModels
|
||||
// services.AddSingleton<CraftViewModel>();
|
||||
// services.AddSingleton<DailyCommissionViewModel>();
|
||||
// services.AddSingleton<DailyRewardViewModel>();
|
||||
// services.AddSingleton<DomainViewModel>();
|
||||
// services.AddSingleton<ForgingViewModel>();
|
||||
// services.AddSingleton<LeyLineBlossomViewModel>();
|
||||
// services.AddSingleton<MailViewModel>();
|
||||
// services.AddSingleton<SereniteaPotViewModel>();
|
||||
// services.AddSingleton<TcgViewModel>();
|
||||
|
||||
// My Services
|
||||
services.AddSingleton<DirectInputMonitor>();
|
||||
services.AddSingleton<RawInputMonitor>();
|
||||
services.AddSingleton<IRelativeMouseInputMonitorFactory, RelativeMouseInputMonitorFactory>();
|
||||
services.AddSingleton<OverlayMetricsService>();
|
||||
services.AddSingleton<CustomHtmlMaskService>();
|
||||
|
||||
// 遮罩窗口:业务侧只依赖 IMaskWindowDrawingBoard / IMaskWindowHost / IMaskWindowMapState
|
||||
services.AddSingleton<MaskWindowDrawingBoard>();
|
||||
services.AddSingleton<IMaskWindowDrawingBoard>(sp => sp.GetRequiredService<MaskWindowDrawingBoard>());
|
||||
services.AddSingleton<IMaskWindowSnapshotSource<MaskWindowDrawingSnapshot>>(sp => sp.GetRequiredService<MaskWindowDrawingBoard>());
|
||||
services.AddSingleton<MaskWindowMapState>();
|
||||
services.AddSingleton<IMaskWindowMapState>(sp => sp.GetRequiredService<MaskWindowMapState>());
|
||||
services.AddSingleton<IMaskWindowSnapshotSource<MaskWindowMapSnapshot>>(sp => sp.GetRequiredService<MaskWindowMapState>());
|
||||
services.AddSingleton<MaskWindowViewModel>();
|
||||
services.AddTransient<MaskWindow>();
|
||||
services.AddSingleton<Func<MaskWindow>>(sp => () => sp.GetRequiredService<MaskWindow>());
|
||||
services.AddSingleton<IMaskWindowHost, MaskWindowHost>();
|
||||
services.AddSingleton<DialogueOptionVoiceDiagnosticState>();
|
||||
services.AddSingleton<DialogueOptionVoiceDiagnosticService>();
|
||||
services.AddHostedService(sp => sp.GetRequiredService<DialogueOptionVoiceDiagnosticService>());
|
||||
services.AddSingleton<TaskTriggerDispatcher>();
|
||||
// 游戏运行环境:按实例类型选定 Provider,见 Docs/design/game-runtime.md
|
||||
services.AddSingleton<Win32RuntimeProvider>();
|
||||
services.AddSingleton<IGameRuntimeProvider>(sp => sp.GetRequiredService<Win32RuntimeProvider>());
|
||||
services.AddSingleton<IGameRuntimeProvider, WebPageRuntimeProvider>();
|
||||
services.AddTransient<CloudWebHostWindow>();
|
||||
services.AddSingleton<Func<CloudWebHostWindow>>(sp => () => sp.GetRequiredService<CloudWebHostWindow>());
|
||||
services.AddSingleton<GameRuntimeService>();
|
||||
// 云原神网页版实例:实例名存储与启动器(Primary 首页使用)
|
||||
services.AddSingleton<WebViewInstanceStore>();
|
||||
services.AddSingleton<WebViewInstanceLauncher>();
|
||||
services.AddSingleton<RecognitionTemplateAssetService>();
|
||||
services.AddSingleton<RecognitionTemplateEditorService>();
|
||||
services.AddSingleton<NotificationService>();
|
||||
services.AddHostedService(sp => sp.GetRequiredService<NotificationService>());
|
||||
services.AddSingleton<NotifierManager>();
|
||||
services.AddSingleton<IScriptService, ScriptService>();
|
||||
services.AddSingleton<IMusicScoreParser, MusicScoreParser>();
|
||||
services.AddSingleton<IMusicStateStore, MusicStateStore>();
|
||||
services.AddSingleton<IInstrumentProfileService, InstrumentProfileService>();
|
||||
services.AddSingleton<IMusicTimelineBuilder, MusicTimelineBuilder>();
|
||||
services.AddSingleton<IMusicLibraryService, MusicLibraryService>();
|
||||
services.AddSingleton<IMusicCoverService, MusicCoverService>();
|
||||
services.AddSingleton<IMusicInstrumentSwitcher, MusicInstrumentSwitcher>();
|
||||
services.AddSingleton<IKeyInputTransport, PostMessageKeyInputTransport>();
|
||||
services.AddSingleton<IKeyInputTransport, SendInputKeyInputTransport>();
|
||||
services.AddSingleton<IMusicPlaybackService, MusicPlaybackService>();
|
||||
services.AddSingleton<BgiOnnxFactory>();
|
||||
services.AddSingleton<OcrFactory>();
|
||||
services.AddMemoryCache();
|
||||
services.AddSingleton<IAppCache, CachingService>();
|
||||
services.AddSingleton<MemoryFileCache>();
|
||||
services.AddSingleton<IMihoyoMapApiService, MihoyoMapApiService>();
|
||||
services.AddSingleton<IKongyingTavernApiService, KongyingTavernApiService>();
|
||||
services.AddSingleton<IHoYoLabMapApiService, HoYoLabMapApiService>();
|
||||
services.AddSingleton<IMaskMapPointService, MaskMapPointService>();
|
||||
|
||||
services.AddSingleton(TimeProvider.System);
|
||||
services.AddSingleton<IServerTimeProvider, ServerTimeProvider>();
|
||||
|
||||
// Configuration
|
||||
//services.Configure<AppConfig>(context.Configuration.GetSection(nameof(AppConfig)));
|
||||
|
||||
I18N.Culture = new CultureInfo("zh-Hans"); // #1846
|
||||
}
|
||||
)
|
||||
.Build();
|
||||
|
||||
public static IServiceProvider ServiceProvider => _host.Services;
|
||||
|
||||
public static ILogger<T> GetLogger<T>()
|
||||
{
|
||||
return _host.Services.GetService<ILogger<T>>()!;
|
||||
@@ -308,67 +126,24 @@ public partial class App : Application
|
||||
/// </summary>
|
||||
protected override async void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Normal;
|
||||
// Wine 平台适配
|
||||
WinePlatformAddon.ApplyApplicationConfig();
|
||||
base.OnStartup(e);
|
||||
|
||||
try
|
||||
{
|
||||
// 分配控制台窗口以支持控制台输出
|
||||
ConsoleHelper.AllocateConsole("BetterGI Console");
|
||||
RegisterEvents();
|
||||
var inferenceRuntime = _host.Services.GetRequiredService<InferenceRuntimeService>();
|
||||
// 此处只准备设备配置;模型验证和提示由主实例的 MainWindowViewModel.OnLoaded 执行。
|
||||
await inferenceRuntime.InitializeAsync();
|
||||
await _host.StartAsync();
|
||||
ServerTimeHelper.Initialize(_host.Services.GetRequiredService<IServerTimeProvider>());
|
||||
if (InstanceBootstrap.Current.Context.IsRoot)
|
||||
{
|
||||
await UrlProtocolHelper.RegisterAsync();
|
||||
}
|
||||
await UrlProtocolHelper.RegisterAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// DEBUG only, no overhead
|
||||
Debug.WriteLine(ex);
|
||||
ConsoleHelper.WriteError($"应用程序启动失败: {ex.Message}");
|
||||
|
||||
var dialogShown = false;
|
||||
try
|
||||
if (Debugger.IsAttached)
|
||||
{
|
||||
// 启动失败发生在 MainWindow 创建前,日志遮罩可能不可用;
|
||||
// 视为致命异常,记录日志并尝试弹窗。
|
||||
dialogShown = HandleException(ex, isTerminating: true);
|
||||
Debugger.Break();
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
Debug.WriteLine(ex2);
|
||||
ConsoleHelper.WriteError($"应用程序启动失败打印日志时又失败了: {ex2.Message}");
|
||||
}
|
||||
|
||||
// 启动早期 WPF Dispatcher 可能尚未就绪,HandleException 可能因此不弹窗。
|
||||
// 仅在未显示 WPF 弹窗时,用不依赖 WPF 的 WinForms MessageBox 兜底,
|
||||
// 避免用户连续看到两个错误对话框。
|
||||
if (!dialogShown)
|
||||
{
|
||||
try
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show(
|
||||
$"应用程序启动失败:{ex.Message}",
|
||||
"BetterGI 启动失败",
|
||||
System.Windows.Forms.MessageBoxButtons.OK,
|
||||
System.Windows.Forms.MessageBoxIcon.Error);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 弹窗失败不影响退出。
|
||||
}
|
||||
}
|
||||
|
||||
// 启动失败 = 无可用的主界面,直接退出,避免留下无窗口的残留进程。
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -378,29 +153,8 @@ public partial class App : Application
|
||||
{
|
||||
base.OnExit(e);
|
||||
|
||||
ConsoleHelper.WriteLine("BetterGI 应用程序正在关闭...");
|
||||
|
||||
// 写入防抖窗口内尚未落盘的配置改动
|
||||
try
|
||||
{
|
||||
_host.Services.GetService<IConfigService>()?.Flush();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex);
|
||||
}
|
||||
|
||||
TempManager.CleanUp();
|
||||
|
||||
await _host.Services.GetRequiredService<InferenceRuntimeService>().StopAsync();
|
||||
await _host.Services.GetRequiredService<OnnxRuntimeInstaller>().StopAsync();
|
||||
await _host.Services.GetRequiredService<InferenceModelDiagnostics>().StopAsync();
|
||||
await _host.StopAsync();
|
||||
_host.Dispose();
|
||||
Log.CloseAndFlush();
|
||||
|
||||
// 释放控制台窗口
|
||||
ConsoleHelper.FreeConsoleWindow();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -422,12 +176,6 @@ public partial class App : Application
|
||||
{
|
||||
try
|
||||
{
|
||||
// 忽略V8引擎释放后pending的Task回调抛出的异常
|
||||
if (IsV8EngineReleasedException(e.Exception))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HandleException(e.Exception);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -440,21 +188,6 @@ public partial class App : Application
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsV8EngineReleasedException(Exception? ex)
|
||||
{
|
||||
while (ex != null)
|
||||
{
|
||||
if (ex.Message?.Contains("V8 object has been released") == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
ex = ex.InnerException;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//非UI线程未捕获异常处理事件(例如自己创建的一个子线程)
|
||||
private static void CurrentDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
@@ -462,13 +195,12 @@ public partial class App : Application
|
||||
{
|
||||
if (e.ExceptionObject is Exception exception)
|
||||
{
|
||||
// 用官方的 IsTerminating 判断是否致命:致命异常进程将终止,需同步弹窗确保用户可见。
|
||||
HandleException(exception, isTerminating: e.IsTerminating);
|
||||
HandleException(exception);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandleException(ex, isTerminating: e.IsTerminating);
|
||||
HandleException(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -477,7 +209,7 @@ public partial class App : Application
|
||||
}
|
||||
|
||||
//UI线程未捕获异常处理事件(UI主线程)
|
||||
private static void AppDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
|
||||
private static void AppDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -494,111 +226,16 @@ public partial class App : Application
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理未处理异常。返回 true 表示已尝试显示弹窗(或已处理),false 表示未弹窗(Dispatcher 不可用)。
|
||||
/// </summary>
|
||||
private static bool HandleException(Exception e, bool isTerminating = false)
|
||||
private static void HandleException(Exception e)
|
||||
{
|
||||
if (e.InnerException != null)
|
||||
{
|
||||
e = e.InnerException;
|
||||
}
|
||||
|
||||
// 错误日志最先落盘并推送到日志遮罩(LogError ≥ Information 会进入遮罩 LogTextBox)。
|
||||
// 文件日志:Debug 级别也写盘;遮罩:仅 Information 以上可见。
|
||||
// 致命异常(IsTerminating)在日志末尾加 [FATAL] 标记,便于区分。
|
||||
var logMessage = isTerminating ? "UnHandle Exception [FATAL]" : "UnHandle Exception";
|
||||
GetLogger<App>().LogError(e, logMessage);
|
||||
MessageBox.Show("程序异常:" + e.Source + "\r\n--" + Environment.NewLine + e.StackTrace + "\r\n---" + Environment.NewLine + e.Message);
|
||||
|
||||
// 可恢复异常(默认):仅日志,不弹模态窗,避免阻塞 UI 线程。
|
||||
// 通过日志遮罩提示用户:非致命异常已记录。
|
||||
if (!isTerminating)
|
||||
{
|
||||
const string nonFatalMessage = "发生非致命异常,已记录日志,请查看日志详情。";
|
||||
GetLogger<App>().LogWarning(nonFatalMessage);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 终止性异常(如线程池未处理异常导致进程即将结束):进程终止前同步弹窗兜底,
|
||||
// 确保用户能看到报告(阻塞无妨,进程反正要终止)。
|
||||
var dispatcher = Application.Current?.Dispatcher;
|
||||
if (dispatcher is null
|
||||
|| dispatcher.HasShutdownStarted
|
||||
|| dispatcher.HasShutdownFinished)
|
||||
{
|
||||
// Dispatcher 不可用(如启动早期或已关闭):仅日志,不弹窗。
|
||||
return false;
|
||||
}
|
||||
|
||||
// 确认 Dispatcher 可用后才记录"正在弹窗",避免与实际行为不一致。
|
||||
const string popupShownMessage = "发生致命异常,正在弹窗提示,同时已记录日志。";
|
||||
GetLogger<App>().LogWarning(popupShownMessage);
|
||||
|
||||
try
|
||||
{
|
||||
if (dispatcher.CheckAccess())
|
||||
{
|
||||
ShowExceptionDialog(e);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 双信号:startedSignal 表示 UI 线程开始执行弹窗(有限超时),
|
||||
// completedSignal 表示弹窗已关闭(无超时等待)。
|
||||
// ShowExceptionDialog 是模态的,用户读完并关闭才返回;
|
||||
// 若只在"开始"后立即返回,进程终止会强杀刚创建的弹窗。
|
||||
using var startedSignal = new System.Threading.ManualResetEventSlim(false);
|
||||
using var completedSignal = new System.Threading.ManualResetEventSlim(false);
|
||||
dispatcher.InvokeAsync(new Action(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
startedSignal.Set();
|
||||
ShowExceptionDialog(e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
completedSignal.Set();
|
||||
}
|
||||
}));
|
||||
|
||||
// 只为"UI 是否开始执行"设置超时:UI 线程被阻塞/死锁时避免无限等待。
|
||||
if (!startedSignal.Wait(TimeSpan.FromSeconds(3)))
|
||||
{
|
||||
GetLogger<App>().LogWarning("弹窗调度超时,异常已记录,进程即将退出。");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 一旦确认开始执行,就等待弹窗关闭,确保用户能读完致命异常详情。
|
||||
completedSignal.Wait();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 弹窗失败不影响进程退出。
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static void ShowExceptionDialog(Exception e)
|
||||
{
|
||||
try
|
||||
{
|
||||
ExceptionReport.Show(e);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Fallback.
|
||||
System.Windows.Forms.MessageBox.Show(
|
||||
$"""
|
||||
程序异常:{e.Source}
|
||||
--
|
||||
{e.StackTrace}
|
||||
--
|
||||
{e.Message}
|
||||
"""
|
||||
);
|
||||
}
|
||||
// log
|
||||
GetLogger<App>().LogDebug(e, "UnHandle Exception");
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: DisableDpiAwareness]
|
||||
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
|
||||
[assembly: InternalsVisibleTo("BetterGenshinImpact.UnitTest")]
|
||||
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<SyntaxDefinition name="Json" extensions=".json" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008">
|
||||
<Color name="Bool" foreground="#569CD6" exampleText="true | false" />
|
||||
<Color name="Number" foreground="#B5CEA8" exampleText="3.14" />
|
||||
<Color name="String" foreground="#CE9178" exampleText="" />
|
||||
<Color name="Null" foreground="#569CD6" exampleText="" />
|
||||
<Color name="FieldName" foreground="#9CDCF0" />
|
||||
<Color name="Punctuation1" foreground="#DA66BE" />
|
||||
<Color name="Punctuation2" foreground="#FFD710" />
|
||||
<Color name="Punctuation3" foreground="#FFFFFF" />
|
||||
|
||||
<RuleSet name="String">
|
||||
<Span begin="\\" end="."/>
|
||||
</RuleSet>
|
||||
|
||||
<RuleSet name="Object">
|
||||
<Span color="FieldName" ruleSet="String">
|
||||
<Begin>"</Begin>
|
||||
<End>"</End>
|
||||
</Span>
|
||||
<Span color="FieldName" ruleSet="String">
|
||||
<Begin>'</Begin>
|
||||
<End>'</End>
|
||||
</Span>
|
||||
<Span color="Punctuation3" ruleSet="Expression">
|
||||
<Begin>:</Begin>
|
||||
</Span>
|
||||
<Span color="Punctuation3">
|
||||
<Begin>,</Begin>
|
||||
</Span>
|
||||
</RuleSet>
|
||||
|
||||
<RuleSet name="Array">
|
||||
<Import ruleSet="Expression"/>
|
||||
<Span color="Punctuation3">
|
||||
<Begin>,</Begin>
|
||||
</Span>
|
||||
</RuleSet>
|
||||
|
||||
<RuleSet name="Expression">
|
||||
<Keywords color="Bool" >
|
||||
<Word>true</Word>
|
||||
<Word>false</Word>
|
||||
</Keywords>
|
||||
<Keywords color="Null" >
|
||||
<Word>null</Word>
|
||||
</Keywords>
|
||||
<Span color="String" ruleSet="String">
|
||||
<Begin>"</Begin>
|
||||
<End>"</End>
|
||||
</Span>
|
||||
<Span color="String" ruleSet="String">
|
||||
<Begin>'</Begin>
|
||||
<End>'</End>
|
||||
</Span>
|
||||
<Span color="Punctuation1" ruleSet="Object" multiline="true">
|
||||
<Begin>\{</Begin>
|
||||
<End>\}</End>
|
||||
</Span>
|
||||
<Span color="Punctuation2" ruleSet="Array" multiline="true">
|
||||
<Begin>\[</Begin>
|
||||
<End>\]</End>
|
||||
</Span>
|
||||
<Rule color="Number">
|
||||
\b0[xX][0-9a-fA-F]+|(\b\d+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?
|
||||
</Rule>
|
||||
</RuleSet>
|
||||
|
||||
<RuleSet>
|
||||
<Import ruleSet="Expression"/>
|
||||
</RuleSet>
|
||||
</SyntaxDefinition>
|
||||
File renamed without changes.
Binary file not shown.
|
After Width: | Height: | Size: 1.4 MiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File renamed without changes.
Binary file not shown.
|
After Width: | Height: | Size: 117 KiB |
File renamed without changes.
Binary file not shown.
|
After Width: | Height: | Size: 76 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 229 KiB |
@@ -1,122 +1,66 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<AssemblyName>BetterGI</AssemblyName>
|
||||
<Version>0.66.2-alpha.4</Version>
|
||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
|
||||
<TargetFramework>net7.0-windows10.0.22621.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<UseWindowsForms>True</UseWindowsForms>
|
||||
<LangVersion>12.0</LangVersion>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<ApplicationIcon>Resources\Images\logo.ico</ApplicationIcon>
|
||||
<ApplicationIcon>Assets\logo.ico</ApplicationIcon>
|
||||
<AssemblyName>BetterGI</AssemblyName>
|
||||
<Platforms>x64</Platforms>
|
||||
<DebugType>embedded</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- <ItemGroup>
|
||||
<None Remove="Assets\Images\*.jpg" />
|
||||
<None Remove="Assets\Images\*" />
|
||||
<None Remove="Assets\Images\*.png" />
|
||||
<None Remove="Assets\Images\*.ico" />
|
||||
<ItemGroup>
|
||||
<None Remove="Assets\*.jpg" />
|
||||
<None Remove="Assets\*.png" />
|
||||
<None Remove="Assets\*.ico" />
|
||||
<None Remove="Assets\Fonts\*.ttf" />
|
||||
<None Remove="Assets\Highlighting\*.xshd" />
|
||||
<None Remove="Assets\Strings\*.html" />
|
||||
<None Remove="Assets\Strings\*.md" />
|
||||
<None Remove="Assets\Audios\*.mp3" />
|
||||
<None Update="Assets\Config\*"/>
|
||||
</ItemGroup>-->
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Images\*.jpg" />
|
||||
<Resource Include="Resources\Images\Anniversary\*" />
|
||||
<Resource Include="Resources\Images\*.png" />
|
||||
<Resource Include="Resources\Images\*.ico" />
|
||||
<Resource Include="Resources\Fonts\*.ttf" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- 云原神网页版输入 SDK,由 WebView2InputBridge.InstallAsync 读取并注入页面 -->
|
||||
<None Remove="Resources\JavaScript\ys-input-inject.js" />
|
||||
<EmbeddedResource Include="Resources\JavaScript\ys-input-inject.js" LogicalName="BetterGenshinImpact.Resources.JavaScript.ys-input-inject.js" />
|
||||
<Resource Include="Assets\*.jpg" />
|
||||
<Resource Include="Assets\*.png" />
|
||||
<Resource Include="Assets\*.ico" />
|
||||
<Resource Include="Assets\Fonts\*.ttf" />
|
||||
<Resource Include="Assets\Highlighting\*.xshd" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- Anthropic 官方 SDK:自动连招在 OpenAI 兼容端点之外可选的原生 Messages API 提供方 -->
|
||||
<PackageReference Include="Anthropic" Version="12.53.0" />
|
||||
|
||||
<PackageReference Include="AvalonEdit" Version="6.3.1.120" />
|
||||
|
||||
<PackageReference Include="BetterGI.VCRuntime" Version="14.44.35208" />
|
||||
<PackageReference Include="BetterGI.Assets.Map" Version="1.0.24" />
|
||||
<PackageReference Include="BetterGI.Assets.Model" Version="1.0.38" />
|
||||
<PackageReference Include="BetterGI.Assets.Other" Version="1.0.27" />
|
||||
|
||||
<PackageReference Include="AvalonEdit" Version="6.3.0.90" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
||||
<PackageReference Include="Clipper2" Version="2.0.0" />
|
||||
<PackageReference Include="CsTrees" Version="1.0.5" />
|
||||
<PackageReference Include="CsTrees.MEAI" Version="1.0.2" />
|
||||
<PackageReference Include="DeviceId" Version="6.9.0" />
|
||||
<PackageReference Include="DeviceId.Windows" Version="6.9.0" />
|
||||
<PackageReference Include="DeviceId.Windows.Wmi" Version="6.9.0" />
|
||||
<PackageReference Include="Emoji.Wpf" Version="0.3.4" />
|
||||
<PackageReference Include="HungarianAlgorithm" Version="2.3.5" />
|
||||
<PackageReference Include="LibGit2Sharp" Version="0.31.0" />
|
||||
<PackageReference Include="LazyCache" Version="2.4.0" />
|
||||
<PackageReference Include="LibreHardwareMonitorLib" Version="0.9.6" />
|
||||
<PackageReference Include="MailKit" Version="4.16.0" />
|
||||
<PackageReference Include="Markdig" Version="1.3.2" />
|
||||
<PackageReference Include="Melanchall.DryWetMidi" Version="8.0.3" />
|
||||
<PackageReference Include="Meziantou.Framework.Win32.CredentialManager" Version="1.7.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.AI" Version="10.6.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="10.6.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.ML.OnnxRuntime.DirectML" Version="1.21.0" />
|
||||
<!--排除掉cpu的runtime dll-->
|
||||
<PackageReference Include="Microsoft.ML.OnnxRuntime" Version="1.21.0" IncludeAssets="none" />
|
||||
<PackageReference Include="Microsoft.ML.OnnxRuntime.Managed" Version="1.21.0" />
|
||||
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
|
||||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2592.51" />
|
||||
<PackageReference Include="MimeKit" Version="4.16.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="OpenccNetLib" Version="1.7.0" />
|
||||
<PackageReference Include="OpenCvSharp4.WpfExtensions" Version="4.11.0.20250507" />
|
||||
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.11.0.20250507" />
|
||||
<PackageReference Include="OpenCvSharp4.Windows" Version="4.11.0.20250507" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.122" />
|
||||
<PackageReference Include="Microsoft.ClearScript.V8" Version="7.4.5" />
|
||||
<PackageReference Include="Microsoft.ClearScript.V8.Native.win-x64" Version="7.4.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.ML.OnnxRuntime.Gpu" Version="1.17.1" />
|
||||
<PackageReference Include="Microsoft.ML.OnnxRuntime.Managed" Version="1.17.1" />
|
||||
<PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" />
|
||||
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.8.0.20230708" />
|
||||
<PackageReference Include="OpenCvSharp4.Windows" Version="4.8.0.20230708" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.77" />
|
||||
<PackageReference Include="MouseKeyHook" Version="5.7.1" />
|
||||
<PackageReference Include="NCalc" Version="6.2.0" />
|
||||
<PackageReference Include="PresentMonFps" Version="2.0.5" />
|
||||
<PackageReference Include="Semver" Version="3.0.0" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="9.0.1" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.RichTextBoxEx.Wpf" Version="1.1.0.1" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="10.0.7" />
|
||||
<PackageReference Include="System.IO.Hashing" Version="9.0.4" />
|
||||
<PackageReference Include="Vanara.PInvoke.CoreAudio" Version="4.1.3" />
|
||||
<PackageReference Include="Vanara.PInvoke.NtDll" Version="4.1.3" />
|
||||
<PackageReference Include="Vanara.PInvoke.SHCore" Version="4.1.3" />
|
||||
<PackageReference Include="Vanara.PInvoke.User32" Version="4.1.3" />
|
||||
<PackageReference Include="XamlAnimatedGif" Version="2.3.1" />
|
||||
<PackageReference Include="WPF-UI" Version="4.3.0" />
|
||||
<PackageReference Include="WPF-UI.DependencyInjection" Version="4.3.0" />
|
||||
<PackageReference Include="WPF-UI.Tray" Version="4.3.0" />
|
||||
<PackageReference Include="WPF-UI.Violeta" Version="4.3.0.15" />
|
||||
<PackageReference Include="gong-wpf-dragdrop" Version="3.2.1" />
|
||||
<PackageReference Include="YamlDotNet" Version="16.3.0" />
|
||||
<PackageReference Include="YoloSharp" Version="6.0.3" />
|
||||
<PackageReference Include="Sdcb.PaddleInference" Version="2.5.0.1" />
|
||||
<PackageReference Include="Sdcb.PaddleInference.runtime.win64.cuda118_cudnn86_tr85_sm86_89" Version="2.5.1" />
|
||||
<PackageReference Include="Sdcb.PaddleInference.runtime.win64.openblas" Version="2.5.1" />
|
||||
<PackageReference Include="Sdcb.PaddleOCR" Version="2.7.0" />
|
||||
<PackageReference Include="Sdcb.PaddleOCR.Models.Online" Version="2.7.0.1" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.RichTextBox.Wpf" Version="1.1.0" />
|
||||
<PackageReference Include="Vanara.PInvoke.NtDll" Version="3.4.17" />
|
||||
<PackageReference Include="Vanara.PInvoke.SHCore" Version="3.4.17" />
|
||||
<PackageReference Include="Vanara.PInvoke.User32" Version="3.4.17" />
|
||||
<PackageReference Include="WPF-UI" Version="3.0.0-preview.7" />
|
||||
<PackageReference Include="WPF-UI.Tray" Version="3.0.0-preview.7" />
|
||||
<PackageReference Include="YoloV8.Gpu" Version="2.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(Configuration)' == 'Debug'">
|
||||
<PackageReference Include="Microsoft.ClearScript.V8" Version="7.4.4" />
|
||||
<PackageReference Include="Microsoft.ClearScript.V8.Native.win-x64" Version="7.4.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -126,170 +70,530 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="GameTask\**\Recognition.json">
|
||||
<Compile Update="GameTask\TaskContext.cs">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
<Compile Update="View\MaskWindow.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="View\Pages\HotkeyPage.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="View\Pages\TriggerSettingsPage.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="View\PickerWindow.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="View\Windows\MapViewer.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Assets\Map\cityMap2048Block.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Map\combined_image_2048_lim[quick].png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Map\combined_image_lim[quick].png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Map\mainMap100Block.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Map\mainMap1024Block.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Map\mainMapZoomOut1024.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Map\map_sd1024.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\Common\avatar_side_classify_sim.onnx">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\Domain\bgi_tree.onnx">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\Domain\bgi_tree.pt">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\Fish\bgi_fish.onnx">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\PaddleOCR\ch_PP-OCRv4_det\inference.pdiparams">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\PaddleOCR\ch_PP-OCRv4_det\inference.pdiparams.info">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\PaddleOCR\ch_PP-OCRv4_det\inference.pdmodel">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\PaddleOCR\ch_PP-OCRv4_rec\inference.pdiparams">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\PaddleOCR\ch_PP-OCRv4_rec\inference.pdiparams.info">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\PaddleOCR\ch_PP-OCRv4_rec\inference.pdmodel">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\PaddleOCR\ch_ppocr_mobile_v2.0_cls\._inference.pdmodel">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\PaddleOCR\ch_ppocr_mobile_v2.0_cls\inference.pdiparams">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\PaddleOCR\ch_ppocr_mobile_v2.0_cls\inference.pdiparams.info">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\PaddleOCR\ch_ppocr_mobile_v2.0_cls\inference.pdmodel">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\PaddleOCR\ppocr_keys_v1.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\PaddleOCR\test_ocr.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\Yap\all_list.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\Yap\index_2_word.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\Yap\model_training.onnx">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFight\Assets\1920x1080\click_any_close_tip.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Map\**">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<None Update="GameTask\AutoFight\Assets\1920x1080\condensed_resin_count.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\**">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<None Update="GameTask\AutoFight\Assets\1920x1080\confirm.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Config\**">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<None Update="GameTask\AutoFight\Assets\1920x1080\exit.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFight\Assets\1920x1080\**">
|
||||
<None Update="GameTask\AutoFight\Assets\1920x1080\fragile_resin_count.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFight\Assets\1920x1080\use_condensed_resin.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFight\Assets\1920x1080\wanderer_icon.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFight\Assets\1920x1080\wanderer_icon_no_active.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFight\Assets\combat_avatar.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\CharacterDevelopment\Assets\1920x1080\**">
|
||||
<None Update="GameTask\AutoFishing\Assets\1920x1080\bait\flashing maintenance mek bait.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFishing\Assets\**">
|
||||
<None Update="GameTask\AutoFishing\Assets\1920x1080\bait\sour bait.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoLeyLineOutcrop\Assets\**">
|
||||
<None Update="GameTask\AutoFishing\Assets\1920x1080\bait\sugardew bait.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\LogParse\Assets\**">
|
||||
<None Update="GameTask\AutoFishing\Assets\1920x1080\lift_rod.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\**">
|
||||
<None Update="GameTask\AutoFishing\Assets\1920x1080\switch_bait.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFishing\Assets\1920x1080\bait\fake fly bait.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFishing\Assets\1920x1080\bait\false worm bait.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFishing\Assets\1920x1080\bait\fruit paste bait.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFishing\Assets\1920x1080\bait\redrot bait.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFishing\Assets\1920x1080\exit_fishing.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFishing\Assets\1920x1080\space.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFishing\Assets\1920x1080\wait_bite.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\action_anemo.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\action_cryo.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\action_dendro.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\action_electro.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\action_geo.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\action_hydro.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\action_omni.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\action_pyro.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\roll_anemo.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\roll_cryo.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\roll_dendro.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\roll_electro.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\roll_geo.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\roll_hydro.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\roll_omni.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\roll_pyro.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\元素调和.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\元素骰子不足.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\冻结.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\出战角色.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\回合结束.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\回合结算阶段.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\对方行动中.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\满能量.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\确定.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\空能量.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\角色死亡.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\角色状态_冻结.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\角色状态_冻结2.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\角色状态_水泡.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\角色血量上方.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\角色被打败.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\退出挑战.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\tcg_character_card.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoPick\Assets\1920x1080\**">
|
||||
<None Update="GameTask\AutoPick\Assets\1920x1080\F.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoSkip\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoSkip\Assets\*.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoTrackPath\Assets\tp.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Job\SwitchCharacter\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\Json\**">
|
||||
<None Update="GameTask\AutoPick\Assets\1920x1080\icon_settings.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoWood\Assets\1920x1080\**">
|
||||
<None Update="GameTask\AutoSkip\Assets\1920x1080\collect.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoMusicGame\Assets\1920x1080\**">
|
||||
<None Update="GameTask\AutoSkip\Assets\1920x1080\comfirm_btn1.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoSkip\Assets\1920x1080\comfirm_btn2.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoSkip\Assets\1920x1080\hangout_selected.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoSkip\Assets\1920x1080\hangout_unselected.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoSkip\Assets\1920x1080\icon_exclamation.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoSkip\Assets\1920x1080\primogem.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoSkip\Assets\1920x1080\re.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoSkip\Assets\1920x1080\icon_daily_reward.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Music\Assets\1920x1080\**">
|
||||
<None Update="GameTask\AutoSkip\Assets\1920x1080\icon_explore.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\GameLoading\Assets\1920x1080\**">
|
||||
<None Update="GameTask\AutoSkip\Assets\hangout.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickTeleport\Assets\1920x1080\**">
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\blue_track_point_28x.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickSereniteaPot\Assets\1920x1080\**">
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\btn_black_cancel.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoEat\Assets\1920x1080\**">
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\btn_online_no.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickBuy\Assets\1920x1080\**">
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\btn_online_yes.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\paimon_menu.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickClaimReward\Assets\1920x1080\**">
|
||||
<None Update="GameTask\AutoSkip\Assets\1920x1080\icon_option.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\UseRedeemCode\Assets\1920x1080\**">
|
||||
<None Update="GameTask\AutoSkip\Assets\1920x1080\page_close.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\LogParse\Assets\log.css">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\LogParse\Assets\log.js">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\GameLoading\Assets\1920x1080\enter_game.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\in_domain.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoDomain\Assets\1920x1080\**">
|
||||
<None Update="GameTask\AutoSkip\Assets\1920x1080\stop_auto.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoBoss\Assets\**">
|
||||
<None Update="GameTask\AutoSkip\Assets\1920x1080\submit_goods.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoSkip\Assets\1920x1080\submit_icon_exclamation.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoWood\Assets\1920x1080\character_guide.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoWood\Assets\1920x1080\confirm.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoWood\Assets\1920x1080\enter_game.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoWood\Assets\1920x1080\exit_welcome.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoWood\Assets\1920x1080\menu_bag.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoWood\Assets\1920x1080\TheBoonOfTheElderTree.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\btn_black_confirm.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\btn_white_cancel.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\btn_white_confirm.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\collect.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\comfirm_btn1.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\comfirm_btn2.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\icon_daily_reward.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\icon_exclamation.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\icon_explore.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\icon_option.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\paimon_menu.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\page_close.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\primogem.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\re.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\stop_auto.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\submit_icon_exclamation.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\ui_left_top_cook_icon.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\ui_lt_cook_icon.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\yellow_track_point_28x.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\GameLoading\Assets\1920x1080\welkin_moon_logo.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickTeleport\Assets\1920x1080\Domain.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickTeleport\Assets\1920x1080\Domain2.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickTeleport\Assets\1920x1080\GoTeleport.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickTeleport\Assets\1920x1080\Mansion.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickTeleport\Assets\1920x1080\MapChoose.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickTeleport\Assets\1920x1080\MapCloseButton.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickTeleport\Assets\1920x1080\MapScaleButton.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickTeleport\Assets\1920x1080\MapUndergroundSwitchButton.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickTeleport\Assets\1920x1080\PortableWaypoint.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickTeleport\Assets\1920x1080\ScaleWithMask.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickTeleport\Assets\1920x1080\StatueOfTheSeven.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickTeleport\Assets\1920x1080\SubSpaceWaypoint.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickTeleport\Assets\1920x1080\TeleportWaypoint.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickSereniteaPot\Assets\1920x1080\SereniteaPotIcon.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\AutoFight\1.四神挂机[推荐].txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\AutoFight\2.宵宫夜兰班行秋.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\AutoFight\2.宵宫队[请看文件内说明].txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\AutoFight\群友分享\*.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\AutoGeniusInvokation\1.莫娜砂糖琴.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\I18n\**">
|
||||
<None Update="User\AutoGeniusInvokation\2.刻晴雷神甘雨.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\AutoGeniusInvokation\3.雷神阿贝多丘丘王.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\AutoGeniusInvokation\4.重云雷神申鹤.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\AutoGeniusInvokation\5.迪希雅白术皇女.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\AutoGeniusInvokation\6.皇女科莱莫娜.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\AutoGeniusInvokation\7.莫娜白术皇女.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\AutoGeniusInvokation\8.雷神柯莱刻晴[推荐].txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\AutoGeniusInvokation\a.[惊喜牌组]东东.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\AutoGeniusInvokation\a.[惊喜牌组]巴哈拉克.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\AutoGeniusInvokation\a.[惊喜牌组]马鲁夫.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\AutoGeniusInvokation\a.[惊喜牌组]黄衫.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\AutoSkip\default_pause_options.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\AutoSkip\select_options.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\AutoSkip\pause_options.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\avatar_macro.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\pick_black_lists.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\pick_white_lists.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="GameTask\OneDragon\" />
|
||||
<Folder Include="GameTask\UseRedeemCode\Assets\1920x1080\" />
|
||||
<Folder Include="Resources\" />
|
||||
<Folder Include="Service\Notification\Builder\" />
|
||||
<Folder Include="User\AutoPathing\" />
|
||||
<Folder Include="GameTask\Common\Element\Assets\MapPoint\" />
|
||||
<Folder Include="View\Controls\WpfUi\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Page Update="View\Windows\WelcomeDialog.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<XamlRuntime>Wpf</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="View\Windows\MapPathingDevWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<XamlRuntime>Wpf</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="View\Pages\View\HardwareAccelerationView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<XamlRuntime>Wpf</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="View\Windows\WelcomeDialog.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
<DependentUpon>WelcomeDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<_DeploymentManifestIconFile Remove="Resources\Images\logo.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
<!--
|
||||
Melanchall.DryWetMidi 的 build\Melanchall.DryWetMidi.targets 会无条件把 x86/x64/macOS
|
||||
三份本地库都复制到输出目录(它没有使用 runtimes/{rid}/native 结构,不感知 RID)。
|
||||
本项目只支持 win-x64,这里在 AssignTargetPaths 之前把多余的 Native32.dll(x86)
|
||||
和 Native64.dylib(macOS)从 None 项中移除,避免它们被打进 Release 产物。
|
||||
-->
|
||||
<Target Name="RemoveDryWetMidiUnusedNativeLibs" BeforeTargets="AssignTargetPaths">
|
||||
<ItemGroup>
|
||||
<None Remove="@(None)" Condition="'%(Filename)' == 'Melanchall_DryWetMidi_Native32' Or ('%(Filename)' == 'Melanchall_DryWetMidi_Native64' And '%(Extension)' == '.dylib')" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<!-- 古树测试样例用于推理运行库验证与设置页测速。 -->
|
||||
<ItemGroup>
|
||||
<None Update="Assets\Model\Domain\test_petrified_trees.jpg" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -1,592 +0,0 @@
|
||||
using BetterGenshinImpact.Core.Input;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.Core.Recognition;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.GameTask.AutoGeniusInvokation.Exception;
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using BetterGenshinImpact.Helpers;
|
||||
using OpenCvSharp;
|
||||
|
||||
namespace BetterGenshinImpact.Core.BgiVision;
|
||||
|
||||
public sealed class BvFlow
|
||||
{
|
||||
private readonly BvPage _page;
|
||||
private readonly BvFlowServices _services;
|
||||
private readonly List<BvFlowStep> _steps = [];
|
||||
private readonly object _syncRoot = new();
|
||||
private bool _hasSteps;
|
||||
private bool _hasStarted;
|
||||
private int _isRunning;
|
||||
|
||||
internal int DefaultTimeout { get; private set; }
|
||||
internal int DefaultRetryInterval { get; private set; }
|
||||
|
||||
internal BvFlow(BvPage page, int defaultTimeout, int defaultRetryInterval)
|
||||
: this(page, defaultTimeout, defaultRetryInterval, BvFlowServices.Create(page))
|
||||
{
|
||||
}
|
||||
|
||||
internal BvFlow(BvPage page, int defaultTimeout, int defaultRetryInterval, BvFlowServices services)
|
||||
{
|
||||
_page = page;
|
||||
_services = services;
|
||||
DefaultTimeout = ValidatePositive(defaultTimeout, nameof(defaultTimeout));
|
||||
DefaultRetryInterval = ValidatePositive(defaultRetryInterval, nameof(defaultRetryInterval));
|
||||
}
|
||||
|
||||
public BvFlow WithDefaultTimeout(int milliseconds)
|
||||
{
|
||||
var timeout = ValidatePositive(milliseconds, nameof(milliseconds));
|
||||
lock (_syncRoot)
|
||||
{
|
||||
EnsureDefaultsCanChange();
|
||||
DefaultTimeout = timeout;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public BvFlow WithDefaultRetryInterval(int milliseconds)
|
||||
{
|
||||
var retryInterval = ValidatePositive(milliseconds, nameof(milliseconds));
|
||||
lock (_syncRoot)
|
||||
{
|
||||
EnsureDefaultsCanChange();
|
||||
DefaultRetryInterval = retryInterval;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public BvFlowAction Do(dynamic action)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(action);
|
||||
return CreateAction("Do", async _ =>
|
||||
{
|
||||
object? result;
|
||||
try
|
||||
{
|
||||
result = action is Delegate callback ? callback.DynamicInvoke() : action();
|
||||
}
|
||||
catch (TargetInvocationException ex) when (ex.InnerException is not null)
|
||||
{
|
||||
ExceptionDispatchInfo.Capture(ex.InnerException).Throw();
|
||||
throw;
|
||||
}
|
||||
|
||||
if (result is Task task)
|
||||
{
|
||||
await task;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public BvFlowAction KeyPress(string key)
|
||||
{
|
||||
var virtualKey = User32Helper.ToVk(key);
|
||||
return CreateAction($"KeyPress({key})", _ =>
|
||||
{
|
||||
_services.KeyPress(virtualKey);
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
||||
public BvFlowAction Click()
|
||||
{
|
||||
return CreateImplicitPointAction("Click(previous)", _services.LeftClick);
|
||||
}
|
||||
|
||||
public BvFlowAction Click(double x, double y)
|
||||
{
|
||||
return CreatePointAction($"Click({x}, {y})", x, y, _services.LeftClick);
|
||||
}
|
||||
|
||||
public BvFlowAction RightClick()
|
||||
{
|
||||
return CreateImplicitPointAction("RightClick(previous)", _services.RightClick);
|
||||
}
|
||||
|
||||
public BvFlowAction RightClick(double x, double y)
|
||||
{
|
||||
return CreatePointAction($"RightClick({x}, {y})", x, y, _services.RightClick);
|
||||
}
|
||||
|
||||
public BvFlowAction MiddleClick()
|
||||
{
|
||||
return CreateImplicitPointAction("MiddleClick(previous)", _services.MiddleClick);
|
||||
}
|
||||
|
||||
public BvFlowAction MiddleClick(double x, double y)
|
||||
{
|
||||
return CreatePointAction($"MiddleClick({x}, {y})", x, y, _services.MiddleClick);
|
||||
}
|
||||
|
||||
public BvFlowAction MoveTo()
|
||||
{
|
||||
return CreateImplicitPointAction("MoveTo(previous)", _services.MoveTo);
|
||||
}
|
||||
|
||||
public BvFlowAction MoveTo(double x, double y)
|
||||
{
|
||||
return CreatePointAction($"MoveTo({x}, {y})", x, y, _services.MoveTo);
|
||||
}
|
||||
|
||||
public BvFlowAction Drag(double fromX, double fromY, double toX, double toY, int duration = 300)
|
||||
{
|
||||
ValidatePositive(duration, nameof(duration));
|
||||
return CreateAction($"Drag({fromX}, {fromY}, {toX}, {toY})",
|
||||
_ => _services.Drag(fromX, fromY, toX, toY, duration));
|
||||
}
|
||||
|
||||
public BvFlowAction DragTo(double toX, double toY, int duration = 300)
|
||||
{
|
||||
ValidatePositive(duration, nameof(duration));
|
||||
return CreateAction($"DragTo({toX}, {toY})", context =>
|
||||
{
|
||||
var (fromX, fromY) = context.GetLastMatchCenter();
|
||||
return _services.Drag(fromX, fromY, toX, toY, duration);
|
||||
});
|
||||
}
|
||||
|
||||
public BvFlowAction DragFrom(double fromX, double fromY, int duration = 300)
|
||||
{
|
||||
ValidatePositive(duration, nameof(duration));
|
||||
return CreateAction($"DragFrom({fromX}, {fromY})", context =>
|
||||
{
|
||||
var (toX, toY) = context.GetLastMatchCenter();
|
||||
return _services.Drag(fromX, fromY, toX, toY, duration);
|
||||
});
|
||||
}
|
||||
|
||||
public BvFlow WaitUntilText(string text, Rect rect = default, int? timeout = null, int? retryInterval = null)
|
||||
{
|
||||
return WaitUntil(CreateTextLocator(text, rect), timeout, retryInterval);
|
||||
}
|
||||
|
||||
public BvFlow WaitUntilAnyText(
|
||||
object texts,
|
||||
Rect rect = default,
|
||||
int? timeout = null,
|
||||
int? retryInterval = null)
|
||||
{
|
||||
return WaitUntil(CreateAnyTextLocator(texts, rect), timeout, retryInterval);
|
||||
}
|
||||
|
||||
public BvFlow WaitUntil(BvLocator target, int? timeout = null, int? retryInterval = null)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(target);
|
||||
return AddWaitStep([target.Clone()], BvFlowCondition.AnyAppear, timeout, retryInterval);
|
||||
}
|
||||
|
||||
public BvFlow WaitUntilAny(object targets, int? timeout = null, int? retryInterval = null)
|
||||
{
|
||||
return AddWaitStep(ParseTargets(targets, nameof(targets)), BvFlowCondition.AnyAppear,
|
||||
timeout, retryInterval);
|
||||
}
|
||||
|
||||
public BvFlow WaitUntilDisappear(BvLocator target, int? timeout = null, int? retryInterval = null)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(target);
|
||||
return AddWaitStep([target.Clone()], BvFlowCondition.AllDisappear, timeout, retryInterval);
|
||||
}
|
||||
|
||||
public BvFlow WaitUntilAllDisappear(object targets, int? timeout = null, int? retryInterval = null)
|
||||
{
|
||||
return AddWaitStep(ParseTargets(targets, nameof(targets)), BvFlowCondition.AllDisappear,
|
||||
timeout, retryInterval);
|
||||
}
|
||||
|
||||
public BvFlow Wait(int milliseconds)
|
||||
{
|
||||
if (milliseconds < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(milliseconds), "milliseconds 不能小于 0");
|
||||
}
|
||||
|
||||
return AddStep($"Wait({milliseconds})", _ => _services.Delay(milliseconds));
|
||||
}
|
||||
|
||||
public async Task<BvPage> Run()
|
||||
{
|
||||
if (Interlocked.CompareExchange(ref _isRunning, 1, 0) != 0)
|
||||
{
|
||||
throw new InvalidOperationException("同一个 BvFlow 不能并发执行");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
BvFlowStep[] steps;
|
||||
lock (_syncRoot)
|
||||
{
|
||||
_hasStarted = true;
|
||||
steps = _steps.ToArray();
|
||||
}
|
||||
|
||||
var context = new BvFlowExecutionContext();
|
||||
for (var i = 0; i < steps.Length; i++)
|
||||
{
|
||||
var step = steps[i];
|
||||
try
|
||||
{
|
||||
_services.ThrowIfCancellationRequested();
|
||||
await step.Action(context);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (NormalEndException)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new InvalidOperationException($"BvFlow 第 {i + 1} 步执行失败:{step.Description}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
return _page;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Volatile.Write(ref _isRunning, 0);
|
||||
}
|
||||
}
|
||||
|
||||
internal BvFlow AddActionStep(BvFlowActionSnapshot snapshot)
|
||||
{
|
||||
return AddStep(snapshot.Description, context => ExecuteActionStep(snapshot, context));
|
||||
}
|
||||
|
||||
internal BvFlow AddOnceActionStep(string description, Func<BvFlowExecutionContext, Task> action)
|
||||
{
|
||||
return AddStep(description, action);
|
||||
}
|
||||
|
||||
internal BvFlowAction CreateAction(string description, Func<BvFlowExecutionContext, Task> action)
|
||||
{
|
||||
lock (_syncRoot)
|
||||
{
|
||||
if (_hasStarted)
|
||||
{
|
||||
throw new InvalidOperationException("BvFlow 已经开始执行,不能再添加步骤");
|
||||
}
|
||||
}
|
||||
|
||||
return new BvFlowAction(this, description, action);
|
||||
}
|
||||
|
||||
internal BvLocator CreateTextLocator(string text, Rect rect)
|
||||
{
|
||||
return _page.Locator(new RecognitionObject
|
||||
{
|
||||
RecognitionType = RecognitionTypes.Ocr,
|
||||
RegionOfInterest = rect,
|
||||
Text = text
|
||||
});
|
||||
}
|
||||
|
||||
internal BvLocator CreateAnyTextLocator(object texts, Rect rect)
|
||||
{
|
||||
return _page.GetByAnyText(texts, rect);
|
||||
}
|
||||
|
||||
internal static IReadOnlyList<BvLocator> ParseTargets(object targets, string paramName)
|
||||
{
|
||||
return BvPage.ParseCollection<BvLocator>(targets, paramName)
|
||||
.Select(target => target.Clone())
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
internal static int ValidatePositive(int value, string paramName)
|
||||
{
|
||||
if (value <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(paramName, $"{paramName} 必须大于 0");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
private BvFlowAction CreateImplicitPointAction(string description, Action<double, double> action)
|
||||
{
|
||||
return CreateAction(description, context =>
|
||||
{
|
||||
var (x, y) = context.GetLastMatchCenter();
|
||||
action(x, y);
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
||||
private BvFlowAction CreatePointAction(string description, double x, double y, Action<double, double> action)
|
||||
{
|
||||
return CreateAction(description, _ =>
|
||||
{
|
||||
action(x, y);
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
||||
private async Task ExecuteActionStep(BvFlowActionSnapshot snapshot, BvFlowExecutionContext context)
|
||||
{
|
||||
var startedAt = _services.GetTimestamp();
|
||||
var attempts = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
_services.ThrowIfCancellationRequested();
|
||||
attempts++;
|
||||
await snapshot.Action(context);
|
||||
|
||||
var remainingMilliseconds = snapshot.Timeout - _services.GetElapsedMilliseconds(startedAt);
|
||||
if (remainingMilliseconds <= 0)
|
||||
{
|
||||
throw new TimeoutException(
|
||||
$"动作 {snapshot.Description} 执行 {attempts} 次后,等待 {snapshot.TargetDescription} 超时({snapshot.Timeout}ms)");
|
||||
}
|
||||
|
||||
await _services.Delay(GetDelayMilliseconds(snapshot.RetryInterval, remainingMilliseconds));
|
||||
|
||||
if (_services.GetElapsedMilliseconds(startedAt) >= snapshot.Timeout)
|
||||
{
|
||||
throw new TimeoutException(
|
||||
$"动作 {snapshot.Description} 执行 {attempts} 次后,等待 {snapshot.TargetDescription} 超时({snapshot.Timeout}ms)");
|
||||
}
|
||||
|
||||
var result = FindTargets(snapshot.Targets, snapshot.Condition);
|
||||
_services.ThrowIfCancellationRequested();
|
||||
if (_services.GetElapsedMilliseconds(startedAt) >= snapshot.Timeout)
|
||||
{
|
||||
throw new TimeoutException(
|
||||
$"动作 {snapshot.Description} 执行 {attempts} 次后,等待 {snapshot.TargetDescription} 超时({snapshot.Timeout}ms)");
|
||||
}
|
||||
|
||||
if (result.Succeeded)
|
||||
{
|
||||
context.LastMatchRect = result.Match is null
|
||||
? null
|
||||
: _services.GetMatchRect(result.Match);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private BvFlow AddWaitStep(
|
||||
IReadOnlyList<BvLocator> targets,
|
||||
BvFlowCondition condition,
|
||||
int? timeout,
|
||||
int? retryInterval)
|
||||
{
|
||||
var actualTimeout = timeout is { } timeoutValue
|
||||
? ValidatePositive(timeoutValue, nameof(timeout))
|
||||
: DefaultTimeout;
|
||||
var actualRetryInterval = retryInterval is { } retryIntervalValue
|
||||
? ValidatePositive(retryIntervalValue, nameof(retryInterval))
|
||||
: DefaultRetryInterval;
|
||||
var targetDescription = BvFlowAction.DescribeTargets(targets, condition);
|
||||
|
||||
return AddStep($"WaitUntil {targetDescription}",
|
||||
context => ExecuteWaitStep(targets, targetDescription, condition,
|
||||
actualTimeout, actualRetryInterval, context));
|
||||
}
|
||||
|
||||
private async Task ExecuteWaitStep(
|
||||
IReadOnlyList<BvLocator> targets,
|
||||
string targetDescription,
|
||||
BvFlowCondition condition,
|
||||
int timeout,
|
||||
int retryInterval,
|
||||
BvFlowExecutionContext context)
|
||||
{
|
||||
var startedAt = _services.GetTimestamp();
|
||||
|
||||
while (true)
|
||||
{
|
||||
_services.ThrowIfCancellationRequested();
|
||||
var elapsedMilliseconds = _services.GetElapsedMilliseconds(startedAt);
|
||||
if (elapsedMilliseconds >= timeout)
|
||||
{
|
||||
throw new TimeoutException($"等待 {targetDescription} 超时({timeout}ms)");
|
||||
}
|
||||
|
||||
var result = FindTargets(targets, condition);
|
||||
_services.ThrowIfCancellationRequested();
|
||||
if (_services.GetElapsedMilliseconds(startedAt) >= timeout)
|
||||
{
|
||||
throw new TimeoutException($"等待 {targetDescription} 超时({timeout}ms)");
|
||||
}
|
||||
|
||||
if (result.Succeeded)
|
||||
{
|
||||
context.LastMatchRect = result.Match is null
|
||||
? null
|
||||
: _services.GetMatchRect(result.Match);
|
||||
return;
|
||||
}
|
||||
|
||||
var remainingMilliseconds = timeout - _services.GetElapsedMilliseconds(startedAt);
|
||||
if (remainingMilliseconds <= 0)
|
||||
{
|
||||
throw new TimeoutException($"等待 {targetDescription} 超时({timeout}ms)");
|
||||
}
|
||||
|
||||
await _services.Delay(GetDelayMilliseconds(retryInterval, remainingMilliseconds));
|
||||
}
|
||||
}
|
||||
|
||||
private BvFlowConditionResult FindTargets(
|
||||
IReadOnlyList<BvLocator> targets,
|
||||
BvFlowCondition condition)
|
||||
{
|
||||
return _services.FindTargets(targets, condition);
|
||||
}
|
||||
|
||||
private static int GetDelayMilliseconds(int retryInterval, double remainingMilliseconds)
|
||||
{
|
||||
return Math.Min(retryInterval, Math.Max(1, (int)Math.Ceiling(remainingMilliseconds)));
|
||||
}
|
||||
|
||||
private BvFlow AddStep(string description, Func<BvFlowExecutionContext, Task> action)
|
||||
{
|
||||
lock (_syncRoot)
|
||||
{
|
||||
if (_hasStarted)
|
||||
{
|
||||
throw new InvalidOperationException("BvFlow 已经开始执行,不能再添加步骤");
|
||||
}
|
||||
|
||||
_hasSteps = true;
|
||||
_steps.Add(new BvFlowStep(description, action));
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private void EnsureDefaultsCanChange()
|
||||
{
|
||||
if (_hasSteps)
|
||||
{
|
||||
throw new InvalidOperationException("添加流程步骤后不能修改流程默认配置");
|
||||
}
|
||||
}
|
||||
|
||||
private sealed record BvFlowStep(string Description, Func<BvFlowExecutionContext, Task> Action);
|
||||
|
||||
}
|
||||
|
||||
internal sealed record BvFlowConditionResult(bool Succeeded, Region? Match);
|
||||
|
||||
internal sealed class BvFlowExecutionContext
|
||||
{
|
||||
public Rect? LastMatchRect { get; set; }
|
||||
|
||||
public (double X, double Y) GetLastMatchCenter()
|
||||
{
|
||||
if (LastMatchRect is not { } rect)
|
||||
{
|
||||
throw new InvalidOperationException("没有可用的上一步识别位置,无法执行隐式坐标操作");
|
||||
}
|
||||
|
||||
return (rect.X + rect.Width / 2d, rect.Y + rect.Height / 2d);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class BvFlowServices
|
||||
{
|
||||
public required Action ThrowIfCancellationRequested { get; set; }
|
||||
public required Func<IReadOnlyList<BvLocator>, BvFlowCondition, BvFlowConditionResult> FindTargets { get; set; }
|
||||
public required Func<Region, Rect> GetMatchRect { get; set; }
|
||||
public required Func<int, Task> Delay { get; set; }
|
||||
public required Func<long> GetTimestamp { get; set; }
|
||||
public required Func<long, double> GetElapsedMilliseconds { get; set; }
|
||||
public required Action<Vanara.PInvoke.User32.VK> KeyPress { get; set; }
|
||||
public required Action<double, double> LeftClick { get; set; }
|
||||
public required Action<double, double> RightClick { get; set; }
|
||||
public required Action<double, double> MiddleClick { get; set; }
|
||||
public required Action<double, double> MoveTo { get; set; }
|
||||
public required Func<double, double, double, double, int, Task> Drag { get; set; }
|
||||
|
||||
public static BvFlowServices Create(BvPage page)
|
||||
{
|
||||
return new BvFlowServices
|
||||
{
|
||||
ThrowIfCancellationRequested = page.ThrowIfCancellationRequested,
|
||||
FindTargets = (targets, condition) =>
|
||||
{
|
||||
using var screen = page.Screenshot();
|
||||
return EvaluateTargets(targets, condition, target => target.FindAll(screen));
|
||||
},
|
||||
GetMatchRect = region =>
|
||||
{
|
||||
var rect = region.ConvertPositionToGameCaptureRegion(0, 0, region.Width, region.Height);
|
||||
var scale = TaskContext.Instance().SystemInfo.ScaleTo1080PRatio;
|
||||
return new Rect(
|
||||
(int)Math.Round(rect.X / scale),
|
||||
(int)Math.Round(rect.Y / scale),
|
||||
(int)Math.Round(rect.Width / scale),
|
||||
(int)Math.Round(rect.Height / scale));
|
||||
},
|
||||
Delay = async milliseconds => await page.Wait(milliseconds),
|
||||
GetTimestamp = System.Diagnostics.Stopwatch.GetTimestamp,
|
||||
GetElapsedMilliseconds = startedAt => System.Diagnostics.Stopwatch.GetElapsedTime(startedAt).TotalMilliseconds,
|
||||
KeyPress = key => InputHub.Foreground.Keyboard.KeyPress(key),
|
||||
LeftClick = GameCaptureRegion.GameRegion1080PPosClick,
|
||||
RightClick = (x, y) =>
|
||||
{
|
||||
GameCaptureRegion.GameRegion1080PPosMove(x, y);
|
||||
InputHub.Foreground.Mouse.RightButtonClick();
|
||||
},
|
||||
MiddleClick = (x, y) =>
|
||||
{
|
||||
GameCaptureRegion.GameRegion1080PPosMove(x, y);
|
||||
InputHub.Foreground.Mouse.MiddleButtonClick();
|
||||
},
|
||||
MoveTo = GameCaptureRegion.GameRegion1080PPosMove,
|
||||
Drag = async (fromX, fromY, toX, toY, duration) =>
|
||||
{
|
||||
GameCaptureRegion.GameRegion1080PPosMove(fromX, fromY);
|
||||
InputHub.Foreground.Mouse.LeftButtonDown();
|
||||
try
|
||||
{
|
||||
var firstDelay = duration / 2;
|
||||
await page.Wait(firstDelay);
|
||||
GameCaptureRegion.GameRegion1080PPosMove(toX, toY);
|
||||
await page.Wait(duration - firstDelay);
|
||||
}
|
||||
finally
|
||||
{
|
||||
InputHub.Foreground.Mouse.LeftButtonUp();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
internal static BvFlowConditionResult EvaluateTargets(
|
||||
IReadOnlyList<BvLocator> targets,
|
||||
BvFlowCondition condition,
|
||||
Func<BvLocator, List<Region>> findAll)
|
||||
{
|
||||
foreach (var target in targets)
|
||||
{
|
||||
var matches = findAll(target);
|
||||
if (condition == BvFlowCondition.AnyAppear && matches.Count > 0)
|
||||
{
|
||||
return new BvFlowConditionResult(true, matches[0]);
|
||||
}
|
||||
|
||||
if (condition == BvFlowCondition.AllDisappear && matches.Count > 0)
|
||||
{
|
||||
return new BvFlowConditionResult(false, null);
|
||||
}
|
||||
}
|
||||
|
||||
return condition == BvFlowCondition.AllDisappear
|
||||
? new BvFlowConditionResult(true, null)
|
||||
: new BvFlowConditionResult(false, null);
|
||||
}
|
||||
}
|
||||
@@ -1,321 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.Core.Recognition;
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using BetterGenshinImpact.Helpers;
|
||||
using OpenCvSharp;
|
||||
|
||||
namespace BetterGenshinImpact.Core.BgiVision;
|
||||
|
||||
public sealed class BvFlowAction
|
||||
{
|
||||
private readonly BvFlow _flow;
|
||||
private readonly string _description;
|
||||
private readonly Func<BvFlowExecutionContext, Task> _action;
|
||||
private readonly object _syncRoot = new();
|
||||
private int? _timeout;
|
||||
private int? _retryInterval;
|
||||
private bool _completed;
|
||||
|
||||
internal BvFlowAction(BvFlow flow, string description, Func<BvFlowExecutionContext, Task> action)
|
||||
{
|
||||
_flow = flow;
|
||||
_description = description;
|
||||
_action = action;
|
||||
}
|
||||
|
||||
public BvFlowAction WithTimeout(int milliseconds)
|
||||
{
|
||||
var timeout = BvFlow.ValidatePositive(milliseconds, nameof(milliseconds));
|
||||
lock (_syncRoot)
|
||||
{
|
||||
EnsureNotCompleted();
|
||||
_timeout = timeout;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public BvFlowAction WithRetryInterval(int milliseconds)
|
||||
{
|
||||
var retryInterval = BvFlow.ValidatePositive(milliseconds, nameof(milliseconds));
|
||||
lock (_syncRoot)
|
||||
{
|
||||
EnsureNotCompleted();
|
||||
_retryInterval = retryInterval;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public BvFlowAction Do(dynamic action)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(action);
|
||||
return CompleteOnce().Do(action);
|
||||
}
|
||||
|
||||
public BvFlowAction KeyPress(string key)
|
||||
{
|
||||
_ = User32Helper.ToVk(key);
|
||||
return CompleteOnce().KeyPress(key);
|
||||
}
|
||||
|
||||
public BvFlowAction Click()
|
||||
{
|
||||
return CompleteOnce().Click();
|
||||
}
|
||||
|
||||
public BvFlowAction Click(double x, double y)
|
||||
{
|
||||
return CompleteOnce().Click(x, y);
|
||||
}
|
||||
|
||||
public BvFlowAction RightClick()
|
||||
{
|
||||
return CompleteOnce().RightClick();
|
||||
}
|
||||
|
||||
public BvFlowAction RightClick(double x, double y)
|
||||
{
|
||||
return CompleteOnce().RightClick(x, y);
|
||||
}
|
||||
|
||||
public BvFlowAction MiddleClick()
|
||||
{
|
||||
return CompleteOnce().MiddleClick();
|
||||
}
|
||||
|
||||
public BvFlowAction MiddleClick(double x, double y)
|
||||
{
|
||||
return CompleteOnce().MiddleClick(x, y);
|
||||
}
|
||||
|
||||
public BvFlowAction MoveTo()
|
||||
{
|
||||
return CompleteOnce().MoveTo();
|
||||
}
|
||||
|
||||
public BvFlowAction MoveTo(double x, double y)
|
||||
{
|
||||
return CompleteOnce().MoveTo(x, y);
|
||||
}
|
||||
|
||||
public BvFlowAction Drag(double fromX, double fromY, double toX, double toY, int duration = 300)
|
||||
{
|
||||
BvFlow.ValidatePositive(duration, nameof(duration));
|
||||
return CompleteOnce().Drag(fromX, fromY, toX, toY, duration);
|
||||
}
|
||||
|
||||
public BvFlowAction DragTo(double toX, double toY, int duration = 300)
|
||||
{
|
||||
BvFlow.ValidatePositive(duration, nameof(duration));
|
||||
return CompleteOnce().DragTo(toX, toY, duration);
|
||||
}
|
||||
|
||||
public BvFlowAction DragFrom(double fromX, double fromY, int duration = 300)
|
||||
{
|
||||
BvFlow.ValidatePositive(duration, nameof(duration));
|
||||
return CompleteOnce().DragFrom(fromX, fromY, duration);
|
||||
}
|
||||
|
||||
public BvFlow WaitUntilText(string text, Rect rect = default, int? timeout = null, int? retryInterval = null)
|
||||
{
|
||||
ValidateWaitOptions(timeout, retryInterval);
|
||||
return CompleteOnce().WaitUntilText(text, rect, timeout, retryInterval);
|
||||
}
|
||||
|
||||
public BvFlow WaitUntilAnyText(
|
||||
object texts,
|
||||
Rect rect = default,
|
||||
int? timeout = null,
|
||||
int? retryInterval = null)
|
||||
{
|
||||
_ = _flow.CreateAnyTextLocator(texts, rect);
|
||||
ValidateWaitOptions(timeout, retryInterval);
|
||||
return CompleteOnce().WaitUntilAnyText(texts, rect, timeout, retryInterval);
|
||||
}
|
||||
|
||||
public BvFlow WaitUntil(BvLocator target, int? timeout = null, int? retryInterval = null)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(target);
|
||||
ValidateWaitOptions(timeout, retryInterval);
|
||||
return CompleteOnce().WaitUntil(target, timeout, retryInterval);
|
||||
}
|
||||
|
||||
public BvFlow WaitUntilAny(object targets, int? timeout = null, int? retryInterval = null)
|
||||
{
|
||||
_ = BvFlow.ParseTargets(targets, nameof(targets));
|
||||
ValidateWaitOptions(timeout, retryInterval);
|
||||
return CompleteOnce().WaitUntilAny(targets, timeout, retryInterval);
|
||||
}
|
||||
|
||||
public BvFlow WaitUntilDisappear(BvLocator target, int? timeout = null, int? retryInterval = null)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(target);
|
||||
ValidateWaitOptions(timeout, retryInterval);
|
||||
return CompleteOnce().WaitUntilDisappear(target, timeout, retryInterval);
|
||||
}
|
||||
|
||||
public BvFlow WaitUntilAllDisappear(object targets, int? timeout = null, int? retryInterval = null)
|
||||
{
|
||||
_ = BvFlow.ParseTargets(targets, nameof(targets));
|
||||
ValidateWaitOptions(timeout, retryInterval);
|
||||
return CompleteOnce().WaitUntilAllDisappear(targets, timeout, retryInterval);
|
||||
}
|
||||
|
||||
public BvFlow Wait(int milliseconds)
|
||||
{
|
||||
if (milliseconds < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(milliseconds), "milliseconds 不能小于 0");
|
||||
}
|
||||
|
||||
return CompleteOnce().Wait(milliseconds);
|
||||
}
|
||||
|
||||
public BvFlow UntilText(string text, Rect rect = default)
|
||||
{
|
||||
return Until(_flow.CreateTextLocator(text, rect));
|
||||
}
|
||||
|
||||
public BvFlow UntilAnyText(object texts, Rect rect = default)
|
||||
{
|
||||
return Until(_flow.CreateAnyTextLocator(texts, rect));
|
||||
}
|
||||
|
||||
public BvFlow Until(BvLocator target)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(target);
|
||||
return Complete([target.Clone()], BvFlowCondition.AnyAppear);
|
||||
}
|
||||
|
||||
public BvFlow UntilAny(object targets)
|
||||
{
|
||||
return Complete(BvFlow.ParseTargets(targets, nameof(targets)), BvFlowCondition.AnyAppear);
|
||||
}
|
||||
|
||||
public BvFlow UntilDisappear(BvLocator target)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(target);
|
||||
return Complete([target.Clone()], BvFlowCondition.AllDisappear);
|
||||
}
|
||||
|
||||
public BvFlow UntilAllDisappear(object targets)
|
||||
{
|
||||
return Complete(BvFlow.ParseTargets(targets, nameof(targets)), BvFlowCondition.AllDisappear);
|
||||
}
|
||||
|
||||
public Task<BvPage> Run()
|
||||
{
|
||||
return CompleteOnce().Run();
|
||||
}
|
||||
|
||||
private BvFlow CompleteOnce()
|
||||
{
|
||||
lock (_syncRoot)
|
||||
{
|
||||
EnsureNotCompleted();
|
||||
if (_timeout is not null || _retryInterval is not null)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"一次性动作不支持 WithTimeout 或 WithRetryInterval,请使用 Until 系列方法设置重试条件");
|
||||
}
|
||||
|
||||
_completed = true;
|
||||
}
|
||||
|
||||
return _flow.AddOnceActionStep(_description, _action);
|
||||
}
|
||||
|
||||
private BvFlow Complete(IReadOnlyList<BvLocator> targets, BvFlowCondition condition)
|
||||
{
|
||||
int timeout;
|
||||
int retryInterval;
|
||||
lock (_syncRoot)
|
||||
{
|
||||
EnsureNotCompleted();
|
||||
_completed = true;
|
||||
timeout = _timeout ?? _flow.DefaultTimeout;
|
||||
retryInterval = _retryInterval ?? _flow.DefaultRetryInterval;
|
||||
}
|
||||
|
||||
var targetDescription = DescribeTargets(targets, condition);
|
||||
return _flow.AddActionStep(new BvFlowActionSnapshot(
|
||||
_description,
|
||||
_action,
|
||||
targets,
|
||||
targetDescription,
|
||||
timeout,
|
||||
retryInterval,
|
||||
condition));
|
||||
}
|
||||
|
||||
private void EnsureNotCompleted()
|
||||
{
|
||||
if (_completed)
|
||||
{
|
||||
throw new InvalidOperationException("当前动作已经设置完成条件,不能再次修改或添加");
|
||||
}
|
||||
}
|
||||
|
||||
private static void ValidateWaitOptions(int? timeout, int? retryInterval)
|
||||
{
|
||||
if (timeout is { } timeoutValue)
|
||||
{
|
||||
BvFlow.ValidatePositive(timeoutValue, nameof(timeout));
|
||||
}
|
||||
|
||||
if (retryInterval is { } retryIntervalValue)
|
||||
{
|
||||
BvFlow.ValidatePositive(retryIntervalValue, nameof(retryInterval));
|
||||
}
|
||||
}
|
||||
|
||||
internal static string DescribeTargets(IReadOnlyList<BvLocator> targets, BvFlowCondition condition)
|
||||
{
|
||||
var descriptions = targets.Select(DescribeTarget);
|
||||
var targetDescription = targets.Count == 1
|
||||
? descriptions.First()
|
||||
: $"目标[{string.Join(" | ", descriptions)}]";
|
||||
if (condition == BvFlowCondition.AllDisappear)
|
||||
{
|
||||
return targets.Count == 1
|
||||
? $"{targetDescription}消失"
|
||||
: $"{targetDescription}全部消失";
|
||||
}
|
||||
|
||||
return targets.Count == 1 && targets[0].AnyTexts.Count == 0
|
||||
? $"{targetDescription}出现"
|
||||
: $"{targetDescription}中的任意一个出现";
|
||||
}
|
||||
|
||||
private static string DescribeTarget(BvLocator locator)
|
||||
{
|
||||
if (locator.AnyTexts.Count > 0)
|
||||
{
|
||||
return $"文字[{string.Join('|', locator.AnyTexts)}]";
|
||||
}
|
||||
|
||||
return locator.RecognitionObject.RecognitionType switch
|
||||
{
|
||||
RecognitionTypes.Ocr => $"文字[{locator.RecognitionObject.Text}]",
|
||||
RecognitionTypes.TemplateMatch => $"图像[{locator.RecognitionObject.Name}]",
|
||||
_ => "识别元素"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
internal enum BvFlowCondition
|
||||
{
|
||||
AnyAppear,
|
||||
AllDisappear
|
||||
}
|
||||
|
||||
internal sealed record BvFlowActionSnapshot(
|
||||
string Description,
|
||||
Func<BvFlowExecutionContext, Task> Action,
|
||||
IReadOnlyList<BvLocator> Targets,
|
||||
string TargetDescription,
|
||||
int Timeout,
|
||||
int RetryInterval,
|
||||
BvFlowCondition Condition);
|
||||
@@ -1,31 +0,0 @@
|
||||
using BetterGenshinImpact.Core.Recognition;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using OpenCvSharp;
|
||||
|
||||
namespace BetterGenshinImpact.Core.BgiVision;
|
||||
|
||||
public class BvImage
|
||||
{
|
||||
public RecognitionObject RecognitionObject { get; }
|
||||
|
||||
public BvImage(string templateAssert, Rect roi = default, double threshold = 0.8)
|
||||
{
|
||||
var args = templateAssert.Split(':');
|
||||
var featureName = args[0];
|
||||
var assertName = args[1];
|
||||
|
||||
RecognitionObject = new RecognitionObject
|
||||
{
|
||||
Name = templateAssert,
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = GameTaskManager.LoadAssetImage(featureName, assertName),
|
||||
RegionOfInterest = roi,
|
||||
Threshold = threshold
|
||||
}.InitTemplate();
|
||||
}
|
||||
|
||||
public RecognitionObject ToRecognitionObject()
|
||||
{
|
||||
return RecognitionObject;
|
||||
}
|
||||
}
|
||||
@@ -1,326 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.Core.Recognition;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.GameTask.Common;
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using OpenCvSharp;
|
||||
using static BetterGenshinImpact.GameTask.Common.TaskControl;
|
||||
|
||||
|
||||
namespace BetterGenshinImpact.Core.BgiVision;
|
||||
|
||||
/// <summary>
|
||||
/// 针对 Region 体系的包装
|
||||
/// </summary>
|
||||
public class BvLocator
|
||||
{
|
||||
private static readonly ILogger Logger = App.GetLogger<BvLocator>();
|
||||
private readonly CancellationToken _cancellationToken;
|
||||
private readonly IReadOnlyList<string> _anyTexts;
|
||||
private int? _timeout;
|
||||
private int? _retryInterval;
|
||||
|
||||
public RecognitionObject RecognitionObject { get; }
|
||||
|
||||
public Func<List<Region>, Task>? RetryAction { get; set; }
|
||||
|
||||
public static int DefaultTimeout { get; set; } = 10000;
|
||||
|
||||
public static int DefaultRetryInterval { get; set; } = 250;
|
||||
|
||||
public BvLocator(RecognitionObject recognitionObject, CancellationToken cancellationToken)
|
||||
: this(recognitionObject, cancellationToken, [])
|
||||
{
|
||||
}
|
||||
|
||||
internal BvLocator(
|
||||
RecognitionObject recognitionObject,
|
||||
CancellationToken cancellationToken,
|
||||
IReadOnlyList<string> anyTexts)
|
||||
{
|
||||
RecognitionObject = recognitionObject.Clone();
|
||||
_cancellationToken = cancellationToken;
|
||||
_anyTexts = anyTexts.ToArray();
|
||||
}
|
||||
|
||||
internal IReadOnlyList<string> AnyTexts => _anyTexts;
|
||||
|
||||
internal BvLocator Clone()
|
||||
{
|
||||
return new BvLocator(RecognitionObject, _cancellationToken, _anyTexts);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据传入的位置信息定位元素
|
||||
/// 不建议外部调用使用
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotSupportedException"></exception>
|
||||
public List<Region> FindAll()
|
||||
{
|
||||
using var screen = CaptureToRectArea();
|
||||
return FindAll(screen);
|
||||
}
|
||||
|
||||
internal List<Region> FindAll(ImageRegion screen)
|
||||
{
|
||||
if (RecognitionObject.RecognitionType == RecognitionTypes.TemplateMatch)
|
||||
{
|
||||
var region = screen.Find(RecognitionObject);
|
||||
if (region.IsExist())
|
||||
{
|
||||
return [region];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
else if (RecognitionObject.RecognitionType == RecognitionTypes.Ocr)
|
||||
{
|
||||
var results = screen.FindMulti(RecognitionObject);
|
||||
return FilterOcrResults(results, _anyTexts, RecognitionObject.Text);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException($"不被 Locator 支持的识别类型: {RecognitionObject.RecognitionType}");
|
||||
}
|
||||
}
|
||||
|
||||
internal static List<Region> FilterOcrResults(
|
||||
List<Region> results,
|
||||
IReadOnlyList<string> anyTexts,
|
||||
string text)
|
||||
{
|
||||
if (anyTexts.Count > 0)
|
||||
{
|
||||
return results.FindAll(region =>
|
||||
anyTexts.Any(candidate => region.Text.Contains(candidate, StringComparison.Ordinal)));
|
||||
}
|
||||
|
||||
return string.IsNullOrEmpty(text)
|
||||
? results
|
||||
: results.FindAll(region => region.Text.Contains(text, StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
public bool IsExist()
|
||||
{
|
||||
return FindAll().Count > 0;
|
||||
}
|
||||
|
||||
public async Task<Region> Click(int? timeout = null)
|
||||
{
|
||||
return (await WaitFor(timeout)).First().Click();
|
||||
}
|
||||
|
||||
public async Task<Region> ClickUntilDisappears(int? timeout = null)
|
||||
{
|
||||
var region = (await WaitFor(timeout)).First().Click();
|
||||
await Clone()
|
||||
.WithRetryAction(resList => { resList.First().Click(); }).WaitForDisappear();
|
||||
return region;
|
||||
}
|
||||
|
||||
public async Task<Region> DoubleClick(int? timeout = null)
|
||||
{
|
||||
var list = await WaitFor(timeout);
|
||||
return list.First().DoubleClick();
|
||||
}
|
||||
|
||||
public async Task<List<Region>> WaitFor(int? timeout = null)
|
||||
{
|
||||
var actualTimeout = timeout ?? _timeout ?? DefaultTimeout;
|
||||
var actualRetryInterval = _retryInterval ?? DefaultRetryInterval;
|
||||
var retryCount = Math.Max(1, actualTimeout / actualRetryInterval);
|
||||
|
||||
List<Region> results = [];
|
||||
var retryRes = await NewRetry.WaitForAction(async () =>
|
||||
{
|
||||
results = FindAll();
|
||||
var b = results.Count > 0;
|
||||
if (!b && RetryAction != null)
|
||||
{
|
||||
await RetryAction(results);
|
||||
}
|
||||
return b;
|
||||
}, _cancellationToken, retryCount, actualRetryInterval);
|
||||
|
||||
if (retryRes)
|
||||
{
|
||||
return results;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw BuildTimeoutException(actualTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
private TimeoutException BuildTimeoutException(int actualTimeout)
|
||||
{
|
||||
if (RecognitionObject.RecognitionType == RecognitionTypes.Ocr)
|
||||
{
|
||||
if (_anyTexts.Count > 0)
|
||||
{
|
||||
return new TimeoutException(
|
||||
$"识别任意文字[{string.Join('|', _anyTexts)}]在 {actualTimeout}ms 后超时未出现!");
|
||||
}
|
||||
|
||||
return new TimeoutException($"识别文字[{RecognitionObject.Text}]在 {actualTimeout}ms 后超时未出现!");
|
||||
}
|
||||
else if (RecognitionObject.RecognitionType == RecognitionTypes.TemplateMatch)
|
||||
{
|
||||
return new TimeoutException($"识别图像[{RecognitionObject.Name}]在 {actualTimeout}ms 后超时未出现!");
|
||||
}
|
||||
else
|
||||
{
|
||||
return new TimeoutException($"识别元素在 {actualTimeout}ms 后超时未出现!");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<Region>> TryWaitFor(int? timeout = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await WaitFor(timeout);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
public async Task WaitForDisappear(int? timeout = null)
|
||||
{
|
||||
var actualTimeout = timeout ?? _timeout ?? DefaultTimeout;
|
||||
var actualRetryInterval = _retryInterval ?? DefaultRetryInterval;
|
||||
var retryCount = Math.Max(1, actualTimeout / actualRetryInterval);
|
||||
|
||||
var retryRes = await NewRetry.WaitForAction(async () =>
|
||||
{
|
||||
var results = FindAll();
|
||||
var b = results.Count == 0;
|
||||
if (!b && RetryAction != null)
|
||||
{
|
||||
await RetryAction(results);
|
||||
}
|
||||
|
||||
return b;
|
||||
}, _cancellationToken, retryCount, actualRetryInterval);
|
||||
|
||||
if (!retryRes)
|
||||
{
|
||||
throw new TimeoutException($"识别元素在 {actualTimeout}ms 后超时未消失!");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task TryWaitForDisappear(int? timeout = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
await WaitForDisappear(timeout);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 方便优雅的设置感兴趣区域 (ROI)
|
||||
/// 该方法会覆盖 RecognitionObject.RegionOfInterest 的值。
|
||||
/// </summary>
|
||||
/// <param name="rect"></param>
|
||||
/// <returns></returns>
|
||||
public BvLocator WithRoi(Rect rect)
|
||||
{
|
||||
RecognitionObject.RegionOfInterest = rect;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BvLocator WithRoi(Func<Rect, Rect> deltaFunc)
|
||||
{
|
||||
var captureAreaRect = TaskContext.Instance().SystemInfo.ScaleMax1080PCaptureRect;
|
||||
var rect = deltaFunc(captureAreaRect);
|
||||
RecognitionObject.RegionOfInterest = rect;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BvLocator WithRetryAction(Action<List<Region>>? action)
|
||||
{
|
||||
if (action == null)
|
||||
{
|
||||
RetryAction = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
RetryAction = (results) =>
|
||||
{
|
||||
action(results);
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置超时时间(毫秒)
|
||||
/// </summary>
|
||||
/// <param name="timeout">超时时间(毫秒)</param>
|
||||
/// <returns></returns>
|
||||
public BvLocator WithTimeout(int timeout)
|
||||
{
|
||||
if (timeout <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(timeout), "timeout 必须大于 0");
|
||||
}
|
||||
_timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置重试间隔(毫秒)
|
||||
/// </summary>
|
||||
/// <param name="retryInterval">重试间隔(毫秒)</param>
|
||||
/// <returns></returns>
|
||||
public BvLocator WithRetryInterval(int retryInterval)
|
||||
{
|
||||
if (retryInterval <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(retryInterval), "retryInterval 必须大于 0");
|
||||
}
|
||||
_retryInterval = retryInterval;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为 JavaScript 提供的动态参数重载
|
||||
/// 解决 ClearScript 无法将 JS 函数隐式转换为 Action 委托的问题
|
||||
/// 支持同步和异步 JS 函数
|
||||
/// </summary>
|
||||
/// <param name="action">JS 回调函数</param>
|
||||
/// <returns></returns>
|
||||
public BvLocator WithRetryAction(dynamic action)
|
||||
{
|
||||
if (action == null)
|
||||
{
|
||||
RetryAction = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
RetryAction = async (results) =>
|
||||
{
|
||||
var taskResult = action(results);
|
||||
// 如果 JS 返回的是 Promise/Task,等待其完成
|
||||
if (taskResult is Task task)
|
||||
{
|
||||
await task;
|
||||
}
|
||||
};
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,180 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.Core.Input;
|
||||
using BetterGenshinImpact.Core.Recognition;
|
||||
using BetterGenshinImpact.GameTask.AutoGeniusInvokation.Exception;
|
||||
using BetterGenshinImpact.GameTask.Common;
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using OpenCvSharp;
|
||||
|
||||
namespace BetterGenshinImpact.Core.BgiVision;
|
||||
|
||||
public class BvPage
|
||||
{
|
||||
private static readonly ILogger Logger = App.GetLogger<BvPage>();
|
||||
private readonly CancellationToken _cancellationToken;
|
||||
|
||||
public IKeyboardInput Keyboard => InputHub.Foreground.Keyboard;
|
||||
|
||||
public IMouseInput Mouse => InputHub.Foreground.Mouse;
|
||||
|
||||
/// <summary>
|
||||
/// Default timeout for operations in milliseconds
|
||||
/// </summary>
|
||||
public int DefaultTimeout { get; set; } = 10000;
|
||||
|
||||
/// <summary>
|
||||
/// Default retry interval in milliseconds
|
||||
/// </summary>
|
||||
public int DefaultRetryInterval { get; set; } = 1000;
|
||||
|
||||
public BvPage(CancellationToken cancellationToken = default)
|
||||
{
|
||||
_cancellationToken = cancellationToken;
|
||||
}
|
||||
|
||||
public BvFlow Flow()
|
||||
{
|
||||
return new BvFlow(this, DefaultTimeout, DefaultRetryInterval);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 截图
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ImageRegion Screenshot()
|
||||
{
|
||||
return TaskControl.CaptureToRectArea();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 等待
|
||||
/// </summary>
|
||||
/// <param name="milliseconds"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<BvPage> Wait(int milliseconds)
|
||||
{
|
||||
await TaskControl.Delay(milliseconds, _cancellationToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
internal void ThrowIfCancellationRequested()
|
||||
{
|
||||
if (_cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
throw new NormalEndException("取消自动任务");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 定位图片位置
|
||||
/// </summary>
|
||||
/// <param name="image"></param>
|
||||
/// <returns></returns>
|
||||
public BvLocator Locator(BvImage image)
|
||||
{
|
||||
return new BvLocator(image.ToRecognitionObject(), _cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 定位文本位置
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
/// <param name="rect"></param>
|
||||
/// <returns></returns>
|
||||
public BvLocator Locator(string text, Rect rect = default)
|
||||
{
|
||||
return Locator(new RecognitionObject
|
||||
{
|
||||
RecognitionType = RecognitionTypes.Ocr,
|
||||
RegionOfInterest = rect,
|
||||
Text = text
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 定位 RecognitionObject 代表的位置
|
||||
/// </summary>
|
||||
/// <param name="ro"></param>
|
||||
/// <returns></returns>
|
||||
public BvLocator Locator(RecognitionObject ro)
|
||||
{
|
||||
return new BvLocator(ro, _cancellationToken);
|
||||
}
|
||||
|
||||
public BvLocator GetByText(string text = "", Rect rect = default)
|
||||
{
|
||||
return Locator(text, rect);
|
||||
}
|
||||
|
||||
public BvLocator GetByAnyText(object texts, Rect rect = default)
|
||||
{
|
||||
var matchTexts = ParseCollection<string>(texts, nameof(texts));
|
||||
if (matchTexts.Any(string.IsNullOrWhiteSpace))
|
||||
{
|
||||
throw new ArgumentException("候选文本不能包含空字符串或纯空白字符串", nameof(texts));
|
||||
}
|
||||
|
||||
matchTexts = matchTexts.Distinct(StringComparer.Ordinal).ToList();
|
||||
return new BvLocator(new RecognitionObject
|
||||
{
|
||||
RecognitionType = RecognitionTypes.Ocr,
|
||||
RegionOfInterest = rect
|
||||
}, _cancellationToken, matchTexts);
|
||||
}
|
||||
|
||||
public BvLocator GetByImage(BvImage image)
|
||||
{
|
||||
return Locator(image);
|
||||
}
|
||||
|
||||
|
||||
public List<Region> Ocr(Rect rect = default)
|
||||
{
|
||||
return Locator(string.Empty, rect).FindAll();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 1080P 分辨率下点击坐标
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
public void Click(double x, double y)
|
||||
{
|
||||
GameCaptureRegion.GameRegion1080PPosClick(x, y);
|
||||
}
|
||||
|
||||
internal static List<T> ParseCollection<T>(object values, string paramName)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(values, paramName);
|
||||
if (values is string || values is not IEnumerable enumerable)
|
||||
{
|
||||
throw new ArgumentException($"{paramName} 必须是集合或 JS Array", paramName);
|
||||
}
|
||||
|
||||
List<T> result = [];
|
||||
foreach (var value in enumerable)
|
||||
{
|
||||
if (value is not T typedValue)
|
||||
{
|
||||
throw new ArgumentException($"{paramName} 中的每个元素都必须是 {typeof(T).Name}", paramName);
|
||||
}
|
||||
|
||||
result.Add(typedValue);
|
||||
}
|
||||
|
||||
if (result.Count == 0)
|
||||
{
|
||||
throw new ArgumentException($"{paramName} 不能为空", paramName);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +1,19 @@
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.GameTask.AutoDomain;
|
||||
using BetterGenshinImpact.GameTask.AutoBoss;
|
||||
using BetterGenshinImpact.GameTask.AutoCombo.ComboBuild;
|
||||
using BetterGenshinImpact.GameTask.AutoFight;
|
||||
using BetterGenshinImpact.GameTask.AutoFishing;
|
||||
using BetterGenshinImpact.GameTask.AutoGeniusInvokation;
|
||||
using BetterGenshinImpact.GameTask.AutoPick;
|
||||
using BetterGenshinImpact.GameTask.AutoSkip;
|
||||
using BetterGenshinImpact.GameTask.AutoWood;
|
||||
using BetterGenshinImpact.GameTask.AutoMusicGame;
|
||||
using BetterGenshinImpact.GameTask.QuickTeleport;
|
||||
using BetterGenshinImpact.Service.Notification;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Fischless.GameCapture;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.GameTask.AutoTrackPath;
|
||||
using BetterGenshinImpact.GameTask.AutoArtifactSalvage;
|
||||
using BetterGenshinImpact.GameTask.AutoStygianOnslaught;
|
||||
using BetterGenshinImpact.GameTask.GetGridIcons;
|
||||
using BetterGenshinImpact.GameTask.AutoEat;
|
||||
using BetterGenshinImpact.GameTask.AutoLeyLineOutcrop;
|
||||
using BetterGenshinImpact.GameTask.AutoCook;
|
||||
using BetterGenshinImpact.GameTask.MapMask;
|
||||
using BetterGenshinImpact.GameTask.SkillCd;
|
||||
using BetterGenshinImpact.GameTask.UseRedeemCode;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config;
|
||||
|
||||
@@ -62,59 +48,18 @@ public partial class AllConfig : ObservableObject
|
||||
private int _triggerInterval = 50;
|
||||
|
||||
/// <summary>
|
||||
/// WGC V2 帧率上限(毫秒,即最小更新间隔,限制 DWM 推帧频率以降低 GPU 占用)
|
||||
/// 0 = 不启用限流(默认);仅 Windows 11 24H2 及以上系统生效
|
||||
/// WGC使用位图缓存
|
||||
/// 高帧率情况下,可能会导致卡顿
|
||||
/// 云原神可能会出现黑屏
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private int _wgcMinUpdateIntervalMs;
|
||||
private bool _wgcUseBitmapCache = true;
|
||||
|
||||
/// <summary>
|
||||
/// WGC V2 使用 CPU 颜色转换(BGRA→BGR 由 CPU CvtColor 完成)
|
||||
/// 默认关闭 = GPU compute shader 打包 BGR24(回读量更小、CPU 零转换);重启捕获后生效
|
||||
/// 推理使用的设备
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _wgcV2UseCpuConvert;
|
||||
|
||||
// /// <summary>
|
||||
// /// WGC使用位图缓存
|
||||
// /// 高帧率情况下,可能会导致卡顿
|
||||
// /// 云原神可能会出现黑屏
|
||||
// /// </summary>
|
||||
// [ObservableProperty]
|
||||
// private bool _wgcUseBitmapCache = true;
|
||||
|
||||
/// <summary>
|
||||
/// 自动修复Win11下BitBlt截图方式不可用的问题
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _autoFixWin11BitBlt = true;
|
||||
|
||||
// /// <summary>
|
||||
// /// 推理使用的设备
|
||||
// /// </summary>
|
||||
// [ObservableProperty]
|
||||
// private string _inferenceDevice = "CPU";
|
||||
|
||||
[ObservableProperty]
|
||||
private List<ValueTuple<string, int, string, string>> _nextScheduledTask = [];
|
||||
|
||||
/// <summary>
|
||||
/// 禁用键鼠监听,需重启
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _disableInputMonitor = false;
|
||||
|
||||
/// <summary>
|
||||
/// 连续执行任务时,从此任务开始执行
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public string NextScriptGroupName { get; set; }= string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 一条龙选中使用的配置
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _selectedOneDragonFlowConfigName = string.Empty;
|
||||
private string _inferenceDevice = "CPU";
|
||||
|
||||
/// <summary>
|
||||
/// 遮罩窗口配置
|
||||
@@ -146,16 +91,16 @@ public partial class AllConfig : ObservableObject
|
||||
/// </summary>
|
||||
public AutoFishingConfig AutoFishingConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 自动连招配置
|
||||
/// </summary>
|
||||
public AutoComboBuildConfig AutoComboBuildConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 快速传送配置
|
||||
/// </summary>
|
||||
public QuickTeleportConfig QuickTeleportConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 自动烹饪配置
|
||||
/// </summary>
|
||||
public AutoCookConfig AutoCookConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 自动打牌配置
|
||||
/// </summary>
|
||||
@@ -171,86 +116,16 @@ public partial class AllConfig : ObservableObject
|
||||
/// </summary>
|
||||
public AutoFightConfig AutoFightConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 自动乐曲配置 - 千音雅集
|
||||
/// </summary>
|
||||
public AutoMusicGameConfig AutoMusicGameConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 自动秘境配置
|
||||
/// </summary>
|
||||
public AutoDomainConfig AutoDomainConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 自动首领讨伐配置
|
||||
/// </summary>
|
||||
public AutoBossConfig AutoBossConfig { get; set; } = new();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 自动秘境配置
|
||||
/// </summary>
|
||||
public AutoStygianOnslaughtConfig AutoStygianOnslaughtConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 自动分解圣遗物配置
|
||||
/// </summary>
|
||||
public AutoArtifactSalvageConfig AutoArtifactSalvageConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 自动吃药配置
|
||||
/// </summary>
|
||||
public AutoEatConfig AutoEatConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 自动地脉花配置
|
||||
/// </summary>
|
||||
public AutoLeyLineOutcropConfig AutoLeyLineOutcropConfig { get; set; } = new();
|
||||
|
||||
public AutoCookConfig AutoCookConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 地图遮罩
|
||||
/// </summary>
|
||||
public MapMaskConfig MapMaskConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 技能 CD 提示
|
||||
/// </summary>
|
||||
public SkillCdConfig SkillCdConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 自动使用
|
||||
/// </summary>
|
||||
public AutoRedeemCodeConfig AutoRedeemCodeConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 截取物品图标配置
|
||||
/// </summary>
|
||||
public GetGridIconsConfig GetGridIconsConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 宏配置
|
||||
/// 脚本类配置
|
||||
/// </summary>
|
||||
public MacroConfig MacroConfig { get; set; } = new();
|
||||
|
||||
public RecordConfig RecordConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 原琴演奏配置
|
||||
/// </summary>
|
||||
public MusicConfig MusicConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 脚本配置
|
||||
/// </summary>
|
||||
public ScriptConfig ScriptConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 地图追踪配置
|
||||
/// </summary>
|
||||
public PathingConditionConfig PathingConditionConfig { get; set; } = PathingConditionConfig.Default;
|
||||
|
||||
/// <summary>
|
||||
/// 快捷键配置
|
||||
/// </summary>
|
||||
@@ -261,69 +136,33 @@ public partial class AllConfig : ObservableObject
|
||||
/// </summary>
|
||||
public NotificationConfig NotificationConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 原神按键绑定配置
|
||||
/// </summary>
|
||||
public KeyBindingsConfig KeyBindingsConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 其他配置
|
||||
/// </summary>
|
||||
public OtherConfig OtherConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 传送相关配置
|
||||
/// </summary>
|
||||
public TpConfig TpConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 开发者配置
|
||||
/// </summary>
|
||||
public DevConfig DevConfig { get; set; } = new();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 硬件加速设置
|
||||
/// </summary>
|
||||
public HardwareAccelerationConfig HardwareAccelerationConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 桌面分身配置
|
||||
/// </summary>
|
||||
public ChildSessionConfig ChildSessionConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 任意配置项变更后的回调(由 ConfigService 设置为防抖保存)
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public Action? OnAnyChangedAction { get; set; }
|
||||
|
||||
private ConfigChangeTracker? _changeTracker;
|
||||
|
||||
/// <summary>
|
||||
/// 开始追踪整个配置对象图的变更(含嵌套对象与集合),重复调用无副作用
|
||||
/// </summary>
|
||||
public void InitEvent()
|
||||
{
|
||||
if (_changeTracker != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PropertyChanged += OnAnyPropertyChanged;
|
||||
MaskWindowConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
CommonConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
GenshinStartConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
NotificationConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
NotificationConfig.PropertyChanged += OnNotificationPropertyChanged;
|
||||
_changeTracker = new ConfigChangeTracker(OnConfigChanged);
|
||||
_changeTracker.Track(this);
|
||||
|
||||
AutoPickConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoSkipConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoFishingConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
QuickTeleportConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoCookConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
MacroConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
HotKeyConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoWoodConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoFightConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoDomainConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
}
|
||||
|
||||
/// <param name="sender">触发变更的对象(某个子配置、嵌套对象或集合)</param>
|
||||
private void OnConfigChanged(object sender)
|
||||
public void OnAnyPropertyChanged(object? sender, EventArgs args)
|
||||
{
|
||||
// 实时触发器每帧读取配置,不需要在这里通知;只有切换遮罩显示相关的开关时清掉旧的识别结果
|
||||
if (sender is MaskWindowConfig)
|
||||
{
|
||||
TaskContext.Instance().Runtime?.MaskWindowDrawingBoard.ClearAll();
|
||||
}
|
||||
|
||||
GameTaskManager.RefreshTriggerConfigs();
|
||||
OnAnyChangedAction?.Invoke();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
using System;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config;
|
||||
|
||||
[Serializable]
|
||||
public partial class ChildSessionConfig : ObservableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// 桌面分身普通窗口模式的位置(物理像素坐标)。
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private WindowPositionConfig? _normalWindowPosition;
|
||||
|
||||
/// <summary>
|
||||
/// 桌面分身小窗模式的位置(物理像素坐标)。
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private WindowPositionConfig? _smallWindowPosition;
|
||||
|
||||
/// <summary>
|
||||
/// 桌面分身窗口是否置顶。
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _topmostEnabled = false;
|
||||
|
||||
/// <summary>
|
||||
/// RDP 画面是否自适应窗口。关闭时使用 1:1 显示。
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _smartSizingEnabled = true;
|
||||
|
||||
/// <summary>
|
||||
/// 桌面分身窗口是否保持 16:9 宽高比。
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _keepAspectRatio = true;
|
||||
|
||||
/// <summary>
|
||||
/// Alt+Tab、Windows 键等系统组合键是否发送到桌面分身。
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _sendSystemShortcutsToRemote = true;
|
||||
|
||||
/// <summary>
|
||||
/// 桌面分身是否启用游戏鼠标模式。默认使用普通鼠标模式。
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _gameMouseModeEnabled = false;
|
||||
|
||||
/// <summary>
|
||||
/// 桌面分身的 RDP 音频是否静音,不影响主桌面的其他程序。
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _audioMuted = false;
|
||||
|
||||
/// <summary>
|
||||
/// 桌面分身是否处于观看模式。开启后键鼠不会在桌面分身内生效,仅显示画面。
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _watchModeEnabled = false;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class WindowPositionConfig
|
||||
{
|
||||
public int Left { get; set; }
|
||||
|
||||
public int Top { get; set; }
|
||||
|
||||
public WindowPositionConfig()
|
||||
{
|
||||
}
|
||||
|
||||
public WindowPositionConfig(int left, int top)
|
||||
{
|
||||
Left = left;
|
||||
Top = top;
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,8 @@
|
||||
using BetterGenshinImpact.Helpers;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Media;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config;
|
||||
|
||||
/// <summary>
|
||||
/// 主题类型配置
|
||||
/// </summary>
|
||||
public enum ThemeType
|
||||
{
|
||||
DarkNone,
|
||||
DarkMica,
|
||||
DarkAcrylic,
|
||||
LightNone,
|
||||
LightMica,
|
||||
LightAcrylic,
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 遮罩窗口配置
|
||||
/// </summary>
|
||||
@@ -37,96 +19,11 @@ public partial class CommonConfig : ObservableObject
|
||||
/// UID遮盖是否启用
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _screenshotUidCoverEnabled = true;
|
||||
|
||||
/// <summary>
|
||||
/// 是否保存奖励识别调试截图
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _rewardRecognitionScreenshotEnabled;
|
||||
private bool _screenshotUidCoverEnabled;
|
||||
|
||||
/// <summary>
|
||||
/// 退出时最小化至托盘
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _exitToTray;
|
||||
|
||||
/// <summary>
|
||||
/// 当前主题类型(新版主题)
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private ThemeType _currentThemeType = OsVersionHelper.IsWindows11_22523_OrGreater ? ThemeType.DarkMica : ThemeType.DarkNone;
|
||||
|
||||
/// <summary>
|
||||
/// 主题(旧版主题,兼容性保留)
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private WindowBackdropType _currentBackdropType = WindowBackdropType.Mica;
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用主窗口自定义背景图
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _mainBackgroundEnabled;
|
||||
|
||||
/// <summary>
|
||||
/// 主窗口自定义背景图路径,空字符串表示未设置
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _mainBackgroundImagePath = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 主窗口背景图不透明度,数值越小背景越淡,文字越清晰
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private double _mainBackgroundOpacity = 0.35;
|
||||
|
||||
/// <summary>
|
||||
/// 主窗口背景图拉伸模式
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private Stretch _mainBackgroundStretch = Stretch.UniformToFill;
|
||||
|
||||
/// <summary>
|
||||
/// 是否是第一次运行
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _isFirstRun = true;
|
||||
|
||||
/// <summary>
|
||||
/// 这个版本是否运行过
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _runForVersion = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 一个设备只运行一次的已运行设备ID列表
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private List<string> _onceHadRunDeviceIdList = new();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 当前看过的兑换码推送版本
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _redeemCodeFeedsUpdateVersion = "20251013";
|
||||
|
||||
/// <summary>
|
||||
/// 国服兑换码更新是否允许通知
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _redeemCodeCnFeedsNotificationEnabled = true;
|
||||
|
||||
/// <summary>
|
||||
/// 国际服兑换码更新是否允许通知
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _redeemCodeGlobalFeedsNotificationEnabled;
|
||||
|
||||
/// <summary>
|
||||
/// 当前看过的国际服兑换码推送版本
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _redeemCodeGlobalFeedsUpdateVersion = string.Empty;
|
||||
}
|
||||
@@ -1,236 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config;
|
||||
|
||||
/// <summary>
|
||||
/// 递归追踪配置对象图中所有 <see cref="INotifyPropertyChanged"/> / <see cref="INotifyCollectionChanged"/> 节点的变更。
|
||||
/// <para>
|
||||
/// 订阅是增量且幂等的:
|
||||
/// 1. 已访问对象记录在 <see cref="ConditionalWeakTable{TKey,TValue}"/> 中,同一对象只订阅一次,也天然防环,且不阻止 GC;
|
||||
/// 2. 属性被整体替换为新对象、集合新增元素时,只补订阅新出现的对象;
|
||||
/// 3. 被替换掉的旧对象不主动退订,它们之后再触发事件也只是多一次无害的变更回调。
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// 不做全量重扫:根节点上的子配置是无通知的自动属性,运行时可能被临时替换(如地脉花任务临时替换 AutoFightConfig),
|
||||
/// 全量重扫会把追踪挂到临时对象上。
|
||||
/// </para>
|
||||
/// 回调在触发事件的线程上同步执行。
|
||||
/// </summary>
|
||||
internal sealed class ConfigChangeTracker
|
||||
{
|
||||
/// <summary>
|
||||
/// 递归深度上限,防御异常的对象图
|
||||
/// </summary>
|
||||
private const int MaxDepth = 32;
|
||||
|
||||
private static readonly object Marker = new();
|
||||
|
||||
/// <summary>
|
||||
/// 每个类型可继续向下追踪的属性(按属性名索引)
|
||||
/// </summary>
|
||||
private static readonly ConcurrentDictionary<Type, Dictionary<string, PropertyInfo>> TrackablePropertyCache = new();
|
||||
|
||||
private readonly ConditionalWeakTable<object, object> _tracked = new();
|
||||
private readonly object _trackedLocker = new();
|
||||
private readonly Action<object> _onChanged;
|
||||
|
||||
/// <param name="onChanged">任意节点变更时回调,参数为触发事件的对象(属性所属对象或集合本身)</param>
|
||||
public ConfigChangeTracker(Action<object> onChanged)
|
||||
{
|
||||
_onChanged = onChanged;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从根节点开始追踪
|
||||
/// </summary>
|
||||
public void Track(object root)
|
||||
{
|
||||
Visit(root, 0);
|
||||
}
|
||||
|
||||
private void Visit(object? node, int depth)
|
||||
{
|
||||
if (node == null || depth > MaxDepth || !IsTrackableInstance(node))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lock (_trackedLocker)
|
||||
{
|
||||
if (_tracked.TryGetValue(node, out _))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_tracked.Add(node, Marker);
|
||||
}
|
||||
|
||||
if (node is INotifyPropertyChanged npc)
|
||||
{
|
||||
npc.PropertyChanged += OnPropertyChanged;
|
||||
}
|
||||
|
||||
if (node is INotifyCollectionChanged ncc)
|
||||
{
|
||||
ncc.CollectionChanged += OnCollectionChanged;
|
||||
}
|
||||
|
||||
VisitChildren(node, depth);
|
||||
}
|
||||
|
||||
private void VisitChildren(object node, int depth)
|
||||
{
|
||||
VisitItems(node, depth);
|
||||
|
||||
if (node is not INotifyPropertyChanged)
|
||||
{
|
||||
// 只沿着可通知对象向下展开属性,普通 POCO(如 GiTpPosition)没有变更通知,且可能存在会抛异常的计算属性
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var property in GetTrackableProperties(node.GetType()).Values)
|
||||
{
|
||||
Visit(TryGetValue(property, node), depth + 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void VisitItems(object node, int depth)
|
||||
{
|
||||
if (node is string)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
switch (node)
|
||||
{
|
||||
case IDictionary dictionary:
|
||||
// 先拷贝一份,缩短与其他线程并发修改的冲突窗口
|
||||
foreach (var value in dictionary.Values.Cast<object?>().ToArray())
|
||||
{
|
||||
Visit(value, depth + 1);
|
||||
}
|
||||
|
||||
break;
|
||||
case IEnumerable enumerable:
|
||||
foreach (var item in enumerable.Cast<object?>().ToArray())
|
||||
{
|
||||
Visit(item, depth + 1);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception e) when (e is InvalidOperationException or ArgumentException)
|
||||
{
|
||||
// 其他线程正在修改集合,尽力而为:新元素会在下一次 CollectionChanged 或属性替换时补订阅
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (sender == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(e.PropertyName))
|
||||
{
|
||||
// 约定:属性名为空表示所有属性都已变化
|
||||
VisitChildren(sender, 0);
|
||||
}
|
||||
else if (GetTrackableProperties(sender.GetType()).TryGetValue(e.PropertyName, out var property))
|
||||
{
|
||||
// 子对象可能被整体替换,补订阅新值
|
||||
Visit(TryGetValue(property, sender), 0);
|
||||
}
|
||||
|
||||
_onChanged(sender);
|
||||
}
|
||||
|
||||
private void OnCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (sender == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.Action == NotifyCollectionChangedAction.Reset)
|
||||
{
|
||||
VisitItems(sender, 0);
|
||||
}
|
||||
else if (e.NewItems != null)
|
||||
{
|
||||
foreach (var item in e.NewItems)
|
||||
{
|
||||
Visit(item, 0);
|
||||
}
|
||||
}
|
||||
|
||||
_onChanged(sender);
|
||||
}
|
||||
|
||||
private static object? TryGetValue(PropertyInfo property, object owner)
|
||||
{
|
||||
try
|
||||
{
|
||||
return property.GetValue(owner);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 计算属性可能抛异常(如依赖未初始化的数据),跳过即可
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 只追踪可能产生变更通知或包含可通知元素的引用类型实例
|
||||
/// </summary>
|
||||
private static bool IsTrackableInstance(object node)
|
||||
{
|
||||
if (node is string or Delegate or MemberInfo || node.GetType().IsValueType)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return node is INotifyPropertyChanged or INotifyCollectionChanged or IEnumerable;
|
||||
}
|
||||
|
||||
private static Dictionary<string, PropertyInfo> GetTrackableProperties(Type type)
|
||||
{
|
||||
return TrackablePropertyCache.GetOrAdd(type, static t => t
|
||||
.GetProperties(BindingFlags.Public | BindingFlags.Instance)
|
||||
.Where(IsTrackableProperty)
|
||||
// 派生类用 new 隐藏基类属性时会出现同名属性,取第一个(最派生)即可
|
||||
.GroupBy(p => p.Name, StringComparer.Ordinal)
|
||||
.ToDictionary(g => g.Key, g => g.First(), StringComparer.Ordinal));
|
||||
}
|
||||
|
||||
private static bool IsTrackableProperty(PropertyInfo property)
|
||||
{
|
||||
if (property.GetMethod is not { IsPublic: true } || property.GetIndexParameters().Length > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var propertyType = property.PropertyType;
|
||||
if (propertyType.IsValueType || propertyType == typeof(string) || typeof(Delegate).IsAssignableFrom(propertyType))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// 不参与序列化的属性不属于配置内容
|
||||
var jsonIgnore = property.GetCustomAttribute<JsonIgnoreAttribute>();
|
||||
return jsonIgnore is not { Condition: JsonIgnoreCondition.Always };
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BetterGenshinImpact.GameTask.Common.Map.Maps.Base;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config;
|
||||
|
||||
/// <summary>
|
||||
/// 脚本配置
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public partial class DevConfig : ObservableObject
|
||||
{
|
||||
// 录制地图名称
|
||||
[ObservableProperty]
|
||||
private string _recordMapName = MapTypes.Teyvat.ToString();
|
||||
|
||||
// Recognition 模板制作工具最近使用的配置文件
|
||||
[ObservableProperty]
|
||||
private string _recognitionJsonPath = "";
|
||||
|
||||
/// <summary>
|
||||
/// Recognition 模板制作工具最近使用的配置文件历史,按最近使用顺序保存,最多 10 条。
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private List<string> _recognitionJsonPathHistory = [];
|
||||
|
||||
// Recognition 模板制作工具最近使用的 Assets 根目录
|
||||
[ObservableProperty]
|
||||
private string _recognitionAssetsRootPath = "";
|
||||
|
||||
/// <summary>
|
||||
/// Recognition 模板制作工具最近使用的输出文件夹历史,按最近使用顺序保存,最多 10 条。
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private List<string> _recognitionAssetsRootPathHistory = [];
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config;
|
||||
@@ -9,11 +9,11 @@ namespace BetterGenshinImpact.Core.Config;
|
||||
[Serializable]
|
||||
public partial class GenshinStartConfig : ObservableObject
|
||||
{
|
||||
// /// <summary>
|
||||
// /// 自动点击月卡
|
||||
// /// </summary>
|
||||
// [ObservableProperty]
|
||||
// private bool _autoClickBlessingOfTheWelkinMoonEnabled;
|
||||
/// <summary>
|
||||
/// 自动点击月卡
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _autoClickBlessingOfTheWelkinMoonEnabled;
|
||||
|
||||
/// <summary>
|
||||
/// 自动进入游戏(开门)
|
||||
@@ -38,19 +38,4 @@ public partial class GenshinStartConfig : ObservableObject
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _linkedStartEnabled = true;
|
||||
|
||||
/// <summary>
|
||||
/// 使用Starward同步记录时间
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _recordGameTimeEnabled = false;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _startGameWithCmd = false;
|
||||
|
||||
/// <summary>
|
||||
/// 启动前自动关闭原神 HDR(删除原神 HDR 对应注册表键)
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _autoDisableGenshinHdrEnabled = true;
|
||||
}
|
||||
@@ -1,40 +1,19 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Semver;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config;
|
||||
|
||||
public class Global
|
||||
{
|
||||
public static string Version { get; } = Assembly.GetEntryAssembly()?.
|
||||
GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.
|
||||
InformationalVersion!;
|
||||
public static string Version { get; } = "0.30.2";
|
||||
|
||||
public static string StartUpPath { get; set; } = AppContext.BaseDirectory;
|
||||
|
||||
public static readonly JsonSerializerOptions ManifestJsonOptions = new()
|
||||
{
|
||||
NumberHandling = JsonNumberHandling.AllowNamedFloatingPointLiterals,
|
||||
Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
|
||||
PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower,
|
||||
WriteIndented = true,
|
||||
AllowTrailingCommas = true,
|
||||
ReadCommentHandling = JsonCommentHandling.Skip,
|
||||
};
|
||||
|
||||
public static string Absolute(string relativePath)
|
||||
{
|
||||
return Path.Combine(StartUpPath, relativePath);
|
||||
}
|
||||
|
||||
public static string ScriptPath()
|
||||
{
|
||||
return Absolute("User\\JsScript");
|
||||
}
|
||||
|
||||
public static string? ReadAllTextIfExist(string relativePath)
|
||||
{
|
||||
var path = Absolute(relativePath);
|
||||
@@ -62,10 +41,10 @@ public class Global
|
||||
{
|
||||
try
|
||||
{
|
||||
var oldVersionX = SemVersion.Parse(oldVersion);
|
||||
var currentVersionX = SemVersion.Parse(currentVersion);
|
||||
Version oldVersionX = new(oldVersion);
|
||||
Version currentVersionX = new(currentVersion);
|
||||
|
||||
if (currentVersionX.CompareSortOrderTo(oldVersionX) > 0)
|
||||
if (currentVersionX > oldVersionX)
|
||||
// 需要更新
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using BetterGenshinImpact.Core.Recognition.ONNX;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config;
|
||||
|
||||
[Serializable]
|
||||
[JsonConverter(typeof(HardwareAccelerationConfigJsonConverter))]
|
||||
public partial class HardwareAccelerationConfig : ObservableObject
|
||||
{
|
||||
// 缺少新结构标识时不迁移旧参数,由启动准备流程使用 CPU 默认设置。
|
||||
[ObservableProperty] private int _formatVersion;
|
||||
[ObservableProperty] private InferenceEngineSettings _cpu = new() { DeviceId = "CPU" };
|
||||
[ObservableProperty] private PaddleOcrCpuConfig _paddleOcrCpu = new();
|
||||
[ObservableProperty] private InferenceEngineSettings _directML = new();
|
||||
[ObservableProperty] private InferenceEngineSettings _openVINO = new();
|
||||
[ObservableProperty] private InferenceEngineSettings _cuda = new();
|
||||
[ObservableProperty] private InferenceEngineSettings _tensorRT = new();
|
||||
[ObservableProperty] private InferenceValidationState _validationState;
|
||||
[ObservableProperty] private string _verifiedSignature = "";
|
||||
// 历史成功记录仅用于设置页展示,不能代替当前设备和参数的验证签名。
|
||||
[ObservableProperty] private InferenceDeviceType[] _validatedEngines = [];
|
||||
[ObservableProperty] private InferenceDeviceType? _lastFailedEngine;
|
||||
[ObservableProperty] private string _lastValidationError = "";
|
||||
|
||||
public InferenceEngineSettings GetEngineSettings(InferenceDeviceType engine) => engine switch
|
||||
{
|
||||
InferenceDeviceType.Cpu => Cpu,
|
||||
InferenceDeviceType.DirectML => DirectML,
|
||||
InferenceDeviceType.OpenVINO => OpenVINO,
|
||||
InferenceDeviceType.CUDA => Cuda,
|
||||
InferenceDeviceType.TensorRT => TensorRT,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(engine))
|
||||
};
|
||||
|
||||
public void RecordValidatedEngine(InferenceDeviceType engine)
|
||||
{
|
||||
if (engine != InferenceDeviceType.Cpu && !ValidatedEngines.Contains(engine))
|
||||
ValidatedEngines = [.. ValidatedEngines, engine];
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public bool IsExpectedConfiguration => FormatVersion == 1 && Enum.IsDefined(InferenceDevice)
|
||||
&& Enum.IsDefined(ValidationState) && Cpu != null && DirectML != null && OpenVINO != null
|
||||
&& Cuda != null && TensorRT != null && Cpu.CpuThreads >= 0
|
||||
&& Cpu.CpuThreads <= Environment.ProcessorCount
|
||||
&& !string.IsNullOrWhiteSpace(GetEngineSettings(InferenceDevice).DeviceId);
|
||||
|
||||
/// <summary>配置结构损坏时恢复完整默认值。运行时回退不得调用此方法。</summary>
|
||||
public void ResetToDefaults()
|
||||
{
|
||||
FormatVersion = 1;
|
||||
Cpu = new() { DeviceId = "CPU" };
|
||||
PaddleOcrCpu = new();
|
||||
DirectML = new(); OpenVINO = new(); Cuda = new(); TensorRT = new();
|
||||
InferenceDevice = InferenceDeviceType.Cpu;
|
||||
CpuOcr = true;
|
||||
ValidationState = InferenceValidationState.None;
|
||||
VerifiedSignature = "";
|
||||
}
|
||||
|
||||
/// <summary>只把当前生效选择切换为 CPU,保留其他引擎、OCR 和线程设置。</summary>
|
||||
public void SwitchToCpu()
|
||||
{
|
||||
FormatVersion = 1;
|
||||
InferenceDevice = InferenceDeviceType.Cpu;
|
||||
Cpu.DeviceId = "CPU";
|
||||
ValidationState = InferenceValidationState.None;
|
||||
VerifiedSignature = "";
|
||||
}
|
||||
/// <summary>
|
||||
/// 推理使用的设备。默认CPU
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private InferenceDeviceType _inferenceDevice = InferenceDeviceType.Cpu;
|
||||
|
||||
partial void OnInferenceDeviceChanged(InferenceDeviceType value)
|
||||
{
|
||||
// 脚本或其他调用方写入历史编号、未知值时,也与配置读取保持一致。
|
||||
if (!Enum.IsDefined(value)) InferenceDevice = InferenceDeviceType.Cpu;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否强制OCR使用CPU推理。在某些环境上使用GPU进行OCR推理会导致性能下降(比如很多使用DirectML推理的情况下)。默认开启。
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _cpuOcr = true;
|
||||
|
||||
#region 已移除参数的源注释(不读取、不保存,也不参与新推理设置)
|
||||
// 强制指定gpu设备,默认为0(使用默认设备)
|
||||
// 附加path,用;分割。默认为空。
|
||||
// 是否输出优化后的模型文件到缓存。注意:在不支持的执行器上使用会导致异常。默认关闭。
|
||||
// 强制指定cuda设备,默认为0(使用默认设备)
|
||||
// 自动附加cuda的path。一般情况下用这个就足够了。默认关闭。
|
||||
// 启用TensorRT缓存。默认开启。不开的话使用TensorRT每次加载模型会卡爆。
|
||||
// 嵌入式引擎缓存。将引擎缓存嵌入到模型中。默认开启。关闭它可能会提高性能(如果不爆炸的话)。
|
||||
// OpenVino 设备参数。
|
||||
// 启用 OpenVINO 缓存。默认关闭。
|
||||
#endregion
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using BetterGenshinImpact.Core.Recognition.ONNX;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config;
|
||||
|
||||
/// <summary>把无效推理字段隔离在硬件设置内,不能因为单个字段错误重置整份用户配置。</summary>
|
||||
public sealed class HardwareAccelerationConfigJsonConverter : JsonConverter<HardwareAccelerationConfig>
|
||||
{
|
||||
public override HardwareAccelerationConfig Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
using var document = JsonDocument.ParseValue(ref reader);
|
||||
try
|
||||
{
|
||||
var data = document.RootElement.Deserialize<SerializedConfiguration>(options);
|
||||
if (data == null) return new();
|
||||
return new()
|
||||
{
|
||||
FormatVersion = data.FormatVersion, InferenceDevice = data.InferenceDevice, CpuOcr = data.CpuOcr,
|
||||
Cpu = data.Cpu!, DirectML = data.DirectML!, OpenVINO = data.OpenVINO!, Cuda = data.Cuda!, TensorRT = data.TensorRT!,
|
||||
PaddleOcrCpu = data.PaddleOcrCpu ?? new(),
|
||||
ValidationState = data.ValidationState, VerifiedSignature = data.VerifiedSignature ?? "",
|
||||
ValidatedEngines = data.ValidatedEngines ?? [],
|
||||
LastFailedEngine = data.LastFailedEngine, LastValidationError = data.LastValidationError ?? ""
|
||||
};
|
||||
}
|
||||
catch (JsonException) { return new(); }
|
||||
}
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, HardwareAccelerationConfig value, JsonSerializerOptions options)
|
||||
=> JsonSerializer.Serialize(writer, new SerializedConfiguration
|
||||
{
|
||||
FormatVersion = value.FormatVersion, InferenceDevice = value.InferenceDevice, CpuOcr = value.CpuOcr,
|
||||
Cpu = value.Cpu, DirectML = value.DirectML, OpenVINO = value.OpenVINO, Cuda = value.Cuda, TensorRT = value.TensorRT,
|
||||
PaddleOcrCpu = value.PaddleOcrCpu,
|
||||
ValidationState = value.ValidationState, VerifiedSignature = value.VerifiedSignature,
|
||||
ValidatedEngines = value.ValidatedEngines,
|
||||
LastFailedEngine = value.LastFailedEngine, LastValidationError = value.LastValidationError
|
||||
}, options);
|
||||
|
||||
private sealed class SerializedConfiguration
|
||||
{
|
||||
public SerializedConfiguration() { }
|
||||
public int FormatVersion { get; set; }
|
||||
public InferenceDeviceType InferenceDevice { get; set; }
|
||||
public bool CpuOcr { get; set; } = true;
|
||||
public InferenceEngineSettings? Cpu { get; set; }
|
||||
public PaddleOcrCpuConfig? PaddleOcrCpu { get; set; }
|
||||
public InferenceEngineSettings? DirectML { get; set; }
|
||||
public InferenceEngineSettings? OpenVINO { get; set; }
|
||||
public InferenceEngineSettings? Cuda { get; set; }
|
||||
public InferenceEngineSettings? TensorRT { get; set; }
|
||||
public InferenceValidationState ValidationState { get; set; }
|
||||
public string? VerifiedSignature { get; set; }
|
||||
public InferenceDeviceType[]? ValidatedEngines { get; set; }
|
||||
public InferenceDeviceType? LastFailedEngine { get; set; }
|
||||
public string? LastValidationError { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using BetterGenshinImpact.Model;
|
||||
using BetterGenshinImpact.Model;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
|
||||
@@ -82,12 +82,6 @@ public partial class HotKeyConfig : ObservableObject
|
||||
[ObservableProperty]
|
||||
private string _quickBuyHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
[ObservableProperty]
|
||||
private string _oneKeyClaimRewardHotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _oneKeyClaimRewardHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
[ObservableProperty]
|
||||
private string _quickSereniteaPotHotkey = "";
|
||||
|
||||
@@ -106,13 +100,6 @@ public partial class HotKeyConfig : ObservableObject
|
||||
|
||||
[ObservableProperty]
|
||||
private string _quickTeleportTickHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 技能CD提示开关
|
||||
[ObservableProperty]
|
||||
private string _skillCdEnabledHotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _skillCdEnabledHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 截图
|
||||
[ObservableProperty]
|
||||
@@ -121,13 +108,6 @@ public partial class HotKeyConfig : ObservableObject
|
||||
[ObservableProperty]
|
||||
private string _takeScreenshotHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// Recognition 模板素材制作
|
||||
[ObservableProperty]
|
||||
private string _recognitionTemplateEditorHotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _recognitionTemplateEditorHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
[ObservableProperty]
|
||||
private string _turnAroundHotkey = "";
|
||||
|
||||
@@ -168,20 +148,6 @@ public partial class HotKeyConfig : ObservableObject
|
||||
|
||||
[ObservableProperty]
|
||||
private string _autoMusicGameHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 活动音游开始/停止
|
||||
[ObservableProperty]
|
||||
private string _autoFishingGameHotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _autoFishingGameHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 自动烹饪开始/停止
|
||||
[ObservableProperty]
|
||||
private string _autoCookGameHotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _autoCookGameHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 自动寻路
|
||||
[ObservableProperty]
|
||||
@@ -196,86 +162,4 @@ public partial class HotKeyConfig : ObservableObject
|
||||
|
||||
[ObservableProperty]
|
||||
private string _test1HotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 测试2
|
||||
[ObservableProperty]
|
||||
private string _test2Hotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _test2HotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 路径记录开始
|
||||
[ObservableProperty]
|
||||
private string _recBigMapPosHotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _recBigMapPosHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 路径记录开始
|
||||
[ObservableProperty]
|
||||
private string _pathRecorderHotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _pathRecorderHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 添加路径记录点
|
||||
[ObservableProperty]
|
||||
private string _addWaypointHotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _addWaypointHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 路径执行
|
||||
[ObservableProperty]
|
||||
private string _executePathHotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _executePathHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 日志与状态窗口展示
|
||||
[ObservableProperty]
|
||||
private string _logBoxDisplayHotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _logBoxDisplayHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 遮罩指标栏展示
|
||||
[ObservableProperty]
|
||||
private string _overlayMetricsDisplayHotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _overlayMetricsDisplayHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 键鼠录制/停止
|
||||
[ObservableProperty]
|
||||
private string _keyMouseMacroRecordHotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _keyMouseMacroRecordHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
// 暂停
|
||||
[ObservableProperty]
|
||||
private string _suspendHotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _suspendHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
// 停止任意独立任务
|
||||
[ObservableProperty]
|
||||
private string _cancelTaskHotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _cancelTaskHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 停止任意独立任务
|
||||
[ObservableProperty]
|
||||
private string _onedragonHotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _onedragonHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 地图遮罩开关
|
||||
[ObservableProperty]
|
||||
private string _mapMaskEnabledHotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _mapMaskEnabledHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
}
|
||||
Loaded 100 of 2757 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user