机明 NC 接收端演示(JmNcReceiver)
.NET Framework 4.8 控制台程序:接收机明推送的 NC 提交 JSON 数组,还原为 NcSubmitItem 列表,明文 / 分行落盘,并可解码 fileStream。
文件
| 文件 | 说明 |
|---|---|
Program.cs | HttpListener + 控制台命令 |
NcOps.cs | 反序列化、明文、extract |
Models/NcSubmitModels.cs | 强类型模型 |
NC提交.txt.example | 机明侧配置样例 |
Samples/sample-nc-submit.json | 联调样例 |
编译 / 运行
msbuild JmNcReceiver.csproj /p:Configuration=Release
bin\Release\JmNcReceiver.exe
默认监听 http://127.0.0.1:1235/。
JmNcReceiver.exe http://127.0.0.1:8089/
JmNcReceiver.exe --fail
机明配置
将 NC提交.txt.example 复制为:
{机明启动目录}\系统配置模板\NC提交.txt
URL 与监听地址一致后重启机明,后处理或串联写出 NC 即可推送。
自测
$body = Get-Content -Raw -Encoding UTF8 Samples\sample-nc-submit.json
Invoke-RestMethod -Uri http://127.0.0.1:1235/ -Method Post -Body $body -ContentType "application/json; charset=utf-8"
仅供联调学习,不含鉴权与生产级持久化。