forked from 66hh/ProtoDumper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Proto.cs
95 lines (81 loc) · 2.54 KB
/
Proto.cs
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
using System.Collections.Generic;
namespace ProtoDumper {
public class Proto {
public string Name;
public int CmdID;
public List<ProtoField> Fields;
public List<ProtoEnum> Enums;
public List<Proto> NestedProtos;
public List<ProtoOneof> Oneofs;
public bool Nested;
public bool IsEnum;
public Proto(string name, int cmdId, List<ProtoField> fields, List<ProtoEnum> enums, List<Proto> nestedProtos, List<ProtoOneof> oneofs, bool nested, bool isEnum) {
Name = name;
CmdID = cmdId;
Fields = fields;
Enums = enums;
NestedProtos = nestedProtos;
Oneofs = oneofs;
Nested = nested;
IsEnum = isEnum;
}
}
public class ProtoField {
public List<ProtoType> Types;
public string Name;
public int FieldNumber;
public bool IsRepeated;
public bool IsMap;
public ProtoField(List<ProtoType> types, string name, int fieldNumber, bool isRepeated = false, bool isMap = false) {
Types = types;
Name = name;
FieldNumber = fieldNumber;
IsRepeated = isRepeated;
IsMap = isMap;
}
}
public class ProtoType {
public string Name;
public bool IsImport;
public ProtoType(string name, bool isImport = false) {
Name = name;
IsImport = isImport;
}
}
public class ProtoEnum {
public string Name;
public List<ProtoEnumEntry> Entries;
public ProtoEnum(string name, List<ProtoEnumEntry> entries) {
Name = name;
Entries = entries;
}
}
public class ProtoEnumEntry {
public string Name;
public int Value;
public ProtoEnumEntry(string name, int value) {
Name = name;
Value = value;
}
}
public class ProtoOneof {
public string Name;
public List<ProtoOneofEntry> Entries;
public ProtoOneof(string name, List<ProtoOneofEntry> entries) {
Name = name;
Entries = entries;
}
}
public class ProtoOneofEntry {
public string Type;
public string Name;
public int FieldNumber;
public bool IsImport;
public ProtoOneofEntry(string type, string name, int fieldNumber, bool isImport = false) {
Type = type;
Name = name;
FieldNumber = fieldNumber;
IsImport = isImport;
}
}
}