kazelee
2025-05-14 cd92df8b7b383a6a3218f50b3b62264db8332899
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
using System.Collections.Generic;
 
// 根据 JSON 文件 生成对应的 C# 对象;网址:https://json2csharp.com/
// 1. 将 config.json 文件复制到网址中
// 2. 将得到的内容复制到 namespace HH.WCS.Mobox3.{项目代号}.AppStart { } 大括号内部(C# 10 才支持 文件范围内的命名空间)
// 3. 将 Root 更名为 Config
// 补充:这种方式没法保留注释,需要熟悉 Config 文件的字段含义(暂不考虑代码生成 Json 文件)
 
namespace HH.WCS.Mobox3.AnGang.AppStart {
    // Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
    public class Area {
        public string Name { get; set; }
        public List<string> Codes { get; set; }
    }
 
    public class Config {
        public string WebApiUrl { get; set; }
        public string RCSApiUrl { get; set; }
        public string NDCApiUrl { get; set; }
        public string SqlServer { get; set; }
        public string TCPServerIP { get; set; }
        public int TCPServerPort { get; set; }
        public List<Area> Areas { get; set; }
        public List<Snap> Snap { get; set; }
        public string CaptureUrl { get; set; }
    }
 
    public class Snap {
        public string Ip { get; set; }
        public int Port { get; set; }
        public string Name { get; set; }
        public string Pwd { get; set; }
    }
 
 
}