-
-
Notifications
You must be signed in to change notification settings - Fork 294
Expand file tree
/
Copy pathModels.cs
More file actions
242 lines (201 loc) · 5.76 KB
/
Models.cs
File metadata and controls
242 lines (201 loc) · 5.76 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
using MemoryPack;
using System.ComponentModel;
using System.Security.Principal;
namespace SandboxWebApp;
[MemoryPackable]
[GenerateTypeScript]
public partial class FooBarBazDayonDattayon
{
public int MyProperty { get; set; }
}
[MemoryPackable]
[GenerateTypeScript]
public partial class AllConvertableType
{
// supported primitives
public bool MyBool { get; set; }
public byte MyByte { get; set; }
public sbyte MySByte { get; set; }
public short MyShort { get; set; }
public int MyInt { get; set; }
public long MyLong { get; set; }
public ushort MyUShort { get; set; }
public uint MyUInt { get; set; }
public ulong MyULong { get; set; }
public float MyFloat { get; set; }
public double MyDouble { get; set; }
public Guid MyGuid { get; set; }
public DateTime MyDate { get; set; }
public NoMarkByteEnum MyEnum1 { get; set; }
public NumberedUShortEnum MyEnum2 { get; set; }
// nullable
public bool? NullMyBool { get; set; }
public byte? NullMyByte { get; set; }
public sbyte? NullMySByte { get; set; }
public short? NullMyShort { get; set; }
public int? NullMyInt { get; set; }
public long? NullMyLong { get; set; }
public ushort? NullMyUShort { get; set; }
public uint? NullMyUInt { get; set; }
public ulong? NullMyULong { get; set; }
public float? NullMyFloat { get; set; }
public double? NullMyDouble { get; set; }
public Guid? NullMyGuid { get; set; }
public DateTime? NullMyDate { get; set; }
public NoMarkByteEnum? NullMyEnum1 { get; set; }
public NumberedUShortEnum? NullMyEnum2 { get; set; }
// reference types
public string? MyString { get; set; }
public byte[]? MyBytes { get; set; }
public int[]? MyIntArray { get; set; }
public string[]? MyStringArray { get; set; }
public List<int>? MyList { get; set; }
public Dictionary<int, int>? MyDictionary { get; set; }
public HashSet<int>? MySet { get; set; }
public List<Dictionary<int, HashSet<string[]>>>? MyNestedNested { get; set; }
public Dictionary<NoMarkByteEnum, bool>? DictCheck2 { get; set; }
public Dictionary<Guid, int?>? DictCheck3 { get; set; }
public Dictionary<int, string>? DictCheck4X { get; set; }
// memory-packable
public NestedObject? Nested1 { get; set; }
public IMogeUnion? Union1 { get; set; }
// not supported type
// public LongEnumBow NonSupportLongEnumBow { get; set; }
// public Dictionary<int, NOBOU?> ddd { get; set; }
}
public enum NOBOU : int
{
AP = 99
}
[MemoryPackable]
[GenerateTypeScript]
public partial class NestedObject
{
public int MyProperty { get; set; }
public string? MyProperty2 { get; set; }
}
[MemoryPackable]
[GenerateTypeScript]
public partial class ArrayGenericsCheck
{
// array
public NestedObject[]? Array1 { get; set; }
public IMogeUnion[]? Array2 { get; set; }
public List<NoMarkByteEnum>? List1 { get; set; }
}
public enum NoMarkByteEnum : byte
{
Apple, Orange, Grape
}
public enum NumberedUShortEnum : ushort
{
Tokyo = 10,
Chiba = 100,
Saitama = 1000
}
[MemoryPackable]
[MemoryPackUnion(0, typeof(SampleUnion1))]
[MemoryPackUnion(1, typeof(SampleUnion2))]
[GenerateTypeScript]
public partial interface IMogeUnion
{
}
[MemoryPackable]
[GenerateTypeScript]
public partial class SampleUnion1 : IMogeUnion
{
public int? MyProperty { get; set; }
}
[MemoryPackable]
[GenerateTypeScript]
public partial class SampleUnion2 : IMogeUnion
{
public string? MyProperty { get; set; }
}
[MemoryPackable]
[GenerateTypeScript]
public partial class Subset
{
public bool MyBool { get; set; }
public byte MyByte { get; set; }
public sbyte MySByte { get; set; }
public short MyShort { get; set; }
}
// https://raw.githubusercontent.com/endel/msgpack-benchmark/master/sample-large.json
[MemoryPackable]
[GenerateTypeScript]
public partial class SampleLarge
{
public string? _id { get; set; }
public string? author { get; set; }
public string? created_at { get; set; }
public string? description { get; set; }
public string? image { get; set; }
public string[]? keywords { get; set; }
public string? language { get; set; }
public string? permalink { get; set; }
public bool published { get; set; }
public string? title { get; set; }
public string? updated_at { get; set; }
public string? url { get; set; }
}
[MemoryPackable]
[GenerateTypeScript]
public partial class Person
{
public required Guid Id { get; init; }
public required int Age { get; init; }
public required string FirstName { get; init; }
public required string LastName { get; init; }
public required DateTime DateOfBirth { get; init; }
public required Gender Gender { get; init; }
public required string[] Emails { get; init; }
}
public enum Gender
{
Male, Female, Other
}
[MemoryPackable]
[GenerateTypeScript]
public partial class Rec
{
public required Rec Id { get; init; }
}
[MemoryPackable]
[GenerateTypeScript]
public partial class NullableFloatTest
{
public float? NullableFloat { get; set; }
public double? NullableDouble { get; set; }
}
[MemoryPackable]
[GenerateTypeScript]
public partial struct Vector3
{
public float X { get; set; }
public float Y { get; set; }
public float Z { get; set; }
}
[MemoryPackable]
[GenerateTypeScript]
public partial struct ColorTag
{
public string? Name { get; set; }
public int Code { get; set; }
}
[MemoryPackable]
[GenerateTypeScript]
public partial struct BoundingBox
{
public Vector3 Min { get; set; }
public Vector3 Max { get; set; }
}
[MemoryPackable]
[GenerateTypeScript]
public partial class GameObject
{
public string? Name { get; set; }
public Vector3 Position { get; set; }
public BoundingBox Bounds { get; set; }
public ColorTag Tag { get; set; }
}