Compare commits
1 Commits
rft/battle
...
feat/githu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02961e60e9 |
@@ -1,9 +1,12 @@
|
||||
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
|
||||
# for clang-format 20.0.0
|
||||
# for clang-format 17.0.1
|
||||
Language: Json
|
||||
IndentWidth: 4
|
||||
---
|
||||
Language: Cpp
|
||||
BasedOnStyle: "WebKit"
|
||||
BasedOnStyle: 'WebKit'
|
||||
# AccessModifierOffset: 2
|
||||
AlignAfterOpenBracket: "AlwaysBreak"
|
||||
AlignAfterOpenBracket: 'AlwaysBreak'
|
||||
AlignArrayOfStructures: None
|
||||
AlignConsecutiveAssignments: None
|
||||
AlignConsecutiveBitFields: None
|
||||
@@ -26,9 +29,9 @@ AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLambdasOnASingleLine: Inline
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
BreakAfterReturnType: Automatic
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
BreakTemplateDeclarations: Yes
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
# AttributeMacros:
|
||||
# - __pragma
|
||||
# - _Pragma
|
||||
@@ -60,15 +63,15 @@ BraceWrapping:
|
||||
BreakAfterAttributes: Never
|
||||
BreakAfterJavaFieldAnnotations: true
|
||||
BreakArrays: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBinaryOperators: NonAssignment
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeConceptDeclarations: Always
|
||||
BreakBeforeInlineASMColon: OnlyMultiline
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: AfterColon
|
||||
BreakInheritanceList: AfterColon
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
BreakInheritanceList: BeforeComma
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 120
|
||||
ColumnLimit: 100
|
||||
# CommentPragmas: '^ MEO pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
@@ -84,12 +87,12 @@ FixNamespaceComments: true
|
||||
# - foreach
|
||||
# - Q_FOREACH
|
||||
# - BOOST_FOREACH
|
||||
# IfMacros:
|
||||
# IfMacros:
|
||||
# - 'KJ_IF_MAYBE'
|
||||
IncludeBlocks: Preserve
|
||||
# IncludeCategories:
|
||||
# IncludeIsMainRegex:
|
||||
# IncludeIsMainSourceRegex:
|
||||
# IncludeIsMainRegex:
|
||||
# IncludeIsMainSourceRegex:
|
||||
IndentAccessModifiers: false
|
||||
IndentCaseBlocks: false
|
||||
IndentCaseLabels: false
|
||||
@@ -127,7 +130,7 @@ NamespaceIndentation: None
|
||||
# ObjCSpaceAfterProperty:
|
||||
# ObjCSpaceBeforeProtocolList:
|
||||
PackConstructorInitializers: Never
|
||||
# PenaltyBreakAssignment:
|
||||
# PenaltyBreakAssignment:
|
||||
# PenaltyBreakBeforeFirstCallParameter:
|
||||
# PenaltyBreakComment:
|
||||
# PenaltyBreakFirstLessLess:
|
||||
@@ -145,7 +148,7 @@ PointerAlignment: Left
|
||||
# - constexpr
|
||||
# - type
|
||||
ReferenceAlignment: Left
|
||||
ReflowComments: Always
|
||||
ReflowComments: true
|
||||
RemoveBracesLLVM: false
|
||||
RemoveParentheses: Leave
|
||||
RemoveSemicolon: false
|
||||
@@ -180,7 +183,7 @@ SpacesInLineCommentPrefix:
|
||||
SpacesInParens: Never
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: c++20
|
||||
# StatementAttributeLikeMacros:
|
||||
# StatementAttributeLikeMacros:
|
||||
# StatementMacros:
|
||||
TabWidth: 4
|
||||
# TypeNames:
|
||||
@@ -188,4 +191,3 @@ TabWidth: 4
|
||||
UseTab: Never
|
||||
# VerilogBreakBetweenInstancePorts:
|
||||
# WhitespaceSensitiveMacros:
|
||||
RemoveEmptyLinesInUnwrappedLines: true
|
||||
|
||||
@@ -7,7 +7,10 @@
|
||||
"postCreateCommand": "sudo sh -ce 'apt update && apt install g++-12 -y && echo export CC=gcc-12 CXX=g++-12 >> /etc/profile.d/set-compiler.sh'",
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": ["llvm-vs-code-extensions.vscode-clangd", "DavidAnson.vscode-markdownlint"]
|
||||
"extensions": [
|
||||
"llvm-vs-code-extensions.vscode-clangd",
|
||||
"DavidAnson.vscode-markdownlint"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
290cc30f153a0206bd870a0a58cb6338aa16ea34
|
||||
db9afdc77e85d5fc462d923fca5318be021656cd
|
||||
a5daac889a55baf8895918d4964f20dad1938470
|
||||
9ed30c5658c88edf1ef839771a53c7d599183b8b
|
||||
|
||||
# incorrect format of 3rdparty/resource/Arknights-Tile-Pos/levels.json
|
||||
65d654e54b9d04d1902c9ee9f9fb2679520adafd
|
||||
@@ -23,7 +22,6 @@ a5daac889a55baf8895918d4964f20dad1938470
|
||||
206df466fd5e3d8ef80387049b0c5011fb58cada
|
||||
c9b5aa638a97397ab8666031ea646904527afc09
|
||||
559c913fca0dd0966896396e251be13f76ea3e52
|
||||
|
||||
# Re-structure again.
|
||||
4b3b84df8f487be0ac86506c28dbebc4635f1282
|
||||
91abbb7f175b93a58368a136acf3799666f770d2
|
||||
@@ -31,24 +29,3 @@ c9b5aa638a97397ab8666031ea646904527afc09
|
||||
bae271c09bb79e5cc2a7f8491ce882d276ac97b4
|
||||
3d83b80dd67d996a5f4f1732fe1eb36cacc7605e
|
||||
21617270bcef2456cb7f89e54560ca6788450711
|
||||
|
||||
# resource/*.json prettier mass styling
|
||||
d84da5d01a872540d520bc87408d4524e07cfa39
|
||||
546bfc399cdd140a9812f44b5e6bc89fccfda5fa
|
||||
f0bdccdf0da7fac29f475951f0f43d3ab56a7ffe
|
||||
7a758bce844bc2778f04a789195efbd17681dac7
|
||||
5f3730b76785b1168125eb3b5edbed399722f8f9
|
||||
bc3ad67a02cb3b8e154c06955cf17091c4265000
|
||||
|
||||
# oxipng template optimization
|
||||
e3d63894b28b2ef5e2405e144a32a6981de5e1b2
|
||||
|
||||
# refactor: divide tasks.json into multiple jsons
|
||||
dce6e317c8e56836662b64ac4b3d1a69b4ff4dd8
|
||||
|
||||
# usage: add "[blame ignore]" to the commit message
|
||||
# This file is managed by an automated workflow
|
||||
# Do not add, remove or modify lines below this comment
|
||||
# as they are automatically appended
|
||||
# --------------------------------------------------- #
|
||||
f7772bc814c52f9a5e65af02404cf54b70fe0a32
|
||||
|
||||
1
.gitattributes
vendored
@@ -8,5 +8,4 @@
|
||||
|
||||
*.json text eol=lf
|
||||
*.md text eol=lf
|
||||
*.yml text eol=lf
|
||||
*.yaml text eol=lf
|
||||
|
||||
1
.github/.last-blame-ignore-commit
vendored
@@ -1 +0,0 @@
|
||||
272d71fa2938f945832f86232532b86a9e5406b8
|
||||
70
.github/ISSUE_TEMPLATE/cn-bug-report.yaml
vendored
@@ -1,32 +1,20 @@
|
||||
name: Bug 反馈(使用中文)
|
||||
description: 识别错误、操作异常、连接错误等
|
||||
labels: ["bug"]
|
||||
labels: ['bug']
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: 请确认自己完成了下列必选项之后再进行勾选,若未完成必选项或勾选了"我未仔细阅读"选项将视为自愿接受被直接关闭 Issue
|
||||
label: 在提问之前...
|
||||
options:
|
||||
- label: 我理解 Issue 是用于反馈和解决问题的,而非吐槽评论区,将尽可能提供更多信息帮助问题解决
|
||||
required: true
|
||||
- label: 我填写了简短且清晰明确的标题,以便开发者在翻阅 Issue 列表时能快速确定大致问题。而不是“一个建议”、“卡住了”等
|
||||
required: true
|
||||
- label: 我使用的是当前更新版本的最新版
|
||||
required: true
|
||||
- label: 我已查看版本发布至今的 [更新内容](https://github.com/MaaAssistantArknights/MaaAssistantArknights/commits/dev/) 中尚未发布的更新内容并未提及该 Bug 已被修复的情况
|
||||
required: true
|
||||
- label: 我已查看版本发布至今的 [Pull Requests](https://github.com/MaaAssistantArknights/MaaAssistantArknights/pulls) 中尚未发布的更新内容并未提及该 Bug 已被修复的情况
|
||||
required: true
|
||||
- label: 我已在未仔细阅读这些内容的情况下勾选所有选项,并相信这不会影响问题的处理
|
||||
required: false
|
||||
- label: 我已检查了[常见问题](https://maa.plus/docs/zh-cn/manual/faq.html),确认我的问题未被提及
|
||||
required: true
|
||||
- label: 我已检查了[公告](https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/7732),确认我的问题未被提及
|
||||
required: true
|
||||
- label: 我已检查了[活跃议题](https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues),确认我的问题未被提及
|
||||
required: true
|
||||
- label: 我已检查了[已关闭议题](https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues?q=is%3Aissue%20state%3Aclosed),确认我的问题未被提及
|
||||
required: true
|
||||
- label: 我理解 Issue 是用于反馈和解决问题的,而非吐槽评论区,将尽可能提供更多信息帮助问题解决
|
||||
required: true
|
||||
- label: 我填写了简短且清晰明确的标题,以便开发者在翻阅 Issue 列表时能快速确定大致问题。而不是“一个建议”、“卡住了”等
|
||||
required: true
|
||||
- label: 我已查看最新测试版本的更新内容,并未提及该 Bug 已被修复的情况
|
||||
required: true
|
||||
- label: 我已检查了置顶议题(pinned issue),确认我的问题未被提及
|
||||
required: true
|
||||
- type: textarea
|
||||
id: describe
|
||||
attributes:
|
||||
@@ -38,49 +26,32 @@ body:
|
||||
id: version
|
||||
attributes:
|
||||
label: Version
|
||||
description: |
|
||||
请提供 MAA 版本。可在 MAA -> 设置 -> 软件更新中找到。点击图标可复制。
|
||||
请分别点击 `资源版本` 和 `MAA 版本` 并粘贴,最终应有 5 行版本信息。
|
||||
description: >-
|
||||
请提供 MAA 版本。可在 MAA -> 设置 -> 软件更新中找到(点击图标可复制)。
|
||||
placeholder: |
|
||||
Resource Version:
|
||||
MAA Version:
|
||||
UI Version:
|
||||
Core Version:
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: 日志和配置文件
|
||||
label: 日志文件
|
||||
description: |
|
||||
**请在 MAA -> 设置 -> 问题反馈中找到生成日志压缩包按钮,点击并上传压缩包**
|
||||
|
||||
**请在关闭MAA后,上传 `debug` 文件夹中的 `asst.log` 和 `gui.log` 日志文件,并说明问题出现的大致时间点**
|
||||
**请直接将完整的文件拖拽进来,而非自己裁切或复制的片段;若文件体积过大可压缩后再上传**
|
||||
|
||||
如果你在使用 MacBook,请点击屏幕左上角的“文件”,点击“打开日志文件夹”
|
||||
placeholder: |
|
||||
请确认上传文件前已关闭 MAA
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: configuration
|
||||
attributes:
|
||||
label: 配置信息
|
||||
description: |
|
||||
请说明操作系统及版本、模拟器品牌、模拟器分辨率、DPI、帧率;
|
||||
若正在使用 MuMu 12 或雷电 9,请说明截图增强是否开启;
|
||||
最后请说明 GPU 加速推理是否开启,若开启请提供 GPU 型号。
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: screenshots
|
||||
attributes:
|
||||
label: 截图或录屏
|
||||
label: 截图
|
||||
description: |
|
||||
`debug` 目录下按功能分类的文件夹内,有一些自动截图的错误图片,若有相关的,请一并打包上传
|
||||
|
||||
可上传屏幕截图或录制以帮助解释你的问题,包括但不限于 MAA 软件截图、游戏画面截图
|
||||
如果有,添加屏幕截图以帮助解释你的问题,包括但不限于 MAA 软件截图、游戏画面截图
|
||||
若是**识别相关问题**,请尽可能提供模拟器自带的截图工具截取的无遮挡的**原图**(或通过 adb 截取原图)
|
||||
用其他的工具(如QQ/微信)截取的图片包含窗口边框且长宽比、分辨率不固定,不利于我们排除bug
|
||||
若文件体积过大可压缩后再上传
|
||||
用其他的工具(如QQ)截取的图片包含窗口边框,不利于我们排除bug
|
||||
`debug` 文件夹下有一些自动截图的错误图片,若有相关的,请一并打包上传
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
@@ -88,6 +59,7 @@ body:
|
||||
attributes:
|
||||
label: 还有别的吗?
|
||||
description: |
|
||||
使用的模拟器?操作系统?相关的配置?链接?参考资料?
|
||||
任何能让我们对你所遇到的问题有更多了解的东西
|
||||
validations:
|
||||
required: false
|
||||
|
||||
26
.github/ISSUE_TEMPLATE/cn-feature-request.yaml
vendored
@@ -1,30 +1,16 @@
|
||||
name: 需求建议(使用中文)
|
||||
description: 新功能、建议等
|
||||
labels: ["enhancement"]
|
||||
labels: ['enhancement']
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: 请确认自己完成了下列必选项之后再进行勾选,若未完成必选项或勾选了"我未仔细阅读"选项将视为自愿接受被直接关闭 Issue
|
||||
label: 在提问之前...
|
||||
options:
|
||||
- label: 我填写了简短且清晰明确的标题,以便开发者在翻阅 Issue 列表时能快速确定大致问题。而不是“一个建议”、“卡住了”等
|
||||
required: true
|
||||
- label: 我基本确定这是一个新功能/建议,而不是遇到了 Bug(不确定的话请附上日志)
|
||||
required: true
|
||||
- label: 我使用的是当前更新版本的最新版
|
||||
required: true
|
||||
- label: 我已查看版本发布至今的 [更新内容](https://github.com/MaaAssistantArknights/MaaAssistantArknights/commits/dev/) 中尚未发布的更新内容,确认我的建议未被提及
|
||||
required: true
|
||||
- label: 我已查看版本发布至今的 [Pull Requests](https://github.com/MaaAssistantArknights/MaaAssistantArknights/pulls) 中尚未发布的更新内容,确认我的建议未被提及
|
||||
required: true
|
||||
- label: 我已在未仔细阅读这些内容的情况下勾选所有选项,并相信这不会影响问题的处理
|
||||
required: false
|
||||
- label: 我已检查了 [公告](/MaaAssistantArknights/MaaAssistantArknights/issues/7732),确认我的建议未被提及
|
||||
required: true
|
||||
- label: 我已检查了 [活跃议题](https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues),确认我的建议未被提及
|
||||
required: true
|
||||
- label: 我已检查了 [已关闭议题](https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues?q=is%3Aissue%20state%3Aclosed),确认我的建议未被提及
|
||||
required: true
|
||||
- label: 我填写了简短且清晰明确的标题,以便开发者在翻阅 Issue 列表时能快速确定大致问题。而不是“一个建议”、“卡住了”等
|
||||
required: true
|
||||
- label: 我基本确定这是一个新功能/建议,而不是遇到了 Bug(不确定的话请附上日志)
|
||||
required: true
|
||||
- type: textarea
|
||||
id: describe
|
||||
attributes:
|
||||
|
||||
85
.github/ISSUE_TEMPLATE/cn-ld-report.yaml
vendored
@@ -1,85 +0,0 @@
|
||||
name: 雷电截图增强反馈(使用中文)
|
||||
description: 有关雷电 9 截图增强功能的集中反馈
|
||||
labels: ["LD9 API"]
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: 在提问之前...
|
||||
options:
|
||||
- label: 我理解 Issue 是用于反馈和解决问题的,而非吐槽评论区,将尽可能提供更多信息帮助问题解决
|
||||
required: true
|
||||
- label: 我填写了简短且清晰明确的标题,以便开发者在翻阅 Issue 列表时能快速确定大致问题。而不是“一个建议”、“卡住了”等
|
||||
required: true
|
||||
- label: 我已检查了[公告](/MaaAssistantArknights/MaaAssistantArknights/issues/7732)、[活跃议题](https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues)、[已关闭议题](https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues?q=is%3Aissue%20state%3Aclosed),确认我的问题未被提及
|
||||
required: true
|
||||
- label: 我正在使用最新的 MAA 公测版本和最新的官版雷电 9 模拟器
|
||||
required: true
|
||||
- label: 我已参考文档确定安装路径、实例编号填写正确,并确认在关闭截图增强模式后问题消失
|
||||
required: true
|
||||
- label: 我未开启高帧率,且模拟器帧数设置为 60
|
||||
required: false
|
||||
- label: 我已在未仔细阅读这些内容的情况下勾选所有选项,并相信这不会影响问题的处理
|
||||
required: false
|
||||
- type: textarea
|
||||
id: describe
|
||||
attributes:
|
||||
label: 问题描述
|
||||
description: 描述问题时请尽可能详细
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: version
|
||||
attributes:
|
||||
label: Version
|
||||
description: |
|
||||
请提供 MAA 版本和雷电 9 版本。MAA 版本可在 MAA -> 设置 -> 软件更新中找到(点击图标可复制)。
|
||||
雷电 9 版本可在右上角菜单按钮 -> 关于雷电 中找到。
|
||||
placeholder: |
|
||||
Resource Version:
|
||||
MAA Version:
|
||||
雷电 9 版本号:
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: MAA 日志和配置文件
|
||||
description: |
|
||||
**请在 MAA -> 设置 -> 问题反馈中找到生成日志压缩包按钮,点击并上传压缩包**
|
||||
|
||||
**请直接将完整的文件拖拽进来,而非自己裁切或复制的片段;若文件体积过大可压缩后再上传**
|
||||
placeholder: |
|
||||
请确认上传文件前已关闭 MAA
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: ldlogs
|
||||
attributes:
|
||||
label: 雷电 9 诊断信息
|
||||
description: |
|
||||
**在雷电 9 右上角菜单按钮 -> 诊断信息 中点击 复制信息,并将全部内容粘贴进来。**
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: screenshots
|
||||
attributes:
|
||||
label: 截图
|
||||
description: |
|
||||
`debug` 目录下按功能分类的文件夹内,有一些自动截图的错误图片,若有相关的,请一并打包上传
|
||||
|
||||
可上传屏幕截图或录制以帮助解释你的问题,包括但不限于 MAA 软件截图、游戏画面截图
|
||||
若是**识别相关问题**,请尽可能提供模拟器自带的截图工具截取的无遮挡的**原图**(或通过 adb 截取原图)
|
||||
用其他的工具(如QQ/微信)截取的图片包含窗口边框且长宽比、分辨率不固定,不利于我们排除bug
|
||||
若文件体积过大可压缩后再上传
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: others
|
||||
attributes:
|
||||
label: 其他
|
||||
description: |
|
||||
GPU 加速推理是否开启,若开启请提供 GPU 型号。
|
||||
亦或者任何能让我们对你所遇到的问题有更多了解的东西
|
||||
validations:
|
||||
required: false
|
||||
63
.github/ISSUE_TEMPLATE/cn-mumu-report.yaml
vendored
@@ -1,26 +1,26 @@
|
||||
name: MuMu 截图增强反馈(使用中文)
|
||||
description: 有关 MuMu 截图增强功能的集中反馈
|
||||
labels: ["MuMu API"]
|
||||
labels: ['mumu api']
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: 在提问之前...
|
||||
options:
|
||||
- label: 我理解 Issue 是用于反馈和解决问题的,而非吐槽评论区,将尽可能提供更多信息帮助问题解决
|
||||
required: true
|
||||
- label: 我填写了简短且清晰明确的标题,以便开发者在翻阅 Issue 列表时能快速确定大致问题。而不是“一个建议”、“卡住了”等
|
||||
required: true
|
||||
- label: 我已检查了[公告](/MaaAssistantArknights/MaaAssistantArknights/issues/7732)、[活跃议题](https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues)、[已关闭议题](https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues?q=is%3Aissue%20state%3Aclosed),确认我的问题未被提及
|
||||
required: true
|
||||
- label: 我正在使用最新的 MAA 公测版本和最新的官版或方舟专版 MuMu 模拟器
|
||||
required: true
|
||||
- label: 我已参考文档确定安装路径、实例编号、屏幕编号填写正确,并确认在关闭截图增强模式后问题消失
|
||||
required: true
|
||||
- label: 我未开启后台保活,模拟器帧数为 60,显存使用策略为“画面表现更好”
|
||||
required: false
|
||||
- label: 我已在未仔细阅读这些内容的情况下勾选所有选项,并相信这不会影响问题的处理
|
||||
required: false
|
||||
- label: 我理解 Issue 是用于反馈和解决问题的,而非吐槽评论区,将尽可能提供更多信息帮助问题解决
|
||||
required: true
|
||||
- label: 我填写了简短且清晰明确的标题,以便开发者在翻阅 Issue 列表时能快速确定大致问题。而不是“一个建议”、“卡住了”等
|
||||
required: true
|
||||
- label: 我已检查了置顶议题(Pinned Issue),确认我的问题未被提及
|
||||
required: true
|
||||
- label: 我正在使用最新的 MAA 内测版本和最新的**官版** MuMu 模拟器
|
||||
required: true
|
||||
- label: 我已参考文档确定安装路径、实例编号、屏幕编号填写正确,并确认在关闭截图增强模式后问题消失
|
||||
required: true
|
||||
- label: 我未开启高帧率模式,且显存使用策略为“画面表现更好”
|
||||
required: false
|
||||
- label: 我正在使用后台保活功能,并确定该问题仅在开启后台保活时出现
|
||||
required: false
|
||||
- type: textarea
|
||||
id: describe
|
||||
attributes:
|
||||
@@ -32,25 +32,22 @@ body:
|
||||
id: version
|
||||
attributes:
|
||||
label: Version
|
||||
description: |
|
||||
请提供 MAA 版本和 MuMu 版本。MAA 版本可在 MAA -> 设置 -> 软件更新中找到(点击图标可复制)。
|
||||
MuMu 版本可在右上角菜单按钮 -> 关于 MuMu 中找到。
|
||||
description: >-
|
||||
请提供 MAA 版本和 MuMu 版本。MAA 版本可在 MAA -> 设置 -> 软件更新中找到(点击图标可复制)。MuMu 版本可在右上角菜单按钮 -> 关于 MuMu 中找到。
|
||||
placeholder: |
|
||||
Resource Version:
|
||||
MAA Version:
|
||||
MuMu 版本号:
|
||||
Resource Version:
|
||||
UI Version:
|
||||
Core Version:
|
||||
MuMu 版本号:
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: MAA 日志和配置文件
|
||||
label: MAA 日志文件
|
||||
description: |
|
||||
**请在 MAA -> 设置 -> 问题反馈中找到生成日志压缩包按钮,点击并上传压缩包**
|
||||
|
||||
**上传 `debug` 文件夹中的 `asst.log` 和 `gui.log` 日志文件,并说明问题出现的大致时间点**
|
||||
**请直接将完整的文件拖拽进来,而非自己裁切或复制的片段;若文件体积过大可压缩后再上传**
|
||||
placeholder: |
|
||||
请确认上传文件前已关闭 MAA
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
@@ -67,20 +64,18 @@ body:
|
||||
attributes:
|
||||
label: 截图
|
||||
description: |
|
||||
`debug` 目录下按功能分类的文件夹内,有一些自动截图的错误图片,若有相关的,请一并打包上传
|
||||
|
||||
可上传屏幕截图或录制以帮助解释你的问题,包括但不限于 MAA 软件截图、游戏画面截图
|
||||
如果有,添加屏幕截图以帮助解释你的问题,包括但不限于 MAA 软件截图、游戏画面截图
|
||||
若是**识别相关问题**,请尽可能提供模拟器自带的截图工具截取的无遮挡的**原图**(或通过 adb 截取原图)
|
||||
用其他的工具(如QQ/微信)截取的图片包含窗口边框且长宽比、分辨率不固定,不利于我们排除bug
|
||||
若文件体积过大可压缩后再上传
|
||||
用其他的工具(如QQ)截取的图片包含窗口边框,不利于我们排除bug
|
||||
`debug` 文件夹下有一些自动截图的错误图片,若有相关的,请一并打包上传
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: others
|
||||
attributes:
|
||||
label: 其他
|
||||
label: 还有别的吗?
|
||||
description: |
|
||||
GPU 加速推理是否开启,若开启请提供 GPU 型号。
|
||||
亦或者任何能让我们对你所遇到的问题有更多了解的东西
|
||||
操作系统?相关的配置?链接?参考资料?
|
||||
任何能让我们对你所遇到的问题有更多了解的东西
|
||||
validations:
|
||||
required: false
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/cn-others.yaml
vendored
@@ -1,6 +1,6 @@
|
||||
name: 其他议题(使用中文)
|
||||
description: 提出问题,而不是 Bug 反馈或需求建议
|
||||
labels: ["question"]
|
||||
labels: ['question']
|
||||
body:
|
||||
- type: textarea
|
||||
id: describe
|
||||
|
||||
99
.github/ISSUE_TEMPLATE/en-bug-report.yaml
vendored
@@ -2,35 +2,32 @@ name: Bug Report (in English)
|
||||
description: >-
|
||||
Recognition errors, operation abnormalities,
|
||||
connection errors, etc.
|
||||
labels: ["bug"]
|
||||
labels: ['bug']
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: |
|
||||
Please ensure that you have completed the required items before checking the boxes.
|
||||
Issues with incomplete required items or with the 'I did not read carefully' option checked will be considered voluntary acceptance of direct closure.
|
||||
label: Before raising the issue...
|
||||
options:
|
||||
- label: I understand that Issues are for feedback and problem solving, not trolling the comments section, and will provide as much information as possible to help solve the problem.
|
||||
required: true
|
||||
- label: I filled in a short, clear title so that developers could quickly identify the general problem when going through the issue list. Instead of "Some suggestions", "Stuck", etc.
|
||||
required: true
|
||||
- label: I am using the latest version of the current update version.
|
||||
required: true
|
||||
- label: I have reviewed both the [Unreleased changes](https://github.com/MaaAssistantArknights/MaaAssistantArknights/commits/dev/) and there is no mention of the bug being fixed.
|
||||
required: true
|
||||
- label: I have reviewed the [Pull Requests](https://github.com/MaaAssistantArknights/MaaAssistantArknights/pulls) and there is no mention of the bug being fixed.
|
||||
required: true
|
||||
- label: I have checked all the options without carefully reading the content and believe this will not affect issue resolution.
|
||||
required: false
|
||||
- label: I have reviewed the [FAQs](https://maa.plus/docs/en-us/manual/faq.html) to ensure that my issue/bug has not been mentioned.
|
||||
required: true
|
||||
- label: I have reviewed the [Announcement](/MaaAssistantArknights/MaaAssistantArknights/issues/7732) to ensure that my issue/bug has not been mentioned.
|
||||
required: true
|
||||
- label: I have reviewed the [Open Issue](https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues) to ensure that my issue/bug has not been mentioned.
|
||||
required: true
|
||||
- label: I have reviewed the [Closed Issue](https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues?q=is%3Aissue%20state%3Aclosed) to ensure that my issue/bug has not been mentioned.
|
||||
required: true
|
||||
- label: >-
|
||||
I understand that Issues are for feedback and problem solving,
|
||||
not trolling the comments section, and will provide as
|
||||
much information as possible to help solve the problem.
|
||||
required: true
|
||||
- label: >-
|
||||
I filled in a short, clear title
|
||||
so that developers could quickly identify the general problem
|
||||
when going through the issue list.
|
||||
Instead of "Some suggestions", "Stuck", etc.
|
||||
required: true
|
||||
- label: >-
|
||||
I have checked the latest beta update and there is no mention
|
||||
of the bug being fixed.
|
||||
required: true
|
||||
- label: >-
|
||||
I have reviewed the pinned issues and confirmed that my issue
|
||||
is not mentioned.
|
||||
required: true
|
||||
- type: textarea
|
||||
id: describe
|
||||
attributes:
|
||||
@@ -42,48 +39,32 @@ body:
|
||||
id: version
|
||||
attributes:
|
||||
label: Version
|
||||
description: |
|
||||
Please provide the MAA version. Can be found in MAA -> Settings -> Update. Click to copy.
|
||||
Click on `Resource Version` and `MAA Version` and paste them respectively. There should be 5 lines of version information in total.
|
||||
description: >-
|
||||
Please provide the MAA version. Can be found in MAA -> Settings -> Update. (Click to copy)
|
||||
placeholder: |
|
||||
Resource Version:
|
||||
MAA Version:
|
||||
UI Version:
|
||||
Core Version:
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Log and config files
|
||||
label: Log files
|
||||
description: >-
|
||||
**Please locate the Generate Support Payload button under MAA Settings -> Issue Report, click the button, and upload the generated zip file**
|
||||
**After closing the MAA, upload the `asst.log` and `gui.log` log file in the `debug` folder and**
|
||||
**indicate the approximate point in time when the problem occurred.**
|
||||
|
||||
**Please drag and drop the full file in, not your own cuttings or copies; compress it before uploading if too large.**
|
||||
|
||||
If you are using MacBook, please click the "File" option in the top-left corner of the screen, then click "Open Log Folder".
|
||||
placeholder: |
|
||||
Please confirm that MAA is not running before uploading files.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: configuration
|
||||
attributes:
|
||||
label: Configuration information
|
||||
description: |
|
||||
Please specify the operating system and version, emulator brand, emulator resolution, DPI, and frame rate;
|
||||
If you are using MuMu 12 or LDPlayer 9, please specify whether Screenshot Enhancement is enabled;
|
||||
Finally, please specify whether GPU accelerated inference is enabled, and if so, provide the GPU model.
|
||||
**Please drag and drop the full file in, not your own cuttings or copies;**
|
||||
**compress it before uploading if too large.**
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: screenshots
|
||||
attributes:
|
||||
label: Screenshots or recordings
|
||||
label: Screenshots
|
||||
description: >-
|
||||
In the `debug` directory, within the functionally categorized folders,
|
||||
there are some error images captured automatically.
|
||||
If related to this issue, please upload them together.
|
||||
|
||||
If available, upload screenshots and recordings to help explain your problem,
|
||||
If available, add screenshots to help explain your problem,
|
||||
including but not limited to screenshots of MAA software,
|
||||
screenshots of game screens.
|
||||
|
||||
@@ -91,11 +72,11 @@ body:
|
||||
the **original image** taken by the emulator's own screenshot tool
|
||||
(or via adb).
|
||||
|
||||
Screenshots taken with other tools may contain the frames of the window/emulator
|
||||
and their aspect ratio and resolution are inconsistent,
|
||||
which makes it harder for us to debug.
|
||||
Screenshots taken with other tools may contain the frames of the window/emulator, which makes it harder for us to debug.
|
||||
|
||||
If the file siz is too large, you may compress it before uploading.
|
||||
The `debug` folder has some automatic screenshots of the error images,
|
||||
if you have any,
|
||||
please upload them together.
|
||||
|
||||
validations:
|
||||
required: false
|
||||
@@ -103,7 +84,11 @@ body:
|
||||
id: others
|
||||
attributes:
|
||||
label: Anthing else?
|
||||
description: |
|
||||
Anything that will give us more insight into the problem you are having.
|
||||
description: >-
|
||||
Emulator used, operating system, related configuration, links,
|
||||
reference material, etc.
|
||||
|
||||
Anything that will give us more insight into the problem
|
||||
you are having.
|
||||
validations:
|
||||
required: false
|
||||
|
||||
39
.github/ISSUE_TEMPLATE/en-feature-request.yaml
vendored
@@ -1,43 +1,16 @@
|
||||
name: Feature Request (in English)
|
||||
description: New features, suggestions, etc.
|
||||
labels: ["enhancement"]
|
||||
labels: ['enhancement']
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: |
|
||||
Please ensure that you have completed the required items before checking the boxes.
|
||||
Issues with incomplete required items or with the 'I did not read carefully' option checked will be considered voluntary acceptance of direct closure.
|
||||
label: Before raising the issue...
|
||||
options:
|
||||
- label: |
|
||||
I filled in a short, clear title so that developers could quickly identify the general problem when going through the issue list.
|
||||
Instead of "Some suggestions", "Stuck", etc.
|
||||
required: true
|
||||
- label: |
|
||||
I'm probably sure this is a new feature/suggestion and not a bug encountered (please attach logs if you're not sure).
|
||||
required: true
|
||||
- label: |
|
||||
I am using the latest version of the current update version.
|
||||
required: true
|
||||
- label: |
|
||||
I have reviewed the [Unreleased changes](https://github.com/MaaAssistantArknights/MaaAssistantArknights/commits/dev/) ,
|
||||
but there is no mention of this feature/suggestion being added.
|
||||
required: true
|
||||
- label: |
|
||||
I have reviewed the [Pull requests](https://github.com/MaaAssistantArknights/MaaAssistantArknights/pulls) ,
|
||||
but there is no mention of this feature/suggestion being added.
|
||||
required: true
|
||||
- label: I have checked all the options without carefully reading the content and believe this will not affect issue resolution.
|
||||
required: false
|
||||
- label: |
|
||||
I have reviewed the [Announcement](/MaaAssistantArknights/MaaAssistantArknights/issues/7732) to ensure that my feature/suggestion has not been mentioned.
|
||||
required: true
|
||||
- label: |
|
||||
I have reviewed the [Open Issue](https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues) to ensure that my feature/suggestion has not been mentioned.
|
||||
required: true
|
||||
- label: |
|
||||
I have reviewed the [Closed Issue](https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues?q=is%3Aissue%20state%3Aclosed) to ensure that my feature/suggestion has not been mentioned.
|
||||
required: true
|
||||
- label: I filled in a short, clear title so that developers could quickly identify the general problem when going through the issue list. Instead of "Some suggestions", "Stuck", etc.
|
||||
required: true
|
||||
- label: I'm probably sure this is a new feature/suggestion and not a bug encountered (please attach logs if you're not sure)
|
||||
required: true
|
||||
- type: textarea
|
||||
id: describe
|
||||
attributes:
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/en-others.yaml
vendored
@@ -1,6 +1,6 @@
|
||||
name: Others (in English)
|
||||
description: Ask a question rather than a bug report or feature request.
|
||||
labels: ["question"]
|
||||
labels: ['question']
|
||||
body:
|
||||
- type: textarea
|
||||
id: describe
|
||||
|
||||
18
.github/dependabot.yaml
vendored
@@ -1,18 +0,0 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: github-actions
|
||||
directory: /.github/workflows
|
||||
schedule:
|
||||
interval: weekly
|
||||
commit-message:
|
||||
prefix: ci
|
||||
assignees:
|
||||
- constrat
|
||||
- AnnAngela
|
||||
groups:
|
||||
github-actions:
|
||||
patterns:
|
||||
- "*"
|
||||
ignore:
|
||||
- dependency-name: "Nerixyz/actionsx-prettier"
|
||||
versions: ["3.0.0"]
|
||||
1057
.github/issue-checker.yml
vendored
1
.github/release_reviewers.yaml
vendored
@@ -11,6 +11,7 @@ reviewers:
|
||||
# A list of assignees to be added to pull requests (GitHub user name)
|
||||
assignees:
|
||||
- AnnAngela
|
||||
|
||||
# A list of keywords to be skipped the process that add reviewers if pull requests include it
|
||||
# skipKeywords:
|
||||
# - wip
|
||||
|
||||
38
.github/stale_cache_remover.ps1
vendored
@@ -1,38 +0,0 @@
|
||||
$totalClearedSize = 0
|
||||
$cacheList = gh cache list --json id,ref,sizeInBytes | ConvertFrom-Json
|
||||
$prCaches = $cacheList | Where-Object { $_.ref -like "*merge*" }
|
||||
|
||||
if (-not $prCaches) {
|
||||
Write-Output "No PR caches found."
|
||||
exit
|
||||
}
|
||||
|
||||
foreach ($cache in $prCaches) {
|
||||
$cacheId = $cache.id
|
||||
$cacheRef = $cache.ref
|
||||
$cacheSizeInBytes = $cache.sizeInBytes
|
||||
|
||||
if ($cacheRef -match "refs/pull/(\d+)/merge") {
|
||||
$prNumber = $matches[1]
|
||||
|
||||
Write-Host "PR #${prNumber}: " -NoNewline
|
||||
|
||||
$prStatus = gh pr view $prNumber --json state | ConvertFrom-Json
|
||||
|
||||
Write-Host $prStatus.state -NoNewline
|
||||
|
||||
if ($prStatus.state -eq "MERGED" -or $prStatus.state -eq "CLOSED") {
|
||||
Write-Host " -> DELETING"
|
||||
|
||||
gh cache delete $cacheId
|
||||
|
||||
$totalClearedSize += $cacheSizeInBytes
|
||||
}
|
||||
else {
|
||||
Write-Host ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$formattedSize = "{0:N2}" -f ($totalClearedSize / 1MB)
|
||||
Write-Output "Cleared size: $formattedSize MB"
|
||||
49
.github/workflows/blame-ignore.yml
vendored
@@ -1,49 +0,0 @@
|
||||
name: Git Blame Ignore
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "45 21 * * *" # Runs daily at 22:00 UTC
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
blame-ignore:
|
||||
if: github.repository_owner == 'MaaAssistantArknights'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false # Needed to bypass protection rules in Push changes
|
||||
|
||||
- name: Check blame
|
||||
id: check_changes
|
||||
run: |
|
||||
LAST_CHECKED_COMMIT=$(cat .github/.last-blame-ignore-commit 2>/dev/null || git rev-list --max-parents=0 HEAD)
|
||||
|
||||
git log $LAST_CHECKED_COMMIT..HEAD --pretty=format:"%H %s" --grep="\[blame ignore\]" | awk '{print $1}' >> .git-blame-ignore-revs
|
||||
|
||||
git diff --quiet .git-blame-ignore-revs
|
||||
|
||||
- name: Commit and Push changes
|
||||
if: ${{ steps.check_changes.outcome == 'failure' }}
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
git rev-parse HEAD > .github/.last-blame-ignore-commit
|
||||
|
||||
git add .github/.last-blame-ignore-commit .git-blame-ignore-revs
|
||||
git commit -m "chore: auto blame ignore" -m "[skip changelog]"
|
||||
|
||||
- name: Push changes
|
||||
if: ${{ steps.check_changes.outcome == 'failure' }}
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
||||
branch: ${{ github.ref }}
|
||||
github_token: ${{ secrets.MAA_RESOURCE_SYNC }}
|
||||
|
||||
- name: Stop if no changes
|
||||
if: ${{ steps.check_changes.outcome == 'success' }}
|
||||
uses: andymckay/cancel-action@0.5
|
||||
39
.github/workflows/cache-delete.yml
vendored
@@ -1,39 +0,0 @@
|
||||
name: Delete Cache
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [closed]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
pr_number:
|
||||
description: "PR Number"
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
cache-delete:
|
||||
# Run only on organization branches with PRs
|
||||
if: github.event_name == 'workflow_dispatch' ||
|
||||
github.event.pull_request.head.repo.full_name ==
|
||||
github.event.pull_request.base.repo.full_name
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Delete cache on PR merged
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
|
||||
PR_NUMBER=${{ github.event.inputs.pr_number }}
|
||||
else
|
||||
PR_NUMBER=${{ github.event.pull_request.number }}
|
||||
fi
|
||||
echo "PR Number: $PR_NUMBER"
|
||||
|
||||
curl -s -L https://api.github.com/repos/Maaassistantarknights/Maaassistantarknights/actions/caches |
|
||||
jq -r --arg PR_NUMBER "refs/pull/$PR_NUMBER/merge" '.actions_caches[] | select(.ref == $PR_NUMBER) | .id' |
|
||||
while read -r id; do
|
||||
echo "Deleting cache with ID: $id"
|
||||
|
||||
curl -L -X DELETE \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
"https://api.github.com/repos/MaaAssistantArknights/MaaAssistantArknights/actions/caches/$id"
|
||||
done
|
||||
174
.github/workflows/ci.yml
vendored
@@ -28,17 +28,8 @@ on:
|
||||
- "!**/*.md"
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
meta:
|
||||
# Prevent duplicate runs on organization branches with PRs
|
||||
if: github.event_name != 'pull_request' ||
|
||||
github.event.pull_request.head.repo.full_name !=
|
||||
github.event.pull_request.base.repo.full_name
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
tag: ${{ steps.set_tag.outputs.tag }}
|
||||
@@ -89,8 +80,6 @@ jobs:
|
||||
fi
|
||||
echo >> CHANGELOG.md
|
||||
echo "**Full Changelog**: [$last_tag -> $this_tag](https://github.com/MaaAssistantArknights/MaaAssistantArknights/compare/${last_tag}...${this_tag})" >> CHANGELOG.md
|
||||
echo >> CHANGELOG.md
|
||||
echo "[已有 Mirror酱 CDK?前往 Mirror酱 高速下载](https://mirrorchyan.com/zh/projects?rid=MAA&source=maagh-release)" >> CHANGELOG.md
|
||||
|
||||
- name: Upload changelog to Github
|
||||
uses: actions/upload-artifact@v4
|
||||
@@ -100,11 +89,6 @@ jobs:
|
||||
path: CHANGELOG.md
|
||||
|
||||
windows:
|
||||
# Prevent duplicate runs on organization branches with PRs
|
||||
if: github.event_name != 'pull_request' ||
|
||||
github.event.pull_request.head.repo.full_name !=
|
||||
github.event.pull_request.base.repo.full_name
|
||||
|
||||
needs: meta
|
||||
strategy:
|
||||
matrix:
|
||||
@@ -122,10 +106,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
|
||||
- name: Fetch submodules
|
||||
run: |
|
||||
git submodule update --init --depth 1 3rdparty/EmulatorExtras
|
||||
submodules: recursive
|
||||
|
||||
- name: Cache .nuke/temp, ~/.nuget/packages
|
||||
id: cache-nuget
|
||||
@@ -140,16 +121,7 @@ jobs:
|
||||
if: steps.cache-nuget.outputs.cache-hit != 'true'
|
||||
run: dotnet restore
|
||||
|
||||
- name: Cache MaaDeps
|
||||
id: cache-maadeps
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./MaaDeps
|
||||
key: ${{ runner.os }}-${{ matrix.lowercase_target }}-maadeps-${{ hashFiles('./maadeps-download.py') }}
|
||||
|
||||
- name: Bootstrap MaaDeps
|
||||
if: steps.cache-maadeps.outputs.cache-hit != 'true'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
@@ -207,28 +179,17 @@ jobs:
|
||||
path: artifacts
|
||||
|
||||
ubuntu:
|
||||
# Prevent duplicate runs on organization branches with PRs
|
||||
if: github.event_name != 'pull_request' ||
|
||||
github.event.pull_request.head.repo.full_name !=
|
||||
github.event.pull_request.base.repo.full_name
|
||||
|
||||
needs: meta
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [aarch64, x86_64]
|
||||
permissions:
|
||||
actions: write
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
|
||||
- name: Fetch submodules
|
||||
run: |
|
||||
git submodule update --init --depth 1 3rdparty/EmulatorExtras
|
||||
git submodule update --init --depth 1 src/maa-cli
|
||||
submodules: recursive
|
||||
|
||||
- name: Install cross compile toolchains
|
||||
if: ${{ matrix.arch != 'x86_64' }}
|
||||
@@ -236,7 +197,11 @@ jobs:
|
||||
sudo apt-get update
|
||||
sudo apt-get install g++-12-aarch64-linux-gnu g++-12-aarch64-linux-gnu
|
||||
|
||||
# Caching not necessary on ubuntu runner
|
||||
- name: Setup ccache
|
||||
uses: Chocobo1/setup-ccache-action@v1
|
||||
with:
|
||||
remove_stale_cache: false
|
||||
|
||||
- name: Bootstrap MaaDeps
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -247,7 +212,6 @@ jobs:
|
||||
run: |
|
||||
mkdir -p build
|
||||
cmake -B build \
|
||||
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON \
|
||||
-DMAADEPS_TRIPLET='maa-${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}-linux' \
|
||||
-DINSTALL_THIRD_LIBS=ON \
|
||||
-DINSTALL_RESOURCE=ON \
|
||||
@@ -258,12 +222,8 @@ jobs:
|
||||
mkdir -p install
|
||||
cmake --install build --prefix install
|
||||
env:
|
||||
CC: ${{ matrix.arch == 'x86_64' && 'gcc-12' || 'aarch64-linux-gnu-gcc-12' }}
|
||||
CXX: ${{ matrix.arch == 'x86_64' && 'g++-12' || 'aarch64-linux-gnu-g++-12' }}
|
||||
CMAKE_COLOR_DIAGNOSTICS: ON
|
||||
CLICOLOR_FORCE: 1
|
||||
CXXFLAGS: | # workaround for gcc bugs
|
||||
-Wno-error=restrict -Wno-error=array-bounds -Wno-error=stringop-overread -Wno-error=missing-field-initializers
|
||||
CC: ${{ matrix.arch == 'x86_64' && 'ccache gcc-12' || 'ccache aarch64-linux-gnu-gcc-12' }}
|
||||
CXX: ${{ matrix.arch == 'x86_64' && 'ccache g++-12' || 'ccache aarch64-linux-gnu-g++-12' }}
|
||||
|
||||
- name: Setup Cross Compile Toolchains for CLI
|
||||
uses: ./src/maa-cli/.github/actions/setup
|
||||
@@ -310,9 +270,9 @@ jobs:
|
||||
cp -v tools/AppImage/io.github.maaassistantarknights.maaassistantarknights.metainfo.xml Maa.AppDir/usr/share/metainfo/
|
||||
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
|
||||
# appimagetool with embedded runtime does not support cross build, till AppImage/appimagetool 7a10b8
|
||||
wget "https://github.com/AppImage/type2-runtime/releases/download/old/runtime-fuse3-${{ matrix.arch }}"
|
||||
wget "https://github.com/AppImage/type2-runtime/releases/download/continuous/runtime-${{ matrix.arch }}"
|
||||
chmod a+x appimagetool-x86_64.AppImage
|
||||
ARCH=${{ matrix.arch }} ./appimagetool-x86_64.AppImage --runtime-file runtime-fuse3-${{ matrix.arch }} Maa.AppDir
|
||||
ARCH=${{ matrix.arch }} ./appimagetool-x86_64.AppImage --runtime-file runtime-${{ matrix.arch }} Maa.AppDir
|
||||
chmod a+x MaaAssistantArknights-${{ matrix.arch }}.AppImage
|
||||
mv -v MaaAssistantArknights-${{ matrix.arch }}.AppImage $GITHUB_WORKSPACE/release/MAA-${{ needs.meta.outputs.tag }}-linux-${{ matrix.arch }}.AppImage
|
||||
|
||||
@@ -331,11 +291,6 @@ jobs:
|
||||
release/*.tar.gz
|
||||
|
||||
macOS-Core:
|
||||
# Prevent duplicate runs on organization branches with PRs
|
||||
if: github.event_name != 'pull_request' ||
|
||||
github.event.pull_request.head.repo.full_name !=
|
||||
github.event.pull_request.base.repo.full_name
|
||||
|
||||
needs: meta
|
||||
runs-on: macos-14
|
||||
strategy:
|
||||
@@ -351,7 +306,6 @@ jobs:
|
||||
run: |
|
||||
brew install ninja
|
||||
|
||||
# Caching not necessary on macOS runner
|
||||
- name: Bootstrap MaaDeps
|
||||
run: |
|
||||
[[ ${{ matrix.arch }} = "arm64" ]] && triplet="arm64-osx" || triplet="x64-osx"
|
||||
@@ -375,11 +329,6 @@ jobs:
|
||||
path: "install/*.dylib"
|
||||
|
||||
macOS-GUI:
|
||||
# Prevent duplicate runs on organization branches with PRs
|
||||
if: github.event_name != 'pull_request' ||
|
||||
github.event.pull_request.head.repo.full_name !=
|
||||
github.event.pull_request.base.repo.full_name
|
||||
|
||||
needs: [meta, macOS-Core]
|
||||
runs-on: macos-14
|
||||
steps:
|
||||
@@ -387,16 +336,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
|
||||
- name: Install Dependencies
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
run: |
|
||||
brew install graphicsmagick imagemagick
|
||||
npm install -g create-dmg
|
||||
|
||||
- name: Fetch submodules
|
||||
run: |
|
||||
git submodule update --init --depth 1 src/MaaMacGui
|
||||
submodules: recursive
|
||||
|
||||
- name: Download Arm64 MAA from Github
|
||||
uses: actions/download-artifact@v4
|
||||
@@ -412,25 +352,11 @@ jobs:
|
||||
|
||||
- name: Install Developer ID Certificate
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
uses: apple-actions/import-codesign-certs@v5
|
||||
uses: ssrobins/import-codesign-certs@v2
|
||||
with:
|
||||
p12-file-base64: ${{ secrets.HGUANDL_SIGN_CERT_P12 }}
|
||||
p12-password: ${{ secrets.HGUANDL_SIGN_CERT_PASSWD }}
|
||||
|
||||
- name: Download Provisioning Profiles
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
uses: apple-actions/download-provisioning-profiles@v4
|
||||
with:
|
||||
bundle-id: "com.hguandl.MeoAsstMac"
|
||||
issuer-id: ${{ secrets.HGUANDL_APPSTORE_ISSUER }}
|
||||
api-key-id: ${{ secrets.HGUANDL_APPSTORE_KEYID }}
|
||||
api-private-key: ${{ secrets.HGUANDL_APPSTORE_KEY }}
|
||||
|
||||
- name: Setup Xcode Toolchain
|
||||
if: true
|
||||
run: |
|
||||
sudo xcode-select -s /Applications/Xcode_16.1.app/Contents/Developer
|
||||
|
||||
- name: Build Universal Binaries
|
||||
run: |
|
||||
mkdir build
|
||||
@@ -438,24 +364,6 @@ jobs:
|
||||
lipo -create install-arm64/$LIB_NAME install-x86_64/$LIB_NAME -output build/$LIB_NAME
|
||||
done
|
||||
|
||||
- name: Archive Runtime Files
|
||||
run: |
|
||||
mkdir runtime && cd runtime
|
||||
name='MAA-${{ needs.meta.outputs.tag }}-macos-runtime-universal'
|
||||
mkdir "$name" && cd "$name"
|
||||
cp -v ../../build/*.dylib .
|
||||
ln -vs libonnxruntime*.dylib libonnxruntime.dylib
|
||||
ln -vs libopencv_world4*.dylib libopencv_world4.dylib
|
||||
cp -vr ../../resource .
|
||||
cd .. || exit 1
|
||||
zip -yrX9 "$name.zip" "$name"
|
||||
|
||||
- name: Upload MAA runtime to Github
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: MAA-macos-runtime-universal
|
||||
path: runtime/MAA-${{ needs.meta.outputs.tag }}-macos-runtime-universal.zip
|
||||
|
||||
- name: Build XCFramework
|
||||
run: |
|
||||
xcodebuild -create-xcframework -library libMaaCore.dylib -headers ../include -output MaaCore.xcframework
|
||||
@@ -473,9 +381,9 @@ jobs:
|
||||
- name: Build MAA
|
||||
run: |
|
||||
if ${{ startsWith(github.ref, 'refs/tags/v') }}; then
|
||||
xcodebuild -scheme MAA archive -archivePath MAA.xcarchive
|
||||
xcodebuild -project MeoAsstMac.xcodeproj -scheme MAA archive -archivePath MAA.xcarchive -configuration Release
|
||||
else
|
||||
xcodebuild CODE_SIGNING_ALLOWED=NO -scheme MAA archive -archivePath MAA.xcarchive
|
||||
xcodebuild CODE_SIGN_IDENTITY="-" DEVELOPMENT_TEAM="-" ONLY_ACTIVE_ARCH=NO -project MeoAsstMac.xcodeproj -scheme MAA archive -archivePath MAA.xcarchive -configuration Debug
|
||||
fi
|
||||
working-directory: src/MaaMacGui
|
||||
|
||||
@@ -488,8 +396,10 @@ jobs:
|
||||
- name: Create Disk Image
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
run: |
|
||||
create-dmg Export/MAA.app
|
||||
mv MAA*.dmg MAA.dmg
|
||||
mkdir Image
|
||||
mv Export/MAA.app Image/
|
||||
ln -s /Applications Image/
|
||||
hdiutil create -volname MAA -srcfolder Image -ov -fs APFS -format ULMO MAA.dmg
|
||||
working-directory: src/MaaMacGui
|
||||
|
||||
- name: Archive Debug Symbols
|
||||
@@ -509,26 +419,17 @@ jobs:
|
||||
mv src/MaaMacGui/MAA.xcarchive/dSYMs/MAA.app.dSYM.zip release/${APP_SYM}
|
||||
|
||||
- name: Notarize Image
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
uses: nick-fields/retry@v3
|
||||
with:
|
||||
max_attempts: 3
|
||||
timeout_minutes: 15
|
||||
command: |
|
||||
cd release
|
||||
echo "$APPSTORE_KEY" > "AuthKey_${APPSTORE_KEYID}.p8"
|
||||
dmg="MAA-${{ needs.meta.outputs.tag }}-macos-universal.dmg"
|
||||
xcrun notarytool submit -k "AuthKey_${APPSTORE_KEYID}.p8" -d "$APPSTORE_KEYID" -i "$ISSUER_ID" --wait ${dmg}
|
||||
env:
|
||||
APPSTORE_KEYID: ${{ secrets.HGUANDL_APPSTORE_KEYID }}
|
||||
APPSTORE_KEY: ${{ secrets.HGUANDL_APPSTORE_KEY }}
|
||||
ISSUER_ID: ${{ secrets.HGUANDL_APPSTORE_ISSUER }}
|
||||
|
||||
- name: Attach Notarization Tickets
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
run: |
|
||||
dmg="MAA-${{ needs.meta.outputs.tag }}-macos-universal.dmg"
|
||||
xcrun stapler staple ${dmg}
|
||||
find . -name "*.dmg" | while read dmg; do
|
||||
codesign -s "$NOTARY_TEAM" --timestamp ${dmg}
|
||||
xcrun notarytool submit --apple-id "$NOTARY_USER" --password "$NOTARY_PASSWD" --team-id "$NOTARY_TEAM" --wait ${dmg}
|
||||
xcrun stapler staple ${dmg}
|
||||
done
|
||||
env:
|
||||
NOTARY_USER: ${{ secrets.HGUANDL_NOTARY_AAPL_ID }}
|
||||
NOTARY_PASSWD: ${{ secrets.HGUANDL_NOTARY_PASSWD }}
|
||||
NOTARY_TEAM: ${{ secrets.HGUANDL_SIGN_IDENTITY }}
|
||||
working-directory: release
|
||||
|
||||
- name: Upload MAA to Github
|
||||
@@ -538,12 +439,8 @@ jobs:
|
||||
path: ${{ startsWith(github.ref, 'refs/tags/v') && 'release/MAA*' || 'src/MaaMacGui/MAA.xcarchive/**' }}
|
||||
|
||||
release:
|
||||
# Prevent duplicate runs on organization branches with PRs
|
||||
if: (github.event_name != 'pull_request' ||
|
||||
github.event.pull_request.head.repo.full_name !=
|
||||
github.event.pull_request.base.repo.full_name) && startsWith(github.ref, 'refs/tags/v')
|
||||
|
||||
needs: [meta, windows, ubuntu, macOS-Core, macOS-GUI]
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
needs: [meta, windows, ubuntu, macOS-GUI]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download MAA from Github
|
||||
@@ -560,20 +457,13 @@ jobs:
|
||||
find . -type f | while read f; do mv -fvt . $f; done
|
||||
|
||||
- name: Release to Github
|
||||
uses: softprops/action-gh-release@v2
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
body_path: CHANGELOG.md
|
||||
files: |
|
||||
assets/*
|
||||
prerelease: ${{ needs.meta.outputs.prerelease != 'false' }}
|
||||
|
||||
- name: Trigger MirrorChyan
|
||||
run: |
|
||||
gh workflow run --repo $GITHUB_REPOSITORY mirrorchyan
|
||||
gh workflow run --repo $GITHUB_REPOSITORY mirrorchyan_release_note
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Trigger secondary workflows # ref: https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
|
||||
run: |
|
||||
gh workflow run --repo $GITHUB_REPOSITORY release-ota
|
||||
|
||||
7
.github/workflows/gen-changelog.yml
vendored
@@ -2,7 +2,7 @@ name: gen-changelog
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
- ready_for_review
|
||||
@@ -79,9 +79,8 @@ jobs:
|
||||
git commit -m "$commit_msg"
|
||||
|
||||
- name: Create PR
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
with:
|
||||
sign-commits: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
title: ${{ steps.extract_tag.outputs.pr_title }}
|
||||
body-path: ${{ format('{0}/{1}', runner.temp, 'output' ) }}
|
||||
@@ -94,6 +93,6 @@ jobs:
|
||||
AnnAngela
|
||||
|
||||
- name: Add reviewers to release PR
|
||||
uses: kentaro-m/auto-assign-action@v2.0.0
|
||||
uses: kentaro-m/auto-assign-action@v1.2.5
|
||||
with:
|
||||
configuration-path: ".github/release_reviewers.yaml"
|
||||
|
||||
77
.github/workflows/issue-checkbox-checker.yml
vendored
@@ -1,77 +0,0 @@
|
||||
name: Auto Close not reading issues or Fold checkboxes
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
check-then-close-or-fold:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
|
||||
steps:
|
||||
- name: Check checkbox status
|
||||
id: unread-checkbox-check
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const texts = [
|
||||
'我已在未仔细阅读这些内容的情况下勾选所有选项,并相信这不会影响问题的处理',
|
||||
'I have checked all the options without carefully reading the content and believe this will not affect issue resolution.'];
|
||||
return texts.some(text => new RegExp(`- \\[x\\]\\s*${text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}`).test(context.payload.issue.body));
|
||||
|
||||
- name: Close and lock issue
|
||||
if: steps.unread-checkbox-check.outputs.result == 'true'
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
await github.rest.issues.update({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
state: 'closed',
|
||||
state_reason: 'not_planned'
|
||||
});
|
||||
|
||||
await github.rest.issues.lock({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
lock_reason: 'spam'
|
||||
});
|
||||
|
||||
- name: Fold checkboxes
|
||||
if: steps.unread-checkbox-check.outputs.result == 'false'
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const originalBody = context.payload.issue.body;
|
||||
const checkboxSectionRegex_cn_bug = /([\s\S]*?)(### 问题描述\n\n)/;
|
||||
const checkboxSectionRegex_cn_feat = /([\s\S]*?)(### 说说你遇到的问题?\n\n)/;
|
||||
const checkboxSectionRegex_en_bug = /([\s\S]*?)(### Description\n\n)/;
|
||||
const checkboxSectionRegex_en_feat = /([\s\S]*?)(### The problems you have encountered?\n\n)/;
|
||||
|
||||
const foldedBody_cn_bug = originalBody.replace(
|
||||
checkboxSectionRegex_cn_bug,
|
||||
`<details><summary>Checkboxes</summary>\n\n$1\n\n</details>\n\n$2`
|
||||
);
|
||||
const foldedBody_cn_feat = foldedBody_cn_bug.replace(
|
||||
checkboxSectionRegex_cn_feat,
|
||||
`<details><summary>Checkboxes</summary>\n\n$1\n\n</details>\n\n$2`
|
||||
);
|
||||
const foldedBody_en_bug = foldedBody_cn_feat.replace(
|
||||
checkboxSectionRegex_en_bug,
|
||||
`<details><summary>Checkboxes</summary>\n\n$1\n\n</details>\n\n$2`
|
||||
);
|
||||
const foldedBody = foldedBody_en_bug.replace(
|
||||
checkboxSectionRegex_en_feat,
|
||||
`<details><summary>Checkboxes</summary>\n\n$1\n\n</details>\n\n$2`
|
||||
);
|
||||
|
||||
await github.rest.issues.update({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
body: foldedBody
|
||||
});
|
||||
3
.github/workflows/issue-checker.yml
vendored
@@ -1,5 +1,4 @@
|
||||
name: "Issue Checker"
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened, edited]
|
||||
@@ -17,7 +16,7 @@ jobs:
|
||||
triage:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: MaaAssistantArknights/issue-checker@v1.14
|
||||
- uses: zzyyyl/issue-checker@v1.8
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
configuration-path: .github/issue-checker.yml
|
||||
|
||||
73
.github/workflows/markdown-checker.yml
vendored
@@ -1,64 +1,49 @@
|
||||
name: Check Dead Links
|
||||
name: Lint Markdown files
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * 2" # Every Tuesday at 00:00 UTC
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
paths:
|
||||
- "**/*.md"
|
||||
- "docs/**"
|
||||
- ".github/workflows/markdown-checker.yml"
|
||||
- ".github/workflows/lint-markdown.yml"
|
||||
pull_request:
|
||||
branches:
|
||||
- dev
|
||||
paths:
|
||||
- "**/*.md"
|
||||
- "docs/**"
|
||||
- ".github/workflows/markdown-checker.yml"
|
||||
- ".github/workflows/lint-markdown.yml"
|
||||
schedule:
|
||||
- cron: "44 7 * * 2"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
check-links:
|
||||
if: github.repository_owner == 'MaaAssistantArknights' && github.event.head_commit.author.email != '41898282+github-actions[bot]@users.noreply.github.com'
|
||||
name: Check Dead Links
|
||||
lint:
|
||||
name: Lint Markdown
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
|
||||
- name: Cache Primes
|
||||
id: cache-primes
|
||||
uses: actions/cache@v4
|
||||
- name: Lint Markdown
|
||||
uses: DavidAnson/markdownlint-cli2-action@v16
|
||||
with:
|
||||
path: .lycheecache
|
||||
key: lychee-cache
|
||||
config: docs/.markdownlint.yaml
|
||||
globs: |
|
||||
README.md
|
||||
docs/**/*.md
|
||||
|
||||
- name: Check dead links
|
||||
uses: lycheeverse/lychee-action@v2
|
||||
with:
|
||||
# 仅检查内部链接,排除所有外部链接
|
||||
args: >
|
||||
--verbose --no-progress
|
||||
--cache --max-cache-age 1d --cache-exclude-status '429, 500..599'
|
||||
--exclude 'https?://.*'
|
||||
--exclude-path 'docs/zh-tw/manual/introduction/introduction_old.md'
|
||||
--exclude-path 'docs/ja-jp/manual/introduction/introduction_old.md'
|
||||
--exclude 'files/MAA_Runtime_Fix_Pwsh.ps1$'
|
||||
-- './docs/**/*.md' './README.md'
|
||||
|
||||
- name: Comment (only for PR)
|
||||
if: failure() && github.event_name == 'pull_request'
|
||||
uses: marocchino/sticky-pull-request-comment@v2
|
||||
with:
|
||||
message: |
|
||||
Dead links found in the documentation. Please fix them.
|
||||
Details: https://github.com/MaaAssistantArknights/MaaAssistantArknights/actions/runs/${{ github.run_id }}
|
||||
# check-links:
|
||||
# name: Check Dead Links
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: Check out code
|
||||
# uses: actions/checkout@v4
|
||||
# with:
|
||||
# show-progress: false
|
||||
#
|
||||
# - name: Check Dead Link
|
||||
# uses: umbrelladocs/action-linkspector@v1
|
||||
# with:
|
||||
# # Use github-pr-review when triggered by a pull request; otherwise, use github-check
|
||||
# reporter: ${{ github.event_name == 'pull_request' && 'github-pr-review' || 'github-check' }}
|
||||
# filter_mode: nofilter
|
||||
# fail_on_error: true
|
||||
|
||||
71
.github/workflows/mirrorchyan.yml
vendored
@@ -1,71 +0,0 @@
|
||||
name: mirrorchyan
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
mirrorchyan:
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- name: Upload MAA win x64
|
||||
uses: MirrorChyan/uploading-action@v1
|
||||
if: always()
|
||||
with:
|
||||
filetype: latest-release
|
||||
filename: "*MAA-*-win-x64.zip"
|
||||
mirrorchyan_rid: MAA
|
||||
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
owner: ${{ github.repository_owner }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
upload_token: ${{ secrets.MirrorChyanUploadToken }}
|
||||
os: win
|
||||
arch: x64
|
||||
|
||||
- name: Upload MAA win arm64
|
||||
uses: MirrorChyan/uploading-action@v1
|
||||
if: always()
|
||||
with:
|
||||
filetype: latest-release
|
||||
filename: "*MAA-*-win-arm64.zip"
|
||||
mirrorchyan_rid: MAA
|
||||
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
owner: ${{ github.repository_owner }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
upload_token: ${{ secrets.MirrorChyanUploadToken }}
|
||||
os: win
|
||||
arch: arm64
|
||||
|
||||
- name: Upload MAA macos arm64
|
||||
uses: MirrorChyan/uploading-action@v1
|
||||
if: always()
|
||||
with:
|
||||
filetype: latest-release
|
||||
filename: "MAA-*-macos-universal.dmg"
|
||||
extra_zip: true
|
||||
mirrorchyan_rid: MAA
|
||||
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
owner: ${{ github.repository_owner }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
upload_token: ${{ secrets.MirrorChyanUploadToken }}
|
||||
os: macos
|
||||
arch: arm64
|
||||
|
||||
- name: Upload MAA macos x64
|
||||
uses: MirrorChyan/uploading-action@v1
|
||||
if: always()
|
||||
with:
|
||||
filetype: latest-release
|
||||
filename: "MAA-*-macos-universal.dmg"
|
||||
extra_zip: true
|
||||
mirrorchyan_rid: MAA
|
||||
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
owner: ${{ github.repository_owner }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
upload_token: ${{ secrets.MirrorChyanUploadToken }}
|
||||
os: macos
|
||||
arch: x64
|
||||
19
.github/workflows/mirrorchyan_release_note.yml
vendored
@@ -1,19 +0,0 @@
|
||||
name: mirrorchyan_release_note
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types: [edited]
|
||||
|
||||
jobs:
|
||||
mirrorchyan:
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- name: Release Note for MAA
|
||||
uses: MirrorChyan/release-note-action@v1
|
||||
with:
|
||||
mirrorchyan_rid: MAA
|
||||
|
||||
upload_token: ${{ secrets.MirrorChyanUploadToken }}
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
109
.github/workflows/optimize-templates.yml
vendored
@@ -1,109 +0,0 @@
|
||||
name: Optimize PNG Templates
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "dev"
|
||||
paths:
|
||||
- "resource/**/*.png"
|
||||
- "docs/.vuepress/public/images/**"
|
||||
- "website/apps/web/public/**"
|
||||
- "website/apps/web/src/assets/links/**"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
commit_message:
|
||||
description: "Commit Message"
|
||||
type: string
|
||||
required: false
|
||||
|
||||
jobs:
|
||||
optimize-png:
|
||||
# Skip workflow to prevent double consecutive runs
|
||||
# Skip workflow on PR merges
|
||||
if: github.repository_owner == 'MaaAssistantArknights' && ${{ github.event.head_commit.author.email != '41898282+github-actions[bot]@users.noreply.github.com' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check for direct push
|
||||
id: check_push
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" != "workflow_dispatch" ]]; then
|
||||
pr_merge_status=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/commits/${{ github.event.after }}/pulls" | xargs)
|
||||
|
||||
if [[ "$pr_merge_status" == "[ ]" ]]; then
|
||||
echo "Direct push detected. Proceeding..."
|
||||
echo "is_pr=False" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "PR merge detected. Exiting."
|
||||
echo "is_pr=True" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
else
|
||||
echo "Manual trigger detected. Proceeding..."
|
||||
echo "is_pr=False" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Checkout repository
|
||||
if: steps.check_push.outputs.is_pr != 'True'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup python
|
||||
if: steps.check_push.outputs.is_pr != 'True'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
# - name: Cache Python packages
|
||||
# id: cache_python
|
||||
# if: steps.check_push.outputs.is_pr != 'True' && always()
|
||||
# uses: actions/cache@v4
|
||||
# with:
|
||||
# path: ${{ env.pythonLocation }}/lib/python3.11/site-packages
|
||||
# key: ${{ runner.os }}-pip-optimize-templates-${{ hashFiles('./tools/OptimizeTemplates/requirements.txt') }}
|
||||
|
||||
- name: Install dependencies
|
||||
# if: steps.check_push.outputs.is_pr != 'True' && steps.cache_python.outputs.cache-hit != 'true'
|
||||
if: steps.check_push.outputs.is_pr != 'True'
|
||||
run: |
|
||||
pip install -r tools/OptimizeTemplates/requirements.txt
|
||||
|
||||
- name: Setup oxipng
|
||||
if: steps.check_push.outputs.is_pr != 'True'
|
||||
uses: baptiste0928/cargo-install@v3
|
||||
with:
|
||||
crate: oxipng
|
||||
|
||||
- name: Run optimize_templates
|
||||
if: steps.check_push.outputs.is_pr != 'True'
|
||||
run: |
|
||||
python3 tools/OptimizeTemplates/optimize_templates.py
|
||||
|
||||
- name: Commit changes
|
||||
id: commit_changes
|
||||
if: steps.check_push.outputs.is_pr != 'True'
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
git add .
|
||||
|
||||
if git diff-index --quiet HEAD --; then
|
||||
echo "No changes to commit"
|
||||
else
|
||||
commit_msg="${{ github.event.inputs.commit_message }}"
|
||||
if [ -z "$commit_msg" ]; then
|
||||
commit_msg="chore: Auto Templates Optimization"
|
||||
fi
|
||||
git commit -m "$commit_msg" -m "Triggered by ${{github.sha}}" -m "[skip changelog]"
|
||||
git pull origin $(git rev-parse --abbrev-ref HEAD) --unshallow --rebase
|
||||
echo "have_commits=True" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Push changes
|
||||
if: steps.check_push.outputs.is_pr != 'True' && steps.commit_changes.outputs.have_commits == 'True'
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.MAA_RESOURCE_SYNC }}
|
||||
branch: ${{ github.ref }}
|
||||
7
.github/workflows/pr-checker.yml
vendored
@@ -4,6 +4,7 @@ on:
|
||||
pull_request_target:
|
||||
types: [opened, edited, ready_for_review, reopened, synchronize]
|
||||
|
||||
|
||||
jobs:
|
||||
check_commit_name_in_pr:
|
||||
if: ${{ !github.event.pull_request.merged && github.base_ref != 'master' }}
|
||||
@@ -38,7 +39,7 @@ jobs:
|
||||
per_page: 100
|
||||
});
|
||||
|
||||
const regex = /^((build|chore|ci|docs?|feat!?|fix|perf|refactor|rft|style|test|i18n|typo|debug)[\:\.\(\,]|[Rr]evert|[Rr]elease|[Rr]eapply)/;
|
||||
const regex = /^((build|chore|ci|docs?|feat!?|fix|perf|refactor|rft|style|test|i18n|typo)[\:\.\(\,]|[Rr]evert|[Rr]elease)/;
|
||||
const invalidCommits = commits.filter(commit => !regex.test(commit.commit.message) || commit.parents.length > 1);
|
||||
|
||||
console.log(`Checked ${commits.length} commit(s)`);
|
||||
@@ -51,8 +52,8 @@ jobs:
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.payload.pull_request.number,
|
||||
body: `## ⚠️ Found ${invalidCommits.length} invalid commit(s):\n\n${invalidCommitInfoList}\n\n---\nPlease follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) format, and **DO NOT** use merge commits.\n请遵循 [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) 格式,以及**不要**使用Merge Commit(修改 Commit Message 无法绕过检测)。`
|
||||
body: `## ⚠️ Found ${invalidCommits.length} invalid commit(s):\n\n${invalidCommitInfoList}\n\n---\nPlease follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) format.`
|
||||
});
|
||||
|
||||
core.setFailed(`Found ${invalidCommits.length} invalid commit(s):\n${invalidCommitNames.join("\n-------------------\n")}`);
|
||||
}
|
||||
}
|
||||
220
.github/workflows/release-nightly-ota.yml
vendored
@@ -1,8 +1,6 @@
|
||||
name: release-nightly-ota
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 22 * * *" # Runs daily at 22:00 UTC
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_body:
|
||||
@@ -13,24 +11,25 @@ on:
|
||||
description: "Commit to build (git checkout)"
|
||||
type: string
|
||||
required: false
|
||||
limit_maa:
|
||||
limit:
|
||||
description: "Number of releases to fetch from MaaAssistantArknights"
|
||||
required: true
|
||||
default: "10"
|
||||
default: 30
|
||||
type: number
|
||||
limit_mr:
|
||||
limit_2:
|
||||
description: "Number of releases to fetch from MaaRelease"
|
||||
required: true
|
||||
default: "10"
|
||||
default: 30
|
||||
type: number
|
||||
|
||||
jobs:
|
||||
build-win-nightly:
|
||||
if: github.repository_owner == 'MaaAssistantArknights'
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
msbuild_target: [x64]
|
||||
include:
|
||||
- msbuild_target: x64
|
||||
lowercase_target: x64
|
||||
fail-fast: false
|
||||
env:
|
||||
MAABUILDER_TARGET_PLATFORM: ${{ matrix.msbuild_target }}
|
||||
@@ -38,136 +37,73 @@ jobs:
|
||||
tag: ${{ steps.set_tag.outputs.tag }}
|
||||
pre_version: ${{ steps.set_tag.outputs.pre_version }}
|
||||
main_tag_name: ${{ steps.push_main_tag.outputs.main_tag_name }}
|
||||
changelog: ${{ steps.read_changelog.outputs.content }}
|
||||
changelog: ${{ steps.generate_changelog.outputs.changelog }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
# repository: 'MaaAssistantArknights/MaaAssistantArknights'
|
||||
submodules: recursive
|
||||
#ref: ${{ inputs.ref }}
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
fetch-depth: 250
|
||||
|
||||
- name: Fetch tags
|
||||
- name: Checkout ref
|
||||
run: |
|
||||
git fetch --depth=250 --tags
|
||||
if ("${{ inputs.ref }}" -ne "") {
|
||||
git checkout --progress --recurse-submodules ${{ inputs.ref || 'dev' }}
|
||||
}
|
||||
|
||||
- name: Fetch submodules
|
||||
- name: Install semver
|
||||
run: |
|
||||
git submodule update --init --depth 1 3rdparty/EmulatorExtras
|
||||
npm install --global --progress semver
|
||||
|
||||
- name: Checkout ref (if provided)
|
||||
if: inputs.ref != ''
|
||||
run: |
|
||||
git checkout --progress --recurse-submodules ${{ inputs.ref }}
|
||||
|
||||
- name: Check for Changes and Set tag
|
||||
- name: Set tag
|
||||
id: set_tag
|
||||
run: |
|
||||
# Fetch the latest tag from the repository
|
||||
$latest_tag = git describe --tags --abbrev=0
|
||||
|
||||
Write-Output "Previous Tag: $latest_tag"
|
||||
Write-Output "latest_tag=$latest_tag" >> $env:GITHUB_OUTPUT
|
||||
|
||||
# Check for changes between the latest tag and HEAD
|
||||
$recent_changes = git log "$latest_tag..HEAD" --oneline
|
||||
|
||||
if (-not $recent_changes) {
|
||||
Write-Output "No commits. Cancelling workflow..."
|
||||
Write-Output "cancel_run=true" >> $env:GITHUB_ENV
|
||||
exit 0
|
||||
} else {
|
||||
Write-Output "Recent commits: $recent_changes"
|
||||
Write-Output "Commits found. Continuing build..."
|
||||
Write-Output "cancel_run=false" >> $env:GITHUB_ENV
|
||||
}
|
||||
|
||||
# Get the full description of the current commit
|
||||
$described = git describe --tags --long --match 'v*'
|
||||
Write-Output "New Described: $described"
|
||||
$ids = $described -split "-"
|
||||
|
||||
if ($ids.Length -eq 3) {
|
||||
# Extract and parse the current version
|
||||
$current_version = $ids[0].Substring(1)
|
||||
$parts = $current_version -split '\.'
|
||||
if ($parts.Length -ne 3) {
|
||||
Write-Error "Invalid version format: $current_version. Expected 'major.minor.patch'."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Increment the patch version
|
||||
$parts[2] = [int]$parts[2] + 1
|
||||
$new_version = "$($parts[0]).$($parts[1]).$($parts[2])"
|
||||
|
||||
# Construct the new tag and pre_version
|
||||
$ver = "v$new_version"
|
||||
$pre_version = $ids[0]
|
||||
$dist = "{0:D3}" -f [int]$ids[1]
|
||||
|
||||
Write-Output "pre_version=$pre_version" >> $env:GITHUB_OUTPUT
|
||||
Write-Output "New Tag: $ver-alpha.1.d$dist.$($ids[2])"
|
||||
Write-Output "tag=$ver-alpha.1.d$dist.$($ids[2])" >> $env:GITHUB_OUTPUT
|
||||
|
||||
# pre_version是上一个公版,这里需要拉上一个tag,避免堆积过多commit
|
||||
$latest_tag=$(git describe --tags --abbrev=0)
|
||||
echo "latest_tag=$latest_tag" >> $env:GITHUB_OUTPUT
|
||||
$described = $(git describe --tags --long --match 'v*')
|
||||
$ids = $($described -split "-")
|
||||
if ($ids.length -eq 3) {
|
||||
$ver = "v$(semver --increment $ids[0].Substring(1))"
|
||||
$pre_version = "$($ids[0])"
|
||||
$dist = `printf "%03d"` $ids[1]
|
||||
echo "tag=$ver-alpha.1.d$($dist).$($ids[2])" >> $env:GITHUB_OUTPUT
|
||||
echo "pre_version=$pre_version" >> $env:GITHUB_OUTPUT
|
||||
exit 0
|
||||
}
|
||||
|
||||
if ($ids.Length -eq 4) {
|
||||
$dist = "{0:D3}" -f [int]$ids[2]
|
||||
$pre_version = "$($ids[0])-$($ids[1])"
|
||||
|
||||
Write-Output "Pre Version: $pre_version"
|
||||
Write-Output "pre_version=$pre_version" >> $env:GITHUB_OUTPUT
|
||||
|
||||
Write-Output "tag: $pre_version.d$dist.$($ids[3])"
|
||||
Write-Output "tag=$pre_version.d$dist.$($ids[3])" >> $env:GITHUB_OUTPUT
|
||||
|
||||
if ($ids.length -eq 4) {
|
||||
$dist = `printf "%03d"` $ids[2]
|
||||
$pre_version = "$($ids[0])""-""$($ids[1])"
|
||||
echo "tag=$($ids[0])-$($ids[1]).d$($dist).$($ids[3])" >> $env:GITHUB_OUTPUT
|
||||
echo "pre_version=$pre_version" >> $env:GITHUB_OUTPUT
|
||||
exit 0
|
||||
}
|
||||
|
||||
exit 1
|
||||
|
||||
- name: Stop if no changes
|
||||
if: env.cancel_run == 'true'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Push tag to main repo
|
||||
id: push_main_tag
|
||||
run: |
|
||||
curl -s -L -X POST `
|
||||
-H "Accept: application/vnd.github+json" `
|
||||
-H "Authorization: Bearer ${{ secrets.MAA_ACTION_READ_WRITE }}" `
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" `
|
||||
"https://api.github.com/repos/MaaAssistantArknights/MaaAssistantArknights/actions/runs/${{ github.run_id }}/cancel" > $null
|
||||
git config user.name 'github-actions[bot]'
|
||||
git config user.email 'github-actions[bot]@users.noreply.github.com'
|
||||
|
||||
gh run watch ${{ github.run_id }}
|
||||
$main_tag_name=$(echo "alpha/${{ steps.set_tag.outputs.tag }}")
|
||||
git tag $main_tag_name -f
|
||||
git push --tags origin HEAD:refs/tags/$main_tag_name -f
|
||||
echo "main_tag_name=$main_tag_name" >> $env:GITHUB_OUTPUT
|
||||
|
||||
- name: Generate Changelog
|
||||
id: generate_changelog
|
||||
run: |
|
||||
python3 tools/ChangelogGenerator/changelog_generator.py --latest "${{ steps.set_tag.outputs.latest_tag }}" --tag "${{ steps.set_tag.outputs.tag }}"
|
||||
Get-Content .\changelog.md | Select-Object -Skip 2 | Out-File -FilePath changelog_notag.md -Encoding utf8
|
||||
$content=$(((Get-Content .\changelog.md) | Select-Object -Skip 2) -join "\n\n")
|
||||
echo "changelog=$content" >> $env:GITHUB_OUTPUT
|
||||
echo $content
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PYTHONIOENCODING: "utf-8"
|
||||
|
||||
- name: Stop if no changes
|
||||
if: steps.generate_changelog.outputs.cancel_run == 'true'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
curl -s -L -X POST `
|
||||
-H "Accept: application/vnd.github+json" `
|
||||
-H "Authorization: Bearer ${{ secrets.MAA_ACTION_READ_WRITE }}" `
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" `
|
||||
"https://api.github.com/repos/MaaAssistantArknights/MaaAssistantArknights/actions/runs/${{ github.run_id }}/cancel" > $null
|
||||
|
||||
gh run watch ${{ github.run_id }}
|
||||
|
||||
- name: Read Changelog to variable
|
||||
id: read_changelog
|
||||
uses: juliangruber/read-file-action@v1
|
||||
with:
|
||||
path: ./changelog_notag.md
|
||||
|
||||
- name: Cache .nuke/temp, ~/.nuget/packages
|
||||
id: cache-nuget
|
||||
uses: actions/cache@v4
|
||||
@@ -175,26 +111,17 @@ jobs:
|
||||
path: |
|
||||
.nuke/temp
|
||||
~/.nuget/packages
|
||||
key: ${{ runner.os }}-${{ matrix.msbuild_target }}-${{ hashFiles('**/global.json', '**/*.csproj') }}
|
||||
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }}
|
||||
|
||||
- name: Restore dependencies
|
||||
if: steps.cache-nuget.outputs.cache-hit != 'true'
|
||||
run: dotnet restore
|
||||
|
||||
- name: Cache MaaDeps
|
||||
id: cache-maadeps
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./MaaDeps
|
||||
key: ${{ runner.os }}-${{ matrix.msbuild_target }}-maadeps-${{ hashFiles('./maadeps-download.py') }}
|
||||
|
||||
- name: Bootstrap MaaDeps
|
||||
if: steps.cache-maadeps.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
python3 maadeps-download.py ${{ matrix.lowercase_target }}-windows
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
python3 maadeps-download.py ${{ matrix.msbuild_target }}-windows
|
||||
|
||||
- name: Taggify Version
|
||||
run: |
|
||||
@@ -232,22 +159,10 @@ jobs:
|
||||
- name: Upload MAA to Github
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: MAA-win-${{ matrix.msbuild_target }}
|
||||
name: MAA-win-${{ matrix.lowercase_target }}
|
||||
path: artifacts
|
||||
|
||||
- name: Push tag to main repo
|
||||
id: push_main_tag
|
||||
run: |
|
||||
git config user.name 'github-actions[bot]'
|
||||
git config user.email 'github-actions[bot]@users.noreply.github.com'
|
||||
|
||||
$main_tag_name=$(echo "alpha/${{ steps.set_tag.outputs.tag }}")
|
||||
git tag $main_tag_name -f
|
||||
git push --tags origin HEAD:refs/tags/$main_tag_name -f
|
||||
echo "main_tag_name=$main_tag_name" >> $env:GITHUB_OUTPUT
|
||||
|
||||
push-tag:
|
||||
if: github.repository_owner == 'MaaAssistantArknights'
|
||||
needs: build-win-nightly
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -270,7 +185,6 @@ jobs:
|
||||
git push --tags origin HEAD:refs/tags/${{ needs.build-win-nightly.outputs.tag }}
|
||||
|
||||
make-ota:
|
||||
if: github.repository_owner == 'MaaAssistantArknights'
|
||||
needs: [build-win-nightly, push-tag]
|
||||
strategy:
|
||||
matrix:
|
||||
@@ -298,17 +212,8 @@ jobs:
|
||||
run: |
|
||||
mkdir -pv build-ota && cd build-ota
|
||||
|
||||
# Convert inputs to integers
|
||||
limit_maa=${{ inputs.limit_maa || 10 }}
|
||||
limit_maa=${limit_maa%.*}
|
||||
echo "Parsed limit_maa: $limit_maa"
|
||||
|
||||
limit_mr=${{ inputs.limit_mr || 10 }}
|
||||
limit_mr=${limit_mr%.*}
|
||||
echo "Parsed limit_mr: $limit_mr"
|
||||
|
||||
gh release list --repo 'MaaAssistantArknights/MaaAssistantArknights' --limit $limit_maa | tee ./release_maa.txt
|
||||
gh release list --repo "${{ github.repository_owner }}/MaaRelease" --limit $limit_mr | tee ./release_mr.txt
|
||||
gh release list --repo 'MaaAssistantArknights/MaaAssistantArknights' --limit ${{ inputs.limit || 30 }} | tee ./release_maa.txt
|
||||
gh release list --repo "${{ github.repository_owner }}/MaaRelease" --limit ${{ inputs.limit_2 || 30 }} | tee ./release_mr.txt
|
||||
echo ${{ needs.build-win-nightly.outputs.tag }} > ./config
|
||||
|
||||
cat ./release_maa.txt | awk '{ print $1 }' > ./tags_maa.txt
|
||||
@@ -337,6 +242,22 @@ jobs:
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Make release body
|
||||
id: make_release_body
|
||||
shell: bash
|
||||
run: |
|
||||
pre_version=${{ needs.build-win-nightly.outputs.pre_version }}
|
||||
cur_version=${{ needs.build-win-nightly.outputs.main_tag_name }}
|
||||
echo -e "${{ inputs.release_body || '' }}\n\n${{ needs.build-win-nightly.outputs.changelog }}\n\n**Full Changelog**: [$pre_version -> $cur_version](https://github.com/$GITHUB_REPOSITORY/compare/$pre_version...$cur_version)" > alpha_changelog.md
|
||||
export r=$(cat alpha_changelog.md)
|
||||
|
||||
# https://github.com/svenstaro/upload-release-action
|
||||
r="${r//'%'/'%25'}" # Multiline escape sequences for %
|
||||
r="${r//$'\n'/'%0A'}" # Multiline escape sequences for '\n'
|
||||
r="${r//$'\r'/'%0D'}" # Multiline escape sequences for '\r'
|
||||
echo $r
|
||||
echo "full_release_body=$r" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Upload to MaaRelease
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
@@ -347,17 +268,10 @@ jobs:
|
||||
tag: ${{ env.release_tag }}
|
||||
prerelease: true
|
||||
overwrite: true
|
||||
body: |
|
||||
${{ inputs.release_body || '' }}
|
||||
|
||||
${{ needs.build-win-nightly.outputs.changelog }}
|
||||
|
||||
**Full Changelog**: [${{ needs.build-win-nightly.outputs.pre_version }} -> ${{ needs.build-win-nightly.outputs.main_tag_name }}](https://github.com/${{ github.repository }}/compare/${{ needs.build-win-nightly.outputs.pre_version }}...${{ needs.build-win-nightly.outputs.main_tag_name }})
|
||||
body: ${{ steps.make_release_body.outputs.full_release_body }}
|
||||
|
||||
- name: Setup release mirror
|
||||
run: |
|
||||
gh workflow --repo MaaAssistantArknights/MaaRelease run release-mirrors.yml
|
||||
gh workflow --repo MaaAssistantArknights/MaaRelease run mirrorchyan_alpha.yml
|
||||
gh workflow --repo MaaAssistantArknights/MaaRelease run mirrorchyan_alpha_release_note.yml
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.MISTEOWORKFLOW }}
|
||||
|
||||
43
.github/workflows/release-ota.yml
vendored
@@ -9,12 +9,12 @@ on:
|
||||
limit:
|
||||
description: Number of releases to fetch from MaaAssistantArknights, 2 at least
|
||||
required: false
|
||||
default: "31"
|
||||
default: '31'
|
||||
type: number
|
||||
limit_2:
|
||||
description: Number of releases to fetch from MaaRelease
|
||||
required: false
|
||||
default: "30"
|
||||
default: '30'
|
||||
type: number
|
||||
|
||||
env:
|
||||
@@ -37,18 +37,8 @@ jobs:
|
||||
id: fetchReleaseInfo
|
||||
run: |
|
||||
mkdir -pv build-ota && cd build-ota
|
||||
|
||||
# Convert inputs to integers
|
||||
limit=${{ inputs.limit || 31 }}
|
||||
limit=${limit%.*}
|
||||
echo "Parsed limit: $limit"
|
||||
|
||||
limit_2=${{ inputs.limit_2 || 30 }}
|
||||
limit_2=${limit_2%.*}
|
||||
echo "Parsed limit_2: $limit_2"
|
||||
|
||||
gh release list --repo 'MaaAssistantArknights/MaaAssistantArknights' --limit $limit | tee ./release_maa.txt
|
||||
gh release list --repo "MaaAssistantArknights/MaaRelease" --limit $limit_2 | tee ./release_mr.txt
|
||||
gh release list --repo 'MaaAssistantArknights/MaaAssistantArknights' --limit ${{ inputs.limit || 31 }} | tee ./release_maa.txt
|
||||
gh release list --repo "MaaAssistantArknights/MaaRelease" --limit ${{ inputs.limit_2 || 30 }} | tee ./release_mr.txt
|
||||
head -n 1 ./release_maa.txt | awk '{ print $1 }' > ./config
|
||||
|
||||
tail -n +1 ./release_maa.txt | awk '{ print $1 }' > ./tags_maa.txt
|
||||
@@ -166,6 +156,31 @@ jobs:
|
||||
run: |
|
||||
find ./packages -type f ! \( -name 'MAA-${{ needs.create-tag.outputs.release_tag }}-macos-universal.dmg' -o -name '*.delta' -o -name '*.xml' \) -print -delete
|
||||
|
||||
- name: Unpack the .dmg files for .dylib
|
||||
run: |
|
||||
cd ${{ runner.temp }}
|
||||
mkdir -p macos-runtime-temp
|
||||
echo ::group::Attaching release package...
|
||||
hdiutil attach ${{ github.workspace }}/packages/MAA-${{ needs.create-tag.outputs.release_tag }}-macos-universal.dmg
|
||||
echo ::endgroup::
|
||||
echo ::group::Copying files...
|
||||
cp -v /Volumes/MAA/MAA.app/Contents/Frameworks/*.dylib macos-runtime-temp/
|
||||
cp -vr /Volumes/MAA/MAA.app/Contents/Resources/resource macos-runtime-temp/resource
|
||||
echo ::endgroup::
|
||||
echo ::group::Linking files...
|
||||
libonnxruntime_file=$(basename macos-runtime-temp/libonnxruntime*.dylib)
|
||||
ln -vs $libonnxruntime_file macos-runtime-temp/libonnxruntime.dylib
|
||||
libopencv_world_file=$(basename macos-runtime-temp/libopencv_world*.dylib)
|
||||
ln -vs $libopencv_world_file macos-runtime-temp/libopencv_world4.dylib
|
||||
echo ::endgroup::
|
||||
cd macos-runtime-temp
|
||||
echo ::group::Compressing files...
|
||||
zip -yrX9 ${{ github.workspace }}/packages/MAA-${{ needs.create-tag.outputs.release_tag }}-macos-runtime-universal.zip *
|
||||
echo ::endgroup::
|
||||
echo ::group::Detaching release package...
|
||||
hdiutil detach /Volumes/MAA
|
||||
echo ::endgroup::
|
||||
|
||||
- name: Upload to MaaRelease
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
|
||||
375
.github/workflows/res-update-game.yml
vendored
@@ -2,7 +2,7 @@ name: res-update-game
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "*/20 * * * *" # Runs every 20 minutes
|
||||
- cron: "*/20 * * * *"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
commit_message:
|
||||
@@ -11,18 +11,38 @@ on:
|
||||
required: false
|
||||
|
||||
jobs:
|
||||
clone-resources-official:
|
||||
update-game-resources:
|
||||
if: github.repository_owner == 'MaaAssistantArknights'
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: windows-latest
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.MISTEOWORKFLOW }}
|
||||
steps:
|
||||
- name: Checkout MAA
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
token: ${{ secrets.MISTEOWORKFLOW }}
|
||||
|
||||
- name: Bootstrap MaaDeps
|
||||
run: |
|
||||
python3 maadeps-download.py x64-windows
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v1
|
||||
|
||||
- name: Build Resource Updater
|
||||
run: |
|
||||
MSBUILD tools/ResourceUpdater/ResourceUpdater.vcxproj /t:rebuild /p:Configuration="Release" /p:Platform="x64" /p:BuildProjectReferences=false /m
|
||||
|
||||
- name: Clone ArknightsGameResource for Official
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
repository: yuanyan3060/ArknightsGameResource
|
||||
ref: main
|
||||
path: ./Official
|
||||
sparse-checkout-cone-mode: false
|
||||
path: .\tools\ResourceUpdater\x64\Release\Official
|
||||
sparse-checkout: |
|
||||
/levels.json
|
||||
/item
|
||||
@@ -34,307 +54,136 @@ jobs:
|
||||
/gamedata/excel/gacha_table.json
|
||||
/gamedata/excel/roguelike_topic_table.json
|
||||
/gamedata/excel/activity_table.json
|
||||
sparse-checkout-cone-mode: false
|
||||
|
||||
- name: Upload Official
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: official
|
||||
path: ./Official
|
||||
compression-level: 0
|
||||
|
||||
clone-resources-overseas:
|
||||
if: github.repository_owner == 'MaaAssistantArknights'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone ArknightsGameResource_Yostar for Overseas
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
repository: ArknightsAssets/ArknightsGamedata
|
||||
ref: master
|
||||
path: ./Overseas
|
||||
sparse-checkout-cone-mode: false
|
||||
repository: Kengxxiao/ArknightsGameData_Yostar
|
||||
ref: main
|
||||
path: .\tools\ResourceUpdater\x64\Release\Overseas
|
||||
sparse-checkout: |
|
||||
/en/gamedata/excel/item_table.json
|
||||
/en/gamedata/excel/building_data.json
|
||||
/en/gamedata/excel/range_table.json
|
||||
/en/gamedata/excel/character_table.json
|
||||
/en/gamedata/excel/gacha_table.json
|
||||
/en/gamedata/excel/roguelike_topic_table.json
|
||||
/en/gamedata/excel/activity_table.json
|
||||
/jp/gamedata/excel/item_table.json
|
||||
/jp/gamedata/excel/building_data.json
|
||||
/jp/gamedata/excel/range_table.json
|
||||
/jp/gamedata/excel/character_table.json
|
||||
/jp/gamedata/excel/gacha_table.json
|
||||
/jp/gamedata/excel/roguelike_topic_table.json
|
||||
/jp/gamedata/excel/activity_table.json
|
||||
/kr/gamedata/excel/item_table.json
|
||||
/kr/gamedata/excel/building_data.json
|
||||
/kr/gamedata/excel/range_table.json
|
||||
/kr/gamedata/excel/character_table.json
|
||||
/kr/gamedata/excel/gacha_table.json
|
||||
/kr/gamedata/excel/roguelike_topic_table.json
|
||||
/kr/gamedata/excel/activity_table.json
|
||||
/en_US/gamedata/excel/item_table.json
|
||||
/en_US/gamedata/excel/building_data.json
|
||||
/en_US/gamedata/excel/range_table.json
|
||||
/en_US/gamedata/excel/character_table.json
|
||||
/en_US/gamedata/excel/gacha_table.json
|
||||
/en_US/gamedata/excel/roguelike_topic_table.json
|
||||
/en_US/gamedata/excel/activity_table.json
|
||||
/ja_JP/gamedata/excel/item_table.json
|
||||
/ja_JP/gamedata/excel/building_data.json
|
||||
/ja_JP/gamedata/excel/range_table.json
|
||||
/ja_JP/gamedata/excel/character_table.json
|
||||
/ja_JP/gamedata/excel/gacha_table.json
|
||||
/ja_JP/gamedata/excel/roguelike_topic_table.json
|
||||
/ja_JP/gamedata/excel/activity_table.json
|
||||
/ko_KR/gamedata/excel/item_table.json
|
||||
/ko_KR/gamedata/excel/building_data.json
|
||||
/ko_KR/gamedata/excel/range_table.json
|
||||
/ko_KR/gamedata/excel/character_table.json
|
||||
/ko_KR/gamedata/excel/gacha_table.json
|
||||
/ko_KR/gamedata/excel/roguelike_topic_table.json
|
||||
/ko_KR/gamedata/excel/activity_table.json
|
||||
sparse-checkout-cone-mode: false
|
||||
|
||||
- name: Upload Official
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: overseas
|
||||
path: ./Overseas
|
||||
compression-level: 0
|
||||
|
||||
clone-resources-txwy:
|
||||
if: github.repository_owner == 'MaaAssistantArknights'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone arknights-toolbox-update for Taiwan
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
repository: arkntools/arknights-toolbox-update
|
||||
ref: data-tw
|
||||
path: ./excel
|
||||
path: .\tools\ResourceUpdater\x64\Release\Overseas\zh_TW\gamedata\excel
|
||||
token: ${{ secrets.ARKNTOOLS_MAA_RESOURCE_UPDATER}}
|
||||
|
||||
- name: Download stages.json from Penguin Stats
|
||||
run: |
|
||||
cd "./excel"
|
||||
|
||||
baseUrl="https://penguin-stats.io/PenguinStats/api/v2/stages?server="
|
||||
|
||||
parameters=("CN" "US" "JP" "KR")
|
||||
|
||||
for param in "${parameters[@]}"; do
|
||||
{
|
||||
if curl -s -o "stages_${param}.json" "${baseUrl}${param}"; then
|
||||
echo "Successfully fetched data for ${param}"
|
||||
else
|
||||
echo "Failed to fetch data for ${param}" >&2
|
||||
exit 1
|
||||
fi
|
||||
} &
|
||||
done
|
||||
wait
|
||||
|
||||
- name: Upload Official
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: txwy
|
||||
path: ./excel
|
||||
compression-level: 0
|
||||
|
||||
update-game-resources:
|
||||
# In case of rate limitations on the runners/instances, add dependency, by removing the comment
|
||||
|
||||
# needs: [clone-resources-official, clone-resources-overseas, clone-resources-txwy]
|
||||
if: github.repository_owner == 'MaaAssistantArknights'
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout MAA
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# TL;DR https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/9872#issuecomment-2251378371
|
||||
# actions/checkout uses ${{ secrets.GITHUB_TOKEN }} by default, meaning all steps will inherit it
|
||||
persist-credentials: false # Needed to bypass protection rules in Push changes
|
||||
show-progress: false
|
||||
fetch-depth: 3
|
||||
|
||||
- name: Restore ResourceUpdater.exe from cache
|
||||
id: cache-resupd
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
key: Resource-updater-${{ hashFiles('./tools/ResourceUpdater/main.cpp') }}
|
||||
path: |
|
||||
./tools/ResourceUpdater/x64/Release/opencv_world4_maa.dll
|
||||
./tools/ResourceUpdater/x64/Release/ResourceUpdater.exe
|
||||
|
||||
- name: Cache MaaDeps
|
||||
if: steps.cache-resupd.outputs.cache-hit != 'true'
|
||||
id: cache-maadeps
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./MaaDeps
|
||||
key: ${{ runner.os }}-x64-maadeps-${{ hashFiles('./maadeps-download.py') }}
|
||||
|
||||
- name: Bootstrap MaaDeps
|
||||
if: steps.cache-resupd.outputs.cache-hit != 'true' && steps.cache-maadeps.outputs.cache-hit != 'true'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
python3 maadeps-download.py x64-windows
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
if: steps.cache-resupd.outputs.cache-hit != 'true'
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
|
||||
- name: Build Resource Updater
|
||||
if: steps.cache-resupd.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
MSBUILD tools/ResourceUpdater/ResourceUpdater.vcxproj /t:rebuild /p:Configuration="Release" /p:Platform="x64" /p:BuildProjectReferences=false /m
|
||||
|
||||
- name: Save ResourceUpdater.exe to cache
|
||||
if: always() && steps.cache-resupd.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
key: Resource-updater-${{ hashFiles('./tools/ResourceUpdater/main.cpp') }}
|
||||
path: |
|
||||
./tools/ResourceUpdater/x64/Release/opencv_world4_maa.dll
|
||||
./tools/ResourceUpdater/x64/Release/ResourceUpdater.exe
|
||||
|
||||
- name: Download txwy
|
||||
id: download-txwy
|
||||
uses: actions/download-artifact@v4.1.8
|
||||
continue-on-error: true
|
||||
with:
|
||||
name: txwy
|
||||
path: ./tools/ResourceUpdater/x64/Release/Overseas/tw/gamedata/excel
|
||||
|
||||
- name: Delay txwy
|
||||
if: steps.download-txwy.outcome == 'failure'
|
||||
run: |
|
||||
Start-Sleep -s 20
|
||||
|
||||
- name: Re-download txwy
|
||||
if: steps.download-txwy.outcome == 'failure'
|
||||
uses: actions/download-artifact@v4.1.8
|
||||
with:
|
||||
name: txwy
|
||||
path: ./tools/ResourceUpdater/x64/Release/Overseas/tw/gamedata/excel
|
||||
|
||||
- name: Download Overseas
|
||||
id: download-overseas
|
||||
uses: actions/download-artifact@v4.1.8
|
||||
continue-on-error: true
|
||||
with:
|
||||
name: overseas
|
||||
path: ./tools/ResourceUpdater/x64/Release/Overseas
|
||||
|
||||
- name: Delay Overseas
|
||||
if: steps.download-overseas.outcome == 'failure'
|
||||
run: |
|
||||
Start-Sleep -s 20
|
||||
|
||||
- name: Re-download Overseas
|
||||
if: steps.download-overseas.outcome == 'failure'
|
||||
uses: actions/download-artifact@v4.1.8
|
||||
with:
|
||||
name: overseas
|
||||
path: ./tools/ResourceUpdater/x64/Release/Overseas
|
||||
|
||||
- name: Download Official
|
||||
id: download-official
|
||||
uses: actions/download-artifact@v4.1.8
|
||||
continue-on-error: true
|
||||
with:
|
||||
name: official
|
||||
path: ./tools/ResourceUpdater/x64/Release/Official
|
||||
|
||||
- name: Delay Official
|
||||
if: steps.download-official.outcome == 'failure'
|
||||
run: |
|
||||
Start-Sleep -s 20
|
||||
|
||||
- name: Re-download Official
|
||||
if: steps.download-official.outcome == 'failure'
|
||||
uses: actions/download-artifact@v4.1.8
|
||||
with:
|
||||
name: official
|
||||
path: ./tools/ResourceUpdater/x64/Release/Official
|
||||
|
||||
- name: Run Resource Updater
|
||||
run: |
|
||||
./tools/ResourceUpdater/x64/Release/ResourceUpdater.exe
|
||||
.\tools\ResourceUpdater\x64\Release\ResourceUpdater.exe
|
||||
|
||||
- name: Task Sorting
|
||||
id: task_sorting
|
||||
- name: Overseas Tasks Ordering
|
||||
run: |
|
||||
python3 tools/TaskSorter/TaskSorter.py
|
||||
Write-Output "gitdiff=$(git diff --name-only --diff-filter=ACM 2>$null | Select-String -Pattern '\.json$' -List)" >> $env:GITHUB_OUTPUT
|
||||
|
||||
- name: Run prettier
|
||||
uses: Nerixyz/actionsx-prettier@v3-adj
|
||||
with:
|
||||
args: -w ${{ steps.task_sorting.outputs.gitdiff }}
|
||||
|
||||
- name: Update version.json date if necessary
|
||||
id: update_version
|
||||
run: pwsh tools/ResourceUpdater/version.ps1
|
||||
|
||||
- name: Setup python
|
||||
if: steps.update_version.outputs.contains_png == 'True'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
- name: Cache Python packages
|
||||
if: always() && steps.update_version.outputs.contains_png == 'True'
|
||||
id: cache_python
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.pythonLocation }}/Lib/site-packages
|
||||
key: ${{ runner.os }}-pip-optimize-templates-${{ hashFiles('./tools/OptimizeTemplates/requirements.txt') }}
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.cache_python.outputs.cache-hit != 'true' && steps.update_version.outputs.contains_png == 'True'
|
||||
- name: Check if only sorted
|
||||
id: check_only_sorted
|
||||
run: |
|
||||
pip install -r tools/OptimizeTemplates/requirements.txt
|
||||
git status
|
||||
|
||||
- name: Setup oxipng
|
||||
if: steps.update_version.outputs.contains_png == 'True'
|
||||
uses: baptiste0928/cargo-install@v3
|
||||
with:
|
||||
crate: oxipng
|
||||
$diff = $(git diff --numstat HEAD | findstr -i resource)
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
echo "no diff"
|
||||
exit 0
|
||||
}
|
||||
|
||||
- name: Run optimize_templates
|
||||
if: steps.update_version.outputs.contains_png == 'True'
|
||||
run: |
|
||||
python3 tools/OptimizeTemplates/optimize_templates.py -p resource/template/items/ resource/template/infrast/
|
||||
echo "diff: "$diff
|
||||
$sp = $($diff -split "\s+")
|
||||
$numbers = $($sp | Where-Object { $_ -match "^\d+$" })
|
||||
echo "numbers: "$numbers
|
||||
|
||||
$length = $numbers.Length
|
||||
$noDiff = $true
|
||||
for ($i = 0; $i -lt $length; $i += 2) {
|
||||
$firstNumber = $numbers[$i]
|
||||
$secondNumber = $numbers[$i+1]
|
||||
|
||||
if ($firstNumber -gt 1) {
|
||||
$noDiff = $false
|
||||
break
|
||||
}
|
||||
|
||||
if ($firstNumber -ne $secondNumber) {
|
||||
$noDiff = $false
|
||||
break
|
||||
}
|
||||
}
|
||||
echo "noDiff: "$noDiff
|
||||
echo "only_sorted=$noDiff" >> $env:GITHUB_OUTPUT
|
||||
|
||||
- name: Cancelling
|
||||
if: steps.check_only_sorted.outputs.only_sorted == 'True'
|
||||
uses: andymckay/cancel-action@0.3
|
||||
|
||||
- name: Add files to git
|
||||
if: steps.update_version.outputs.changes == 'True'
|
||||
if: steps.check_only_sorted.outputs.only_sorted != 'True'
|
||||
id: add_files
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git status
|
||||
|
||||
git config user.name "$env:GITHUB_ACTOR"
|
||||
git config user.email "$env:GITHUB_ACTOR@users.noreply.github.com"
|
||||
git add .
|
||||
|
||||
$commit_msg = "${{ github.event.inputs.commit_message }}"
|
||||
if ([string]::IsNullOrWhiteSpace($commit_msg)) {
|
||||
$commit_msg = "chore: Auto Update Game Resources - $(Get-Date -Format 'yyyy-MM-dd')"
|
||||
} else {
|
||||
if (-not [string]::IsNullOrWhiteSpace($commit_msg)) {
|
||||
$commit_msg = $commit_msg.Trim()
|
||||
} else {
|
||||
$commit_msg = "chore: Auto Update Game Resources - $(Get-Date -Format 'yyyy-MM-dd')"
|
||||
}
|
||||
|
||||
$run_url = "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||
|
||||
git commit -m "$commit_msg" -m "$run_url" -m "[skip changelog]"
|
||||
git commit -m "$commit_msg" -m "[skip changelog]"
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Output "have_commits=True" >> $env:GITHUB_OUTPUT
|
||||
echo "have_commits=True" >> $env:GITHUB_OUTPUT
|
||||
}
|
||||
|
||||
git pull origin ${{ github.ref_name }} --rebase
|
||||
git pull origin $(git rev-parse --abbrev-ref HEAD) --unshallow --rebase
|
||||
|
||||
- name: Push changes
|
||||
- name: Cancelling
|
||||
if: steps.add_files.outputs.have_commits != 'True'
|
||||
uses: andymckay/cancel-action@0.3
|
||||
|
||||
- name: Push changes # push the output folder to your repo
|
||||
if: steps.add_files.outputs.have_commits == 'True'
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
||||
branch: ${{ github.ref }}
|
||||
github_token: ${{ secrets.MAA_RESOURCE_SYNC }}
|
||||
github_token: ${{ secrets.MISTEOWORKFLOW }}
|
||||
|
||||
# - name: Update OTA resource
|
||||
# if: steps.update_version.outputs.update_resources == 'True'
|
||||
# env:
|
||||
# GH_TOKEN: ${{ secrets.MISTEOWORKFLOW }}
|
||||
# run: |
|
||||
# gh workflow --repo MaaAssistantArknights/MaaRelease run update-resource.yml
|
||||
|
||||
- name: Add cancelled status
|
||||
if: steps.update_version.outputs.changes != 'True' || steps.add_files.outputs.have_commits != 'True'
|
||||
uses: andymckay/cancel-action@0.5
|
||||
- name: Update OTA resource
|
||||
if: steps.add_files.outputs.have_commits == 'True'
|
||||
run: |
|
||||
gh workflow --repo MaaAssistantArknights/MaaRelease run update-resource.yml
|
||||
|
||||
# - name: Release # ref: https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
|
||||
# if: steps.add_files.outputs.have_commits == 'True'
|
||||
# run: |
|
||||
# gh workflow run release-nightly-ota -f release_body="Auto Release of Resource Updates"
|
||||
# env:
|
||||
# GH_TOKEN: ${{ github.token }}
|
||||
|
||||
111
.github/workflows/smoke-testing.yml
vendored
@@ -1,121 +1,78 @@
|
||||
name: smoke-testing
|
||||
name: test
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "3rdparty/include/**"
|
||||
- "include/**"
|
||||
- "src/Cpp/**"
|
||||
- "src/MaaCore/**"
|
||||
- "src/SyncRes/**"
|
||||
- "src/**"
|
||||
- "cmake/**"
|
||||
- "CMakeLists.txt"
|
||||
- "MAA.sln"
|
||||
- "resource/**"
|
||||
- "MaaDeps/**"
|
||||
- "!**/*.md"
|
||||
pull_request:
|
||||
paths:
|
||||
- "3rdparty/include/**"
|
||||
- "include/**"
|
||||
- "src/Cpp/**"
|
||||
- "src/MaaCore/**"
|
||||
- "src/SyncRes/**"
|
||||
- "src/**"
|
||||
- "cmake/**"
|
||||
- "CMakeLists.txt"
|
||||
- "MAA.sln"
|
||||
- "resource/**"
|
||||
- "MaaDeps/**"
|
||||
- "!**/*.md"
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
smoke-testing:
|
||||
# Prevent duplicate runs on organization branches with PRs
|
||||
if: github.event_name != 'pull_request' ||
|
||||
github.event.pull_request.head.repo.full_name !=
|
||||
github.event.pull_request.base.repo.full_name
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
|
||||
- name: Generate cache key
|
||||
id: cache_key
|
||||
run: |
|
||||
Write-Output "key=Smoke-testing-${{ hashFiles('src/Cpp/**', 'src/MaaCore/**', 'src/SyncRes/**', '3rdparty/include/**', 'include/**', 'MAA.sln') }}" >> $env:GITHUB_OUTPUT
|
||||
|
||||
- name: Restore cache smoke-testing
|
||||
id: cache-exe
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
key: ${{ steps.cache_key.outputs.key }}
|
||||
path: |
|
||||
./x64/Debug/Sample.exe
|
||||
./x64/Debug/fastdeploy_ppocr.dll
|
||||
./x64/Debug/MaaCore.dll
|
||||
./x64/Debug/onnxruntime_maa.dll
|
||||
./x64/Debug/opencv_world4d_maa.dll
|
||||
|
||||
- name: Fetch submodules
|
||||
if: steps.cache-exe.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
git submodule update --init --depth 1 3rdparty/EmulatorExtras
|
||||
|
||||
- name: Cache MaaDeps
|
||||
if: steps.cache-exe.outputs.cache-hit != 'true'
|
||||
id: cache-maadeps
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./MaaDeps
|
||||
key: ${{ runner.os }}-x64-maadeps-${{ hashFiles('./maadeps-download.py') }}
|
||||
|
||||
submodules: recursive
|
||||
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
|
||||
- name: Bootstrap MaaDeps
|
||||
if: steps.cache-exe.outputs.cache-hit != 'true' && steps.cache-maadeps.outputs.cache-hit != 'true'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
python3 maadeps-download.py x64-windows
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
if: steps.cache-exe.outputs.cache-hit != 'true'
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
with:
|
||||
msbuild-architecture: x64
|
||||
|
||||
uses: microsoft/setup-msbuild@v1
|
||||
- name: Build MaaSample
|
||||
if: steps.cache-exe.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
MSBUILD src/Cpp/MaaSample.slnf -t:restore,build -p:Configuration="Debug" -p:Platform="x64" -m
|
||||
MSBUILD src/Cpp/MaaSample.slnf /t:rebuild /p:Configuration="Debug" /p:Platform="x64" /m
|
||||
|
||||
- name: Copy resource to build directory
|
||||
if: steps.cache-exe.outputs.cache-hit == 'true'
|
||||
- name: Run tests - Official #用来判断是不是国服资源出错导致外服全炸
|
||||
run: |
|
||||
(robocopy "resource" "x64/Debug/resource" /E /XD "Arknights-Tile-Pos" /MT:4 > $null);
|
||||
if ($LASTEXITCODE -lt 2) { $global:LASTEXITCODE = $null }
|
||||
(robocopy "resource/Arknights-Tile-Pos" "x64/Debug/resource/Arknights-Tile-Pos" "overview.json" > $null);
|
||||
if ($LASTEXITCODE -lt 2) { $global:LASTEXITCODE= $null }
|
||||
.\x64\Debug\Sample.exe
|
||||
|
||||
- name: Run tests
|
||||
- name: Run tests - YostarJP
|
||||
run: |
|
||||
pwsh tools/SmokeTesting/run_tests.ps1
|
||||
|
||||
- name: Save cache smoke-testing (only in dev)
|
||||
if: steps.cache-exe.outputs.cache-hit != 'true' && github.ref == 'refs/heads/dev'
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
key: ${{ steps.cache_key.outputs.key }}
|
||||
path: |
|
||||
./x64/Debug/Sample.exe
|
||||
./x64/Debug/fastdeploy_ppocr.dll
|
||||
./x64/Debug/MaaCore.dll
|
||||
./x64/Debug/onnxruntime_maa.dll
|
||||
./x64/Debug/opencv_world4d_maa.dll
|
||||
.\x64\Debug\Sample.exe YostarJP
|
||||
|
||||
- name: Run tests - YostarEN
|
||||
run: |
|
||||
.\x64\Debug\Sample.exe YostarEN
|
||||
|
||||
- name: Run tests - YostarKR
|
||||
run: |
|
||||
.\x64\Debug\Sample.exe YostarKR
|
||||
|
||||
- name: Run tests - txwy
|
||||
run: |
|
||||
.\x64\Debug\Sample.exe txwy
|
||||
|
||||
- name: Upload logs
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: logs
|
||||
path: ./x64/Debug/debug
|
||||
name: log
|
||||
path: .\x64\Debug\debug
|
||||
|
||||
39
.github/workflows/stale.yml
vendored
@@ -1,39 +0,0 @@
|
||||
name: "Inactive Issues Closer"
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *" # Runs daily at UTC 00:00
|
||||
workflow_dispatch: # Allows manual triggering
|
||||
|
||||
env: # config
|
||||
daysBeforeStale: 90 # Number of days of inactivity before marking as stale
|
||||
daysBeforeClose: 7 # Number of days to wait after marking as stale before closing
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
if: github.repository_owner == 'MaaAssistantArknights'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: write # Workaround for https://github.com/actions/stale/issues/1090
|
||||
issues: write
|
||||
# Completely disable stalling for PRs
|
||||
pull-requests: none
|
||||
contents: none
|
||||
steps:
|
||||
- name: Close inactive issues
|
||||
uses: actions/stale@v9
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
days-before-stale: ${{ env.daysBeforeStale }}
|
||||
days-before-close: ${{ env.daysBeforeClose }}
|
||||
stale-issue-label: "stale"
|
||||
stale-issue-message: |
|
||||
This issue has been inactive for a prolonged period and will be closed automatically in ${{ env.daysBeforeClose }} days.
|
||||
该问题已长时间处于闲置状态,${{ env.daysBeforeClose }} 天后将自动关闭。
|
||||
exempt-issue-labels: "keep-open, MAA Team, enhancement"
|
||||
days-before-pr-stale: -1 # Completely disable stalling for PRs
|
||||
days-before-pr-close: -1 # Completely disable closing for PRs
|
||||
|
||||
# Temporary to reduce the huge issues number
|
||||
operations-per-run: 100
|
||||
debug-only: false
|
||||
15
.github/workflows/sync-resource.yml
vendored
@@ -1,17 +1,16 @@
|
||||
name: sync-resource
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
paths:
|
||||
- "resource/**"
|
||||
- ".github/workflows/sync-resource.yml"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
sync-resource:
|
||||
if: github.repository_owner == 'MaaAssistantArknights'
|
||||
sync-reource:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
@@ -22,8 +21,8 @@ jobs:
|
||||
|
||||
- name: Setup Git
|
||||
run: |
|
||||
git config --global user.name 'github-actions[bot]'
|
||||
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
||||
git config --global user.name "$GITHUB_ACTOR"
|
||||
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
||||
git show -s
|
||||
|
||||
- name: Checkout MaaResource
|
||||
@@ -49,3 +48,9 @@ jobs:
|
||||
git status
|
||||
git commit -m "$commit_msg" || exit 0
|
||||
git push
|
||||
|
||||
- name: Setup resource update
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.MISTEOWORKFLOW }}
|
||||
run: |
|
||||
gh workflow --repo MaaAssistantArknights/MaaRelease run update-resource.yml
|
||||
|
||||
4
.github/workflows/website-workflow.yml
vendored
@@ -41,7 +41,9 @@ jobs:
|
||||
- name: Setup Node.js environment
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
node-version: 20
|
||||
cache: pnpm
|
||||
cache-dependency-path: './website/pnpm-lock.yaml'
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
19
.gitignore
vendored
@@ -437,9 +437,6 @@ tools/**/*.png
|
||||
.vscode
|
||||
enc_temp_folder/*
|
||||
|
||||
# RoguelikeRecruitmentTool 导出的 Excel 文件
|
||||
tools/RoguelikeRecruitmentTool/output
|
||||
|
||||
# Nuke
|
||||
.nuke/temp/*
|
||||
|
||||
@@ -451,19 +448,3 @@ tools/RoguelikeRecruitmentTool/output
|
||||
# CF 活动关卡(异格夜刀),手动改的地图
|
||||
/resource/Arknights-Tile-Pos/act24side_09-activities-act24side-level_act24side_09.json
|
||||
/src/MaaWpfGui/FodyWeavers.xml
|
||||
|
||||
# 链接检查缓存
|
||||
.lycheecache
|
||||
|
||||
# MaaDeps
|
||||
/MaaDeps/*
|
||||
|
||||
# ResourceUpdater workflow
|
||||
/original/*
|
||||
|
||||
# Windows Explorer Shits
|
||||
desktop.ini
|
||||
Thumbs.db
|
||||
|
||||
# macOS Finder Shit
|
||||
.DS_Store
|
||||
|
||||
5
.gitmodules
vendored
@@ -4,6 +4,11 @@
|
||||
[submodule "src/MaaMacGui"]
|
||||
path = src/MaaMacGui
|
||||
url = https://github.com/MaaAssistantArknights/MaaMacGui.git
|
||||
[submodule "MaaDeps"]
|
||||
path = MaaDeps
|
||||
url = https://github.com/MaaAssistantArknights/MaaDeps
|
||||
shallow = true
|
||||
branch = master
|
||||
[submodule "src/maa-cli"]
|
||||
path = src/maa-cli
|
||||
url = https://github.com/MaaAssistantArknights/maa-cli.git
|
||||
|
||||
5
.linkspector.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
dirs:
|
||||
- .
|
||||
useGitIgnore: true
|
||||
ignorePatterns:
|
||||
- pattern: "^https?://127.0.0.1(:\\d+)?/"
|
||||
@@ -1,127 +1,132 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"title": "Build Schema",
|
||||
"$ref": "#/definitions/build",
|
||||
"definitions": {
|
||||
"build": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Continue": {
|
||||
"type": "boolean",
|
||||
"description": "Indicates to continue a previously failed build attempt"
|
||||
},
|
||||
"Help": {
|
||||
"type": "boolean",
|
||||
"description": "Shows the help text for this build assembly"
|
||||
},
|
||||
"Host": {
|
||||
"type": "string",
|
||||
"description": "Host for execution. Default is 'automatic'",
|
||||
"enum": [
|
||||
"AppVeyor",
|
||||
"AzurePipelines",
|
||||
"Bamboo",
|
||||
"Bitbucket",
|
||||
"Bitrise",
|
||||
"GitHubActions",
|
||||
"GitLab",
|
||||
"Jenkins",
|
||||
"Rider",
|
||||
"SpaceAutomation",
|
||||
"TeamCity",
|
||||
"Terminal",
|
||||
"TravisCI",
|
||||
"VisualStudio",
|
||||
"VSCode"
|
||||
]
|
||||
},
|
||||
"NoLogo": {
|
||||
"type": "boolean",
|
||||
"description": "Disables displaying the NUKE logo"
|
||||
},
|
||||
"Partition": {
|
||||
"type": "string",
|
||||
"description": "Partition to use on CI"
|
||||
},
|
||||
"Plan": {
|
||||
"type": "boolean",
|
||||
"description": "Shows the execution plan (HTML)"
|
||||
},
|
||||
"Profile": {
|
||||
"type": "array",
|
||||
"description": "Defines the profiles to load",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"Root": {
|
||||
"type": "string",
|
||||
"description": "Root directory during build execution"
|
||||
},
|
||||
"Skip": {
|
||||
"type": "array",
|
||||
"description": "List of targets to be skipped. Empty list skips all dependencies",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Default",
|
||||
"DevBuild",
|
||||
"DevBuildDefault",
|
||||
"DevBuildReleaseSimulation",
|
||||
"ReleaseMaa",
|
||||
"SetMaaChangeLog",
|
||||
"SetPackageBundled",
|
||||
"SetVersion",
|
||||
"UseClean",
|
||||
"UseCommitVersion",
|
||||
"UseMaaChangeLog",
|
||||
"UseMaaDevBundle",
|
||||
"UseMaaRelease",
|
||||
"UsePublishArtifact",
|
||||
"UsePublishRelease",
|
||||
"UseRsVersion",
|
||||
"UseTagVersion",
|
||||
"WithCompileCoreRelease",
|
||||
"WithCompileWpfRelease",
|
||||
"WithSyncRes"
|
||||
]
|
||||
}
|
||||
},
|
||||
"Target": {
|
||||
"type": "array",
|
||||
"description": "List of targets to be invoked. Default is '{default_target}'",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Default",
|
||||
"DevBuild",
|
||||
"DevBuildDefault",
|
||||
"DevBuildReleaseSimulation",
|
||||
"ReleaseMaa",
|
||||
"SetMaaChangeLog",
|
||||
"SetPackageBundled",
|
||||
"SetVersion",
|
||||
"UseClean",
|
||||
"UseCommitVersion",
|
||||
"UseMaaChangeLog",
|
||||
"UseMaaDevBundle",
|
||||
"UseMaaRelease",
|
||||
"UsePublishArtifact",
|
||||
"UsePublishRelease",
|
||||
"UseRsVersion",
|
||||
"UseTagVersion",
|
||||
"WithCompileCoreRelease",
|
||||
"WithCompileWpfRelease",
|
||||
"WithSyncRes"
|
||||
]
|
||||
}
|
||||
},
|
||||
"Verbosity": {
|
||||
"type": "string",
|
||||
"description": "Logging verbosity during build execution. Default is 'Normal'",
|
||||
"enum": ["Minimal", "Normal", "Quiet", "Verbose"]
|
||||
}
|
||||
}
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"title": "Build Schema",
|
||||
"$ref": "#/definitions/build",
|
||||
"definitions": {
|
||||
"build": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Continue": {
|
||||
"type": "boolean",
|
||||
"description": "Indicates to continue a previously failed build attempt"
|
||||
},
|
||||
"Help": {
|
||||
"type": "boolean",
|
||||
"description": "Shows the help text for this build assembly"
|
||||
},
|
||||
"Host": {
|
||||
"type": "string",
|
||||
"description": "Host for execution. Default is 'automatic'",
|
||||
"enum": [
|
||||
"AppVeyor",
|
||||
"AzurePipelines",
|
||||
"Bamboo",
|
||||
"Bitbucket",
|
||||
"Bitrise",
|
||||
"GitHubActions",
|
||||
"GitLab",
|
||||
"Jenkins",
|
||||
"Rider",
|
||||
"SpaceAutomation",
|
||||
"TeamCity",
|
||||
"Terminal",
|
||||
"TravisCI",
|
||||
"VisualStudio",
|
||||
"VSCode"
|
||||
]
|
||||
},
|
||||
"NoLogo": {
|
||||
"type": "boolean",
|
||||
"description": "Disables displaying the NUKE logo"
|
||||
},
|
||||
"Partition": {
|
||||
"type": "string",
|
||||
"description": "Partition to use on CI"
|
||||
},
|
||||
"Plan": {
|
||||
"type": "boolean",
|
||||
"description": "Shows the execution plan (HTML)"
|
||||
},
|
||||
"Profile": {
|
||||
"type": "array",
|
||||
"description": "Defines the profiles to load",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"Root": {
|
||||
"type": "string",
|
||||
"description": "Root directory during build execution"
|
||||
},
|
||||
"Skip": {
|
||||
"type": "array",
|
||||
"description": "List of targets to be skipped. Empty list skips all dependencies",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Default",
|
||||
"DevBuild",
|
||||
"DevBuildDefault",
|
||||
"DevBuildReleaseSimulation",
|
||||
"ReleaseMaa",
|
||||
"SetMaaChangeLog",
|
||||
"SetPackageBundled",
|
||||
"SetVersion",
|
||||
"UseClean",
|
||||
"UseCommitVersion",
|
||||
"UseMaaChangeLog",
|
||||
"UseMaaDevBundle",
|
||||
"UseMaaRelease",
|
||||
"UsePublishArtifact",
|
||||
"UsePublishRelease",
|
||||
"UseRsVersion",
|
||||
"UseTagVersion",
|
||||
"WithCompileCoreRelease",
|
||||
"WithCompileWpfRelease",
|
||||
"WithSyncRes"
|
||||
]
|
||||
}
|
||||
},
|
||||
"Target": {
|
||||
"type": "array",
|
||||
"description": "List of targets to be invoked. Default is '{default_target}'",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Default",
|
||||
"DevBuild",
|
||||
"DevBuildDefault",
|
||||
"DevBuildReleaseSimulation",
|
||||
"ReleaseMaa",
|
||||
"SetMaaChangeLog",
|
||||
"SetPackageBundled",
|
||||
"SetVersion",
|
||||
"UseClean",
|
||||
"UseCommitVersion",
|
||||
"UseMaaChangeLog",
|
||||
"UseMaaDevBundle",
|
||||
"UseMaaRelease",
|
||||
"UsePublishArtifact",
|
||||
"UsePublishRelease",
|
||||
"UseRsVersion",
|
||||
"UseTagVersion",
|
||||
"WithCompileCoreRelease",
|
||||
"WithCompileWpfRelease",
|
||||
"WithSyncRes"
|
||||
]
|
||||
}
|
||||
},
|
||||
"Verbosity": {
|
||||
"type": "string",
|
||||
"description": "Logging verbosity during build execution. Default is 'Normal'",
|
||||
"enum": [
|
||||
"Minimal",
|
||||
"Normal",
|
||||
"Quiet",
|
||||
"Verbose"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"$schema": "./build.schema.json",
|
||||
"Solution": "tools/MaaBuilder.sln"
|
||||
"$schema": "./build.schema.json",
|
||||
"Solution": "tools/MaaBuilder.sln"
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
default_install_hook_types: [pre-commit, prepare-commit-msg]
|
||||
ci:
|
||||
autofix_commit_msg: "chore: Auto update by pre-commit hooks [skip changelog]"
|
||||
autofix_prs: true
|
||||
repos:
|
||||
- repo: https://github.com/shssoichiro/oxipng
|
||||
rev: v9.1.4
|
||||
hooks:
|
||||
- id: oxipng
|
||||
args: ["-q", "-o", "2", "-s", "--ng"]
|
||||
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||
rev: v20.1.0
|
||||
hooks:
|
||||
- id: clang-format
|
||||
files: ^src/MaaCore/.*
|
||||
args: ["--assume-filename", ".clang-format"]
|
||||
- repo: https://github.com/rbubley/mirrors-prettier
|
||||
rev: v3.5.3
|
||||
hooks:
|
||||
- id: prettier
|
||||
files: ^((\.github/ISSUE_TEMPLATE|docs|resource|src|tools|website)/.*|\.pre-commit-config\.yaml|package-definition\.json)
|
||||
types_or:
|
||||
- yaml
|
||||
- json
|
||||
- repo: https://github.com/DavidAnson/markdownlint-cli2
|
||||
rev: v0.17.2
|
||||
hooks:
|
||||
- id: markdownlint-cli2
|
||||
files: ^docs/.*|^README\.md$
|
||||
types:
|
||||
- markdown
|
||||
args: ["--fix", "--config", "docs/.markdownlint.yaml", "#**/node_modules"]
|
||||
@@ -1,15 +0,0 @@
|
||||
**/node_modules/
|
||||
|
||||
MaaDeps/
|
||||
3rdparty/
|
||||
src/maa-cli
|
||||
src/MaaMacGui
|
||||
|
||||
website/
|
||||
docs/
|
||||
|
||||
resource/Arknights-Tile-Pos/
|
||||
tools/OptimizeTemplates/optimize_templates.json
|
||||
|
||||
CITATION.cff
|
||||
CHANGELOG.md
|
||||
17
.prettierrc
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"tabWidth": 4,
|
||||
"printWidth": 120,
|
||||
"useTabs": false,
|
||||
"bracketSameLine": true,
|
||||
"bracketSpacing": true,
|
||||
"endOfLine": "auto",
|
||||
"overrides": [
|
||||
{
|
||||
"files": [".clang-format", "**/*.yml", "**/*.yaml"],
|
||||
"options": {
|
||||
"parser": "yaml",
|
||||
"tabWidth": 2
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
3
.vscode/settings.json
vendored
@@ -2,8 +2,7 @@
|
||||
"json.schemas": [
|
||||
{
|
||||
"fileMatch": [
|
||||
"resource/tasks/**/*.json",
|
||||
"resource/global/**/resource/tasks/**/*.json",
|
||||
"resource/tasks.json"
|
||||
],
|
||||
"url": "./docs/maa_tasks_schema.json"
|
||||
}
|
||||
|
||||
2
3rdparty/EmulatorExtras
vendored
@@ -39,8 +39,8 @@ inline matrix4x4 camera_matrix_from_trans(
|
||||
const vec3d& euler,
|
||||
double ratio,
|
||||
double fov_2_y = 20 * degree,
|
||||
double far_c = 1000,
|
||||
double near_c = 0.3)
|
||||
double far = 1000,
|
||||
double near = 0.3)
|
||||
{
|
||||
const double cos_y = std::cos(euler[0]);
|
||||
const double sin_y = std::sin(euler[0]);
|
||||
@@ -66,11 +66,11 @@ inline matrix4x4 camera_matrix_from_trans(
|
||||
0, -sin_x, -cos_x, 0, //
|
||||
0, 0, 0, 1,
|
||||
};
|
||||
const matrix4x4 proj = matrix4x4 {
|
||||
const matrix4x4 proj = {
|
||||
// clang-format off
|
||||
ratio / tan_f, 0, 0, 0,
|
||||
0, 1 / tan_f, 0, 0,
|
||||
0, 0, -(far_c + near_c) / (far_c - near_c), -(far_c * near_c * 2) / (far_c - near_c),
|
||||
0, 0, -(far + near) / (far - near), -(far * near * 2) / (far - near),
|
||||
0, 0, -1, 0,
|
||||
// clang-format on
|
||||
};
|
||||
@@ -78,13 +78,14 @@ inline matrix4x4 camera_matrix_from_trans(
|
||||
return proj * matrixX * matrixY * translate;
|
||||
}
|
||||
|
||||
inline cv::Point world_to_screen(const Level& level, const vec3d& world_pos, bool side, const vec3d& offset = {})
|
||||
inline cv::Point
|
||||
world_to_screen(const Level& level, const vec3d& world_pos, bool side, const vec3d& offset = {})
|
||||
{
|
||||
static constexpr int width = 1280;
|
||||
static constexpr int height = 720;
|
||||
static constexpr double width = 1280;
|
||||
static constexpr double height = 720;
|
||||
const vec3d pos_cam = camera_pos(level, side, width, height) + offset;
|
||||
const vec3d euler = camera_euler_angles_yxz(level, side);
|
||||
const matrix4x4 matrix = camera_matrix_from_trans(pos_cam, euler, static_cast<double>(height) / width);
|
||||
const matrix4x4 matrix = camera_matrix_from_trans(pos_cam, euler, height / width);
|
||||
auto result = matrix * cv::Point3d(world_pos);
|
||||
result = result / result(3);
|
||||
result = (result + cv::Vec4d::ones()) / 2.;
|
||||
@@ -106,7 +107,12 @@ inline vec3d get_tile_world_pos(const Level& level, int tile_y, int tile_x)
|
||||
};
|
||||
}
|
||||
|
||||
inline auto get_tile_screen_pos(const Level& level, int tile_y, int tile_x, bool side = false, const vec3d& offset = {})
|
||||
inline auto get_tile_screen_pos(
|
||||
const Level& level,
|
||||
int tile_y,
|
||||
int tile_x,
|
||||
bool side = false,
|
||||
const vec3d& offset = {})
|
||||
{
|
||||
return world_to_screen(level, get_tile_world_pos(level, tile_y, tile_x), side, offset);
|
||||
}
|
||||
|
||||
320
3rdparty/include/meojson/common/array.hpp
vendored
@@ -1,5 +1,3 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <initializer_list>
|
||||
@@ -39,86 +37,37 @@ public:
|
||||
// explicit basic_array(const basic_value<string_t>& val);
|
||||
// explicit basic_array(basic_value<string_t>&& val);
|
||||
|
||||
template <
|
||||
typename collection_t,
|
||||
std::enable_if_t<
|
||||
_utils::is_collection<collection_t>
|
||||
&& std::is_constructible_v<value_type, _utils::range_value_t<collection_t>>,
|
||||
bool> = true>
|
||||
template <typename collection_t,
|
||||
std::enable_if_t<_utils::is_collection<collection_t> &&
|
||||
std::is_constructible_v<value_type, _utils::range_value_t<collection_t>>,
|
||||
bool> = true>
|
||||
basic_array(collection_t arr)
|
||||
: _array_data(std::make_move_iterator(arr.begin()), std::make_move_iterator(arr.end()))
|
||||
{
|
||||
}
|
||||
|
||||
template <
|
||||
typename fixed_array_t,
|
||||
std::enable_if_t<_utils::is_fixed_array<fixed_array_t>, bool> = true>
|
||||
basic_array(const fixed_array_t& arr)
|
||||
: _array_data(arr.begin(), arr.end())
|
||||
{
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_to_json_in_member<jsonization_t>::value, bool> = true>
|
||||
basic_array(const jsonization_t& value)
|
||||
: basic_array(value.to_json())
|
||||
{
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_to_json_in_templ_spec<jsonization_t>::value, bool> = true>
|
||||
basic_array(const jsonization_t& value)
|
||||
: basic_array(ext::jsonization<jsonization_t>().to_json(value))
|
||||
{
|
||||
}
|
||||
|
||||
template <typename... elem_ts>
|
||||
basic_array(const std::tuple<elem_ts...>& tup)
|
||||
{
|
||||
foreach_tuple(tup, std::make_index_sequence<std::tuple_size_v<std::tuple<elem_ts...>>>());
|
||||
}
|
||||
template <typename first_t, typename second_t>
|
||||
basic_array(std::pair<first_t, second_t> pair)
|
||||
: _array_data({ std::move(pair.first), std::move(pair.second) })
|
||||
{
|
||||
}
|
||||
{}
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_to_json_in_member<jsonization_t>::value, bool> = true>
|
||||
basic_array(const jsonization_t& value) : basic_array(value.to_json())
|
||||
{}
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_to_json_in_templ_spec<jsonization_t>::value, bool> = true>
|
||||
basic_array(const jsonization_t& value) : basic_array(ext::jsonization<jsonization_t>().to_json(value))
|
||||
{}
|
||||
|
||||
~basic_array() noexcept = default;
|
||||
|
||||
bool empty() const noexcept { return _array_data.empty(); }
|
||||
|
||||
size_t size() const noexcept { return _array_data.size(); }
|
||||
|
||||
bool contains(size_t pos) const { return pos < _array_data.size(); }
|
||||
|
||||
bool exists(size_t pos) const { return contains(pos); }
|
||||
|
||||
const basic_value<string_t>& at(size_t pos) const;
|
||||
|
||||
string_t dumps(std::optional<size_t> indent = std::nullopt) const
|
||||
{
|
||||
return indent ? format(*indent) : to_string();
|
||||
}
|
||||
|
||||
string_t dumps(std::optional<size_t> indent = std::nullopt) const { return indent ? format(*indent) : to_string(); }
|
||||
string_t to_string() const;
|
||||
|
||||
string_t format(size_t indent = 4) const { return format(indent, 0); }
|
||||
|
||||
template <typename value_t>
|
||||
bool all() const;
|
||||
template <typename value_t, template <typename...> typename collection_t = std::vector>
|
||||
collection_t<value_t> as_collection() const;
|
||||
template <
|
||||
typename value_t,
|
||||
size_t Size,
|
||||
template <typename, size_t> typename fixed_array_t = std::array>
|
||||
fixed_array_t<value_t, Size> as_fixed_array() const;
|
||||
template <typename... elem_ts>
|
||||
std::tuple<elem_ts...> as_tuple() const;
|
||||
template <typename first_t, typename second_t>
|
||||
std::pair<first_t, second_t> as_pair() const;
|
||||
|
||||
// Usage: get(key_1, key_2, ..., default_value);
|
||||
template <typename... key_then_default_value_t>
|
||||
@@ -163,54 +112,23 @@ public:
|
||||
|
||||
basic_array<string_t>& operator=(const basic_array<string_t>&) = default;
|
||||
basic_array<string_t>& operator=(basic_array<string_t>&&) noexcept = default;
|
||||
|
||||
template <
|
||||
typename value_t,
|
||||
std::enable_if_t<std::is_convertible_v<value_t, basic_array<string_t>>, bool> = true>
|
||||
template <typename value_t, std::enable_if_t<std::is_convertible_v<value_t, basic_array<string_t>>, bool> = true>
|
||||
basic_array<string_t>& operator=(value_t rhs)
|
||||
{
|
||||
return *this = basic_array<string_t>(std::move(rhs));
|
||||
}
|
||||
|
||||
bool operator==(const basic_array<string_t>& rhs) const;
|
||||
|
||||
bool operator!=(const basic_array<string_t>& rhs) const { return !(*this == rhs); }
|
||||
|
||||
template <
|
||||
typename value_t,
|
||||
template <typename...> typename collection_t = std::vector,
|
||||
std::enable_if_t<_utils::is_collection<collection_t<value_t>>, bool> = true>
|
||||
template <typename value_t, template <typename...> typename collection_t = std::vector,
|
||||
std::enable_if_t<_utils::is_collection<collection_t<value_t>>, bool> = true>
|
||||
explicit operator collection_t<value_t>() const
|
||||
{
|
||||
return as_collection<value_t, collection_t>();
|
||||
}
|
||||
|
||||
template <
|
||||
typename value_t,
|
||||
size_t Size,
|
||||
template <typename, size_t> typename fixed_array_t = std::array,
|
||||
std::enable_if_t<_utils::is_fixed_array<fixed_array_t<value_t, Size>>, bool> = true>
|
||||
explicit operator fixed_array_t<value_t, Size>() const
|
||||
{
|
||||
return as_fixed_array<value_t, Size, fixed_array_t>();
|
||||
}
|
||||
|
||||
template <typename... elem_ts>
|
||||
explicit operator std::tuple<elem_ts...>() const
|
||||
{
|
||||
return as_tuple<elem_ts...>();
|
||||
}
|
||||
|
||||
template <typename elem1_t, typename elem2_t>
|
||||
explicit operator std::pair<elem1_t, elem2_t>() const
|
||||
{
|
||||
return as_pair<elem1_t, elem2_t>();
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_from_json_in_member<jsonization_t, string_t>::value, bool> =
|
||||
true>
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_from_json_in_member<jsonization_t, string_t>::value, bool> = true>
|
||||
explicit operator jsonization_t() const
|
||||
{
|
||||
jsonization_t dst {};
|
||||
@@ -219,12 +137,8 @@ public:
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<
|
||||
_utils::has_from_json_in_templ_spec<jsonization_t, string_t>::value,
|
||||
bool> = true>
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_from_json_in_templ_spec<jsonization_t, string_t>::value, bool> = true>
|
||||
explicit operator jsonization_t() const
|
||||
{
|
||||
jsonization_t dst {};
|
||||
@@ -236,25 +150,13 @@ public:
|
||||
|
||||
private:
|
||||
template <typename... key_then_default_value_t, size_t... keys_indexes_t>
|
||||
auto
|
||||
get(std::tuple<key_then_default_value_t...> keys_then_default_value,
|
||||
std::index_sequence<keys_indexes_t...>) const;
|
||||
auto get(std::tuple<key_then_default_value_t...> keys_then_default_value,
|
||||
std::index_sequence<keys_indexes_t...>) const;
|
||||
template <typename value_t, typename... rest_keys_t>
|
||||
auto get_helper(const value_t& default_value, size_t pos, rest_keys_t&&... rest) const;
|
||||
template <typename value_t>
|
||||
auto get_helper(const value_t& default_value, size_t pos) const;
|
||||
|
||||
template <typename tuple_t>
|
||||
tuple_t as_tuple_templ() const;
|
||||
template <size_t index, typename tuple_t>
|
||||
void set_tuple(tuple_t& tup) const;
|
||||
|
||||
template <typename Tuple, std::size_t... Is>
|
||||
void foreach_tuple(const Tuple& t, std::index_sequence<Is...>)
|
||||
{
|
||||
(_array_data.emplace_back(std::get<Is>(t)), ...);
|
||||
}
|
||||
|
||||
string_t format(size_t indent, size_t indent_times) const;
|
||||
|
||||
private:
|
||||
@@ -262,20 +164,15 @@ private:
|
||||
};
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_array<string_t>::basic_array(std::initializer_list<value_type> init_list)
|
||||
: _array_data(init_list)
|
||||
{
|
||||
}
|
||||
inline basic_array<string_t>::basic_array(std::initializer_list<value_type> init_list) : _array_data(init_list)
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_array<string_t>::basic_array(typename raw_array::size_type size)
|
||||
: _array_data(size)
|
||||
{
|
||||
}
|
||||
inline basic_array<string_t>::basic_array(typename raw_array::size_type size) : _array_data(size)
|
||||
{}
|
||||
|
||||
// template <typename string_t>
|
||||
// inline basic_array<string_t>::basic_array(const basic_value<string_t>& val) :
|
||||
// basic_array<string_t>(val.as_array())
|
||||
// inline basic_array<string_t>::basic_array(const basic_value<string_t>& val) : basic_array<string_t>(val.as_array())
|
||||
//{}
|
||||
//
|
||||
// template <typename string_t>
|
||||
@@ -305,9 +202,8 @@ template <typename string_t>
|
||||
template <typename... args_t>
|
||||
inline decltype(auto) basic_array<string_t>::emplace_back(args_t&&... args)
|
||||
{
|
||||
static_assert(
|
||||
std::is_constructible_v<value_type, args_t...>,
|
||||
"Parameter can't be used to construct a raw_array::value_type");
|
||||
static_assert(std::is_constructible_v<value_type, args_t...>,
|
||||
"Parameter can't be used to construct a raw_array::value_type");
|
||||
return _array_data.emplace_back(std::forward<args_t>(args)...);
|
||||
}
|
||||
|
||||
@@ -370,18 +266,18 @@ inline bool basic_array<string_t>::all() const
|
||||
|
||||
namespace _as_collection_helper
|
||||
{
|
||||
template <typename T>
|
||||
class has_emplace_back
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int) -> decltype(std::declval<U>().emplace_back(), std::true_type());
|
||||
template <typename T>
|
||||
class has_emplace_back
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int) -> decltype(std::declval<U>().emplace_back(), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
@@ -402,94 +298,31 @@ inline collection_t<value_t> basic_array<string_t>::as_collection() const
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t, size_t Size, template <typename, size_t> typename fixed_array_t>
|
||||
inline fixed_array_t<value_t, Size> basic_array<string_t>::as_fixed_array() const
|
||||
{
|
||||
if (size() != Size) {
|
||||
throw exception("Wrong array size");
|
||||
}
|
||||
|
||||
fixed_array_t<value_t, Size> result;
|
||||
for (size_t i = 0; i < Size; ++i) {
|
||||
result.at(i) = _array_data.at(i).template as<value_t>();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <size_t index, typename tuple_t>
|
||||
inline void basic_array<string_t>::set_tuple(tuple_t& tup) const
|
||||
{
|
||||
using elem_t = std::tuple_element_t<index, tuple_t>;
|
||||
|
||||
if constexpr (index > 0) {
|
||||
set_tuple<index - 1>(tup);
|
||||
}
|
||||
|
||||
std::get<index>(tup) = static_cast<elem_t>(at(index));
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename tuple_t>
|
||||
inline tuple_t basic_array<string_t>::as_tuple_templ() const
|
||||
{
|
||||
constexpr size_t tuple_size = std::tuple_size_v<tuple_t>;
|
||||
|
||||
if (size() != tuple_size) {
|
||||
throw exception("Wrong array size");
|
||||
}
|
||||
|
||||
tuple_t result;
|
||||
set_tuple<tuple_size - 1>(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... elem_ts>
|
||||
inline std::tuple<elem_ts...> basic_array<string_t>::as_tuple() const
|
||||
{
|
||||
return as_tuple_templ<std::tuple<elem_ts...>>();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename first_t, typename second_t>
|
||||
inline std::pair<first_t, second_t> basic_array<string_t>::as_pair() const
|
||||
{
|
||||
return as_tuple_templ<std::pair<first_t, second_t>>();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... key_then_default_value_t>
|
||||
inline auto basic_array<string_t>::get(key_then_default_value_t&&... keys_then_default_value) const
|
||||
{
|
||||
return get(
|
||||
std::forward_as_tuple(keys_then_default_value...),
|
||||
std::make_index_sequence<sizeof...(keys_then_default_value) - 1> {});
|
||||
return get(std::forward_as_tuple(keys_then_default_value...),
|
||||
std::make_index_sequence<sizeof...(keys_then_default_value) - 1> {});
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... key_then_default_value_t, size_t... keys_indexes_t>
|
||||
inline auto basic_array<string_t>::get(
|
||||
std::tuple<key_then_default_value_t...> keys_then_default_value,
|
||||
std::index_sequence<keys_indexes_t...>) const
|
||||
inline auto basic_array<string_t>::get(std::tuple<key_then_default_value_t...> keys_then_default_value,
|
||||
std::index_sequence<keys_indexes_t...>) const
|
||||
{
|
||||
constexpr unsigned long default_value_index = sizeof...(key_then_default_value_t) - 1;
|
||||
return get_helper(
|
||||
std::get<default_value_index>(keys_then_default_value),
|
||||
std::get<keys_indexes_t>(keys_then_default_value)...);
|
||||
return get_helper(std::get<default_value_index>(keys_then_default_value),
|
||||
std::get<keys_indexes_t>(keys_then_default_value)...);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t, typename... rest_keys_t>
|
||||
inline auto basic_array<string_t>::get_helper(
|
||||
const value_t& default_value,
|
||||
size_t pos,
|
||||
rest_keys_t&&... rest) const
|
||||
inline auto basic_array<string_t>::get_helper(const value_t& default_value, size_t pos, rest_keys_t&&... rest) const
|
||||
{
|
||||
constexpr bool is_json = std::is_same_v<basic_value<string_t>, value_t>
|
||||
|| std::is_same_v<basic_array<string_t>, value_t>
|
||||
|| std::is_same_v<basic_object<string_t>, value_t>;
|
||||
constexpr bool is_json = std::is_same_v<basic_value<string_t>, value_t> ||
|
||||
std::is_same_v<basic_array<string_t>, value_t> ||
|
||||
std::is_same_v<basic_object<string_t>, value_t>;
|
||||
constexpr bool is_string = std::is_constructible_v<string_t, value_t> && !is_json;
|
||||
|
||||
if (!contains(pos)) {
|
||||
@@ -508,9 +341,9 @@ template <typename string_t>
|
||||
template <typename value_t>
|
||||
inline auto basic_array<string_t>::get_helper(const value_t& default_value, size_t pos) const
|
||||
{
|
||||
constexpr bool is_json = std::is_same_v<basic_value<string_t>, value_t>
|
||||
|| std::is_same_v<basic_array<string_t>, value_t>
|
||||
|| std::is_same_v<basic_object<string_t>, value_t>;
|
||||
constexpr bool is_json = std::is_same_v<basic_value<string_t>, value_t> ||
|
||||
std::is_same_v<basic_array<string_t>, value_t> ||
|
||||
std::is_same_v<basic_object<string_t>, value_t>;
|
||||
constexpr bool is_string = std::is_constructible_v<string_t, value_t> && !is_json;
|
||||
|
||||
if (!contains(pos)) {
|
||||
@@ -549,8 +382,7 @@ inline std::optional<value_t> basic_array<string_t>::find(size_t pos) const
|
||||
return std::nullopt;
|
||||
}
|
||||
const auto& val = _array_data.at(pos);
|
||||
return val.template is<value_t>() ? std::optional<value_t>(val.template as<value_t>())
|
||||
: std::nullopt;
|
||||
return val.template is<value_t>() ? std::optional<value_t>(val.template as<value_t>()) : std::nullopt;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
@@ -602,29 +434,25 @@ inline typename basic_array<string_t>::reverse_iterator basic_array<string_t>::r
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::const_reverse_iterator
|
||||
basic_array<string_t>::rbegin() const noexcept
|
||||
inline typename basic_array<string_t>::const_reverse_iterator basic_array<string_t>::rbegin() const noexcept
|
||||
{
|
||||
return _array_data.rbegin();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::const_reverse_iterator
|
||||
basic_array<string_t>::rend() const noexcept
|
||||
inline typename basic_array<string_t>::const_reverse_iterator basic_array<string_t>::rend() const noexcept
|
||||
{
|
||||
return _array_data.rend();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::const_reverse_iterator
|
||||
basic_array<string_t>::crbegin() const noexcept
|
||||
inline typename basic_array<string_t>::const_reverse_iterator basic_array<string_t>::crbegin() const noexcept
|
||||
{
|
||||
return _array_data.crbegin();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_array<string_t>::const_reverse_iterator
|
||||
basic_array<string_t>::crend() const noexcept
|
||||
inline typename basic_array<string_t>::const_reverse_iterator basic_array<string_t>::crend() const noexcept
|
||||
{
|
||||
return _array_data.crend();
|
||||
}
|
||||
@@ -642,8 +470,7 @@ inline const basic_value<string_t>& basic_array<string_t>::operator[](size_t pos
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_array<string_t>
|
||||
basic_array<string_t>::operator+(const basic_array<string_t>& rhs) const&
|
||||
inline basic_array<string_t> basic_array<string_t>::operator+(const basic_array<string_t>& rhs) const&
|
||||
{
|
||||
basic_array<string_t> temp = *this;
|
||||
temp._array_data.insert(_array_data.end(), rhs.begin(), rhs.end());
|
||||
@@ -654,10 +481,8 @@ template <typename string_t>
|
||||
inline basic_array<string_t> basic_array<string_t>::operator+(basic_array<string_t>&& rhs) const&
|
||||
{
|
||||
basic_array<string_t> temp = *this;
|
||||
temp._array_data.insert(
|
||||
_array_data.end(),
|
||||
std::make_move_iterator(rhs.begin()),
|
||||
std::make_move_iterator(rhs.end()));
|
||||
temp._array_data.insert(_array_data.end(), std::make_move_iterator(rhs.begin()),
|
||||
std::make_move_iterator(rhs.end()));
|
||||
return temp;
|
||||
}
|
||||
|
||||
@@ -671,10 +496,7 @@ inline basic_array<string_t> basic_array<string_t>::operator+(const basic_array<
|
||||
template <typename string_t>
|
||||
inline basic_array<string_t> basic_array<string_t>::operator+(basic_array<string_t>&& rhs) &&
|
||||
{
|
||||
_array_data.insert(
|
||||
_array_data.end(),
|
||||
std::make_move_iterator(rhs.begin()),
|
||||
std::make_move_iterator(rhs.end()));
|
||||
_array_data.insert(_array_data.end(), std::make_move_iterator(rhs.begin()), std::make_move_iterator(rhs.end()));
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
@@ -688,10 +510,7 @@ inline basic_array<string_t>& basic_array<string_t>::operator+=(const basic_arra
|
||||
template <typename string_t>
|
||||
inline basic_array<string_t>& basic_array<string_t>::operator+=(basic_array<string_t>&& rhs)
|
||||
{
|
||||
_array_data.insert(
|
||||
_array_data.end(),
|
||||
std::make_move_iterator(rhs.begin()),
|
||||
std::make_move_iterator(rhs.end()));
|
||||
_array_data.insert(_array_data.end(), std::make_move_iterator(rhs.begin()), std::make_move_iterator(rhs.end()));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -701,14 +520,11 @@ inline bool basic_array<string_t>::operator==(const basic_array<string_t>& rhs)
|
||||
return _array_data == rhs._array_data;
|
||||
}
|
||||
|
||||
template <
|
||||
typename ostream_t,
|
||||
typename string_t,
|
||||
typename std_ostream_t = std::basic_ostream<
|
||||
typename string_t::value_type,
|
||||
std::char_traits<typename string_t::value_type>>,
|
||||
typename enable_t = std::enable_if_t<
|
||||
std::is_same_v<std_ostream_t, ostream_t> || std::is_base_of_v<std_ostream_t, ostream_t>>>
|
||||
template <typename ostream_t, typename string_t,
|
||||
typename std_ostream_t =
|
||||
std::basic_ostream<typename string_t::value_type, std::char_traits<typename string_t::value_type>>,
|
||||
typename enable_t =
|
||||
std::enable_if_t<std::is_same_v<std_ostream_t, ostream_t> || std::is_base_of_v<std_ostream_t, ostream_t>>>
|
||||
ostream_t& operator<<(ostream_t& out, const basic_array<string_t>& arr)
|
||||
{
|
||||
out << arr.format();
|
||||
|
||||
13
3rdparty/include/meojson/common/exception.hpp
vendored
@@ -1,5 +1,3 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <exception>
|
||||
@@ -11,11 +9,7 @@ class exception : public std::exception
|
||||
{
|
||||
public:
|
||||
exception() = default;
|
||||
|
||||
exception(const std::string& msg)
|
||||
: _what(msg)
|
||||
{
|
||||
}
|
||||
exception(const std::string& msg) : _what(msg) {}
|
||||
|
||||
exception(const exception&) = default;
|
||||
exception& operator=(const exception&) = default;
|
||||
@@ -24,10 +18,7 @@ public:
|
||||
|
||||
virtual ~exception() noexcept override = default;
|
||||
|
||||
virtual const char* what() const noexcept override
|
||||
{
|
||||
return _what.empty() ? "Unknown exception" : _what.c_str();
|
||||
}
|
||||
virtual const char* what() const noexcept override { return _what.empty() ? "Unknown exception" : _what.c_str(); }
|
||||
|
||||
protected:
|
||||
std::string _what;
|
||||
|
||||
174
3rdparty/include/meojson/common/object.hpp
vendored
@@ -1,5 +1,3 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <initializer_list>
|
||||
@@ -38,54 +36,31 @@ public:
|
||||
// explicit basic_object(const basic_value<string_t>& val);
|
||||
// explicit basic_object(basic_value<string_t>&& val);
|
||||
|
||||
template <
|
||||
typename map_t,
|
||||
std::enable_if_t<
|
||||
_utils::is_map<map_t>
|
||||
&& std::is_constructible_v<value_type, _utils::range_value_t<map_t>>,
|
||||
bool> = true>
|
||||
basic_object(map_t map)
|
||||
: _object_data(std::make_move_iterator(map.begin()), std::make_move_iterator(map.end()))
|
||||
{
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_to_json_in_member<jsonization_t>::value, bool> = true>
|
||||
basic_object(const jsonization_t& value)
|
||||
: basic_object(value.to_json())
|
||||
{
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_to_json_in_templ_spec<jsonization_t>::value, bool> = true>
|
||||
basic_object(const jsonization_t& value)
|
||||
: basic_object(ext::jsonization<jsonization_t>().to_json(value))
|
||||
{
|
||||
}
|
||||
template <typename map_t, std::enable_if_t<_utils::is_map<map_t> &&
|
||||
std::is_constructible_v<value_type, _utils::range_value_t<map_t>>,
|
||||
bool> = true>
|
||||
basic_object(map_t map) : _object_data(std::make_move_iterator(map.begin()), std::make_move_iterator(map.end()))
|
||||
{}
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_to_json_in_member<jsonization_t>::value, bool> = true>
|
||||
basic_object(const jsonization_t& value) : basic_object(value.to_json())
|
||||
{}
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_to_json_in_templ_spec<jsonization_t>::value, bool> = true>
|
||||
basic_object(const jsonization_t& value) : basic_object(ext::jsonization<jsonization_t>().to_json(value))
|
||||
{}
|
||||
|
||||
~basic_object() = default;
|
||||
|
||||
bool empty() const noexcept { return _object_data.empty(); }
|
||||
|
||||
size_t size() const noexcept { return _object_data.size(); }
|
||||
|
||||
bool contains(const string_t& key) const;
|
||||
|
||||
bool exists(const string_t& key) const { return contains(key); }
|
||||
|
||||
const basic_value<string_t>& at(const string_t& key) const;
|
||||
|
||||
string_t dumps(std::optional<size_t> indent = std::nullopt) const
|
||||
{
|
||||
return indent ? format(*indent) : to_string();
|
||||
}
|
||||
|
||||
string_t dumps(std::optional<size_t> indent = std::nullopt) const { return indent ? format(*indent) : to_string(); }
|
||||
string_t to_string() const;
|
||||
|
||||
string_t format(size_t indent = 4) const { return format(indent, 0); }
|
||||
|
||||
template <typename value_t>
|
||||
bool all() const;
|
||||
template <typename value_t, template <typename...> typename map_t = std::map>
|
||||
@@ -127,32 +102,23 @@ public:
|
||||
|
||||
basic_object<string_t>& operator=(const basic_object<string_t>&) = default;
|
||||
basic_object<string_t>& operator=(basic_object<string_t>&&) = default;
|
||||
|
||||
template <
|
||||
typename value_t,
|
||||
std::enable_if_t<std::is_convertible_v<value_t, basic_object<string_t>>, bool> = true>
|
||||
template <typename value_t, std::enable_if_t<std::is_convertible_v<value_t, basic_object<string_t>>, bool> = true>
|
||||
basic_object<string_t>& operator=(value_t rhs)
|
||||
{
|
||||
return *this = basic_object<string_t>(std::move(rhs));
|
||||
}
|
||||
|
||||
bool operator==(const basic_object<string_t>& rhs) const;
|
||||
|
||||
bool operator!=(const basic_object<string_t>& rhs) const { return !(*this == rhs); }
|
||||
|
||||
template <
|
||||
typename value_t,
|
||||
template <typename...> typename map_t = std::map,
|
||||
std::enable_if_t<_utils::is_map<map_t<string_t, value_t>>, bool> = true>
|
||||
template <typename value_t, template <typename...> typename map_t = std::map,
|
||||
std::enable_if_t<_utils::is_map<map_t<string_t, value_t>>, bool> = true>
|
||||
explicit operator map_t<string_t, value_t>() const
|
||||
{
|
||||
return as_map<value_t, map_t>();
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_from_json_in_member<jsonization_t, string_t>::value, bool> =
|
||||
true>
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_from_json_in_member<jsonization_t, string_t>::value, bool> = true>
|
||||
explicit operator jsonization_t() const
|
||||
{
|
||||
jsonization_t dst {};
|
||||
@@ -161,12 +127,8 @@ public:
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<
|
||||
_utils::has_from_json_in_templ_spec<jsonization_t, string_t>::value,
|
||||
bool> = true>
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_from_json_in_templ_spec<jsonization_t, string_t>::value, bool> = true>
|
||||
explicit operator jsonization_t() const
|
||||
{
|
||||
jsonization_t dst {};
|
||||
@@ -178,9 +140,8 @@ public:
|
||||
|
||||
private:
|
||||
template <typename... key_then_default_value_t, size_t... keys_indexes_t>
|
||||
auto
|
||||
get(std::tuple<key_then_default_value_t...> keys_then_default_value,
|
||||
std::index_sequence<keys_indexes_t...>) const;
|
||||
auto get(std::tuple<key_then_default_value_t...> keys_then_default_value,
|
||||
std::index_sequence<keys_indexes_t...>) const;
|
||||
template <typename value_t, typename... rest_keys_t>
|
||||
auto get_helper(const value_t& default_value, const string_t& key, rest_keys_t&&... rest) const;
|
||||
template <typename value_t>
|
||||
@@ -194,11 +155,8 @@ private:
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_object<string_t>::basic_object(std::initializer_list<value_type> init_list)
|
||||
: _object_data(
|
||||
std::make_move_iterator(init_list.begin()),
|
||||
std::make_move_iterator(init_list.end()))
|
||||
{
|
||||
}
|
||||
: _object_data(std::make_move_iterator(init_list.begin()), std::make_move_iterator(init_list.end()))
|
||||
{}
|
||||
|
||||
// template <typename string_t>
|
||||
// inline basic_object<string_t>::basic_object(const basic_value<string_t>& val) :
|
||||
@@ -244,10 +202,9 @@ template <typename string_t>
|
||||
template <typename... args_t>
|
||||
inline decltype(auto) basic_object<string_t>::emplace(args_t&&... args)
|
||||
{
|
||||
static_assert(
|
||||
std::is_constructible_v<value_type, args_t...>,
|
||||
"Parameter can't be used to construct a raw_object::value_type");
|
||||
return _object_data.insert_or_assign(std::forward<args_t>(args)...);
|
||||
static_assert(std::is_constructible_v<value_type, args_t...>,
|
||||
"Parameter can't be used to construct a raw_object::value_type");
|
||||
return _object_data.emplace(std::forward<args_t>(args)...);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
@@ -263,8 +220,7 @@ inline string_t basic_object<string_t>::to_string() const
|
||||
string_t str { '{' };
|
||||
for (auto iter = _object_data.cbegin(); iter != _object_data.cend();) {
|
||||
const auto& [key, val] = *iter;
|
||||
str +=
|
||||
char_t('"') + _utils::unescape_string(key) + string_t { '\"', ':' } + val.to_string();
|
||||
str += char_t('"') + _utils::unescape_string(key) + string_t { '\"', ':' } + val.to_string();
|
||||
if (++iter != _object_data.cend()) {
|
||||
str += ',';
|
||||
}
|
||||
@@ -282,8 +238,8 @@ inline string_t basic_object<string_t>::format(size_t indent, size_t indent_time
|
||||
string_t str { '{', '\n' };
|
||||
for (auto iter = _object_data.cbegin(); iter != _object_data.cend();) {
|
||||
const auto& [key, val] = *iter;
|
||||
str += body_indent + char_t('"') + _utils::unescape_string(key)
|
||||
+ string_t { '\"', ':', ' ' } + val.format(indent, indent_times + 1);
|
||||
str += body_indent + char_t('"') + _utils::unescape_string(key) + string_t { '\"', ':', ' ' } +
|
||||
val.format(indent, indent_times + 1);
|
||||
if (++iter != _object_data.cend()) {
|
||||
str += ',';
|
||||
}
|
||||
@@ -320,33 +276,28 @@ template <typename string_t>
|
||||
template <typename... key_then_default_value_t>
|
||||
inline auto basic_object<string_t>::get(key_then_default_value_t&&... keys_then_default_value) const
|
||||
{
|
||||
return get(
|
||||
std::forward_as_tuple(keys_then_default_value...),
|
||||
std::make_index_sequence<sizeof...(keys_then_default_value) - 1> {});
|
||||
return get(std::forward_as_tuple(keys_then_default_value...),
|
||||
std::make_index_sequence<sizeof...(keys_then_default_value) - 1> {});
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... key_then_default_value_t, size_t... keys_indexes_t>
|
||||
inline auto basic_object<string_t>::get(
|
||||
std::tuple<key_then_default_value_t...> keys_then_default_value,
|
||||
std::index_sequence<keys_indexes_t...>) const
|
||||
inline auto basic_object<string_t>::get(std::tuple<key_then_default_value_t...> keys_then_default_value,
|
||||
std::index_sequence<keys_indexes_t...>) const
|
||||
{
|
||||
constexpr unsigned long default_value_index = sizeof...(key_then_default_value_t) - 1;
|
||||
return get_helper(
|
||||
std::get<default_value_index>(keys_then_default_value),
|
||||
std::get<keys_indexes_t>(keys_then_default_value)...);
|
||||
return get_helper(std::get<default_value_index>(keys_then_default_value),
|
||||
std::get<keys_indexes_t>(keys_then_default_value)...);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t, typename... rest_keys_t>
|
||||
inline auto basic_object<string_t>::get_helper(
|
||||
const value_t& default_value,
|
||||
const string_t& key,
|
||||
rest_keys_t&&... rest) const
|
||||
inline auto basic_object<string_t>::get_helper(const value_t& default_value, const string_t& key,
|
||||
rest_keys_t&&... rest) const
|
||||
{
|
||||
constexpr bool is_json = std::is_same_v<basic_value<string_t>, value_t>
|
||||
|| std::is_same_v<basic_array<string_t>, value_t>
|
||||
|| std::is_same_v<basic_object<string_t>, value_t>;
|
||||
constexpr bool is_json = std::is_same_v<basic_value<string_t>, value_t> ||
|
||||
std::is_same_v<basic_array<string_t>, value_t> ||
|
||||
std::is_same_v<basic_object<string_t>, value_t>;
|
||||
constexpr bool is_string = std::is_constructible_v<string_t, value_t> && !is_json;
|
||||
|
||||
if (!contains(key)) {
|
||||
@@ -363,12 +314,11 @@ inline auto basic_object<string_t>::get_helper(
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t>
|
||||
inline auto
|
||||
basic_object<string_t>::get_helper(const value_t& default_value, const string_t& key) const
|
||||
inline auto basic_object<string_t>::get_helper(const value_t& default_value, const string_t& key) const
|
||||
{
|
||||
constexpr bool is_json = std::is_same_v<basic_value<string_t>, value_t>
|
||||
|| std::is_same_v<basic_array<string_t>, value_t>
|
||||
|| std::is_same_v<basic_object<string_t>, value_t>;
|
||||
constexpr bool is_json = std::is_same_v<basic_value<string_t>, value_t> ||
|
||||
std::is_same_v<basic_array<string_t>, value_t> ||
|
||||
std::is_same_v<basic_object<string_t>, value_t>;
|
||||
constexpr bool is_string = std::is_constructible_v<string_t, value_t> && !is_json;
|
||||
|
||||
if (!contains(key)) {
|
||||
@@ -408,8 +358,7 @@ inline std::optional<value_t> basic_object<string_t>::find(const string_t& key)
|
||||
return std::nullopt;
|
||||
}
|
||||
const auto& val = iter->second;
|
||||
return val.template is<value_t>() ? std::optional<value_t>(val.template as<value_t>())
|
||||
: std::nullopt;
|
||||
return val.template is<value_t>() ? std::optional<value_t>(val.template as<value_t>()) : std::nullopt;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
@@ -425,8 +374,7 @@ inline typename basic_object<string_t>::iterator basic_object<string_t>::end() n
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_object<string_t>::const_iterator
|
||||
basic_object<string_t>::begin() const noexcept
|
||||
inline typename basic_object<string_t>::const_iterator basic_object<string_t>::begin() const noexcept
|
||||
{
|
||||
return _object_data.begin();
|
||||
}
|
||||
@@ -438,8 +386,7 @@ inline typename basic_object<string_t>::const_iterator basic_object<string_t>::e
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename basic_object<string_t>::const_iterator
|
||||
basic_object<string_t>::cbegin() const noexcept
|
||||
inline typename basic_object<string_t>::const_iterator basic_object<string_t>::cbegin() const noexcept
|
||||
{
|
||||
return _object_data.cbegin();
|
||||
}
|
||||
@@ -463,8 +410,7 @@ inline basic_value<string_t>& basic_object<string_t>::operator[](string_t&& key)
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_object<string_t>
|
||||
basic_object<string_t>::operator|(const basic_object<string_t>& rhs) const&
|
||||
inline basic_object<string_t> basic_object<string_t>::operator|(const basic_object<string_t>& rhs) const&
|
||||
{
|
||||
basic_object<string_t> temp = *this;
|
||||
temp._object_data.insert(rhs.begin(), rhs.end());
|
||||
@@ -476,15 +422,12 @@ inline basic_object<string_t> basic_object<string_t>::operator|(basic_object<str
|
||||
{
|
||||
basic_object<string_t> temp = *this;
|
||||
// temp._object_data.merge(std::move(rhs._object_data));
|
||||
temp._object_data.insert(
|
||||
std::make_move_iterator(rhs.begin()),
|
||||
std::make_move_iterator(rhs.end()));
|
||||
temp._object_data.insert(std::make_move_iterator(rhs.begin()), std::make_move_iterator(rhs.end()));
|
||||
return temp;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_object<string_t>
|
||||
basic_object<string_t>::operator|(const basic_object<string_t>& rhs) &&
|
||||
inline basic_object<string_t> basic_object<string_t>::operator|(const basic_object<string_t>& rhs) &&
|
||||
{
|
||||
_object_data.insert(rhs.begin(), rhs.end());
|
||||
return std::move(*this);
|
||||
@@ -518,14 +461,11 @@ inline bool basic_object<string_t>::operator==(const basic_object<string_t>& rhs
|
||||
return _object_data == rhs._object_data;
|
||||
}
|
||||
|
||||
template <
|
||||
typename ostream_t,
|
||||
typename string_t,
|
||||
typename std_ostream_t = std::basic_ostream<
|
||||
typename string_t::value_type,
|
||||
std::char_traits<typename string_t::value_type>>,
|
||||
typename enable_t = std::enable_if_t<
|
||||
std::is_same_v<std_ostream_t, ostream_t> || std::is_base_of_v<std_ostream_t, ostream_t>>>
|
||||
template <typename ostream_t, typename string_t,
|
||||
typename std_ostream_t =
|
||||
std::basic_ostream<typename string_t::value_type, std::char_traits<typename string_t::value_type>>,
|
||||
typename enable_t =
|
||||
std::enable_if_t<std::is_same_v<std_ostream_t, ostream_t> || std::is_base_of_v<std_ostream_t, ostream_t>>>
|
||||
ostream_t& operator<<(ostream_t& out, const basic_object<string_t>& obj)
|
||||
{
|
||||
out << obj.format();
|
||||
|
||||
175
3rdparty/include/meojson/common/serialization.hpp
vendored
@@ -1,5 +1,3 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
@@ -11,101 +9,96 @@ namespace json
|
||||
{
|
||||
namespace _serialization_helper
|
||||
{
|
||||
template <typename in_t, typename serializer_t>
|
||||
class is_serializable
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<serializer_t>()(std::declval<U>()), std::true_type());
|
||||
template <typename in_t, typename serializer_t>
|
||||
class is_serializable
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int) -> decltype(std::declval<serializer_t>()(std::declval<U>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<in_t>(0))::value;
|
||||
};
|
||||
public:
|
||||
static constexpr bool value = decltype(test<in_t>(0))::value;
|
||||
};
|
||||
|
||||
struct empty_serializer
|
||||
{
|
||||
// sample:
|
||||
// json::value operator()(const type_1&) const { return ...; }
|
||||
// json::value operator()(const type_2&) const { return ...; }
|
||||
// json::value operator()(const type_3&) const { return ...; }
|
||||
};
|
||||
struct empty_serializer
|
||||
{
|
||||
// sample:
|
||||
// json::value operator()(const type_1&) const { return ...; }
|
||||
// json::value operator()(const type_2&) const { return ...; }
|
||||
// json::value operator()(const type_3&) const { return ...; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void unable_to_serialize()
|
||||
{
|
||||
static_assert(
|
||||
!sizeof(T),
|
||||
"Unable to serialize T. "
|
||||
template <typename T>
|
||||
void unable_to_serialize()
|
||||
{
|
||||
static_assert(!sizeof(T), "Unable to serialize T. "
|
||||
#ifdef _MSC_VER
|
||||
"See T below: " __FUNCSIG__
|
||||
"See T below: " __FUNCSIG__
|
||||
#else
|
||||
// "See T below: " __PRETTY_FUNCTION__
|
||||
// "See T below: " __PRETTY_FUNCTION__
|
||||
|
||||
#endif
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
namespace _serialization_helper
|
||||
{
|
||||
template <typename out_t, typename deserializer_t, typename string_t = default_string_t>
|
||||
class is_deserializable
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<deserializer_t>()(std::declval<basic_value<string_t>>(), std::declval<U&>()), std::true_type());
|
||||
template <typename out_t, typename deserializer_t, typename string_t = default_string_t>
|
||||
class is_deserializable
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<deserializer_t>()(std::declval<basic_value<string_t>>(), std::declval<U&>()),
|
||||
std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
|
||||
public:
|
||||
static constexpr bool value = decltype(test<out_t>(0))::value;
|
||||
};
|
||||
public:
|
||||
static constexpr bool value = decltype(test<out_t>(0))::value;
|
||||
};
|
||||
|
||||
struct empty_deserializer
|
||||
{
|
||||
// sample:
|
||||
// bool operator()(const json::value&, type_1&) const { return ...; }
|
||||
// bool operator()(const json::value&, type_2&) const { return ...; }
|
||||
// bool operator()(const json::value&, type_3&) const { return ...; }
|
||||
};
|
||||
struct empty_deserializer
|
||||
{
|
||||
// sample:
|
||||
// bool operator()(const json::value&, type_1&) const { return ...; }
|
||||
// bool operator()(const json::value&, type_2&) const { return ...; }
|
||||
// bool operator()(const json::value&, type_3&) const { return ...; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void unable_to_deserialize()
|
||||
{
|
||||
static_assert(
|
||||
!sizeof(T),
|
||||
"Unable to deserialize T. "
|
||||
template <typename T>
|
||||
void unable_to_deserialize()
|
||||
{
|
||||
static_assert(!sizeof(T), "Unable to deserialize T. "
|
||||
#ifdef _MSC_VER
|
||||
"See T below: " __FUNCSIG__
|
||||
"See T below: " __FUNCSIG__
|
||||
#else
|
||||
// "See T below: " __PRETTY_FUNCTION__
|
||||
// "See T below: " __PRETTY_FUNCTION__
|
||||
|
||||
#endif
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
template <
|
||||
typename in_t,
|
||||
typename serializer_t = _serialization_helper::empty_serializer,
|
||||
typename string_t = default_string_t>
|
||||
template <typename in_t, typename serializer_t = _serialization_helper::empty_serializer,
|
||||
typename string_t = default_string_t>
|
||||
basic_value<string_t> serialize(in_t&& in, const serializer_t& serializer = {})
|
||||
{
|
||||
if constexpr (_serialization_helper::is_serializable<in_t, serializer_t>::value) {
|
||||
return serializer(std::forward<in_t>(in));
|
||||
}
|
||||
else if constexpr (
|
||||
_utils::is_collection<std::decay_t<in_t>> || _utils::is_fixed_array<std::decay_t<in_t>>) {
|
||||
else if constexpr (std::is_constructible_v<basic_value<string_t>, in_t>) {
|
||||
return basic_value<string_t>(std::forward<in_t>(in));
|
||||
}
|
||||
else if constexpr (_utils::is_collection<std::decay_t<in_t>>) {
|
||||
basic_array<string_t> arr;
|
||||
for (auto&& elem : in) {
|
||||
using elem_t = decltype(elem);
|
||||
|
||||
auto j_elem =
|
||||
serialize<elem_t, serializer_t, string_t>(std::forward<elem_t>(elem), serializer);
|
||||
auto j_elem = serialize<elem_t, serializer_t, string_t>(std::forward<elem_t>(elem), serializer);
|
||||
arr.emplace_back(std::move(j_elem));
|
||||
}
|
||||
return arr;
|
||||
@@ -116,32 +109,27 @@ basic_value<string_t> serialize(in_t&& in, const serializer_t& serializer = {})
|
||||
using key_t = decltype(key);
|
||||
using elem_t = decltype(elem);
|
||||
|
||||
auto j_elem =
|
||||
serialize<elem_t, serializer_t, string_t>(std::forward<elem_t>(elem), serializer);
|
||||
auto j_elem = serialize<elem_t, serializer_t, string_t>(std::forward<elem_t>(elem), serializer);
|
||||
obj.emplace(std::forward<key_t>(key), std::move(j_elem));
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
else if constexpr (std::is_constructible_v<basic_value<string_t>, in_t>) {
|
||||
return basic_value<string_t>(std::forward<in_t>(in));
|
||||
}
|
||||
else {
|
||||
_serialization_helper::unable_to_serialize<in_t>();
|
||||
}
|
||||
}
|
||||
|
||||
template <
|
||||
typename out_t,
|
||||
typename deserializer_t = _serialization_helper::empty_deserializer,
|
||||
typename string_t = default_string_t>
|
||||
bool deserialize(
|
||||
const basic_value<string_t>& in,
|
||||
out_t& out,
|
||||
const deserializer_t& deserializer = {})
|
||||
template <typename out_t, typename deserializer_t = _serialization_helper::empty_deserializer,
|
||||
typename string_t = default_string_t>
|
||||
bool deserialize(const basic_value<string_t>& in, out_t& out, const deserializer_t& deserializer = {})
|
||||
{
|
||||
if constexpr (_serialization_helper::is_deserializable<out_t, deserializer_t>::value) {
|
||||
return deserializer(in, out);
|
||||
}
|
||||
else if constexpr (std::is_constructible_v<out_t, basic_value<string_t>>) {
|
||||
out = out_t(in);
|
||||
return true;
|
||||
}
|
||||
else if constexpr (_utils::is_collection<std::decay_t<out_t>>) {
|
||||
if (!in.is_array()) {
|
||||
return false;
|
||||
@@ -161,45 +149,20 @@ bool deserialize(
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if constexpr (_utils::is_fixed_array<std::decay_t<out_t>>) {
|
||||
if (!in.is_array()) {
|
||||
return false;
|
||||
}
|
||||
auto&& in_as_arr = in.as_array();
|
||||
constexpr size_t out_size = _utils::fixed_array_size<out_t>;
|
||||
if (in_as_arr.size() != out_size) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < out_size; ++i) {
|
||||
auto&& j_elem = in_as_arr.at(i);
|
||||
using elem_t = typename out_t::value_type;
|
||||
elem_t elem {};
|
||||
if (!deserialize<elem_t, deserializer_t, string_t>(j_elem, elem, deserializer)) {
|
||||
return false;
|
||||
}
|
||||
out.at(i) = std::move(elem);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if constexpr (_utils::is_map<std::decay_t<out_t>>) {
|
||||
if (!in.is_object()) {
|
||||
return false;
|
||||
}
|
||||
for (auto&& [key, j_elem] : in.as_object()) {
|
||||
using elem_t = typename out_t::mapped_type;
|
||||
using elem_t = typename out_t::value_type;
|
||||
elem_t elem {};
|
||||
if (!deserialize<elem_t, deserializer_t, string_t>(j_elem, elem, deserializer)) {
|
||||
return false;
|
||||
}
|
||||
out.emplace(std::forward<decltype(key)>(key), std::move(elem));
|
||||
out.emplace(std::move(elem));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if constexpr (std::is_constructible_v<out_t, basic_value<string_t>>) {
|
||||
out = out_t(in);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
_serialization_helper::unable_to_deserialize<out_t>();
|
||||
}
|
||||
|
||||
4
3rdparty/include/meojson/common/types.hpp
vendored
@@ -1,7 +1,5 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "array.hpp"
|
||||
#include "object.hpp"
|
||||
#include "value.hpp"
|
||||
#include "value.hpp"
|
||||
122
3rdparty/include/meojson/common/utils.hpp
vendored
@@ -1,14 +1,7 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <iomanip>
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <variant>
|
||||
|
||||
namespace json
|
||||
{
|
||||
@@ -68,38 +61,12 @@ constexpr bool is_container<T, std::void_t<typename T::value_type, range_value_t
|
||||
template <typename T, typename = void>
|
||||
constexpr bool is_map = false;
|
||||
template <typename T>
|
||||
constexpr bool is_map<T, std::void_t<typename T::key_type, typename T::mapped_type>> =
|
||||
is_container<T>;
|
||||
|
||||
template <typename T, typename = void>
|
||||
constexpr bool is_fixed_array = false;
|
||||
template <template <typename, size_t> typename arr_t, typename value_t, size_t size>
|
||||
constexpr bool is_fixed_array<arr_t<value_t, size>> = true;
|
||||
|
||||
template <typename T, typename = std::enable_if_t<is_fixed_array<T>>>
|
||||
constexpr size_t fixed_array_size = 0;
|
||||
template <template <typename, size_t> typename arr_t, typename value_t, size_t size>
|
||||
constexpr size_t fixed_array_size<arr_t<value_t, size>> = size;
|
||||
constexpr bool is_map<T, std::void_t<typename T::key_type, typename T::mapped_type>> = is_container<T>;
|
||||
|
||||
template <typename T, typename = void>
|
||||
constexpr bool is_collection = false;
|
||||
template <typename T>
|
||||
constexpr bool is_collection<T> = is_container<T> && !is_map<T> && !is_fixed_array<T>;
|
||||
|
||||
template <typename T>
|
||||
constexpr bool is_variant = false;
|
||||
template <typename... args_t>
|
||||
constexpr bool is_variant<std::variant<args_t...>> = true;
|
||||
|
||||
template <typename T>
|
||||
constexpr bool is_tuple = false;
|
||||
template <typename... args_t>
|
||||
constexpr bool is_tuple<std::tuple<args_t...>> = true;
|
||||
|
||||
template <typename T>
|
||||
constexpr bool is_pair = false;
|
||||
template <typename... args_t>
|
||||
constexpr bool is_pair<std::pair<args_t...>> = true;
|
||||
constexpr bool is_collection<T> = is_container<T> && !is_map<T>;
|
||||
|
||||
template <typename T>
|
||||
class has_to_json_in_member
|
||||
@@ -118,8 +85,7 @@ template <typename T>
|
||||
class has_to_json_in_templ_spec
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<ext::jsonization<U>>().to_json(std::declval<U>()), std::true_type());
|
||||
static auto test(int) -> decltype(std::declval<ext::jsonization<U>>().to_json(std::declval<U>()), std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
@@ -147,7 +113,8 @@ class has_check_json_in_templ_spec
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<ext::jsonization<U>>().check_json(std::declval<json::basic_value<string_t>>()), std::true_type());
|
||||
-> decltype(std::declval<ext::jsonization<U>>().check_json(std::declval<json::basic_value<string_t>>()),
|
||||
std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
@@ -175,7 +142,9 @@ class has_from_json_in_templ_spec
|
||||
{
|
||||
template <typename U>
|
||||
static auto test(int)
|
||||
-> decltype(std::declval<ext::jsonization<U>>().from_json(std::declval<json::basic_value<string_t>>(), std::declval<U&>()), std::true_type());
|
||||
-> decltype(std::declval<ext::jsonization<U>>().from_json(std::declval<json::basic_value<string_t>>(),
|
||||
std::declval<U&>()),
|
||||
std::true_type());
|
||||
|
||||
template <typename U>
|
||||
static std::false_type test(...);
|
||||
@@ -185,7 +154,7 @@ public:
|
||||
};
|
||||
|
||||
template <typename string_t>
|
||||
inline constexpr string_t unescape_string(const string_t& str)
|
||||
static constexpr string_t unescape_string(const string_t& str)
|
||||
{
|
||||
using char_t = typename string_t::value_type;
|
||||
|
||||
@@ -233,41 +202,26 @@ inline constexpr string_t unescape_string(const string_t& str)
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline constexpr string_t true_string()
|
||||
static constexpr string_t true_string()
|
||||
{
|
||||
return { 't', 'r', 'u', 'e' };
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline constexpr string_t false_string()
|
||||
static constexpr string_t false_string()
|
||||
{
|
||||
return { 'f', 'a', 'l', 's', 'e' };
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline constexpr string_t null_string()
|
||||
static constexpr string_t null_string()
|
||||
{
|
||||
return { 'n', 'u', 'l', 'l' };
|
||||
}
|
||||
|
||||
template <typename string_t, typename any_t>
|
||||
inline string_t to_basic_string(any_t&& arg)
|
||||
string_t to_basic_string(any_t&& arg)
|
||||
{
|
||||
#ifdef MEOJSON_KEEP_FLOATING_PRECISION
|
||||
using real_type = std::remove_reference_t<any_t>;
|
||||
if constexpr (std::is_floating_point_v<real_type>) {
|
||||
if constexpr (std::is_same_v<string_t, std::string>) {
|
||||
std::ostringstream oss;
|
||||
oss << std::setprecision(std::numeric_limits<real_type>::max_digits10) << arg;
|
||||
return oss.str();
|
||||
}
|
||||
else if constexpr (std::is_same_v<string_t, std::wstring>) {
|
||||
std::wostringstream oss;
|
||||
oss << std::setprecision(std::numeric_limits<real_type>::max_digits10) << arg;
|
||||
return oss.str();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if constexpr (std::is_same_v<string_t, std::string>) {
|
||||
return std::to_string(std::forward<any_t>(arg));
|
||||
}
|
||||
@@ -278,54 +232,4 @@ inline string_t to_basic_string(any_t&& arg)
|
||||
static_assert(!sizeof(any_t), "Unsupported type");
|
||||
}
|
||||
}
|
||||
|
||||
template <std::size_t id, typename string_t, typename variant_t>
|
||||
inline bool _serialize_variant_impl(basic_value<string_t>& val, variant_t&& var)
|
||||
{
|
||||
if (var.index() != id) {
|
||||
return false;
|
||||
}
|
||||
val = basic_value<string_t>(std::get<id>(std::forward<variant_t>(var)));
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename string_t, typename variant_t, std::size_t... ids>
|
||||
inline basic_value<string_t> serialize_variant(variant_t&& var, std::index_sequence<ids...>)
|
||||
{
|
||||
basic_value<string_t> val;
|
||||
(_serialize_variant_impl<ids>(val, std::forward<variant_t>(var)) || ...);
|
||||
return val;
|
||||
}
|
||||
|
||||
template <std::size_t id, typename string_t, typename variant_t>
|
||||
inline bool _deserialize_variant_impl(const basic_value<string_t>& val, variant_t& var)
|
||||
{
|
||||
using alt_t = std::variant_alternative_t<id, variant_t>;
|
||||
if (!val.template is<alt_t>()) {
|
||||
return false;
|
||||
}
|
||||
var = val.template as<alt_t>();
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename string_t, typename variant_t, std::size_t... ids>
|
||||
inline variant_t deserialize_variant(const basic_value<string_t>& val, std::index_sequence<ids...>)
|
||||
{
|
||||
variant_t var;
|
||||
(_deserialize_variant_impl<ids>(val, var) || ...);
|
||||
return var;
|
||||
}
|
||||
|
||||
template <typename string_t, typename variant_t, std::size_t... ids>
|
||||
inline bool detect_variant(const basic_value<string_t>& val, std::index_sequence<ids...>)
|
||||
{
|
||||
return (val.template is<std::variant_alternative_t<ids, variant_t>>() || ...);
|
||||
}
|
||||
|
||||
template <typename string_t, typename tuple_t, std::size_t... ids>
|
||||
inline bool detect_tuple(const basic_value<string_t>& val, std::index_sequence<ids...>)
|
||||
{
|
||||
return val.is_array() && val.as_array().size() == std::tuple_size_v<tuple_t>
|
||||
&& (val.at(ids).template is<std::tuple_element_t<ids, tuple_t>>() || ...);
|
||||
}
|
||||
} // namespace json::_utils
|
||||
|
||||
445
3rdparty/include/meojson/common/value.hpp
vendored
@@ -1,5 +1,3 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
@@ -9,8 +7,6 @@
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <variant>
|
||||
|
||||
#include "exception.hpp"
|
||||
@@ -68,87 +64,30 @@ public:
|
||||
template <typename... args_t>
|
||||
basic_value(value_type type, args_t&&... args);
|
||||
|
||||
template <
|
||||
typename collection_t,
|
||||
std::enable_if_t<
|
||||
_utils::is_collection<collection_t>
|
||||
&& std::is_constructible_v<
|
||||
typename basic_array<string_t>::value_type,
|
||||
_utils::range_value_t<collection_t>>,
|
||||
bool> = true>
|
||||
basic_value(collection_t&& collection)
|
||||
: basic_value(basic_array<string_t>(std::forward<collection_t>(collection)))
|
||||
{
|
||||
}
|
||||
template <typename collection_t,
|
||||
std::enable_if_t<_utils::is_collection<collection_t> &&
|
||||
std::is_constructible_v<typename basic_array<string_t>::value_type,
|
||||
_utils::range_value_t<collection_t>>,
|
||||
bool> = true>
|
||||
basic_value(collection_t&& collection) : basic_value(basic_array<string_t>(std::forward<collection_t>(collection)))
|
||||
{}
|
||||
template <typename map_t, std::enable_if_t<_utils::is_map<map_t> &&
|
||||
std::is_constructible_v<typename basic_object<string_t>::value_type,
|
||||
_utils::range_value_t<map_t>>,
|
||||
bool> = true>
|
||||
basic_value(map_t&& map) : basic_value(basic_object<string_t>(std::forward<map_t>(map)))
|
||||
{}
|
||||
|
||||
template <
|
||||
typename fixed_array_t,
|
||||
std::enable_if_t<_utils::is_fixed_array<fixed_array_t>, bool> = true>
|
||||
basic_value(const fixed_array_t& arr)
|
||||
: basic_value(basic_array<string_t>(arr))
|
||||
{
|
||||
}
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_to_json_in_member<jsonization_t>::value, bool> = true>
|
||||
basic_value(const jsonization_t& value) : basic_value(value.to_json())
|
||||
{}
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_to_json_in_templ_spec<jsonization_t>::value, bool> = true>
|
||||
basic_value(const jsonization_t& value) : basic_value(ext::jsonization<jsonization_t>().to_json(value))
|
||||
{}
|
||||
|
||||
template <
|
||||
typename map_t,
|
||||
std::enable_if_t<
|
||||
_utils::is_map<map_t>
|
||||
&& std::is_constructible_v<
|
||||
typename basic_object<string_t>::value_type,
|
||||
_utils::range_value_t<map_t>>,
|
||||
bool> = true>
|
||||
basic_value(map_t&& map)
|
||||
: basic_value(basic_object<string_t>(std::forward<map_t>(map)))
|
||||
{
|
||||
}
|
||||
|
||||
template <typename enum_t, std::enable_if_t<std::is_enum_v<enum_t>, bool> = true>
|
||||
basic_value(enum_t e)
|
||||
: basic_value(static_cast<std::underlying_type_t<enum_t>>(e))
|
||||
{
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_to_json_in_member<jsonization_t>::value, bool> = true>
|
||||
basic_value(const jsonization_t& value)
|
||||
: basic_value(value.to_json())
|
||||
{
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_to_json_in_templ_spec<jsonization_t>::value, bool> = true>
|
||||
basic_value(const jsonization_t& value)
|
||||
: basic_value(ext::jsonization<jsonization_t>().to_json(value))
|
||||
{
|
||||
}
|
||||
|
||||
template <typename... elem_ts>
|
||||
basic_value(std::tuple<elem_ts...>&& tup)
|
||||
: basic_value(basic_array<string_t>(std::forward<std::tuple<elem_ts...>>(tup)))
|
||||
{
|
||||
}
|
||||
|
||||
template <typename elem1_t, typename elem2_t>
|
||||
basic_value(std::pair<elem1_t, elem2_t>&& pair)
|
||||
: basic_value(basic_array<string_t>(std::pair<elem1_t, elem2_t>(pair)))
|
||||
{
|
||||
}
|
||||
|
||||
template <
|
||||
typename variant_t,
|
||||
std::enable_if_t<_utils::is_variant<std::decay_t<variant_t>>, bool> = true>
|
||||
basic_value(variant_t&& var)
|
||||
: basic_value(_utils::serialize_variant<string_t>(
|
||||
std::forward<variant_t>(var),
|
||||
std::make_index_sequence<std::variant_size_v<std::decay_t<variant_t>>>()))
|
||||
{
|
||||
}
|
||||
|
||||
template <
|
||||
typename value_t,
|
||||
std::enable_if_t<!std::is_convertible_v<value_t, basic_value<string_t>>, bool> = true>
|
||||
template <typename value_t, std::enable_if_t<!std::is_convertible_v<value_t, basic_value<string_t>>, bool> = true>
|
||||
basic_value(value_t) = delete;
|
||||
|
||||
// I don't know if you want to convert char to string or number, so I delete these constructors.
|
||||
@@ -160,21 +99,13 @@ public:
|
||||
~basic_value();
|
||||
|
||||
bool valid() const noexcept { return _type != value_type::invalid; }
|
||||
|
||||
bool empty() const noexcept { return is_null(); }
|
||||
|
||||
bool is_null() const noexcept { return _type == value_type::null; }
|
||||
|
||||
bool is_number() const noexcept { return _type == value_type::number; }
|
||||
|
||||
bool is_boolean() const noexcept { return _type == value_type::boolean; }
|
||||
|
||||
bool is_string() const noexcept { return _type == value_type::string; }
|
||||
|
||||
bool is_array() const noexcept { return _type == value_type::array; }
|
||||
|
||||
bool is_object() const noexcept { return _type == value_type::object; }
|
||||
|
||||
template <typename value_t>
|
||||
bool is() const noexcept;
|
||||
|
||||
@@ -183,13 +114,9 @@ public:
|
||||
|
||||
bool contains(const string_t& key) const;
|
||||
bool contains(size_t pos) const;
|
||||
|
||||
bool exists(const string_t& key) const { return contains(key); }
|
||||
|
||||
bool exists(size_t pos) const { return contains(pos); }
|
||||
|
||||
value_type type() const noexcept { return _type; }
|
||||
|
||||
const basic_value<string_t>& at(size_t pos) const;
|
||||
const basic_value<string_t>& at(const string_t& key) const;
|
||||
|
||||
@@ -221,11 +148,6 @@ public:
|
||||
|
||||
template <typename value_t, template <typename...> typename collection_t = std::vector>
|
||||
collection_t<value_t> as_collection() const;
|
||||
template <
|
||||
typename value_t,
|
||||
size_t Size,
|
||||
template <typename, size_t> typename fixed_array_t = std::array>
|
||||
fixed_array_t<value_t, Size> as_fixed_array() const;
|
||||
template <typename value_t, template <typename...> typename map_t = std::map>
|
||||
map_t<string_t, value_t> as_map() const;
|
||||
|
||||
@@ -240,29 +162,20 @@ public:
|
||||
|
||||
void clear() noexcept;
|
||||
|
||||
string_t dumps(std::optional<size_t> indent = std::nullopt) const
|
||||
{
|
||||
return indent ? format(*indent) : to_string();
|
||||
}
|
||||
|
||||
string_t dumps(std::optional<size_t> indent = std::nullopt) const { return indent ? format(*indent) : to_string(); }
|
||||
// return raw string
|
||||
string_t to_string() const;
|
||||
|
||||
string_t format(size_t indent = 4) const { return format(indent, 0); }
|
||||
|
||||
basic_value<string_t>& operator=(const basic_value<string_t>& rhs);
|
||||
basic_value<string_t>& operator=(basic_value<string_t>&&) noexcept;
|
||||
|
||||
template <
|
||||
typename value_t,
|
||||
std::enable_if_t<std::is_convertible_v<value_t, basic_value<string_t>>, bool> = true>
|
||||
template <typename value_t, std::enable_if_t<std::is_convertible_v<value_t, basic_value<string_t>>, bool> = true>
|
||||
basic_value<string_t>& operator=(value_t rhs)
|
||||
{
|
||||
return *this = basic_value<string_t>(std::move(rhs));
|
||||
}
|
||||
|
||||
bool operator==(const basic_value<string_t>& rhs) const;
|
||||
|
||||
bool operator!=(const basic_value<string_t>& rhs) const { return !(*this == rhs); }
|
||||
|
||||
const basic_value<string_t>& operator[](size_t pos) const;
|
||||
@@ -287,63 +200,34 @@ public:
|
||||
basic_value<string_t>& operator+=(basic_array<string_t>&& rhs);
|
||||
|
||||
explicit operator bool() const { return as_boolean(); }
|
||||
|
||||
explicit operator int() const { return as_integer(); }
|
||||
|
||||
explicit operator unsigned() const { return as_unsigned(); }
|
||||
|
||||
explicit operator long() const { return as_long(); }
|
||||
|
||||
explicit operator unsigned long() const { return as_unsigned_long(); }
|
||||
|
||||
explicit operator long long() const { return as_long_long(); }
|
||||
|
||||
explicit operator unsigned long long() const { return as_unsigned_long_long(); }
|
||||
|
||||
explicit operator float() const { return as_float(); }
|
||||
|
||||
explicit operator double() const { return as_double(); }
|
||||
|
||||
explicit operator long double() const { return as_long_double(); }
|
||||
|
||||
explicit operator string_t() const { return as_string(); }
|
||||
|
||||
explicit operator basic_array<string_t>() const { return as_array(); }
|
||||
|
||||
explicit operator basic_object<string_t>() const { return as_object(); }
|
||||
|
||||
template <
|
||||
typename value_t,
|
||||
template <typename...> typename collection_t = std::vector,
|
||||
std::enable_if_t<_utils::is_collection<collection_t<value_t>>, bool> = true>
|
||||
template <typename value_t, template <typename...> typename collection_t = std::vector,
|
||||
std::enable_if_t<_utils::is_collection<collection_t<value_t>>, bool> = true>
|
||||
explicit operator collection_t<value_t>() const
|
||||
{
|
||||
return as_collection<value_t, collection_t>();
|
||||
}
|
||||
|
||||
template <
|
||||
typename value_t,
|
||||
size_t Size,
|
||||
template <typename, size_t> typename fixed_array_t = std::array,
|
||||
std::enable_if_t<_utils::is_fixed_array<fixed_array_t<value_t, Size>>, bool> = true>
|
||||
explicit operator fixed_array_t<value_t, Size>() const
|
||||
{
|
||||
return as_fixed_array<value_t, Size, fixed_array_t>();
|
||||
}
|
||||
|
||||
template <
|
||||
typename value_t,
|
||||
template <typename...> typename map_t = std::map,
|
||||
std::enable_if_t<_utils::is_map<map_t<string_t, value_t>>, bool> = true>
|
||||
template <typename value_t, template <typename...> typename map_t = std::map,
|
||||
std::enable_if_t<_utils::is_map<map_t<string_t, value_t>>, bool> = true>
|
||||
explicit operator map_t<string_t, value_t>() const
|
||||
{
|
||||
return as_map<value_t, map_t>();
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_from_json_in_member<jsonization_t, string_t>::value, bool> =
|
||||
true>
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_from_json_in_member<jsonization_t, string_t>::value, bool> = true>
|
||||
explicit operator jsonization_t() const
|
||||
{
|
||||
jsonization_t dst {};
|
||||
@@ -352,12 +236,8 @@ public:
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
template <
|
||||
typename jsonization_t,
|
||||
std::enable_if_t<
|
||||
_utils::has_from_json_in_templ_spec<jsonization_t, string_t>::value,
|
||||
bool> = true>
|
||||
template <typename jsonization_t,
|
||||
std::enable_if_t<_utils::has_from_json_in_templ_spec<jsonization_t, string_t>::value, bool> = true>
|
||||
explicit operator jsonization_t() const
|
||||
{
|
||||
jsonization_t dst {};
|
||||
@@ -367,32 +247,6 @@ public:
|
||||
return dst;
|
||||
}
|
||||
|
||||
template <typename enum_t, std::enable_if_t<std::is_enum_v<enum_t>, bool> = true>
|
||||
explicit operator enum_t() const
|
||||
{
|
||||
return static_cast<enum_t>(static_cast<std::underlying_type_t<enum_t>>(*this));
|
||||
}
|
||||
|
||||
template <typename... elem_ts>
|
||||
explicit operator std::tuple<elem_ts...>() const
|
||||
{
|
||||
return as_array().template as_tuple<elem_ts...>();
|
||||
}
|
||||
|
||||
template <typename elem1_t, typename elem2_t>
|
||||
explicit operator std::pair<elem1_t, elem2_t>() const
|
||||
{
|
||||
return as_array().template as_pair<elem1_t, elem2_t>();
|
||||
}
|
||||
|
||||
template <typename... args_t>
|
||||
explicit operator std::variant<args_t...>() const
|
||||
{
|
||||
return _utils::deserialize_variant<string_t, std::variant<args_t...>>(
|
||||
*this,
|
||||
std::make_index_sequence<std::variant_size_v<std::variant<args_t...>>>());
|
||||
}
|
||||
|
||||
private:
|
||||
friend class basic_array<string_t>;
|
||||
friend class basic_object<string_t>;
|
||||
@@ -402,9 +256,8 @@ private:
|
||||
static var_t deep_copy(const var_t& src);
|
||||
|
||||
template <typename... key_then_default_value_t, size_t... keys_indexes_t>
|
||||
auto
|
||||
get(std::tuple<key_then_default_value_t...> keys_then_default_value,
|
||||
std::index_sequence<keys_indexes_t...>) const;
|
||||
auto get(std::tuple<key_then_default_value_t...> keys_then_default_value,
|
||||
std::index_sequence<keys_indexes_t...>) const;
|
||||
|
||||
template <typename value_t, typename first_key_t, typename... rest_keys_t>
|
||||
auto get_helper(const value_t& default_value, first_key_t&& first, rest_keys_t&&... rest) const;
|
||||
@@ -423,125 +276,89 @@ inline basic_value<string_t>::basic_value() = default;
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(const basic_value<string_t>& rhs)
|
||||
: _type(rhs._type)
|
||||
, _raw_data(deep_copy(rhs._raw_data))
|
||||
{
|
||||
}
|
||||
: _type(rhs._type), _raw_data(deep_copy(rhs._raw_data))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(basic_value<string_t>&& rhs) noexcept = default;
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(bool b)
|
||||
: _type(value_type::boolean)
|
||||
, _raw_data(string_t(b ? _utils::true_string<string_t>() : _utils::false_string<string_t>()))
|
||||
{
|
||||
}
|
||||
: _type(value_type::boolean),
|
||||
_raw_data(string_t(b ? _utils::true_string<string_t>() : _utils::false_string<string_t>()))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(int num)
|
||||
: _type(value_type::number)
|
||||
, _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{
|
||||
}
|
||||
: _type(value_type::number), _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(unsigned num)
|
||||
: _type(value_type::number)
|
||||
, _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{
|
||||
}
|
||||
: _type(value_type::number), _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(long num)
|
||||
: _type(value_type::number)
|
||||
, _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{
|
||||
}
|
||||
: _type(value_type::number), _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(unsigned long num)
|
||||
: _type(value_type::number)
|
||||
, _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{
|
||||
}
|
||||
: _type(value_type::number), _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(long long num)
|
||||
: _type(value_type::number)
|
||||
, _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{
|
||||
}
|
||||
: _type(value_type::number), _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(unsigned long long num)
|
||||
: _type(value_type::number)
|
||||
, _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{
|
||||
}
|
||||
: _type(value_type::number), _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(float num)
|
||||
: _type(value_type::number)
|
||||
, _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{
|
||||
}
|
||||
: _type(value_type::number), _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(double num)
|
||||
: _type(value_type::number)
|
||||
, _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{
|
||||
}
|
||||
: _type(value_type::number), _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(long double num)
|
||||
: _type(value_type::number)
|
||||
, _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{
|
||||
}
|
||||
: _type(value_type::number), _raw_data(_utils::to_basic_string<string_t>(num))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(const char_t* str)
|
||||
: _type(value_type::string)
|
||||
, _raw_data(string_t(str))
|
||||
{
|
||||
}
|
||||
inline basic_value<string_t>::basic_value(const char_t* str) : _type(value_type::string), _raw_data(string_t(str))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(string_t str)
|
||||
: _type(value_type::string)
|
||||
, _raw_data(std::move(str))
|
||||
{
|
||||
}
|
||||
inline basic_value<string_t>::basic_value(string_t str) : _type(value_type::string), _raw_data(std::move(str))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(std::nullptr_t)
|
||||
: _type(value_type::null)
|
||||
{
|
||||
}
|
||||
inline basic_value<string_t>::basic_value(std::nullptr_t) : _type(value_type::null)
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(basic_array<string_t> arr)
|
||||
: _type(value_type::array)
|
||||
, _raw_data(std::make_unique<basic_array<string_t>>(std::move(arr)))
|
||||
{
|
||||
}
|
||||
: _type(value_type::array), _raw_data(std::make_unique<basic_array<string_t>>(std::move(arr)))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(basic_object<string_t> obj)
|
||||
: _type(value_type::object)
|
||||
, _raw_data(std::make_unique<basic_object<string_t>>(std::move(obj)))
|
||||
{
|
||||
}
|
||||
: _type(value_type::object), _raw_data(std::make_unique<basic_object<string_t>>(std::move(obj)))
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>::basic_value(
|
||||
std::initializer_list<typename basic_object<string_t>::value_type> init_list)
|
||||
: _type(value_type::object)
|
||||
, _raw_data(std::make_unique<basic_object<string_t>>(init_list))
|
||||
{
|
||||
}
|
||||
inline basic_value<string_t>::basic_value(std::initializer_list<typename basic_object<string_t>::value_type> init_list)
|
||||
: _type(value_type::object), _raw_data(std::make_unique<basic_object<string_t>>(init_list))
|
||||
{}
|
||||
|
||||
// for Pimpl
|
||||
template <typename string_t>
|
||||
@@ -563,7 +380,7 @@ inline bool basic_value<string_t>::is() const noexcept
|
||||
else if constexpr (std::is_same_v<bool, value_t>) {
|
||||
return is_boolean();
|
||||
}
|
||||
else if constexpr (std::is_arithmetic_v<value_t> || std::is_enum_v<value_t>) {
|
||||
else if constexpr (std::is_arithmetic_v<value_t>) {
|
||||
return is_number();
|
||||
}
|
||||
else if constexpr (std::is_constructible_v<string_t, value_t>) {
|
||||
@@ -575,31 +392,12 @@ inline bool basic_value<string_t>::is() const noexcept
|
||||
else if constexpr (_utils::is_collection<value_t>) {
|
||||
return is_array() && all<typename value_t::value_type>();
|
||||
}
|
||||
else if constexpr (_utils::is_fixed_array<value_t>) {
|
||||
return is_array() && all<typename value_t::value_type>()
|
||||
&& as_array().size() == _utils::fixed_array_size<value_t>;
|
||||
}
|
||||
else if constexpr (std::is_same_v<basic_object<string_t>, value_t>) {
|
||||
return is_object();
|
||||
}
|
||||
else if constexpr (_utils::is_map<value_t>) {
|
||||
return is_object() && std::is_constructible_v<string_t, typename value_t::key_type>
|
||||
&& all<typename value_t::mapped_type>();
|
||||
}
|
||||
else if constexpr (_utils::is_variant<value_t>) {
|
||||
return _utils::detect_variant<string_t, value_t>(
|
||||
*this,
|
||||
std::make_index_sequence<std::variant_size_v<value_t>>());
|
||||
}
|
||||
else if constexpr (_utils::is_pair<value_t>) {
|
||||
return is_array() && as_array().size() == 2
|
||||
&& at(0).template is<typename value_t::first_type>()
|
||||
&& at(1).template is<typename value_t::second_type>();
|
||||
}
|
||||
else if constexpr (_utils::is_tuple<value_t>) {
|
||||
return _utils::detect_tuple<string_t, value_t>(
|
||||
*this,
|
||||
std::make_index_sequence<std::tuple_size_v<value_t>>());
|
||||
return is_object() && std::is_constructible_v<string_t, typename value_t::key_type> &&
|
||||
all<typename value_t::mapped_type>();
|
||||
}
|
||||
else {
|
||||
static_assert(!sizeof(value_t), "Unsupported type");
|
||||
@@ -646,42 +444,33 @@ template <typename string_t>
|
||||
template <typename... key_then_default_value_t>
|
||||
inline auto basic_value<string_t>::get(key_then_default_value_t&&... keys_then_default_value) const
|
||||
{
|
||||
return get(
|
||||
std::forward_as_tuple(keys_then_default_value...),
|
||||
std::make_index_sequence<sizeof...(keys_then_default_value) - 1> {});
|
||||
return get(std::forward_as_tuple(keys_then_default_value...),
|
||||
std::make_index_sequence<sizeof...(keys_then_default_value) - 1> {});
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename... key_then_default_value_t, size_t... keys_indexes_t>
|
||||
inline auto basic_value<string_t>::get(
|
||||
std::tuple<key_then_default_value_t...> keys_then_default_value,
|
||||
std::index_sequence<keys_indexes_t...>) const
|
||||
inline auto basic_value<string_t>::get(std::tuple<key_then_default_value_t...> keys_then_default_value,
|
||||
std::index_sequence<keys_indexes_t...>) const
|
||||
{
|
||||
constexpr unsigned long default_value_index = sizeof...(key_then_default_value_t) - 1;
|
||||
return get_helper(
|
||||
std::get<default_value_index>(keys_then_default_value),
|
||||
std::get<keys_indexes_t>(keys_then_default_value)...);
|
||||
return get_helper(std::get<default_value_index>(keys_then_default_value),
|
||||
std::get<keys_indexes_t>(keys_then_default_value)...);
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t, typename first_key_t, typename... rest_keys_t>
|
||||
inline auto basic_value<string_t>::get_helper(
|
||||
const value_t& default_value,
|
||||
first_key_t&& first,
|
||||
rest_keys_t&&... rest) const
|
||||
inline auto basic_value<string_t>::get_helper(const value_t& default_value, first_key_t&& first,
|
||||
rest_keys_t&&... rest) const
|
||||
{
|
||||
if constexpr (std::is_constructible_v<string_t, first_key_t>) {
|
||||
return is_object() ? as_object().get_helper(
|
||||
default_value,
|
||||
std::forward<first_key_t>(first),
|
||||
std::forward<rest_keys_t>(rest)...)
|
||||
return is_object() ? as_object().get_helper(default_value, std::forward<first_key_t>(first),
|
||||
std::forward<rest_keys_t>(rest)...)
|
||||
: default_value;
|
||||
}
|
||||
else if constexpr (std::is_integral_v<std::decay_t<first_key_t>>) {
|
||||
return is_array() ? as_array().get_helper(
|
||||
default_value,
|
||||
std::forward<first_key_t>(first),
|
||||
std::forward<rest_keys_t>(rest)...)
|
||||
return is_array() ? as_array().get_helper(default_value, std::forward<first_key_t>(first),
|
||||
std::forward<rest_keys_t>(rest)...)
|
||||
: default_value;
|
||||
}
|
||||
else {
|
||||
@@ -691,22 +480,16 @@ inline auto basic_value<string_t>::get_helper(
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t, typename unique_key_t>
|
||||
inline auto
|
||||
basic_value<string_t>::get_helper(const value_t& default_value, unique_key_t&& first) const
|
||||
inline auto basic_value<string_t>::get_helper(const value_t& default_value, unique_key_t&& first) const
|
||||
{
|
||||
if constexpr (std::is_constructible_v<string_t, unique_key_t>) {
|
||||
return is_object()
|
||||
? as_object().get_helper(default_value, std::forward<unique_key_t>(first))
|
||||
: default_value;
|
||||
return is_object() ? as_object().get_helper(default_value, std::forward<unique_key_t>(first)) : default_value;
|
||||
}
|
||||
else if constexpr (std::is_integral_v<std::decay_t<unique_key_t>>) {
|
||||
return is_array() ? as_array().get_helper(default_value, std::forward<unique_key_t>(first))
|
||||
: default_value;
|
||||
return is_array() ? as_array().get_helper(default_value, std::forward<unique_key_t>(first)) : default_value;
|
||||
}
|
||||
else {
|
||||
static_assert(
|
||||
!sizeof(unique_key_t),
|
||||
"Parameter must be integral or string_t constructible");
|
||||
static_assert(!sizeof(unique_key_t), "Parameter must be integral or string_t constructible");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -939,14 +722,10 @@ template <typename string_t>
|
||||
template <typename... args_t>
|
||||
inline decltype(auto) basic_value<string_t>::emplace(args_t&&... args)
|
||||
{
|
||||
constexpr bool is_array_args =
|
||||
std::is_constructible_v<typename basic_array<string_t>::value_type, args_t...>;
|
||||
constexpr bool is_object_args =
|
||||
std::is_constructible_v<typename basic_object<string_t>::value_type, args_t...>;
|
||||
constexpr bool is_array_args = std::is_constructible_v<typename basic_array<string_t>::value_type, args_t...>;
|
||||
constexpr bool is_object_args = std::is_constructible_v<typename basic_object<string_t>::value_type, args_t...>;
|
||||
|
||||
static_assert(
|
||||
is_array_args || is_object_args,
|
||||
"Args can not constructure a array or object value");
|
||||
static_assert(is_array_args || is_object_args, "Args can not constructure a array or object value");
|
||||
|
||||
if constexpr (is_array_args) {
|
||||
return as_array().emplace_back(std::forward<args_t>(args)...);
|
||||
@@ -1022,13 +801,6 @@ inline collection_t<value_t> basic_value<string_t>::as_collection() const
|
||||
return as_array().template as_collection<value_t, collection_t>();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t, size_t Size, template <typename, size_t> typename fixed_array_t>
|
||||
inline fixed_array_t<value_t, Size> basic_value<string_t>::as_fixed_array() const
|
||||
{
|
||||
return as_array().template as_fixed_array<value_t, Size>();
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
template <typename value_t, template <typename...> typename map_t>
|
||||
inline map_t<string_t, value_t> basic_value<string_t>::as_map() const
|
||||
@@ -1046,15 +818,12 @@ inline basic_value<string_t>& basic_value<string_t>::operator=(const basic_value
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>&
|
||||
basic_value<string_t>::operator=(basic_value<string_t>&& rhs) noexcept = default;
|
||||
inline basic_value<string_t>& basic_value<string_t>::operator=(basic_value<string_t>&& rhs) noexcept = default;
|
||||
|
||||
template <typename string_t>
|
||||
inline bool basic_value<string_t>::operator==(const basic_value<string_t>& rhs) const
|
||||
{
|
||||
if (_type != rhs._type) {
|
||||
return false;
|
||||
}
|
||||
if (_type != rhs._type) return false;
|
||||
|
||||
switch (_type) {
|
||||
case value_type::null:
|
||||
@@ -1109,8 +878,7 @@ inline basic_value<string_t>& basic_value<string_t>::operator[](string_t&& key)
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>
|
||||
basic_value<string_t>::operator|(const basic_object<string_t>& rhs) const&
|
||||
inline basic_value<string_t> basic_value<string_t>::operator|(const basic_object<string_t>& rhs) const&
|
||||
{
|
||||
return as_object() | rhs;
|
||||
}
|
||||
@@ -1148,8 +916,7 @@ inline basic_value<string_t>& basic_value<string_t>::operator|=(basic_object<str
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline basic_value<string_t>
|
||||
basic_value<string_t>::operator+(const basic_array<string_t>& rhs) const&
|
||||
inline basic_value<string_t> basic_value<string_t>::operator+(const basic_array<string_t>& rhs) const&
|
||||
{
|
||||
return as_array() + rhs;
|
||||
}
|
||||
@@ -1189,12 +956,9 @@ inline basic_value<string_t>& basic_value<string_t>::operator+=(basic_array<stri
|
||||
template <typename string_t>
|
||||
template <typename... args_t>
|
||||
inline basic_value<string_t>::basic_value(value_type type, args_t&&... args)
|
||||
: _type(type)
|
||||
, _raw_data(std::forward<args_t>(args)...)
|
||||
: _type(type), _raw_data(std::forward<args_t>(args)...)
|
||||
{
|
||||
static_assert(
|
||||
std::is_constructible_v<var_t, args_t...>,
|
||||
"Parameter can't be used to construct a var_t");
|
||||
static_assert(std::is_constructible_v<var_t, args_t...>, "Parameter can't be used to construct a var_t");
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
@@ -1217,14 +981,11 @@ inline typename basic_value<string_t>::var_t basic_value<string_t>::deep_copy(co
|
||||
return dst;
|
||||
}
|
||||
|
||||
template <
|
||||
typename ostream_t,
|
||||
typename string_t,
|
||||
typename std_ostream_t = std::basic_ostream<
|
||||
typename string_t::value_type,
|
||||
std::char_traits<typename string_t::value_type>>,
|
||||
typename = std::enable_if_t<
|
||||
std::is_same_v<std_ostream_t, ostream_t> || std::is_base_of_v<std_ostream_t, ostream_t>>>
|
||||
template <typename ostream_t, typename string_t,
|
||||
typename std_ostream_t =
|
||||
std::basic_ostream<typename string_t::value_type, std::char_traits<typename string_t::value_type>>,
|
||||
typename =
|
||||
std::enable_if_t<std::is_same_v<std_ostream_t, ostream_t> || std::is_base_of_v<std_ostream_t, ostream_t>>>
|
||||
ostream_t& operator<<(ostream_t& out, const basic_value<string_t>& val)
|
||||
{
|
||||
out << val.format();
|
||||
|
||||
4
3rdparty/include/meojson/json.hpp
vendored
@@ -1,10 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
|
||||
#include "common/serialization.hpp"
|
||||
#include "common/types.hpp"
|
||||
#include "parser/parser.hpp"
|
||||
#include "reflection/jsonization.hpp"
|
||||
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
6
3rdparty/include/meojson/json5.hpp
vendored
@@ -1,8 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
|
||||
#include "common/types.hpp"
|
||||
#include "parser5/parser5.hpp"
|
||||
|
||||
// IWYU pragma: end_exports
|
||||
#include "parser5/parser5.hpp"
|
||||
37
3rdparty/include/meojson/parser/bitops.hpp
vendored
@@ -1,17 +1,13 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus >= 202002L || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L)
|
||||
#include <bit>
|
||||
|
||||
namespace json::_bitops
|
||||
{
|
||||
using std::countl_one;
|
||||
using std::countl_zero;
|
||||
using std::countr_one;
|
||||
using std::countr_zero;
|
||||
|
||||
inline constexpr bool is_little_endian()
|
||||
{
|
||||
return std::endian::native == std::endian::little;
|
||||
@@ -19,37 +15,25 @@ inline constexpr bool is_little_endian()
|
||||
}
|
||||
#else
|
||||
#include <cstdint>
|
||||
|
||||
namespace json::_bitops
|
||||
{
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
inline constexpr int countl_zero(uint32_t x)
|
||||
{
|
||||
if constexpr (sizeof(uint32_t) == sizeof(unsigned int)) {
|
||||
return x == 0 ? 32 : __builtin_clz(x);
|
||||
}
|
||||
if constexpr (sizeof(uint32_t) == sizeof(unsigned long)) {
|
||||
return x == 0 ? 32 : __builtin_clzl(x);
|
||||
}
|
||||
if constexpr (sizeof(uint32_t) == sizeof(unsigned int)) return x == 0 ? 32 : __builtin_clz(x);
|
||||
if constexpr (sizeof(uint32_t) == sizeof(unsigned long)) return x == 0 ? 32 : __builtin_clzl(x);
|
||||
return x == 0 ? 32 : __builtin_clzll(x);
|
||||
}
|
||||
|
||||
inline constexpr int countr_zero(uint32_t x)
|
||||
{
|
||||
if constexpr (sizeof(uint32_t) == sizeof(unsigned int)) {
|
||||
return x == 0 ? 32 : __builtin_ctz(x);
|
||||
}
|
||||
if constexpr (sizeof(uint32_t) == sizeof(unsigned long)) {
|
||||
return x == 0 ? 32 : __builtin_ctzl(x);
|
||||
}
|
||||
if constexpr (sizeof(uint32_t) == sizeof(unsigned int)) return x == 0 ? 32 : __builtin_ctz(x);
|
||||
if constexpr (sizeof(uint32_t) == sizeof(unsigned long)) return x == 0 ? 32 : __builtin_ctzl(x);
|
||||
return x == 0 ? 32 : __builtin_ctzll(x);
|
||||
}
|
||||
|
||||
inline constexpr int countl_zero(uint64_t x)
|
||||
{
|
||||
return x == 0 ? 64 : __builtin_clzll(x);
|
||||
}
|
||||
|
||||
inline constexpr int countr_zero(uint64_t x)
|
||||
{
|
||||
return x == 0 ? 64 : __builtin_ctzll(x);
|
||||
@@ -61,17 +45,14 @@ inline int countl_zero(uint32_t x)
|
||||
{
|
||||
return __lzcnt(x);
|
||||
}
|
||||
|
||||
inline int countr_zero(uint32_t x)
|
||||
{
|
||||
return _tzcnt_u32(x);
|
||||
}
|
||||
|
||||
inline int countl_zero(uint64_t x)
|
||||
{
|
||||
return (int)__lzcnt64(x);
|
||||
}
|
||||
|
||||
inline int countr_zero(uint64_t x)
|
||||
{
|
||||
return (int)_tzcnt_u64(x);
|
||||
@@ -82,19 +63,16 @@ inline constexpr int countl_zero(uint32_t x)
|
||||
unsigned long index = 0;
|
||||
return _BitScanReverse(&index, x) ? 31 - index : 32;
|
||||
}
|
||||
|
||||
inline constexpr int countr_zero(uint32_t x)
|
||||
{
|
||||
unsigned long index = 0;
|
||||
return _BitScanForward(&index, x) ? index : 32;
|
||||
}
|
||||
|
||||
inline constexpr int countl_zero(uint64_t x)
|
||||
{
|
||||
unsigned long index = 0;
|
||||
return _BitScanReverse64(&index, x) ? 63 - index : 64;
|
||||
}
|
||||
|
||||
inline constexpr int countr_zero(uint64_t x)
|
||||
{
|
||||
unsigned long index = 0;
|
||||
@@ -108,17 +86,14 @@ inline int countl_one(uint32_t x)
|
||||
{
|
||||
return countl_zero(~x);
|
||||
}
|
||||
|
||||
inline int countr_one(uint32_t x)
|
||||
{
|
||||
return countr_zero(~x);
|
||||
}
|
||||
|
||||
inline int countl_one(uint64_t x)
|
||||
{
|
||||
return countl_zero(~x);
|
||||
}
|
||||
|
||||
inline int countr_one(uint64_t x)
|
||||
{
|
||||
return countr_zero(~x);
|
||||
@@ -127,12 +102,10 @@ inline int countr_one(uint64_t x)
|
||||
// no constexpr endian awareness before C++20
|
||||
inline bool is_little_endian()
|
||||
{
|
||||
union
|
||||
{
|
||||
union {
|
||||
uint32_t u32;
|
||||
uint8_t u8;
|
||||
} u = { 0x01020304 };
|
||||
|
||||
return u.u8 == 4;
|
||||
}
|
||||
} // namespace json::_bitops
|
||||
|
||||
42
3rdparty/include/meojson/parser/packed_bytes.hpp
vendored
@@ -1,5 +1,3 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
@@ -30,13 +28,11 @@ struct packed_bytes
|
||||
};
|
||||
}
|
||||
|
||||
#ifndef MEOJSON_DISABLE_PACKED_BYTES
|
||||
#if defined(__SSE2__) || defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP)
|
||||
#include "packed_bytes_x86.hpp"
|
||||
#elif defined(__ARM_NEON) || defined(_M_ARM) || defined(_M_ARM64)
|
||||
#include "packed_bytes_arm.hpp"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace json::_packed_bytes
|
||||
{
|
||||
@@ -70,19 +66,14 @@ struct packed_bytes_trait_uint64
|
||||
return is_zero_memberwise((x) ^ (UINT64_C(0x0101010101010101) * (n)));
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type bitwise_or(value_type a, value_type b)
|
||||
{
|
||||
return a | b;
|
||||
}
|
||||
__packed_bytes_strong_inline static value_type bitwise_or(value_type a, value_type b) { return a | b; }
|
||||
|
||||
__packed_bytes_strong_inline static size_t first_nonzero_byte(value_type x)
|
||||
{
|
||||
if (_bitops::is_little_endian()) {
|
||||
if (_bitops::is_little_endian())
|
||||
return _bitops::countr_zero(x) / 8;
|
||||
}
|
||||
else {
|
||||
else
|
||||
return _bitops::countl_zero(x) / 8;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -117,22 +108,16 @@ struct packed_bytes_trait_uint32
|
||||
return is_zero_memberwise((x) ^ (~UINT32_C(0) / 255 * (n)));
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type bitwise_or(value_type a, value_type b)
|
||||
{
|
||||
return a | b;
|
||||
}
|
||||
__packed_bytes_strong_inline static value_type bitwise_or(value_type a, value_type b) { return a | b; }
|
||||
|
||||
__packed_bytes_strong_inline static size_t first_nonzero_byte(value_type x)
|
||||
{
|
||||
if (_bitops::is_little_endian()) {
|
||||
if (_bitops::is_little_endian())
|
||||
return _bitops::countr_zero(x) / 8;
|
||||
}
|
||||
else {
|
||||
else
|
||||
return _bitops::countl_zero(x) / 8;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct packed_bytes<8>
|
||||
{
|
||||
@@ -148,14 +133,9 @@ struct packed_bytes<4>
|
||||
template <size_t N>
|
||||
using packed_bytes_trait = typename packed_bytes<N>::traits;
|
||||
|
||||
using packed_bytes_trait_max = std::conditional_t<
|
||||
packed_bytes_trait<32>::available,
|
||||
packed_bytes_trait<32>,
|
||||
std::conditional_t<
|
||||
packed_bytes_trait<16>::available,
|
||||
packed_bytes_trait<16>,
|
||||
std::conditional_t<
|
||||
packed_bytes_trait<8>::available,
|
||||
packed_bytes_trait<8>,
|
||||
packed_bytes_trait<4>>>>;
|
||||
using packed_bytes_trait_max =
|
||||
std::conditional_t<packed_bytes_trait<32>::available, packed_bytes_trait<32>,
|
||||
std::conditional_t<packed_bytes_trait<16>::available, packed_bytes_trait<16>,
|
||||
std::conditional_t<packed_bytes_trait<8>::available, packed_bytes_trait<8>,
|
||||
packed_bytes_trait<4>>>>;
|
||||
} // namespace json::_packed_bytes
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
// current NEON implementation doesn't outperform 64-bit scalar implementation
|
||||
@@ -19,10 +17,7 @@ struct packed_bytes_trait_neon
|
||||
static constexpr auto step = 16;
|
||||
using value_type = uint8x16_t;
|
||||
|
||||
__packed_bytes_strong_inline static value_type load_unaligned(const void* ptr)
|
||||
{
|
||||
return vld1q_u8((uint8_t*)ptr);
|
||||
}
|
||||
__packed_bytes_strong_inline static value_type load_unaligned(const void* ptr) { return vld1q_u8((uint8_t*)ptr); }
|
||||
|
||||
__packed_bytes_strong_inline static value_type less(value_type x, uint8_t n)
|
||||
{
|
||||
@@ -31,31 +26,19 @@ struct packed_bytes_trait_neon
|
||||
return is_less;
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type equal(value_type x, uint8_t n)
|
||||
{
|
||||
return vceqq_u8(x, vdupq_n_u8(n));
|
||||
}
|
||||
__packed_bytes_strong_inline static value_type equal(value_type x, uint8_t n) { return vceqq_u8(x, vdupq_n_u8(n)); }
|
||||
|
||||
__packed_bytes_strong_inline static value_type equal(value_type x, value_type y)
|
||||
{
|
||||
return vceqq_u8(x, y);
|
||||
}
|
||||
__packed_bytes_strong_inline static value_type equal(value_type x, value_type y) { return vceqq_u8(x, y); }
|
||||
|
||||
__packed_bytes_strong_inline static value_type bitwise_or(value_type a, value_type b)
|
||||
{
|
||||
return vorrq_u8(a, b);
|
||||
}
|
||||
__packed_bytes_strong_inline static value_type bitwise_or(value_type a, value_type b) { return vorrq_u8(a, b); }
|
||||
|
||||
__packed_bytes_strong_inline static bool is_all_zero(value_type x)
|
||||
{
|
||||
#ifdef __packed_bytes_trait_arm64
|
||||
return vmaxvq_u8(x) == 0;
|
||||
#else
|
||||
auto fold64 = vorr_u64(
|
||||
vget_high_u64(vreinterpretq_u8_u64(x), 0),
|
||||
vget_low_u64(vreinterpretq_u8_u64(x), 1));
|
||||
auto fold32 = vget_lane_u32(vreinterpret_u64_u32(fold64), 0)
|
||||
| vget_lane_u32(vreinterpret_u64_u32(fold64), 1);
|
||||
auto fold64 = vorr_u64(vget_high_u64(vreinterpretq_u8_u64(x), 0), vget_low_u64(vreinterpretq_u8_u64(x), 1));
|
||||
auto fold32 = vget_lane_u32(vreinterpret_u64_u32(fold64), 0) | vget_lane_u32(vreinterpret_u64_u32(fold64), 1);
|
||||
return fold32 == 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "packed_bytes.hpp"
|
||||
|
||||
#include <emmintrin.h>
|
||||
@@ -38,15 +35,9 @@ struct packed_bytes_trait_sse
|
||||
return _mm_cmpeq_epi8(x, _mm_set1_epi8(static_cast<char>(n)));
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type equal(value_type x, value_type y)
|
||||
{
|
||||
return _mm_cmpeq_epi8(x, y);
|
||||
}
|
||||
__packed_bytes_strong_inline static value_type equal(value_type x, value_type y) { return _mm_cmpeq_epi8(x, y); }
|
||||
|
||||
__packed_bytes_strong_inline static value_type bitwise_or(value_type a, value_type b)
|
||||
{
|
||||
return _mm_or_si128(a, b);
|
||||
}
|
||||
__packed_bytes_strong_inline static value_type bitwise_or(value_type a, value_type b) { return _mm_or_si128(a, b); }
|
||||
|
||||
__packed_bytes_strong_inline static bool is_all_zero(value_type x)
|
||||
{
|
||||
@@ -106,20 +97,14 @@ struct packed_bytes_trait_avx2
|
||||
return _mm256_cmpeq_epi8(x, _mm256_set1_epi8(static_cast<char>(n)));
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static value_type equal(value_type x, value_type y)
|
||||
{
|
||||
return _mm256_cmpeq_epi8(x, y);
|
||||
}
|
||||
__packed_bytes_strong_inline static value_type equal(value_type x, value_type y) { return _mm256_cmpeq_epi8(x, y); }
|
||||
|
||||
__packed_bytes_strong_inline static value_type bitwise_or(value_type a, value_type b)
|
||||
{
|
||||
return _mm256_or_si256(a, b);
|
||||
}
|
||||
|
||||
__packed_bytes_strong_inline static bool is_all_zero(value_type x)
|
||||
{
|
||||
return (bool)_mm256_testz_si256(x, x);
|
||||
}
|
||||
__packed_bytes_strong_inline static bool is_all_zero(value_type x) { return (bool)_mm256_testz_si256(x, x); }
|
||||
|
||||
__packed_bytes_strong_inline static size_t first_nonzero_byte(value_type x)
|
||||
{
|
||||
|
||||
256
3rdparty/include/meojson/parser/parser.hpp
vendored
@@ -1,8 +1,5 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cctype>
|
||||
#include <fstream>
|
||||
#include <optional>
|
||||
#include <ostream>
|
||||
@@ -18,10 +15,8 @@ namespace json
|
||||
// * parser declare *
|
||||
// ****************************
|
||||
|
||||
template <
|
||||
typename string_t = default_string_t,
|
||||
typename parsing_t = void,
|
||||
typename accel_traits = _packed_bytes::packed_bytes_trait_max>
|
||||
template <typename string_t = default_string_t, typename parsing_t = void,
|
||||
typename accel_traits = _packed_bytes::packed_bytes_trait_max>
|
||||
class parser
|
||||
{
|
||||
public:
|
||||
@@ -33,12 +28,7 @@ public:
|
||||
static std::optional<basic_value<string_t>> parse(const parsing_t& content);
|
||||
|
||||
private:
|
||||
parser(parsing_iter_t cbegin, parsing_iter_t cend) noexcept
|
||||
: _cur(cbegin)
|
||||
, _end(cend)
|
||||
{
|
||||
;
|
||||
}
|
||||
parser(parsing_iter_t cbegin, parsing_iter_t cend) noexcept : _cur(cbegin), _end(cend) { ; }
|
||||
|
||||
std::optional<basic_value<string_t>> parse();
|
||||
basic_value<string_t> parse_value();
|
||||
@@ -57,7 +47,6 @@ private:
|
||||
bool skip_string_literal_with_accel();
|
||||
bool skip_whitespace() noexcept;
|
||||
bool skip_digit();
|
||||
bool skip_unicode_escape(uint16_t& pair_high, string_t& result);
|
||||
|
||||
private:
|
||||
parsing_iter_t _cur;
|
||||
@@ -74,10 +63,8 @@ auto parse(const parsing_t& content);
|
||||
template <typename char_t>
|
||||
auto parse(char_t* content);
|
||||
|
||||
template <
|
||||
typename istream_t,
|
||||
typename = std::enable_if_t<
|
||||
std::is_base_of_v<std::basic_istream<typename istream_t::char_type>, istream_t>>>
|
||||
template <typename istream_t,
|
||||
typename = std::enable_if_t<std::is_base_of_v<std::basic_istream<typename istream_t::char_type>, istream_t>>>
|
||||
auto parse(istream_t& istream, bool check_bom);
|
||||
|
||||
template <typename ifstream_t = std::ifstream, typename path_t = void>
|
||||
@@ -85,17 +72,17 @@ auto open(const path_t& path, bool check_bom = false);
|
||||
|
||||
namespace literals
|
||||
{
|
||||
value operator""_json(const char* str, size_t len);
|
||||
wvalue operator""_json(const wchar_t* str, size_t len);
|
||||
value operator""_json(const char* str, size_t len);
|
||||
wvalue operator""_json(const wchar_t* str, size_t len);
|
||||
|
||||
value operator""_jvalue(const char* str, size_t len);
|
||||
wvalue operator""_jvalue(const wchar_t* str, size_t len);
|
||||
value operator""_jvalue(const char* str, size_t len);
|
||||
wvalue operator""_jvalue(const wchar_t* str, size_t len);
|
||||
|
||||
array operator""_jarray(const char* str, size_t len);
|
||||
warray operator""_jarray(const wchar_t* str, size_t len);
|
||||
array operator""_jarray(const char* str, size_t len);
|
||||
warray operator""_jarray(const wchar_t* str, size_t len);
|
||||
|
||||
object operator""_jobject(const char* str, size_t len);
|
||||
wobject operator""_jobject(const wchar_t* str, size_t len);
|
||||
object operator""_jobject(const char* str, size_t len);
|
||||
wobject operator""_jobject(const wchar_t* str, size_t len);
|
||||
}
|
||||
|
||||
template <typename string_t = default_string_t>
|
||||
@@ -106,8 +93,7 @@ const basic_value<string_t> invalid_value();
|
||||
// *************************
|
||||
|
||||
template <typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline std::optional<basic_value<string_t>>
|
||||
parser<string_t, parsing_t, accel_traits>::parse(const parsing_t& content)
|
||||
inline std::optional<basic_value<string_t>> parser<string_t, parsing_t, accel_traits>::parse(const parsing_t& content)
|
||||
{
|
||||
return parser<string_t, parsing_t, accel_traits>(content.cbegin(), content.cend()).parse();
|
||||
}
|
||||
@@ -266,9 +252,7 @@ inline basic_value<string_t> parser<string_t, parsing_t, accel_traits>::parse_st
|
||||
if (!string_opt) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
return basic_value<string_t>(
|
||||
basic_value<string_t>::value_type::string,
|
||||
std::move(string_opt).value());
|
||||
return basic_value<string_t>(basic_value<string_t>::value_type::string, std::move(string_opt).value());
|
||||
}
|
||||
|
||||
template <typename string_t, typename parsing_t, typename accel_traits>
|
||||
@@ -366,10 +350,7 @@ inline basic_value<string_t> parser<string_t, parsing_t, accel_traits>::parse_ob
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
|
||||
auto emplaced = result.emplace(std::move(*key_opt), std::move(val)).second;
|
||||
if (!emplaced) {
|
||||
return invalid_value<string_t>();
|
||||
}
|
||||
result.emplace(std::move(*key_opt), std::move(val));
|
||||
|
||||
if (*_cur == ',') {
|
||||
++_cur;
|
||||
@@ -401,7 +382,6 @@ inline std::optional<string_t> parser<string_t, parsing_t, accel_traits>::parse_
|
||||
|
||||
string_t result;
|
||||
auto no_escape_beg = _cur;
|
||||
uint16_t pair_high = 0;
|
||||
|
||||
while (_cur != _end) {
|
||||
if constexpr (sizeof(*_cur) == 1 && accel_traits::available) {
|
||||
@@ -419,9 +399,6 @@ inline std::optional<string_t> parser<string_t, parsing_t, accel_traits>::parse_
|
||||
if (_cur == _end) {
|
||||
return std::nullopt;
|
||||
}
|
||||
if (pair_high && *_cur != 'u') {
|
||||
return std::nullopt;
|
||||
}
|
||||
switch (*_cur) {
|
||||
case '"':
|
||||
result.push_back('"');
|
||||
@@ -447,11 +424,9 @@ inline std::optional<string_t> parser<string_t, parsing_t, accel_traits>::parse_
|
||||
case 't':
|
||||
result.push_back('\t');
|
||||
break;
|
||||
case 'u':
|
||||
if (!skip_unicode_escape(pair_high, result)) {
|
||||
return std::nullopt;
|
||||
}
|
||||
break;
|
||||
// case 'u':
|
||||
// result.push_back('\u');
|
||||
// break;
|
||||
default:
|
||||
// Illegal backslash escape
|
||||
return std::nullopt;
|
||||
@@ -460,16 +435,10 @@ inline std::optional<string_t> parser<string_t, parsing_t, accel_traits>::parse_
|
||||
break;
|
||||
}
|
||||
case '"': {
|
||||
if (pair_high) {
|
||||
return std::nullopt;
|
||||
}
|
||||
result += string_t(no_escape_beg, _cur++);
|
||||
return result;
|
||||
}
|
||||
default:
|
||||
if (pair_high) {
|
||||
return std::nullopt;
|
||||
}
|
||||
++_cur;
|
||||
break;
|
||||
}
|
||||
@@ -477,103 +446,6 @@ inline std::optional<string_t> parser<string_t, parsing_t, accel_traits>::parse_
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
template <typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline bool parser<string_t, parsing_t, accel_traits>::skip_unicode_escape(
|
||||
uint16_t& pair_high,
|
||||
string_t& result)
|
||||
{
|
||||
uint16_t cp = 0;
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (++_cur == _end) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!std::isxdigit(static_cast<unsigned char>(*_cur))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
cp <<= 4;
|
||||
|
||||
if ('0' <= *_cur && *_cur <= '9') {
|
||||
cp |= *_cur - '0';
|
||||
}
|
||||
else if ('a' <= *_cur && *_cur <= 'f') {
|
||||
cp |= *_cur - 'a' + 10;
|
||||
}
|
||||
else if ('A' <= *_cur && *_cur <= 'F') {
|
||||
cp |= *_cur - 'A' + 10;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t ext_cp = cp;
|
||||
uint16_t hi_cp = 0, lo_cp = 0;
|
||||
|
||||
if (0xD800 <= cp && cp <= 0xDBFF) {
|
||||
if (pair_high) {
|
||||
return false;
|
||||
}
|
||||
pair_high = cp;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (0xDC00 <= cp && cp <= 0xDFFF) {
|
||||
if (!pair_high) {
|
||||
return false;
|
||||
}
|
||||
ext_cp = (((pair_high - 0xD800) << 10) | (cp - 0xDC00)) + 0x10000;
|
||||
hi_cp = pair_high;
|
||||
lo_cp = cp;
|
||||
pair_high = 0;
|
||||
}
|
||||
|
||||
if constexpr (std::is_same_v<typename string_t::value_type, char>) {
|
||||
// utf8
|
||||
if (ext_cp <= 0x7F) {
|
||||
result.push_back(static_cast<char>(ext_cp));
|
||||
}
|
||||
else if (ext_cp <= 0x7FF) {
|
||||
result.push_back(static_cast<char>(((ext_cp >> 6) & 0b00011111) | 0b11000000u));
|
||||
result.push_back(static_cast<char>((ext_cp & 0b00111111) | 0b10000000u));
|
||||
}
|
||||
else if (ext_cp <= 0xFFFF) {
|
||||
result.push_back(static_cast<char>(((ext_cp >> 12) & 0b00001111) | 0b11100000u));
|
||||
result.push_back(static_cast<char>(((ext_cp >> 6) & 0b00111111) | 0b10000000u));
|
||||
result.push_back(static_cast<char>((ext_cp & 0b00111111) | 0b10000000u));
|
||||
}
|
||||
else {
|
||||
result.push_back(static_cast<char>(((ext_cp >> 18) & 0b00000111) | 0b11110000u));
|
||||
result.push_back(static_cast<char>(((ext_cp >> 12) & 0b00111111) | 0b10000000u));
|
||||
result.push_back(static_cast<char>(((ext_cp >> 6) & 0b00111111) | 0b10000000u));
|
||||
result.push_back(static_cast<char>((ext_cp & 0b00111111) | 0b10000000u));
|
||||
}
|
||||
}
|
||||
else if constexpr (std::is_same_v<typename string_t::value_type, wchar_t>) {
|
||||
if constexpr (sizeof(wchar_t) == 4) {
|
||||
result.push_back(static_cast<wchar_t>(ext_cp));
|
||||
}
|
||||
else if constexpr (sizeof(wchar_t) == 2) {
|
||||
if (ext_cp <= 0xFFFF) {
|
||||
result.push_back(static_cast<wchar_t>(ext_cp));
|
||||
}
|
||||
else {
|
||||
result.push_back(static_cast<wchar_t>(hi_cp));
|
||||
result.push_back(static_cast<wchar_t>(lo_cp));
|
||||
}
|
||||
}
|
||||
else {
|
||||
static_assert(!sizeof(typename string_t::value_type), "Unsupported wchar");
|
||||
}
|
||||
}
|
||||
else {
|
||||
static_assert(!sizeof(typename string_t::value_type), "Unsupported type");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename string_t, typename parsing_t, typename accel_traits>
|
||||
inline bool parser<string_t, parsing_t, accel_traits>::skip_string_literal_with_accel()
|
||||
{
|
||||
@@ -584,10 +456,8 @@ inline bool parser<string_t, parsing_t, accel_traits>::skip_string_literal_with_
|
||||
while (_end - _cur >= accel_traits::step) {
|
||||
auto pack = accel_traits::load_unaligned(&(*_cur));
|
||||
auto result = accel_traits::less(pack, 32);
|
||||
result =
|
||||
accel_traits::bitwise_or(result, accel_traits::equal(pack, static_cast<uint8_t>('"')));
|
||||
result =
|
||||
accel_traits::bitwise_or(result, accel_traits::equal(pack, static_cast<uint8_t>('\\')));
|
||||
result = accel_traits::bitwise_or(result, accel_traits::equal(pack, static_cast<uint8_t>('"')));
|
||||
result = accel_traits::bitwise_or(result, accel_traits::equal(pack, static_cast<uint8_t>('\\')));
|
||||
|
||||
if (accel_traits::is_all_zero(result)) {
|
||||
_cur += accel_traits::step;
|
||||
@@ -681,8 +551,8 @@ auto parse(istream_t& ifs, bool check_bom)
|
||||
static constexpr uchar Bom_1 = 0xBB;
|
||||
static constexpr uchar Bom_2 = 0xBF;
|
||||
|
||||
if (str.size() >= 3 && static_cast<uchar>(str.at(0)) == Bom_0
|
||||
&& static_cast<uchar>(str.at(1)) == Bom_1 && static_cast<uchar>(str.at(2)) == Bom_2) {
|
||||
if (str.size() >= 3 && static_cast<uchar>(str.at(0)) == Bom_0 && static_cast<uchar>(str.at(1)) == Bom_1 &&
|
||||
static_cast<uchar>(str.at(2)) == Bom_2) {
|
||||
str.assign(str.begin() + 3, str.end());
|
||||
}
|
||||
}
|
||||
@@ -708,56 +578,50 @@ auto open(const path_t& filepath, bool check_bom)
|
||||
|
||||
namespace literals
|
||||
{
|
||||
inline value operator""_json(const char* str, size_t len)
|
||||
{
|
||||
return operator""_jvalue(str, len);
|
||||
}
|
||||
inline value operator""_json(const char* str, size_t len)
|
||||
{
|
||||
return operator""_jvalue(str, len);
|
||||
}
|
||||
inline wvalue operator""_json(const wchar_t* str, size_t len)
|
||||
{
|
||||
return operator""_jvalue(str, len);
|
||||
}
|
||||
|
||||
inline wvalue operator""_json(const wchar_t* str, size_t len)
|
||||
{
|
||||
return operator""_jvalue(str, len);
|
||||
}
|
||||
inline value operator""_jvalue(const char* str, size_t len)
|
||||
{
|
||||
return parse(std::string_view(str, len)).value_or(value());
|
||||
}
|
||||
inline wvalue operator""_jvalue(const wchar_t* str, size_t len)
|
||||
{
|
||||
return parse(std::wstring_view(str, len)).value_or(wvalue());
|
||||
}
|
||||
|
||||
inline value operator""_jvalue(const char* str, size_t len)
|
||||
{
|
||||
return parse(std::string_view(str, len)).value_or(value());
|
||||
}
|
||||
inline array operator""_jarray(const char* str, size_t len)
|
||||
{
|
||||
auto val = parse(std::string_view(str, len)).value_or(value());
|
||||
return val.is_array() ? val.as_array() : array();
|
||||
}
|
||||
inline warray operator""_jarray(const wchar_t* str, size_t len)
|
||||
{
|
||||
auto val = parse(std::wstring_view(str, len)).value_or(wvalue());
|
||||
return val.is_array() ? val.as_array() : warray();
|
||||
}
|
||||
|
||||
inline wvalue operator""_jvalue(const wchar_t* str, size_t len)
|
||||
{
|
||||
return parse(std::wstring_view(str, len)).value_or(wvalue());
|
||||
}
|
||||
|
||||
inline array operator""_jarray(const char* str, size_t len)
|
||||
{
|
||||
auto val = parse(std::string_view(str, len)).value_or(value());
|
||||
return val.is_array() ? val.as_array() : array();
|
||||
}
|
||||
|
||||
inline warray operator""_jarray(const wchar_t* str, size_t len)
|
||||
{
|
||||
auto val = parse(std::wstring_view(str, len)).value_or(wvalue());
|
||||
return val.is_array() ? val.as_array() : warray();
|
||||
}
|
||||
|
||||
inline object operator""_jobject(const char* str, size_t len)
|
||||
{
|
||||
auto val = parse(std::string_view(str, len)).value_or(value());
|
||||
return val.is_object() ? val.as_object() : object();
|
||||
}
|
||||
|
||||
inline wobject operator""_jobject(const wchar_t* str, size_t len)
|
||||
{
|
||||
auto val = parse(std::wstring_view(str, len)).value_or(wvalue());
|
||||
return val.is_object() ? val.as_object() : wobject();
|
||||
}
|
||||
inline object operator""_jobject(const char* str, size_t len)
|
||||
{
|
||||
auto val = parse(std::string_view(str, len)).value_or(value());
|
||||
return val.is_object() ? val.as_object() : object();
|
||||
}
|
||||
inline wobject operator""_jobject(const wchar_t* str, size_t len)
|
||||
{
|
||||
auto val = parse(std::wstring_view(str, len)).value_or(wvalue());
|
||||
return val.is_object() ? val.as_object() : wobject();
|
||||
}
|
||||
} // namespace literals
|
||||
|
||||
template <typename string_t>
|
||||
const basic_value<string_t> invalid_value()
|
||||
{
|
||||
return basic_value<string_t>(
|
||||
basic_value<string_t>::value_type::invalid,
|
||||
typename basic_value<string_t>::var_t());
|
||||
return basic_value<string_t>(basic_value<string_t>::value_type::invalid, typename basic_value<string_t>::var_t());
|
||||
}
|
||||
} // namespace json
|
||||
|
||||
103
3rdparty/include/meojson/parser5/parser5.hpp
vendored
@@ -1,11 +1,10 @@
|
||||
// IWYU pragma: private, include <meojson/json5.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <cmath>
|
||||
#include <iomanip>
|
||||
#include <regex>
|
||||
#include <sstream>
|
||||
#include <stack>
|
||||
#include <vector>
|
||||
@@ -32,7 +31,6 @@ public:
|
||||
{
|
||||
public:
|
||||
exception() = default;
|
||||
|
||||
exception(const std::string& type, const std::string& msg, const std::string& detail)
|
||||
{
|
||||
std::stringstream ss;
|
||||
@@ -40,7 +38,6 @@ public:
|
||||
ss << detail << std::endl;
|
||||
_what = ss.str();
|
||||
}
|
||||
|
||||
exception(const exception&) = default;
|
||||
exception& operator=(const exception&) = default;
|
||||
exception(exception&&) = default;
|
||||
@@ -53,12 +50,8 @@ public:
|
||||
{
|
||||
public:
|
||||
InvalidChar(u8char ch = 0, const std::string& detail = "")
|
||||
: exception(
|
||||
"Invalid Char",
|
||||
"Unexpected token \'" + StringFromCharCode(ch) + "\'",
|
||||
detail)
|
||||
{
|
||||
}
|
||||
: exception("Invalid Char", "Unexpected token \'" + StringFromCharCode(ch) + "\'", detail)
|
||||
{}
|
||||
};
|
||||
|
||||
class InvalidIdentifier : public exception
|
||||
@@ -66,17 +59,14 @@ public:
|
||||
public:
|
||||
InvalidIdentifier(const std::string& msg = "", const std::string& detail = "")
|
||||
: exception("Invalid Identifier", msg, detail)
|
||||
{
|
||||
}
|
||||
{}
|
||||
};
|
||||
|
||||
class InvalidEOF : public exception
|
||||
{
|
||||
public:
|
||||
InvalidEOF(const std::string& msg = "", const std::string& detail = "")
|
||||
: exception("Invalid EOF", msg, detail)
|
||||
{
|
||||
}
|
||||
InvalidEOF(const std::string& msg = "", const std::string& detail = "") : exception("Invalid EOF", msg, detail)
|
||||
{}
|
||||
};
|
||||
|
||||
public:
|
||||
@@ -185,13 +175,7 @@ public:
|
||||
static std::optional<value> parse(const string_t& content, std::string* error = nullptr);
|
||||
|
||||
private:
|
||||
parser5(string_iter_t cbegin, string_iter_t cend) noexcept
|
||||
: _cur(cbegin)
|
||||
, _end(cend)
|
||||
, _line_begin_cur(cbegin)
|
||||
{
|
||||
}
|
||||
|
||||
parser5(string_iter_t cbegin, string_iter_t cend) noexcept : _cur(cbegin), _end(cend), _line_begin_cur(cbegin) {}
|
||||
std::optional<value> parse();
|
||||
|
||||
private:
|
||||
@@ -288,68 +272,62 @@ inline bool parser5<string_t>::unicode::isSpaceSeparator(u8char ch)
|
||||
template <typename string_t>
|
||||
inline bool parser5<string_t>::unicode::isIdStartChar(u8char ch)
|
||||
{
|
||||
return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch == '$') || (ch == '_')
|
||||
|| findInRange(json::unicode::id_start, toUnicode(ch));
|
||||
return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch == '$') || (ch == '_') ||
|
||||
findInRange(json::unicode::id_start, toUnicode(ch));
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline bool parser5<string_t>::unicode::isIdContinueChar(u8char ch)
|
||||
{
|
||||
return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9')
|
||||
|| (ch == '$') || (ch == '_') || findInRange(json::unicode::id_continue, toUnicode(ch));
|
||||
return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || (ch == '$') ||
|
||||
(ch == '_') || findInRange(json::unicode::id_continue, toUnicode(ch));
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline bool parser5<string_t>::unicode::isDigit(u8char ch)
|
||||
{
|
||||
return (ch >= '0' && ch <= '9');
|
||||
auto str = StringFromCharCode(ch);
|
||||
return std::regex_search(str, std::regex(R"([0-9])"));
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline bool parser5<string_t>::unicode::isHexDigit(u8char ch)
|
||||
{
|
||||
return (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F') || (ch >= '0' && ch <= '9');
|
||||
auto str = StringFromCharCode(ch);
|
||||
return std::regex_search(str, std::regex(R"([0-9A-Fa-f])"));
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline uint64_t parser5<string_t>::unicode::toUnicode(u8char ch)
|
||||
{
|
||||
std::stack<uint8_t> coded;
|
||||
if (ch == 0) {
|
||||
return ch;
|
||||
}
|
||||
|
||||
std::stack<uint8_t> coded;
|
||||
while (ch > 0) {
|
||||
coded.push(ch & 0xff);
|
||||
ch >>= 8;
|
||||
ch = ch >> 8;
|
||||
}
|
||||
|
||||
u8char charcode = 0;
|
||||
uint8_t t = coded.top();
|
||||
coded.pop();
|
||||
if (t < 128) {
|
||||
return t;
|
||||
}
|
||||
|
||||
uint8_t high_bit_mask = 0b00111111;
|
||||
uint8_t high_bit_mask = (1 << 6) - 1;
|
||||
uint8_t high_bit_shift = 0;
|
||||
int total_bits = 0;
|
||||
const int other_bits = 6;
|
||||
|
||||
while ((t & 0xC0) == 0xC0) {
|
||||
t <<= 1;
|
||||
t &= 0xff;
|
||||
total_bits += other_bits;
|
||||
total_bits += 6;
|
||||
high_bit_mask >>= 1;
|
||||
high_bit_shift++;
|
||||
|
||||
if (!coded.empty()) {
|
||||
charcode <<= other_bits;
|
||||
charcode |= coded.top() & ((1 << other_bits) - 1);
|
||||
coded.pop();
|
||||
}
|
||||
charcode <<= other_bits;
|
||||
charcode |= coded.top() & ((1 << other_bits) - 1);
|
||||
coded.pop();
|
||||
}
|
||||
|
||||
charcode |= static_cast<uint64_t>((t >> high_bit_shift) & high_bit_mask) << total_bits;
|
||||
return charcode;
|
||||
}
|
||||
@@ -368,8 +346,7 @@ inline bool parser5<string_t>::unicode::findInRange(const array_t& range, u8char
|
||||
return false;
|
||||
}
|
||||
// set 中保存的是类似于 { start1, end1, start2, end2, ... } 的形式, 区间可表示为[start, end)
|
||||
// 判断lb是否位于start的位置, 如果是, 则表示codePoint在某个区间的内部, 如果不是,
|
||||
// 则表示codePoint在两个区间中间
|
||||
// 判断lb是否位于start的位置, 如果是, 则表示codePoint在某个区间的内部, 如果不是, 则表示codePoint在两个区间中间
|
||||
return std::distance(begin, lb) % 2 == 0;
|
||||
}
|
||||
|
||||
@@ -542,13 +519,11 @@ inline typename parser5<string_t>::u8char parser5<string_t>::unicodeEscape()
|
||||
|
||||
/* utf-8 reader */
|
||||
template <typename string_t>
|
||||
inline typename parser5<string_t>::u8char
|
||||
parser5<string_t>::peek(const string_iter_t& begin, const string_iter_t& end, size_t* plen)
|
||||
inline typename parser5<string_t>::u8char parser5<string_t>::peek(const string_iter_t& begin, const string_iter_t& end,
|
||||
size_t* plen)
|
||||
{
|
||||
if (begin == end) {
|
||||
if (plen) {
|
||||
*plen = 0;
|
||||
}
|
||||
if (plen) *plen = 0;
|
||||
return 0;
|
||||
}
|
||||
uint8_t head = *begin;
|
||||
@@ -574,12 +549,10 @@ inline typename parser5<string_t>::u8char parser5<string_t>::peek(const std::str
|
||||
{
|
||||
return peek(str.cbegin(), str.cend());
|
||||
}
|
||||
|
||||
inline constexpr size_t operator"" _sz(unsigned long long size)
|
||||
{
|
||||
return size;
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline typename parser5<string_t>::u8char parser5<string_t>::read()
|
||||
{
|
||||
@@ -608,15 +581,11 @@ inline typename parser5<string_t>::u8char parser5<string_t>::read()
|
||||
template <typename string_t>
|
||||
inline std::string parser5<string_t>::StringFromCharCode(typename parser5<string_t>::u8char code)
|
||||
{
|
||||
if (code == 0) {
|
||||
return "";
|
||||
}
|
||||
if (code == 0) return "";
|
||||
std::string str;
|
||||
for (auto i = 0; i < 8; ++i) {
|
||||
auto ch = (0xff & code);
|
||||
if (ch) {
|
||||
str.insert(0, 1, static_cast<char>(ch));
|
||||
}
|
||||
if (ch) str.insert(0, 1, static_cast<char>(ch));
|
||||
code >>= 8;
|
||||
}
|
||||
return str;
|
||||
@@ -731,8 +700,7 @@ inline std::optional<typename parser5<string_t>::Token> parser5<string_t>::lex_m
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline std::optional<typename parser5<string_t>::Token>
|
||||
parser5<string_t>::lex_multiLineCommentAsterisk()
|
||||
inline std::optional<typename parser5<string_t>::Token> parser5<string_t>::lex_multiLineCommentAsterisk()
|
||||
{
|
||||
switch (_current_char) {
|
||||
case '*':
|
||||
@@ -840,8 +808,7 @@ inline std::optional<typename parser5<string_t>::Token> parser5<string_t>::lex_v
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline std::optional<typename parser5<string_t>::Token>
|
||||
parser5<string_t>::lex_identifierNameStartEscape()
|
||||
inline std::optional<typename parser5<string_t>::Token> parser5<string_t>::lex_identifierNameStartEscape()
|
||||
{
|
||||
if (_current_char != 'u') {
|
||||
throw InvalidChar(_current_char, exceptionDetailInfo());
|
||||
@@ -888,8 +855,7 @@ inline std::optional<typename parser5<string_t>::Token> parser5<string_t>::lex_i
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline std::optional<typename parser5<string_t>::Token>
|
||||
parser5<string_t>::lex_identifierNameEscape()
|
||||
inline std::optional<typename parser5<string_t>::Token> parser5<string_t>::lex_identifierNameEscape()
|
||||
{
|
||||
if (_current_char != 'u') {
|
||||
throw InvalidChar(_current_char, exceptionDetailInfo());
|
||||
@@ -1081,8 +1047,7 @@ inline std::optional<typename parser5<string_t>::Token> parser5<string_t>::lex_d
|
||||
}
|
||||
|
||||
template <typename string_t>
|
||||
inline std::optional<typename parser5<string_t>::Token>
|
||||
parser5<string_t>::lex_decimalExponentInteger()
|
||||
inline std::optional<typename parser5<string_t>::Token> parser5<string_t>::lex_decimalExponentInteger()
|
||||
{
|
||||
if (unicode::isDigit(_current_char)) {
|
||||
_buffer += StringFromCharCode(read());
|
||||
@@ -1421,8 +1386,7 @@ inline void parser5<string_t>::parse_afterArrayValue()
|
||||
|
||||
template <typename string_t>
|
||||
inline void parser5<string_t>::parse_end()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
template <typename string_t>
|
||||
inline void parser5<string_t>::parseStates(ParseState state)
|
||||
@@ -1453,7 +1417,6 @@ inline void parser5<string_t>::parseStates(ParseState state)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* stack operation */
|
||||
template <typename string_t>
|
||||
inline void parser5<string_t>::push()
|
||||
|
||||
2
3rdparty/include/meojson/parser5/unicode.h
vendored
@@ -1,5 +1,3 @@
|
||||
// IWYU pragma: private, include <meojson/json5.hpp>
|
||||
|
||||
// This is a generated file. Do not edit.
|
||||
#pragma once
|
||||
#include <array>
|
||||
|
||||
456
3rdparty/include/meojson/reflection/jsonization.hpp
vendored
@@ -1,5 +1,3 @@
|
||||
// IWYU pragma: private, include <meojson/json.hpp>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
@@ -10,12 +8,9 @@
|
||||
namespace json::_jsonization_helper
|
||||
{
|
||||
struct next_is_optional_t
|
||||
{
|
||||
};
|
||||
|
||||
{};
|
||||
struct va_arg_end
|
||||
{
|
||||
};
|
||||
{};
|
||||
|
||||
struct dumper
|
||||
{
|
||||
@@ -26,25 +21,19 @@ struct dumper
|
||||
result.emplace(key, var);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename... rest_t>
|
||||
json::value _to_json(const char*, next_is_optional_t, rest_t&&... rest) const
|
||||
{
|
||||
return _to_json(std::forward<rest_t>(rest)...);
|
||||
}
|
||||
|
||||
json::value _to_json(va_arg_end) const { return {}; }
|
||||
};
|
||||
|
||||
struct checker
|
||||
{
|
||||
template <typename var_t, typename... rest_t>
|
||||
bool _check_json(
|
||||
const json::value& in,
|
||||
std::string& error_key,
|
||||
const char* key,
|
||||
const var_t&,
|
||||
rest_t&&... rest) const
|
||||
bool _check_json(const json::value& in, std::string& error_key, const char* key, const var_t&,
|
||||
rest_t&&... rest) const
|
||||
{
|
||||
auto opt = in.find(key);
|
||||
if (!opt || !opt->is<var_t>()) {
|
||||
@@ -53,16 +42,9 @@ struct checker
|
||||
}
|
||||
return _check_json(in, error_key, std::forward<rest_t>(rest)...);
|
||||
}
|
||||
|
||||
template <typename var_t, typename... rest_t>
|
||||
bool _check_json(
|
||||
const json::value& in,
|
||||
std::string& error_key,
|
||||
const char*,
|
||||
next_is_optional_t,
|
||||
const char* key,
|
||||
const var_t&,
|
||||
rest_t&&... rest) const
|
||||
bool _check_json(const json::value& in, std::string& error_key, const char*, next_is_optional_t, const char* key,
|
||||
const var_t&, rest_t&&... rest) const
|
||||
{
|
||||
auto opt = in.find(key);
|
||||
if (opt) {
|
||||
@@ -74,19 +56,13 @@ struct checker
|
||||
|
||||
return _check_json(in, error_key, std::forward<rest_t>(rest)...);
|
||||
}
|
||||
|
||||
bool _check_json(const json::value&, std::string&, va_arg_end) const { return true; }
|
||||
};
|
||||
|
||||
struct loader
|
||||
{
|
||||
template <typename var_t, typename... rest_t>
|
||||
bool _from_json(
|
||||
const json::value& in,
|
||||
std::string& error_key,
|
||||
const char* key,
|
||||
var_t& var,
|
||||
rest_t&&... rest) const
|
||||
bool _from_json(const json::value& in, std::string& error_key, const char* key, var_t& var, rest_t&&... rest) const
|
||||
{
|
||||
auto opt = in.find(key);
|
||||
if (!opt || !opt->is<var_t>()) {
|
||||
@@ -97,16 +73,9 @@ struct loader
|
||||
|
||||
return _from_json(in, error_key, std::forward<rest_t>(rest)...);
|
||||
}
|
||||
|
||||
template <typename var_t, typename... rest_t>
|
||||
bool _from_json(
|
||||
const json::value& in,
|
||||
std::string& error_key,
|
||||
const char*,
|
||||
next_is_optional_t,
|
||||
const char* key,
|
||||
var_t& var,
|
||||
rest_t&&... rest) const
|
||||
bool _from_json(const json::value& in, std::string& error_key, const char*, next_is_optional_t, const char* key,
|
||||
var_t& var, rest_t&&... rest) const
|
||||
{
|
||||
auto opt = in.find(key);
|
||||
if (opt) {
|
||||
@@ -119,7 +88,6 @@ struct loader
|
||||
|
||||
return _from_json(in, error_key, std::forward<rest_t>(rest)...);
|
||||
}
|
||||
|
||||
bool _from_json(const json::value&, std::string&, va_arg_end) const { return true; }
|
||||
};
|
||||
} // namespace json::_jsonization_helper
|
||||
@@ -143,322 +111,122 @@ namespace json::_private_macro
|
||||
|
||||
#define _MEOJSON_FOR_EACH_0(pred, ...)
|
||||
#define _MEOJSON_FOR_EACH_1(pred, x, ...) pred(x)
|
||||
#define _MEOJSON_FOR_EACH_2(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_1(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_3(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_2(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_4(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_3(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_5(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_4(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_6(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_5(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_7(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_6(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_8(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_7(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_9(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_8(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_10(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_9(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_11(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_10(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_12(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_11(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_13(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_12(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_14(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_13(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_15(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_14(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_16(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_15(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_17(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_16(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_18(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_17(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_19(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_18(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_20(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_19(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_21(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_20(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_22(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_21(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_23(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_22(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_24(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_23(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_25(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_24(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_26(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_25(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_27(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_26(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_28(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_27(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_29(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_28(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_30(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_29(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_31(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_30(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_32(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_31(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_33(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_32(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_34(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_33(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_35(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_34(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_36(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_35(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_37(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_36(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_38(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_37(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_39(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_38(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_40(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_39(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_41(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_40(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_42(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_41(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_43(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_42(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_44(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_43(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_45(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_44(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_46(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_45(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_47(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_46(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_48(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_47(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_49(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_48(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_50(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_49(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_51(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_50(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_52(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_51(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_53(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_52(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_54(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_53(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_55(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_54(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_56(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_55(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_57(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_56(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_58(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_57(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_59(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_58(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_60(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_59(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_61(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_60(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_62(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_61(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_63(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_62(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_64(pred, x, ...) \
|
||||
pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_63(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_2(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_1(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_3(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_2(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_4(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_3(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_5(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_4(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_6(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_5(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_7(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_6(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_8(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_7(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_9(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_8(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_10(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_9(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_11(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_10(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_12(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_11(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_13(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_12(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_14(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_13(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_15(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_14(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_16(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_15(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_17(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_16(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_18(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_17(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_19(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_18(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_20(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_19(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_21(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_20(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_22(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_21(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_23(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_22(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_24(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_23(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_25(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_24(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_26(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_25(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_27(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_26(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_28(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_27(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_29(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_28(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_30(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_29(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_31(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_30(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_32(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_31(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_33(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_32(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_34(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_33(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_35(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_34(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_36(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_35(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_37(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_36(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_38(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_37(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_39(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_38(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_40(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_39(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_41(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_40(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_42(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_41(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_43(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_42(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_44(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_43(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_45(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_44(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_46(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_45(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_47(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_46(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_48(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_47(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_49(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_48(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_50(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_49(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_51(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_50(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_52(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_51(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_53(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_52(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_54(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_53(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_55(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_54(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_56(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_55(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_57(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_56(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_58(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_57(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_59(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_58(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_60(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_59(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_61(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_60(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_62(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_61(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_63(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_62(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_64(pred, x, ...) pred(x) _MEOJSON_EXPAND(_MEOJSON_FOR_EACH_63(pred, __VA_ARGS__))
|
||||
|
||||
#define _MEOJSON_ARG_COUNT(...) \
|
||||
_MEOJSON_EXPAND(_MEOJSON_ARG_COUNT1( \
|
||||
0, \
|
||||
##__VA_ARGS__, \
|
||||
64, \
|
||||
63, \
|
||||
62, \
|
||||
61, \
|
||||
60, \
|
||||
59, \
|
||||
58, \
|
||||
57, \
|
||||
56, \
|
||||
55, \
|
||||
54, \
|
||||
53, \
|
||||
52, \
|
||||
51, \
|
||||
50, \
|
||||
49, \
|
||||
48, \
|
||||
47, \
|
||||
46, \
|
||||
45, \
|
||||
44, \
|
||||
43, \
|
||||
42, \
|
||||
41, \
|
||||
40, \
|
||||
39, \
|
||||
38, \
|
||||
37, \
|
||||
36, \
|
||||
35, \
|
||||
34, \
|
||||
33, \
|
||||
32, \
|
||||
31, \
|
||||
30, \
|
||||
29, \
|
||||
28, \
|
||||
27, \
|
||||
26, \
|
||||
25, \
|
||||
24, \
|
||||
23, \
|
||||
22, \
|
||||
21, \
|
||||
20, \
|
||||
19, \
|
||||
18, \
|
||||
17, \
|
||||
16, \
|
||||
15, \
|
||||
14, \
|
||||
13, \
|
||||
12, \
|
||||
11, \
|
||||
10, \
|
||||
9, \
|
||||
8, \
|
||||
7, \
|
||||
6, \
|
||||
5, \
|
||||
4, \
|
||||
3, \
|
||||
2, \
|
||||
1, \
|
||||
0))
|
||||
#define _MEOJSON_ARG_COUNT1( \
|
||||
_0, \
|
||||
_1, \
|
||||
_2, \
|
||||
_3, \
|
||||
_4, \
|
||||
_5, \
|
||||
_6, \
|
||||
_7, \
|
||||
_8, \
|
||||
_9, \
|
||||
_10, \
|
||||
_11, \
|
||||
_12, \
|
||||
_13, \
|
||||
_14, \
|
||||
_15, \
|
||||
_16, \
|
||||
_17, \
|
||||
_18, \
|
||||
_19, \
|
||||
_20, \
|
||||
_21, \
|
||||
_22, \
|
||||
_23, \
|
||||
_24, \
|
||||
_25, \
|
||||
_26, \
|
||||
_27, \
|
||||
_28, \
|
||||
_29, \
|
||||
_30, \
|
||||
_31, \
|
||||
_32, \
|
||||
_33, \
|
||||
_34, \
|
||||
_35, \
|
||||
_36, \
|
||||
_37, \
|
||||
_38, \
|
||||
_39, \
|
||||
_40, \
|
||||
_41, \
|
||||
_42, \
|
||||
_43, \
|
||||
_44, \
|
||||
_45, \
|
||||
_46, \
|
||||
_47, \
|
||||
_48, \
|
||||
_49, \
|
||||
_50, \
|
||||
_51, \
|
||||
_52, \
|
||||
_53, \
|
||||
_54, \
|
||||
_55, \
|
||||
_56, \
|
||||
_57, \
|
||||
_58, \
|
||||
_59, \
|
||||
_60, \
|
||||
_61, \
|
||||
_62, \
|
||||
_63, \
|
||||
_64, \
|
||||
N, \
|
||||
...) \
|
||||
#define _MEOJSON_ARG_COUNT(...) \
|
||||
_MEOJSON_EXPAND(_MEOJSON_ARG_COUNT1(0, ##__VA_ARGS__, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, \
|
||||
49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, \
|
||||
30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, \
|
||||
11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0))
|
||||
#define _MEOJSON_ARG_COUNT1(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, \
|
||||
_20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, \
|
||||
_38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, \
|
||||
_56, _57, _58, _59, _60, _61, _62, _63, _64, N, ...) \
|
||||
N
|
||||
|
||||
#define _MEOJSON_FOR_EACH_(N, pred, ...) \
|
||||
_MEOJSON_EXPAND(_MEOJSON_CONCATENATE(_MEOJSON_FOR_EACH_, N)(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH_(N, pred, ...) _MEOJSON_EXPAND(_MEOJSON_CONCATENATE(_MEOJSON_FOR_EACH_, N)(pred, __VA_ARGS__))
|
||||
#define _MEOJSON_FOR_EACH(pred, ...) \
|
||||
_MEOJSON_EXPAND( \
|
||||
_MEOJSON_FOR_EACH_(_MEOJSON_EXPAND(_MEOJSON_ARG_COUNT(__VA_ARGS__)), pred, __VA_ARGS__))
|
||||
_MEOJSON_EXPAND(_MEOJSON_FOR_EACH_(_MEOJSON_EXPAND(_MEOJSON_ARG_COUNT(__VA_ARGS__)), pred, __VA_ARGS__))
|
||||
|
||||
#define _MEOJSON_VARNAME(x) _MEOJSON_CONCATENATE(_meojson_jsonization_, x)
|
||||
#define _MEOJSON_KEY_VALUE(x) _MEOJSON_STRINGIZE(x), x,
|
||||
} // namespace json::_private_macro
|
||||
|
||||
#define MEO_TOJSON(...) \
|
||||
json::value to_json() const \
|
||||
{ \
|
||||
return json::_jsonization_helper::dumper()._to_json( \
|
||||
_MEOJSON_EXPAND(_MEOJSON_FOR_EACH(_MEOJSON_KEY_VALUE, __VA_ARGS__)) \
|
||||
json::_jsonization_helper::va_arg_end {}); \
|
||||
#define MEO_TOJSON(...) \
|
||||
json::value to_json() const \
|
||||
{ \
|
||||
return json::_jsonization_helper::dumper()._to_json(_MEOJSON_EXPAND( \
|
||||
_MEOJSON_FOR_EACH(_MEOJSON_KEY_VALUE, __VA_ARGS__)) json::_jsonization_helper::va_arg_end {}); \
|
||||
}
|
||||
|
||||
#define MEO_CHECKJSON(...) \
|
||||
bool check_json(const json::value& _MEOJSON_VARNAME(in)) const \
|
||||
{ \
|
||||
std::string _MEOJSON_VARNAME(error_key); \
|
||||
return check_json(_MEOJSON_VARNAME(in), _MEOJSON_VARNAME(error_key)); \
|
||||
} \
|
||||
bool check_json( \
|
||||
const json::value& _MEOJSON_VARNAME(in), \
|
||||
std::string& _MEOJSON_VARNAME(error_key)) const \
|
||||
{ \
|
||||
return json::_jsonization_helper::checker()._check_json( \
|
||||
_MEOJSON_VARNAME(in), \
|
||||
_MEOJSON_VARNAME(error_key), \
|
||||
_MEOJSON_EXPAND(_MEOJSON_FOR_EACH(_MEOJSON_KEY_VALUE, __VA_ARGS__)) \
|
||||
json::_jsonization_helper::va_arg_end {}); \
|
||||
#define MEO_CHECKJSON(...) \
|
||||
bool check_json(const json::value& _MEOJSON_VARNAME(in)) const \
|
||||
{ \
|
||||
std::string _MEOJSON_VARNAME(error_key); \
|
||||
return check_json(_MEOJSON_VARNAME(in), _MEOJSON_VARNAME(error_key)); \
|
||||
} \
|
||||
bool check_json(const json::value& _MEOJSON_VARNAME(in), std::string& _MEOJSON_VARNAME(error_key)) const \
|
||||
{ \
|
||||
return json::_jsonization_helper::checker()._check_json( \
|
||||
_MEOJSON_VARNAME(in), _MEOJSON_VARNAME(error_key), \
|
||||
_MEOJSON_EXPAND(_MEOJSON_FOR_EACH(_MEOJSON_KEY_VALUE, __VA_ARGS__)) \
|
||||
json::_jsonization_helper::va_arg_end {}); \
|
||||
}
|
||||
|
||||
#define MEO_FROMJSON(...) \
|
||||
bool from_json(const json::value& _MEOJSON_VARNAME(in)) \
|
||||
{ \
|
||||
std::string _MEOJSON_VARNAME(error_key); \
|
||||
return from_json(_MEOJSON_VARNAME(in), _MEOJSON_VARNAME(error_key)); \
|
||||
} \
|
||||
bool from_json( \
|
||||
const json::value& _MEOJSON_VARNAME(in), \
|
||||
std::string& _MEOJSON_VARNAME(error_key)) \
|
||||
{ \
|
||||
return json::_jsonization_helper::loader()._from_json( \
|
||||
_MEOJSON_VARNAME(in), \
|
||||
_MEOJSON_VARNAME(error_key), \
|
||||
_MEOJSON_EXPAND(_MEOJSON_FOR_EACH(_MEOJSON_KEY_VALUE, __VA_ARGS__)) \
|
||||
json::_jsonization_helper::va_arg_end {}); \
|
||||
#define MEO_FROMJSON(...) \
|
||||
bool from_json(const json::value& _MEOJSON_VARNAME(in)) \
|
||||
{ \
|
||||
std::string _MEOJSON_VARNAME(error_key); \
|
||||
return from_json(_MEOJSON_VARNAME(in), _MEOJSON_VARNAME(error_key)); \
|
||||
} \
|
||||
bool from_json(const json::value& _MEOJSON_VARNAME(in), std::string& _MEOJSON_VARNAME(error_key)) \
|
||||
{ \
|
||||
return json::_jsonization_helper::loader()._from_json( \
|
||||
_MEOJSON_VARNAME(in), _MEOJSON_VARNAME(error_key), \
|
||||
_MEOJSON_EXPAND(_MEOJSON_FOR_EACH(_MEOJSON_KEY_VALUE, __VA_ARGS__)) \
|
||||
json::_jsonization_helper::va_arg_end {}); \
|
||||
}
|
||||
|
||||
#define MEO_JSONIZATION(...) \
|
||||
|
||||
34
CHANGELOG.md
@@ -1,25 +1,15 @@
|
||||
## v5.17.1
|
||||
|
||||
### 主要更新 | Highlight
|
||||
|
||||
* 修复 wpfgui 更新后不重启 (但得下个版本才能生效x)
|
||||
* 海外版新基建 UI 适配 | Global infrastructure adaptation
|
||||
|
||||
### 新增 | New
|
||||
|
||||
* Global infrastructure adaptation @Manicsteiner @HX3N @Constrat
|
||||
* 远程控制协议增加“轮询间隔”参数 @ABA2396
|
||||
* Global SSS#7 + EN buffchoose @Constrat @HX3N
|
||||
* EN base no beta (#12901) @Constrat
|
||||
|
||||
### 改进 | Improved
|
||||
|
||||
* 自动战斗编队固定优先编入所有干员, 且按照作业顺序 @status102
|
||||
|
||||
### 修复 | Fix
|
||||
|
||||
* 更新后不重启(但得下个版本才能生效x) @ABA2396 @status102
|
||||
## v5.4.1
|
||||
|
||||
### 文档 | Docs
|
||||
|
||||
* update connection doc to reflect latest change. (#12689) @ksharperd
|
||||
* website docs (#9287) @ABA2396 @Rbqwow @Constrat @wangl-cc @HX3N @SherkeyXD
|
||||
* 修改win7相关问题描述&更新运行库 @Rbqwow
|
||||
* fix a bad link @Rbqwow
|
||||
* make i18n warnings show only once @Rbqwow
|
||||
* 修复字体和评论区分类 @Rbqwow
|
||||
|
||||
### For Overseas
|
||||
|
||||
#### YostarEN
|
||||
|
||||
* YoStarEN resolution warning on client switch (#9539) @Constrat @ABA2396
|
||||
|
||||
@@ -44,13 +44,10 @@ if (MSVC)
|
||||
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
|
||||
else ()
|
||||
target_compile_options(MaaCore PRIVATE "-Wall;-Wextra;-Wpedantic")
|
||||
# LLVM clang 16 will failed with `error: no member named 'join' in namespace 'std::ranges::views'`, but Apple clang 16 won't
|
||||
# value defined in https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html
|
||||
if ((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
|
||||
OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND (NOT CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17))
|
||||
target_compile_options(MaaCore PRIVATE "-fexperimental-library")
|
||||
endif ()
|
||||
target_compile_options(MaaCore PRIVATE "-Wall;-Werror;-Wextra;-Wpedantic;-Wno-missing-field-initializers")
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13)
|
||||
target_compile_options(MaaCore PRIVATE "-Wno-restrict")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if (WIN32)
|
||||
@@ -81,8 +78,7 @@ if (BUILD_TEST)
|
||||
target_link_libraries(test MaaCore)
|
||||
endif (BUILD_TEST)
|
||||
|
||||
find_package(OpenCV REQUIRED COMPONENTS core imgproc imgcodecs videoio features2d)
|
||||
find_package(OpenCV QUIET COMPONENTS xfeatures2d)
|
||||
find_package(OpenCV REQUIRED COMPONENTS core imgproc imgcodecs videoio)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(cpr CONFIG REQUIRED)
|
||||
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
@echo off
|
||||
chcp 65001
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
:: 定义ANSI颜色代码
|
||||
for /f %%a in ('echo prompt $E^| cmd') do set "ESC=%%a"
|
||||
set "RESET=%ESC%[0m"
|
||||
set "GREEN=%ESC%[32m"
|
||||
set "RED=%ESC%[31m"
|
||||
set "YELLOW=%ESC%[33m"
|
||||
set "BLUE=%ESC%[34m"
|
||||
set "CYAN=%ESC%[36m"
|
||||
set "WHITE=%ESC%[37m"
|
||||
set "BOLD=%ESC%[1m"
|
||||
|
||||
:: 初始化错误标志
|
||||
set "ErrorOccurred=0"
|
||||
|
||||
openfiles >nul 2>&1
|
||||
if %errorlevel% neq 0 (
|
||||
echo %YELLOW%正在获取管理员权限...%RESET%
|
||||
echo %YELLOW%Obtaining administrator privileges...%RESET%
|
||||
powershell -Command "Start-Process cmd.exe -ArgumentList '/c %~f0' -Verb RunAs"
|
||||
exit /b
|
||||
)
|
||||
|
||||
echo.
|
||||
echo %BLUE%========================================%RESET%
|
||||
echo %BOLD%%CYAN%正在安装 Microsoft Visual C++ Redistributable%RESET%
|
||||
echo %BOLD%%CYAN%Installing Microsoft Visual C++ Redistributable%RESET%
|
||||
echo %BLUE%========================================%RESET%
|
||||
echo.
|
||||
|
||||
winget install "Microsoft.VCRedist.2015+.x64" --override "/repair /passive /norestart" --uninstall-previous --accept-package-agreements --force
|
||||
if %errorlevel% neq 0 (
|
||||
echo.
|
||||
echo %BOLD%%RED%错误: Microsoft.VCRedist.2015+.x64 安装失败%RESET%
|
||||
echo %BOLD%%RED%Error: Microsoft.VCRedist.2015+.x64 installation failed%RESET%
|
||||
set "ErrorOccurred=1"
|
||||
)
|
||||
|
||||
echo.
|
||||
echo %BLUE%========================================%RESET%
|
||||
echo %BOLD%%CYAN%正在安装 .NET Desktop Runtime 8.0%RESET%
|
||||
echo %BOLD%%CYAN%Installing .NET Desktop Runtime 8.0%RESET%
|
||||
echo %BLUE%========================================%RESET%
|
||||
echo.
|
||||
|
||||
winget install "Microsoft.DotNet.DesktopRuntime.8" --override "/repair /passive /norestart" --uninstall-previous --accept-package-agreements --force
|
||||
if %errorlevel% neq 0 (
|
||||
echo.
|
||||
echo %BOLD%%RED%错误: Microsoft.DotNet.DesktopRuntime.8 安装失败%RESET%
|
||||
echo %BOLD%%RED%Error: Microsoft.DotNet.DesktopRuntime.8 installation failed%RESET%
|
||||
set "ErrorOccurred=1"
|
||||
)
|
||||
|
||||
echo.
|
||||
if %ErrorOccurred% equ 0 (
|
||||
echo %BOLD%%GREEN%运行库修复完成,请重启电脑后再次尝试运行 MAA。%RESET%
|
||||
echo %BOLD%%GREEN%The runtime library repair is complete. Please restart your computer and try running MAA again.%RESET%
|
||||
) else (
|
||||
echo %RED%========================================%RESET%
|
||||
echo %BOLD%%RED%运行库修复过程中出现错误%RESET%
|
||||
echo %BOLD%%RED%Errors occurred during runtime library repair%RESET%
|
||||
echo.
|
||||
echo %YELLOW%您可以尝试手动下载并安装以下组件:%RESET%
|
||||
echo %YELLOW%You can try to manually download and install the following components:%RESET%
|
||||
echo.
|
||||
echo %WHITE%Microsoft Visual C++ Redistributable:%RESET%
|
||||
echo %CYAN%https://aka.ms/vs/17/release/vc_redist.x64.exe%RESET%
|
||||
echo.
|
||||
echo %WHITE%.NET Desktop Runtime 8.0:%RESET%
|
||||
echo %CYAN%https://aka.ms/dotnet/8.0/windowsdesktop-runtime-win-x64.exe%RESET%
|
||||
echo %RED%========================================%RESET%
|
||||
)
|
||||
|
||||
pause
|
||||
@@ -1,7 +1,4 @@
|
||||
<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:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=EN/@EntryIndexedValue">EN</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=KR/@EntryIndexedValue">KR</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=JP/@EntryIndexedValue">JP</s:String>
|
||||
<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:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GUI/@EntryIndexedValue">GUI</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SWMINIMIZE/@EntryIndexedValue">SWMINIMIZE</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=AP/@EntryIndexedValue">AP</s:String>
|
||||
@@ -30,18 +27,8 @@
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=SSS/@EntryIndexedValue">SSS</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=WSA/@EntryIndexedValue">WSA</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=XYAZ/@EntryIndexedValue">XYAZ</s:String>
|
||||
<s:Boolean x:Key="/Default/GrammarAndSpelling/GrammarChecking/Exceptions/=Github/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/GrammarAndSpelling/GrammarChecking/Exceptions/=_4E00_9375_8F2A/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/GrammarAndSpelling/GrammarChecking/Exceptions/=_591C_95F4_6A21_5F0F/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=acast/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=acfend/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=acguad/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=acpion/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=acspec/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=acsupo/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=advapi/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Aero/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Affero/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=aguard/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=amedic/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=amiya/@EntryIndexedValue">True</s:Boolean>
|
||||
@@ -54,25 +41,12 @@
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bilibili/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bluestacks/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=bsconsole/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=ccast/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=cdfend/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=cguard/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Chayn/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Chyan/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=cmedic/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Collapsal/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=cpione/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=csnipe/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=cspec/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=csuppo/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=ctrler/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=desp/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=dnplayer/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Ehem/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=esource/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Eyjafjalla/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Favourite/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=filetime/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=findstr/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=FLASHW/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=FLASHWINFO/@EntryIndexedValue">True</s:Boolean>
|
||||
@@ -87,22 +61,14 @@
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=hwnd/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Infrast/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Inited/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=iter/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=jsend/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=ldconsole/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=ldplayer/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=LD_0027s/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=leidian/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Lolicon/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=lpwndpl/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=ls_005B_0022sub/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=luestacks/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=maatouch/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=MAA_0027s/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=memuc/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Minitouch/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=mirrorc/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Mirrorchyan/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Mizuki/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Mumu/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Nemu/@EntryIndexedValue">True</s:Boolean>
|
||||
@@ -111,7 +77,6 @@
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=netstat/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Nonfriend/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=notstationed/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=objstr/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=oper/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=opers/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Originite/@EntryIndexedValue">True</s:Boolean>
|
||||
@@ -123,48 +88,35 @@
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Pallas/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=pidl/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Pormpt/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=powrprof/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=ppidl/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Prts/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=pwfi/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=qmsg/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Raidian/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=rcast/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=rdfend/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=removelist/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=rguard/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=rmean/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=rmedic/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Roguelike/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=rsnipe/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Sami/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Sarkaz/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Screencap/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=sctp/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=serilog/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Showminimized/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Shownormal/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Skland/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=specialaccess/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=spid/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=SSS/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=STGM/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Stormeye/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=strlen/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Stylet/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=subtask/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Suppressions/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Surtr/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=SWMINIMIZE/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=taskchain/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Todays/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=txwy/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=ucrtbase/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=vmonitor/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Webhook/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=XYAZ/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Yahei/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=yituliu/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Yostar/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=_0020_0020_0020wp_002ELength_0020/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=_0020_003D_0020stri/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
|
||||
1
MaaDeps
Submodule
77
README.md
@@ -2,7 +2,7 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
<img alt="LOGO" src="./docs/.vuepress/public/images/maa-logo_512x512.png" width="256" height="256" />
|
||||
<img alt="LOGO" src="https://cdn.jsdelivr.net/gh/MaaAssistantArknights/design@main/logo/maa-logo_512x512.png" width="256" height="256" />
|
||||
|
||||
# MaaAssistantArknights
|
||||
|
||||
@@ -33,20 +33,16 @@ MAA 的意思是 MAA Assistant Arknights
|
||||
|
||||
基于图像识别技术,一键完成全部日常任务!
|
||||
|
||||
绝赞更新中 ✿✿ヽ(°▽°)ノ✿
|
||||
绝赞更新中 ✿✿ヽ(°▽°)ノ✿
|
||||
|
||||
</div>
|
||||
|
||||
## 下载与安装
|
||||
|
||||
请阅读 [文档](https://maa.plus/docs/zh-cn/manual/newbie.html) 后前往 [官网](https://maa.plus) 或 [Releases](https://github.com/MaaAssistantArknights/MaaAssistantArknights/releases) 下载,并参考 [新手上路](https://maa.plus/docs/zh-cn/manual/newbie.html) 进行安装。
|
||||
|
||||
## 亮点功能
|
||||
|
||||
- 刷理智,掉落识别及上传 [企鹅物流](https://penguin-stats.cn/),[一图流](https://ark.yituliu.cn/)
|
||||
- 智能基建换班,自动计算干员效率,单设施内最优解;同时也支持 [自定义排班](https://maa.plus/docs/zh-cn/protocol/base-scheduling-schema.html)
|
||||
- 自动公招,可选使用加急许可,一次全部刷完!公招数据自动上传 [企鹅物流](https://penguin-stats.cn/result/stage/recruit/recruit),[一图流](https://ark.yituliu.cn/survey/maarecruitdata)
|
||||
- 支持手动识别公招界面,方便对高星公招做出选择 ~~(你的这个高资回费出的是推王呢还是推王呢)~~
|
||||
- 支持手动识别公招界面,方便对高星公招做出选择 ~~(你的这个高姿回费出的是推王呢还是推王呢)~~
|
||||
- 支持识别干员列表,统计已有和未有干员及潜能,并在公招识别显示
|
||||
- 支持识别养成材料,并导出至 [企鹅物流刷图规划](https://penguin-stats.cn/planner)、[明日方舟工具箱](https://arkntools.app/#/material)、[ARK-NIGHTS 干员培养表](https://ark-nights.com/settings)
|
||||
- 访问好友、收取信用及购物、领取日常奖励等,一键全日常自动长草
|
||||
@@ -59,31 +55,50 @@ MAA 的意思是 MAA Assistant Arknights
|
||||
<details><summary>话不多说,看图!</summary>
|
||||
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="./docs/.vuepress/public/images/zh-cn/readme/1-dark.png">
|
||||
<img alt="zh1" src="./docs/.vuepress/public/images/zh-cn/readme/1-light.png">
|
||||
<source media="(prefers-color-scheme: dark)" srcset="./docs/.vuepress/public/image/zh-cn/readme/1-dark.png">
|
||||
<img alt="zh1" src="./docs/.vuepress/public/image/zh-cn/readme/1-light.png">
|
||||
</picture>
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="./docs/.vuepress/public/images/zh-cn/readme/2-dark.png">
|
||||
<img alt="zh2" src="./docs/.vuepress/public/images/zh-cn/readme/2-light.png">
|
||||
<source media="(prefers-color-scheme: dark)" srcset="./docs/.vuepress/public/image/zh-cn/readme/2-dark.png">
|
||||
<img alt="zh2" src="./docs/.vuepress/public/image/zh-cn/readme/2-light.png">
|
||||
</picture>
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="./docs/.vuepress/public/images/zh-cn/readme/3-dark.png">
|
||||
<img alt="zh3" src="./docs/.vuepress/public/images/zh-cn/readme/3-light.png">
|
||||
<source media="(prefers-color-scheme: dark)" srcset="./docs/.vuepress/public/image/zh-cn/readme/3-dark.png">
|
||||
<img alt="zh3" src="./docs/.vuepress/public/image/zh-cn/readme/3-light.png">
|
||||
</picture>
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="./docs/.vuepress/public/images/zh-cn/readme/4-dark.png">
|
||||
<img alt="zh4" src="./docs/.vuepress/public/images/zh-cn/readme/4-light.png">
|
||||
<source media="(prefers-color-scheme: dark)" srcset="./docs/.vuepress/public/image/zh-cn/readme/4-dark.png">
|
||||
<img alt="zh4" src="./docs/.vuepress/public/image/zh-cn/readme/4-light.png">
|
||||
</picture>
|
||||
|
||||
</details>
|
||||
|
||||
<!-- markdownlint-restore -->
|
||||
|
||||
## 下载地址
|
||||
|
||||
前往[官网](https://maa.plus)自动匹配镜像源并下载稳定版,或:
|
||||
|
||||
- [稳定版/公测版](https://github.com/MaaAssistantArknights/MaaAssistantArknights/releases)
|
||||
- [内测版](https://github.com/MaaAssistantArknights/MaaRelease/releases)
|
||||
|
||||
## 使用说明
|
||||
|
||||
### 功能介绍
|
||||
### 基本说明
|
||||
|
||||
请参阅 [用户手册](https://maa.plus/docs/zh-cn/manual/)。
|
||||
请参阅 [新手上路](https://maa.plus/docs/zh-cn/manual/newbie.html) 与 [功能介绍](https://maa.plus/docs/zh-cn/manual/introduction/)。
|
||||
|
||||
### 常见问题
|
||||
|
||||
- 软件一打开就闪退;
|
||||
- 连接错误、不知道 ADB 路径怎么填写;
|
||||
- 连接成功了,但没反应;
|
||||
- 如何连接自定义端口;
|
||||
- 下载速度慢,且镜像站无法打开网页;
|
||||
- 下载到一半提示“登陆”/“鉴权”;
|
||||
- 连接正常,任务开始了,但是没反应。
|
||||
|
||||
请参阅 [常见问题](https://maa.plus/docs/zh-cn/manual/faq.html)
|
||||
|
||||
### 外服支持
|
||||
|
||||
@@ -92,7 +107,7 @@ MAA 的意思是 MAA Assistant Arknights
|
||||
|
||||
### CLI 支持
|
||||
|
||||
MAA 支持命令行界面(CLI)操作,支持 Linux,macOS 和 Windows,可用于自动化脚本或在无图形界面的服务器上使用。请参阅 [CLI 使用指南](https://maa.plus/docs/zh-cn/manual/cli/)
|
||||
MAA 支持命令行界面(CLI)操作,支持 Linux,macOS 和 Windows,可用于自动化脚本或在无图形界面的服务器上使用。请参阅 [CLI 使用指南](https://maa.plus/docs/zh-cn/manual/cli/intro.html)
|
||||
|
||||
## 加入我们
|
||||
|
||||
@@ -101,9 +116,10 @@ MAA 支持命令行界面(CLI)操作,支持 Linux,macOS 和 Windows,
|
||||
**目前项目组非常缺前端大佬,若您有相关经验,欢迎加入我们!**
|
||||
|
||||
- 全新框架:[MaaFramework](https://github.com/MaaXYZ/MaaFramework)
|
||||
- 全新 GUI:[MaaX](https://github.com/MaaAssistantArknights/MaaX)
|
||||
- [作业站](https://prts.plus) 前端:[maa-copilot-frontend](https://github.com/MaaAssistantArknights/maa-copilot-frontend)
|
||||
- [作业站](https://prts.plus) 后端:[MaaBackendCenter](https://github.com/MaaAssistantArknights/MaaBackendCenter)
|
||||
- [官网](https://maa.plus):[前端](website)
|
||||
- [官网](https://maa.plus):[前端](https://github.com/MaaAssistantArknights/maa-website)
|
||||
- 深度学习:[MaaAI](https://github.com/MaaAssistantArknights/MaaAI)
|
||||
|
||||
### 多语言 (i18n)
|
||||
@@ -182,33 +198,28 @@ MAA 以中文(简体)为第一语言,翻译词条均以中文(简体)
|
||||
- ~~干员及基建数据:[PRTS Wiki](http://prts.wiki/)~~
|
||||
- 关卡数据:[企鹅物流数据统计](https://penguin-stats.cn/)
|
||||
- 游戏数据及资源:[明日方舟客户端素材](https://github.com/yuanyan3060/ArknightsGameResource)
|
||||
- 游戏数据:[《明日方舟》Yostar游戏数据](https://github.com/ArknightsAssets/ArknightsGamedata)
|
||||
- ~~游戏数据:[《明日方舟》游戏数据](https://github.com/Kengxxiao/ArknightsGameData)~~
|
||||
|
||||
### 贡献/参与者
|
||||
|
||||
感谢所有参与到开发/测试中的朋友们,是大家的帮助让 MAA 越来越好! (\*´▽`)ノノ
|
||||
|
||||
[](https://github.com/MaaAssistantArknights/MaaAssistantArknights/graphs/contributors)
|
||||
[](https://github.com/MaaAssistantArknights/MaaAssistantArknights/graphs/contributors)
|
||||
|
||||
## 声明
|
||||
|
||||
- 本软件使用 [GNU Affero General Public License v3.0 only](https://spdx.org/licenses/AGPL-3.0-only.html) 开源,并附带额外 [用户协议](https://github.com/MaaAssistantArknights/MaaAssistantArknights/blob/dev/terms-of-service.md)。
|
||||
- 本软件 logo 并非使用 AGPL 3.0 协议开源,[耗毛](https://weibo.com/u/3251357314)、vie 两位画师及软件全体开发者保留所有权利。不得以 AGPL 3.0 协议已授权为由在未经授权的情况下使用本软件 logo,不得在未经授权的情况下将本软件 logo 用于任何商业用途。
|
||||
- 本软件开源、免费,仅供学习交流使用。若您遇到商家使用本软件进行代练并收费,可能是设备与时间等费用,产生的问题及后果与本软件无关。
|
||||
|
||||
### DirectML 支持说明
|
||||
|
||||
本软件支持 GPU 加速功能,其在 Windows 平台上依赖于 Microsoft 提供的独立组件 [DirectML](https://learn.microsoft.com/en-us/windows/ai/directml/)。DirectML 并非本项目的开源部分,也不受 AGPL 3.0 的约束。为方便用户,我们随安装包附带了一个未经修改的 DirectML.dll 文件。如果您无需 GPU 加速功能,可安全删除该 DLL 文件,软件的核心功能仍可正常运行。
|
||||
- 本软件使用 [GNU Affero General Public License v3.0 only](https://spdx.org/licenses/AGPL-3.0-only.html) 开源。
|
||||
- 本软件 logo 并非使用 AGPL 3.0 协议开源,[耗毛](https://weibo.com/u/3251357314)、vie 两位画师及软件全体开发者保留所有权利。不得以 AGPL 3.0 协议已授权为由在未经授权的情况下使用本软件 logo,不得在未经授权的情况下将本软件 logo 用于任何用途。
|
||||
- 本软件开源、免费,仅供学习交流使用。若您遇到商家使用本软件进行代练并收费,可能由于设备或时间等原因,产生的任何问题及后果与本软件无关。
|
||||
|
||||
## 广告
|
||||
|
||||
用户交流 QQ 群:[MAA 使用 & 粥游交流 QQ 群](https://api.maa.plus/MaaAssistantArknights/api/qqgroup/index.html)
|
||||
Discord 服务器: [邀请链接](https://discord.gg/23DfZ9uA4V)
|
||||
用户交流 QQ 群:[MAA 使用 & 粥游交流 QQ 群](https://ota.maa.plus/MaaAssistantArknights/api/qqgroup/index.html)
|
||||
用户交流 TG 群:[Telegram 群](https://t.me/+Mgc2Zngr-hs3ZjU1)
|
||||
自动战斗 JSON 作业分享:[prts.plus](https://prts.plus)
|
||||
Bilibili 直播间:[MrEO 直播间](https://live.bilibili.com/2808861) 直播敲代码 & [MAA-Official 直播间](https://live.bilibili.com/27548877) 游戏/杂谈
|
||||
自动战斗 JSON 作业分享:[prts.plus](https://prts.plus) 或 [抄作业.com](http://抄作业.com)
|
||||
Bilibili 直播间:[直播间](https://live.bilibili.com/2808861) 每晚直播敲代码,近期很长一段时间应该都是在写本软件~
|
||||
|
||||
技术群(舟无关、禁水):[内卷地狱!(QQ 群)](https://jq.qq.com/?_wv=1027&k=ypbzXcA2)
|
||||
开发者群:[QQ 群](https://jq.qq.com/?_wv=1027&k=JM9oCk3C)
|
||||
开发者群:[QQ 群](https://jq.qq.com/?_wv=1027&k=JM9oCk3C)
|
||||
|
||||
如果觉得软件对你有帮助,帮忙点个 Star 吧!~(网页最上方右上角的小星星),这就是对我们最大的支持了!
|
||||
|
||||
@@ -7,12 +7,12 @@ if (BUILD_XCFRAMEWORK)
|
||||
|
||||
add_custom_command(OUTPUT OpenCV.xcframework
|
||||
COMMAND rm -rf OpenCV.xcframework
|
||||
COMMAND xcodebuild -create-xcframework -library "${PROJECT_SOURCE_DIR}/MaaDeps/runtime/${MAADEPS_TRIPLET}/libopencv_world4.408.dylib" -output OpenCV.xcframework
|
||||
COMMAND xcodebuild -create-xcframework -library "${PROJECT_SOURCE_DIR}/MaaDeps/runtime/${MAADEPS_TRIPLET}/libopencv_world4.407.dylib" -output OpenCV.xcframework
|
||||
)
|
||||
|
||||
add_custom_command(OUTPUT ONNXRuntime.xcframework
|
||||
COMMAND rm -rf ONNXRuntime.xcframework
|
||||
COMMAND xcodebuild -create-xcframework -library "${PROJECT_SOURCE_DIR}/MaaDeps/runtime/${MAADEPS_TRIPLET}/libonnxruntime.1.18.0.dylib" -output ONNXRuntime.xcframework
|
||||
COMMAND xcodebuild -create-xcframework -library "${PROJECT_SOURCE_DIR}/MaaDeps/runtime/${MAADEPS_TRIPLET}/libonnxruntime.1.14.1.dylib" -output ONNXRuntime.xcframework
|
||||
)
|
||||
|
||||
add_custom_command(OUTPUT fastdeploy_ppocr.xcframework
|
||||
|
||||
@@ -223,4 +223,6 @@ MD052: true
|
||||
# MD053/link-image-reference-definitions - Link and image reference definitions should be needed
|
||||
MD053:
|
||||
# Ignored definitions
|
||||
ignored_definitions: ["//"]
|
||||
ignored_definitions: [
|
||||
"//"
|
||||
]
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
import { defineClientConfig } from "vuepress/client";
|
||||
import Image1 from "../components/Image1.vue";
|
||||
import Image2 from "../components/Image2.vue";
|
||||
import Image4 from "../components/Image4.vue";
|
||||
import ImageGrid from "../components/ImageGrid.vue";
|
||||
|
||||
export default defineClientConfig({
|
||||
enhance: ({ app }) => {
|
||||
app.component("Image1", Image1);
|
||||
app.component("Image2", Image2);
|
||||
app.component("Image4", Image4);
|
||||
app.component("ImageGrid", ImageGrid);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
import type { VNode } from "vue";
|
||||
import { defineComponent, h } from "vue";
|
||||
|
||||
import NavbarDropdown from "@theme-hope/modules/navbar/components/NavbarDropdown";
|
||||
import { I18nIcon } from "@theme-hope/modules/navbar/components/icons/index";
|
||||
import { useNavbarLanguageDropdown } from "@theme-hope/modules/navbar/composables/index";
|
||||
|
||||
export default defineComponent({
|
||||
name: "LanguageDropdown",
|
||||
|
||||
setup() {
|
||||
const dropdown = useNavbarLanguageDropdown();
|
||||
|
||||
const filteredDropdown = () => {
|
||||
if (!dropdown.value) return null;
|
||||
|
||||
const filteredConfig = { ...dropdown.value };
|
||||
|
||||
if (filteredConfig.children) {
|
||||
filteredConfig.children = filteredConfig.children.filter(item => item.link !== '/');
|
||||
}
|
||||
|
||||
return filteredConfig;
|
||||
};
|
||||
|
||||
//console.log("OldLanguageDropdown", dropdown.value);
|
||||
//console.log("NewLanguageDropdown", filteredDropdown());
|
||||
|
||||
return (): VNode | null =>
|
||||
dropdown.value
|
||||
? h(
|
||||
"div",
|
||||
{ class: "vp-nav-item" },
|
||||
h(
|
||||
NavbarDropdown,
|
||||
{ config: filteredDropdown() },
|
||||
{
|
||||
title: () =>
|
||||
h(I18nIcon, {
|
||||
"aria-label": filteredDropdown()?.ariaLabel,
|
||||
style: {
|
||||
width: "1rem",
|
||||
height: "1rem",
|
||||
verticalAlign: "middle",
|
||||
},
|
||||
}),
|
||||
},
|
||||
),
|
||||
)
|
||||
: null;
|
||||
},
|
||||
});
|
||||
@@ -1,11 +1,8 @@
|
||||
import { defineUserConfig } from "vuepress";
|
||||
import { getDirname, path } from "vuepress/utils";
|
||||
import { viteBundler } from "@vuepress/bundler-vite";
|
||||
import { googleAnalyticsPlugin } from "@vuepress/plugin-google-analytics";
|
||||
import Theme from "./theme";
|
||||
|
||||
const __dirname = getDirname(import.meta.url);
|
||||
|
||||
export default defineUserConfig({
|
||||
base: "/docs/",
|
||||
lang: "zh-CN",
|
||||
@@ -14,29 +11,24 @@ export default defineUserConfig({
|
||||
port: 3001,
|
||||
|
||||
locales: {
|
||||
"/": {
|
||||
lang: " ",
|
||||
title: " ",
|
||||
description: " ",
|
||||
},
|
||||
"/zh-cn/": {
|
||||
lang: "zh-cn",
|
||||
lang: "zh-CN",
|
||||
description: "文档",
|
||||
},
|
||||
"/zh-tw/": {
|
||||
lang: "zh-tw",
|
||||
lang: "zh-TW",
|
||||
description: "文件",
|
||||
},
|
||||
"/en-us/": {
|
||||
lang: "en-us",
|
||||
lang: "en-US",
|
||||
description: "Documentation",
|
||||
},
|
||||
"/ja-jp/": {
|
||||
lang: "ja-jp",
|
||||
lang: "ja-JP",
|
||||
description: "ドキュメンテーション",
|
||||
},
|
||||
"/ko-kr/": {
|
||||
lang: "ko-kr",
|
||||
lang: "ko-KR",
|
||||
description: "선적 서류 비치",
|
||||
},
|
||||
},
|
||||
@@ -49,13 +41,6 @@ export default defineUserConfig({
|
||||
|
||||
theme: Theme,
|
||||
|
||||
alias: {
|
||||
"@theme-hope/modules/navbar/components/LanguageDropdown": path.resolve(
|
||||
__dirname,
|
||||
"./components/LanguageDropdown.ts",
|
||||
),
|
||||
},
|
||||
|
||||
plugins: [
|
||||
googleAnalyticsPlugin({
|
||||
id: "G-FJQDKG394Z",
|
||||
|
||||
@@ -1,88 +1,83 @@
|
||||
export default {
|
||||
appId: "99JM20SIFG",
|
||||
apiKey: "7596a5a8c95cd64d4cf3050c9a4f878e",
|
||||
indexName: "maa",
|
||||
// 这里应该把所有本地化配置都放入 locales 中
|
||||
appId: '99JM20SIFG',
|
||||
apiKey: '32ad931040facd36d2e99c3cb8e425e1',
|
||||
indexName: 'maa',
|
||||
locales: {
|
||||
"/zh-cn/": {
|
||||
placeholder: "搜索",
|
||||
translations: {
|
||||
button: {
|
||||
buttonText: "搜索",
|
||||
},
|
||||
modal: {
|
||||
searchBox: {
|
||||
resetButtonTitle: "清除查询条件",
|
||||
cancelButtonText: "取消",
|
||||
},
|
||||
startScreen: {
|
||||
recentSearchesTitle: "搜索历史",
|
||||
noRecentSearchesText: "没有搜索历史",
|
||||
saveRecentSearchButtonTitle: "保存至搜索历史",
|
||||
removeRecentSearchButtonTitle: "从搜索历史中移除",
|
||||
favoriteSearchesTitle: "收藏",
|
||||
removeFavoriteSearchButtonTitle: "从收藏中移除",
|
||||
},
|
||||
errorScreen: {
|
||||
titleText: "无法获取结果",
|
||||
helpText: "你可能需要检查你的网络连接",
|
||||
},
|
||||
footer: {
|
||||
selectText: "选择",
|
||||
navigateText: "切换",
|
||||
closeText: "关闭",
|
||||
searchByText: "搜索提供者",
|
||||
},
|
||||
noResultsScreen: {
|
||||
noResultsText: "无法找到相关结果",
|
||||
suggestedQueryText: "你可以尝试查询",
|
||||
reportMissingResultsText: "你认为该查询应该有结果?",
|
||||
reportMissingResultsLinkText: "点击反馈",
|
||||
},
|
||||
},
|
||||
'/': {
|
||||
placeholder: '搜索',
|
||||
translations: {
|
||||
button: {
|
||||
buttonText: '搜索',
|
||||
},
|
||||
modal: {
|
||||
searchBox: {
|
||||
resetButtonTitle: '清除查询条件',
|
||||
cancelButtonText: '取消',
|
||||
},
|
||||
},
|
||||
"/en-us/": {
|
||||
placeholder: "Search",
|
||||
translations: {
|
||||
button: {
|
||||
buttonText: "Search",
|
||||
},
|
||||
modal: {
|
||||
searchBox: {
|
||||
resetButtonTitle: "Clear the query",
|
||||
cancelButtonText: "Cancel",
|
||||
},
|
||||
startScreen: {
|
||||
recentSearchesTitle: "Recent",
|
||||
noRecentSearchesText: "No recent searches",
|
||||
saveRecentSearchButtonTitle: "Save this search",
|
||||
removeRecentSearchButtonTitle:
|
||||
"Remove this search from history",
|
||||
favoriteSearchesTitle: "Favorite",
|
||||
removeFavoriteSearchButtonTitle:
|
||||
"Remove this search from favorites",
|
||||
},
|
||||
errorScreen: {
|
||||
titleText: "Unable to fetch results",
|
||||
helpText:
|
||||
"You might want to check your network connection.",
|
||||
},
|
||||
footer: {
|
||||
selectText: "to select",
|
||||
navigateText: "to navigate",
|
||||
closeText: "to close",
|
||||
searchByText: "Search by",
|
||||
},
|
||||
noResultsScreen: {
|
||||
noResultsText: "No results for",
|
||||
suggestedQueryText: "Try searching for",
|
||||
reportMissingResultsText:
|
||||
"Believe this query should return results?",
|
||||
reportMissingResultsLinkText: "Let us know.",
|
||||
},
|
||||
},
|
||||
startScreen: {
|
||||
recentSearchesTitle: '搜索历史',
|
||||
noRecentSearchesText: '没有搜索历史',
|
||||
saveRecentSearchButtonTitle: '保存至搜索历史',
|
||||
removeRecentSearchButtonTitle: '从搜索历史中移除',
|
||||
favoriteSearchesTitle: '收藏',
|
||||
removeFavoriteSearchButtonTitle: '从收藏中移除',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
errorScreen: {
|
||||
titleText: '无法获取结果',
|
||||
helpText: '你可能需要检查你的网络连接',
|
||||
},
|
||||
footer: {
|
||||
selectText: '选择',
|
||||
navigateText: '切换',
|
||||
closeText: '关闭',
|
||||
searchByText: '搜索提供者',
|
||||
},
|
||||
noResultsScreen: {
|
||||
noResultsText: '无法找到相关结果',
|
||||
suggestedQueryText: '你可以尝试查询',
|
||||
reportMissingResultsText: '你认为该查询应该有结果?',
|
||||
reportMissingResultsLinkText: '点击反馈',
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
'/en-us/': {
|
||||
placeholder: 'Search',
|
||||
translations: {
|
||||
button: {
|
||||
buttonText: 'Search',
|
||||
},
|
||||
modal: {
|
||||
searchBox: {
|
||||
resetButtonTitle: 'Clear the query',
|
||||
cancelButtonText: 'Cancel',
|
||||
},
|
||||
startScreen: {
|
||||
recentSearchesTitle: 'Recent',
|
||||
noRecentSearchesText: 'No recent searches',
|
||||
saveRecentSearchButtonTitle: 'Save this search',
|
||||
removeRecentSearchButtonTitle: 'Remove this search from history',
|
||||
favoriteSearchesTitle: 'Favorite',
|
||||
removeFavoriteSearchButtonTitle: 'Remove this search from favorites',
|
||||
},
|
||||
errorScreen: {
|
||||
titleText: 'Unable to fetch results',
|
||||
helpText: 'You might want to check your network connection.',
|
||||
},
|
||||
footer: {
|
||||
selectText: 'to select',
|
||||
navigateText: 'to navigate',
|
||||
closeText: 'to close',
|
||||
searchByText: 'Search by',
|
||||
},
|
||||
noResultsScreen: {
|
||||
noResultsText: 'No results for',
|
||||
suggestedQueryText: 'Try searching for',
|
||||
reportMissingResultsText: 'Believe this query should return results?',
|
||||
reportMissingResultsLinkText: 'Let us know.',
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
# This file MUST use GBK encoding, whatever the system language is.
|
||||
# You may do more testing, but at least it works like this for me.
|
||||
# Fuck Microsoft.
|
||||
# 修改请使用 GBK 编码保存。
|
||||
# 如果能用 UTF-8 保存而不乱码,那就去做,我实在是研究不明白微软的屎了。
|
||||
# 你或许想加一条 [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 来解决问题。
|
||||
# 但很神奇的,这根本不管用,甚至还会让中文汉字渲染重叠在一起。
|
||||
# 我在 CMD 里面都能 chcp 65001 换成 UTF-8。
|
||||
# 微软什么时候能把 PowerShell 7 集成到系统里。
|
||||
# 我由衷的认为 Windows 中预装的 PowerShell 就是一坨屎,甚至不如 CMD。
|
||||
# 用 PowerShell 写这东西真成为了一盘醋包的饺子了。
|
||||
|
||||
# 检查 PowerShell 脚本运行策略
|
||||
# 我真理解不了这个运行策略的存在意义了,明明叫脚本运行策略,却可以用脚本修改。
|
||||
# 我既可以在不提权的情况下允许所有脚本运行,也可以直接启动一个运行所有脚本运行的会话。
|
||||
# 本脚本在测试时发现,在不修改策略且不提权的情况下也可以正常运行,只是在安装运行库时需要点安装程序的 UAC 弹窗。
|
||||
# 而不修改策略且提权时反而因为脚本策略运行不了了,这是什么品种的管理员权限。
|
||||
# $ExecutionPolicy = Get-ExecutionPolicy
|
||||
# if ($ExecutionPolicy -eq 'Restricted' -or $ExecutionPolicy -eq 'AllSigned') {
|
||||
# Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||
# Write-Host "已修改当前用户的 PowerShell 脚本运行策略为 RemoteSigned 以便运行此脚本。"
|
||||
# Write-Host "这只需运行一次,且理应不会产生较大的安全风险。"
|
||||
# Write-Host "如果您对此有疑虑,请在脚本运行结束后,在 PowerShell 中运行以下命令将策略值清空。"
|
||||
# Write-Host "Set-ExecutionPolicy -ExecutionPolicy Undefined -Scope CurrentUser"
|
||||
# Pause
|
||||
# }
|
||||
|
||||
# 获取 UAC 权限并启动一个 RemoteSigned 脚本策略会话
|
||||
If (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)) {
|
||||
Write-Host "正在获取管理员权限..."
|
||||
Start-Process powershell.exe "-ExecutionPolicy RemoteSigned -File `"$PSCommandPath`" -ArgumentList `"$PSCommandPath`"" -Verb RunAs
|
||||
Exit
|
||||
}
|
||||
|
||||
# 读取系统代理并应用
|
||||
$Internet_Settings = Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings'
|
||||
if ($Internet_Settings.ProxyEnable -eq 1) {
|
||||
$env:HTTP_PROXY = "http://$($Internet_Settings.ProxyServer)"
|
||||
$env:HTTPS_PROXY = "http://$($Internet_Settings.ProxyServer)"
|
||||
Write-Host "已应用系统代理:$($Internet_Settings.ProxyServer)。"
|
||||
}
|
||||
# else {
|
||||
# Write-Host "未启用系统代理。"
|
||||
# }
|
||||
Remove-Variable -Name Internet_Settings
|
||||
|
||||
# 新建下载用临时文件夹
|
||||
New-Item -Path "$env:TEMP" -Name "MAA_Runtime_Fix_Pwsh" -ItemType "Directory" | Out-Null
|
||||
|
||||
# 使用 BITS 下载运行库安装包
|
||||
Write-Host "正在下载运行库安装包..."
|
||||
# Start-Sleep -Seconds 1
|
||||
Start-BitsTransfer -Source "https://aka.ms/vs/17/release/vc_redist.x64.exe" -Destination "$env:TEMP\MAA_Runtime_Fix_Pwsh\vc_redist.x64.exe"
|
||||
Start-BitsTransfer -Source "https://builds.dotnet.microsoft.com/dotnet/WindowsDesktop/8.0.11/windowsdesktop-runtime-8.0.11-win-x64.exe" -Destination "$env:TEMP\MAA_Runtime_Fix_Pwsh\windowsdesktop-runtime-8.0.11-win-x64.exe"
|
||||
|
||||
# 卸载 vc++ 和 dotnet8
|
||||
Write-Host ""
|
||||
Write-Host "尝试调用 WinGet 卸载已安装的运行库..."
|
||||
winget uninstall "Microsoft.VCRedist.2015+.x64" "Microsoft.DotNet.DesktopRuntime.8" --force --all-versions
|
||||
|
||||
# 安装 vc++
|
||||
Write-Host ""
|
||||
Write-Host "正在安装/修复 Microsoft Visual C++ 可再发行程序包..."
|
||||
$vcProcess = Start-Process "$env:TEMP\MAA_Runtime_Fix_Pwsh\vc_redist.x64.exe" -ArgumentList '/repair', '/passive', '/norestart' -PassThru
|
||||
$vcProcess.WaitForExit()
|
||||
|
||||
# 安装 dotnet8
|
||||
Write-Host "正在安装/修复 .NET 桌面运行时 8..."
|
||||
$dotnetProcess = Start-Process "$env:TEMP\MAA_Runtime_Fix_Pwsh\windowsdesktop-runtime-8.0.11-win-x64.exe" -ArgumentList '/repair', '/passive', '/norestart' -PassThru
|
||||
$dotnetProcess.WaitForExit()
|
||||
|
||||
# 删除临时文件夹
|
||||
Write-Host ""
|
||||
Write-Host "正在清理临时文件..."
|
||||
Remove-Item -Path "$env:TEMP\MAA_Runtime_Fix_Pwsh" -Recurse -Force
|
||||
|
||||
Write-Host "运行库修复完成,请再次尝试运行 MAA。"
|
||||
Write-Host ""
|
||||
Pause
|
||||
|
||||
# 使用 winget 安装/更新运行库并卸载旧版本
|
||||
# winget install "Microsoft.VCRedist.2015+.x64" "Microsoft.DotNet.DesktopRuntime.8" --uninstall-previous --accept-package-agreements
|
||||
|
||||
# 使用 winget 下载运行库安装包
|
||||
# winget download --id "Microsoft.VCRedist.2015+.x64" -d "$env:TEMP\MAA_Runtime_Fix_Pwsh\"
|
||||
# winget download --id "Microsoft.DotNet.DesktopRuntime.8" -d "$env:TEMP\MAA_Runtime_Fix_Pwsh\"
|
||||
|
||||
# 不使用 winget 卸载 vc++
|
||||
# 会进行卸载 但是卸不掉
|
||||
# Get-Package -Name "Microsoft Visual C++ 2015-2022 Redistributable (x64) - *" | Uninstall-Package -Force
|
||||
|
||||
# 不使用 winget 卸载 dotnet8
|
||||
# 会进行卸载 但是卸不掉
|
||||
# Get-Package -Name "Microsoft Windows Desktop Runtime - 8.* (x64)" | Uninstall-Package -Force
|
||||
|
||||
# 下载安装包那里注释了一个睡一秒是因为本来下载文件的那个进度条会把上面输出过的所有内容都覆盖掉,上来就只能看到个下载进度条,别的啥也看不到。
|
||||
# 但当我去掉新建文件夹时输出的一大坨东西之后,这行就能露出来了。
|
||||
# 我建议每个人都去看一下 PowerShell 的 New-Item 新建文件夹能输出多大一坨玩意。
|
||||
# 还有 PowerShell 弱智一样的进度条显示机制,非得搞个固定不透明一大坨的浮窗上去干什么,就不能和别人一样在命令底部显示吗。
|
||||
|
||||
# 再用 Pwsh 写脚本我就是傻逼。
|
||||
BIN
docs/.vuepress/public/image/en-us/readme/1-dark.png
Normal file
|
After Width: | Height: | Size: 74 KiB |
BIN
docs/.vuepress/public/image/en-us/readme/1-light.png
Normal file
|
After Width: | Height: | Size: 73 KiB |
BIN
docs/.vuepress/public/image/en-us/readme/2-dark.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
docs/.vuepress/public/image/en-us/readme/2-light.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
docs/.vuepress/public/image/en-us/readme/3-dark.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
docs/.vuepress/public/image/en-us/readme/3-light.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
docs/.vuepress/public/image/en-us/readme/4-dark.png
Normal file
|
After Width: | Height: | Size: 89 KiB |
BIN
docs/.vuepress/public/image/en-us/readme/4-light.png
Normal file
|
After Width: | Height: | Size: 88 KiB |
BIN
docs/.vuepress/public/image/ja-jp/readme/1-light.png
Normal file
|
After Width: | Height: | Size: 67 KiB |
BIN
docs/.vuepress/public/image/ja-jp/readme/2-light.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
docs/.vuepress/public/image/ko-kr/readme/1-light.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
docs/.vuepress/public/image/ko-kr/readme/2-light.png
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
docs/.vuepress/public/image/zh-cn/readme/1-dark.png
Normal file
|
After Width: | Height: | Size: 63 KiB |
BIN
docs/.vuepress/public/image/zh-cn/readme/1-light.png
Normal file
|
After Width: | Height: | Size: 62 KiB |
BIN
docs/.vuepress/public/image/zh-cn/readme/2-dark.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
docs/.vuepress/public/image/zh-cn/readme/2-light.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
docs/.vuepress/public/image/zh-cn/readme/3-dark.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
docs/.vuepress/public/image/zh-cn/readme/3-light.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
docs/.vuepress/public/image/zh-cn/readme/4-dark.png
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
docs/.vuepress/public/image/zh-cn/readme/4-light.png
Normal file
|
After Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 691 KiB |
|
Before Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 42 KiB |