-
Notifications
You must be signed in to change notification settings - Fork 0
Standard 0.9 #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Standard 0.9 #3
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the project to the “Standard 0.9” metadata pipeline by fixing script paths, refactoring the CLI runner, and adding a full XML metadata processor.
- build.sh and csproj: fix output path casing and remove stray BOM
- Program.cs: introduce default folder constants, argument parsing, folder creation, Chinese logs, and metadata processing steps
- Metadata.cs: add a comprehensive XML loader, validator, variable replacer, and compiler
- README & XML files: switch to a unified
<Metadata>root, clarify variable syntax, and reorganize module includes
Reviewed Changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| build.sh | Updated --dst path to ./Output |
| Ra3.BattleNet.Metadata/Ra3.BattleNet.Metadata.csproj | Removed leading BOM character |
| Ra3.BattleNet.Metadata/Program.cs | Refactored main runner, added CLI args and metadata workflow |
| Ra3.BattleNet.Metadata/Metadata.cs | New metadata parsing, validation, variable replacement, hashing |
| README.md | Expanded module docs, updated inline variable examples |
| Metadata/**/*.xml | Converted roots to <Metadata>, restructured includes |
Comments suppressed due to low confidence (1)
Ra3.BattleNet.Metadata/Metadata.cs:1
- This file references types from
System,System.IO,System.Collections.Generic, and LINQ extension methods but is missingusing System;,using System.IO;,using System.Collections.Generic;, andusing System.Linq;. Add these directives to ensure it compiles.
using System.Security.Cryptography;
| if (!Directory.Exists(dstOutputFolder)) | ||
| { | ||
| Directory.CreateDirectory(dstOutputFolder); | ||
| Directory.CreateDirectory(dstOutputFolder ?? DefaultDstFolder); |
Copilot
AI
Jul 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The null-coalescing here is redundant since dstOutputFolder is always non-null after initialization. Simplify to Directory.CreateDirectory(dstOutputFolder);.
| Directory.CreateDirectory(dstOutputFolder ?? DefaultDstFolder); | |
| Directory.CreateDirectory(dstOutputFolder); |
| { | ||
| // 构建目标文件的完整路径 | ||
| string targetFilePath = Path.Combine(dstOutputFolder, file[(srcMetadataFolder.Length + 1)..]); | ||
| if (file.EndsWith("metadata.xml")) continue; // 已处理 |
Copilot
AI
Jul 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using EndsWith on a full path can be brittle. Consider Path.GetFileName(file).Equals("metadata.xml", StringComparison.OrdinalIgnoreCase) to more reliably skip the metadata file.
| if (file.EndsWith("metadata.xml")) continue; // 已处理 | |
| if (Path.GetFileName(file).Equals("metadata.xml", StringComparison.OrdinalIgnoreCase)) continue; // 已处理 |
| // 4. 验证处理后的文件 | ||
| try | ||
| { | ||
| var verifiedMetadata = Metadata.LoadFromFile(metadataPath); |
Copilot
AI
Jul 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reloads the original source metadata.xml instead of the processed copy in the output folder. To verify the build output, load from Path.Combine(dstOutputFolder, "metadata.xml") instead.
| var verifiedMetadata = Metadata.LoadFromFile(metadataPath); | |
| string processedMetadataPath = Path.Combine(dstOutputFolder, "metadata.xml"); | |
| var verifiedMetadata = Metadata.LoadFromFile(processedMetadataPath); |
| string targetFilePath = Path.Combine(dstOutputFolder ?? DefaultDstFolder, | ||
| file[(srcMetadataFolder.Length + 1)..]); |
Copilot
AI
Jul 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manual slicing of the full path can break if folder separators or trailing slashes change. Use Path.GetRelativePath(srcMetadataFolder, file) to compute the relative path robustly.
| string targetFilePath = Path.Combine(dstOutputFolder ?? DefaultDstFolder, | |
| file[(srcMetadataFolder.Length + 1)..]); | |
| string relativePath = Path.GetRelativePath(srcMetadataFolder, file); | |
| string targetFilePath = Path.Combine(dstOutputFolder ?? DefaultDstFolder, relativePath); |
No description provided.