MonoChestnut.Rom
0.22.0
dotnet add package MonoChestnut.Rom --version 0.22.0
NuGet\Install-Package MonoChestnut.Rom -Version 0.22.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MonoChestnut.Rom" Version="0.22.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MonoChestnut.Rom" Version="0.22.0" />
<PackageReference Include="MonoChestnut.Rom" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MonoChestnut.Rom --version 0.22.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MonoChestnut.Rom, 0.22.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MonoChestnut.Rom@0.22.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MonoChestnut.Rom&version=0.22.0
#tool nuget:?package=MonoChestnut.Rom&version=0.22.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MonoChestnut.Rom
MonoChestnut 游戏引擎的 rom 格式:发布游戏时把配置和资源打包成一个文件,玩家无法修改。只依赖 .NET。
- 签名防篡改:ECDSA P-256 签名覆盖文件头和索引,每个数据块的 SHA-256 记录在已签名的索引中;引擎只内置公钥,没有私钥无法重新签名。
- 加密防查看:Brotli 压缩后 AES-256-GCM 加密,每个 rom 的密钥由密钥材料和随机盐派生。密钥材料随引擎发布,只能挡住随手查看。
- 按需读取:打开时只读取并验签索引;每个文件切成 64 KB 的块,读到哪一块才校验、解密哪一块。
- 流式写入:写入时按块读取文件,可以报告进度、中途取消;写到文件时先写临时文件,不会留下不完整的 rom。
- 贴图图集索引:
RomAtlasIndex是打包方生成的__atlas/atlas.json的格式,引擎和打包方共用。
using MonoChestnut.Rom;
// 生成密钥(只需一次):签名密钥含私钥,只保存在打包方;信任文件含公钥,内置到引擎
using var key = RomSigningKey.Generate();
File.WriteAllText("rom-signing-key.json", key.ToJson());
File.WriteAllText("rom-trust.json", key.GetTrust().ToJson());
// 打包
var files = new[]
{
RomFileSource.FromFile(RomFormat.ConfigPath, "game.json"),
RomFileSource.FromFile("Content/map/beach.map.json", "Content/map/beach.map.json"),
};
RomWriter.Write("game.rom", files, key, new Progress<RomWriteProgress>(p => Console.WriteLine(p)));
// 读取(验签失败、数据被修改时抛出 RomException)
using var trust = RomTrust.FromJson(File.ReadAllText("rom-trust.json"));
using var package = RomReader.Read("game.rom", trust);
var json = package.ReadAllText(RomFormat.ConfigPath);
using var stream = package.Open("Content/map/beach.map.json");
签名密钥文件不要提交到代码仓库,也不要随游戏发布。
许可证:GPL-3.0-only。
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.22.0 | 93 | 11/17/2026 |
| 0.20.0 | 97 | 11/17/2026 |
| 0.18.0 | 95 | 11/16/2026 |
| 0.17.0 | 94 | 11/14/2026 |
| 0.16.0 | 93 | 11/14/2026 |
| 0.15.0 | 90 | 11/14/2026 |
| 0.14.0 | 102 | 11/14/2026 |
| 0.13.0 | 78 | 11/13/2026 |
| 0.12.0 | 84 | 11/13/2026 |
| 0.11.0 | 92 | 11/13/2026 |
| 0.10.0 | 90 | 11/13/2026 |
| 0.9.0 | 88 | 11/12/2026 |
| 0.8.0 | 92 | 11/8/2026 |
| 0.7.0 | 90 | 11/8/2026 |
| 0.6.0 | 95 | 11/3/2026 |
| 0.5.0 | 93 | 11/3/2026 |
| 0.4.0 | 104 | 11/3/2026 |
| 0.3.0 | 93 | 11/2/2026 |
| 0.2.0 | 104 | 11/1/2026 |
| 0.1.0 | 103 | 10/30/2026 |