com.xmobitea.changx.gn-unity 2.0.3 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Editor/GNServerSettingsEditor.cs +16 -300
- package/Runtime/Common/GNArray.cs +387 -302
- package/Runtime/Common/GNArray.cs.meta +11 -11
- package/Runtime/Common/GNData.cs +61 -48
- package/Runtime/Common/GNData.cs.meta +11 -11
- package/Runtime/Common/GNHashtable.cs +404 -241
- package/Runtime/Common/GNHashtable.cs.meta +11 -11
- package/Runtime/Common/IGNData.cs +20 -11
- package/Runtime/Common/IGNData.cs.meta +11 -11
- package/Runtime/Common.meta +8 -8
- package/Runtime/Config/GNServerSettings.cs +136 -92
- package/Runtime/Config/GNServerSettings.cs.meta +11 -11
- package/Runtime/Config.meta +8 -8
- package/Runtime/Constant/Commands.cs +82 -19
- package/Runtime/Constant/Commands.cs.meta +11 -11
- package/Runtime/Constant/EnumType/FriendStatus.cs +12 -12
- package/Runtime/Constant/EnumType/FriendStatus.cs.meta +11 -11
- package/Runtime/Constant/EnumType/GoogleLoginType.cs +5 -5
- package/Runtime/Constant/EnumType/GoogleLoginType.cs.meta +11 -11
- package/Runtime/Constant/EnumType/GroupStatus.cs +7 -7
- package/Runtime/Constant/EnumType/GroupStatus.cs.meta +11 -11
- package/Runtime/Constant/EnumType/InvalidMemberType.cs +23 -23
- package/Runtime/Constant/EnumType/InvalidMemberType.cs.meta +11 -11
- package/Runtime/Constant/EnumType/ItemType.cs +5 -5
- package/Runtime/Constant/EnumType/ItemType.cs.meta +11 -11
- package/Runtime/Constant/EnumType/MatchmakingMemberStatus.cs +6 -6
- package/Runtime/Constant/EnumType/MatchmakingMemberStatus.cs.meta +11 -11
- package/Runtime/Constant/EnumType/MatchmakingTicketStatus.cs +2 -2
- package/Runtime/Constant/EnumType/MatchmakingTicketStatus.cs.meta +11 -11
- package/Runtime/Constant/EnumType/OwnerType.cs +3 -2
- package/Runtime/Constant/EnumType/OwnerType.cs.meta +11 -11
- package/Runtime/Constant/EnumType/PermissionDataItem.cs +10 -10
- package/Runtime/Constant/EnumType/PermissionDataItem.cs.meta +11 -11
- package/Runtime/Constant/EnumType/PushPlatformType.cs +10 -0
- package/Runtime/Constant/EnumType/PushPlatformType.cs.meta +11 -0
- package/Runtime/Constant/EnumType/RequestRole.cs +11 -11
- package/Runtime/Constant/EnumType/RequestRole.cs.meta +7 -7
- package/Runtime/Constant/EnumType/RequestType.cs +20 -19
- package/Runtime/Constant/EnumType/RequestType.cs.meta +11 -11
- package/Runtime/Constant/EnumType/StoreReceiveType.cs +13 -0
- package/Runtime/Constant/EnumType/StoreReceiveType.cs.meta +11 -0
- package/Runtime/Constant/EnumType.meta +8 -8
- package/Runtime/Constant/ErrorCode/GNErrorCode.cs +53 -48
- package/Runtime/Constant/ErrorCode/GNErrorCode.cs.meta +7 -7
- package/Runtime/Constant/ErrorCode.meta +8 -8
- package/Runtime/Constant/EventCode.cs +43 -16
- package/Runtime/Constant/EventCode.cs.meta +11 -11
- package/Runtime/Constant/OperationCode.cs +249 -211
- package/Runtime/Constant/OperationCode.cs.meta +11 -11
- package/Runtime/Constant/ParameterCode/GNParameterCode.cs +614 -466
- package/Runtime/Constant/ParameterCode/GNParameterCode.cs.meta +11 -11
- package/Runtime/Constant/ParameterCode/ParameterCode.cs +12 -12
- package/Runtime/Constant/ParameterCode/ParameterCode.cs.meta +11 -11
- package/Runtime/Constant/ParameterCode.meta +8 -8
- package/Runtime/Constant/ReturnCode.cs +73 -25
- package/Runtime/Constant/ReturnCode.cs.meta +11 -11
- package/Runtime/Constant.meta +8 -8
- package/Runtime/Entity/DataMember.cs +342 -124
- package/Runtime/Entity/DataMember.cs.meta +11 -11
- package/Runtime/Entity/GNMetadata.cs +72 -27
- package/Runtime/Entity/GNMetadata.cs.meta +11 -11
- package/Runtime/Entity/InvalidMember.cs +52 -33
- package/Runtime/Entity/InvalidMember.cs.meta +11 -11
- package/Runtime/Entity/Models/AuthenticateModels.cs +251 -207
- package/Runtime/Entity/Models/AuthenticateModels.cs.meta +11 -11
- package/Runtime/Entity/Models/AuthenticateRequestModels.cs +153 -131
- package/Runtime/Entity/Models/AuthenticateRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/AuthenticateResponseModels.cs +61 -51
- package/Runtime/Entity/Models/AuthenticateResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/CharacterPlayerModels.cs +985 -849
- package/Runtime/Entity/Models/CharacterPlayerModels.cs.meta +11 -11
- package/Runtime/Entity/Models/CharacterPlayerRequestModels.cs +957 -885
- package/Runtime/Entity/Models/CharacterPlayerRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/CharacterPlayerResponseModels.cs +165 -150
- package/Runtime/Entity/Models/CharacterPlayerResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/CloudScriptModels.cs +185 -0
- package/Runtime/Entity/Models/CloudScriptModels.cs.meta +11 -0
- package/Runtime/Entity/Models/CloudScriptRequestModels.cs +134 -0
- package/Runtime/Entity/Models/CloudScriptRequestModels.cs.meta +11 -0
- package/Runtime/Entity/Models/CloudScriptResponseModels.cs +34 -0
- package/Runtime/Entity/Models/CloudScriptResponseModels.cs.meta +11 -0
- package/Runtime/Entity/Models/ContentModels.cs +150 -153
- package/Runtime/Entity/Models/ContentModels.cs.meta +11 -11
- package/Runtime/Entity/Models/ContentRequestModels.cs +129 -129
- package/Runtime/Entity/Models/ContentRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/ContentResponseModels.cs +24 -24
- package/Runtime/Entity/Models/ContentResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/DashboardModels.cs +1684 -1156
- package/Runtime/Entity/Models/DashboardModels.cs.meta +11 -11
- package/Runtime/Entity/Models/DashboardRequestModels.cs +220 -147
- package/Runtime/Entity/Models/DashboardRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/DashboardResponseModels.cs +92 -57
- package/Runtime/Entity/Models/DashboardResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/GamePlayerModels.cs +1073 -933
- package/Runtime/Entity/Models/GamePlayerModels.cs.meta +11 -11
- package/Runtime/Entity/Models/GamePlayerRequestModels.cs +939 -867
- package/Runtime/Entity/Models/GamePlayerRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/GamePlayerResponseModels.cs +162 -147
- package/Runtime/Entity/Models/GamePlayerResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/GenericModels.cs +102 -102
- package/Runtime/Entity/Models/GenericModels.cs.meta +11 -11
- package/Runtime/Entity/Models/GroupModels.cs +812 -676
- package/Runtime/Entity/Models/GroupModels.cs.meta +11 -11
- package/Runtime/Entity/Models/GroupRequestModels.cs +741 -669
- package/Runtime/Entity/Models/GroupRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/GroupResponseModels.cs +129 -114
- package/Runtime/Entity/Models/GroupResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/InventoryModels.cs +667 -558
- package/Runtime/Entity/Models/InventoryModels.cs.meta +11 -11
- package/Runtime/Entity/Models/InventoryRequestModels.cs +626 -579
- package/Runtime/Entity/Models/InventoryRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/InventoryResponseModels.cs +109 -99
- package/Runtime/Entity/Models/InventoryResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/MasterPlayerModels.cs +1882 -1340
- package/Runtime/Entity/Models/MasterPlayerModels.cs.meta +11 -11
- package/Runtime/Entity/Models/MasterPlayerRequestModels.cs +1643 -1253
- package/Runtime/Entity/Models/MasterPlayerRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/MasterPlayerResponseModels.cs +293 -213
- package/Runtime/Entity/Models/MasterPlayerResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/MultiplayerModels.cs +293 -223
- package/Runtime/Entity/Models/MultiplayerModels.cs.meta +11 -11
- package/Runtime/Entity/Models/MultiplayerRequestModels.cs +199 -149
- package/Runtime/Entity/Models/MultiplayerRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/MultiplayerResponseModels.cs +59 -49
- package/Runtime/Entity/Models/MultiplayerResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/StoreInventoryModels.cs +514 -323
- package/Runtime/Entity/Models/StoreInventoryModels.cs.meta +11 -11
- package/Runtime/Entity/Models/StoreInventoryRequestModels.cs +236 -165
- package/Runtime/Entity/Models/StoreInventoryRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/StoreInventoryResponseModels.cs +45 -30
- package/Runtime/Entity/Models/StoreInventoryResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models.meta +8 -8
- package/Runtime/Entity/OperationEvent.cs +111 -75
- package/Runtime/Entity/OperationEvent.cs.meta +11 -11
- package/Runtime/Entity/OperationHelper.cs +51 -35
- package/Runtime/Entity/OperationHelper.cs.meta +11 -11
- package/Runtime/Entity/OperationRequest.cs +142 -99
- package/Runtime/Entity/OperationRequest.cs.meta +11 -11
- package/Runtime/Entity/OperationResponse.cs +111 -63
- package/Runtime/Entity/OperationResponse.cs.meta +11 -11
- package/Runtime/Entity/Request/CustomOperationRequest.cs +112 -61
- package/Runtime/Entity/Request/CustomOperationRequest.cs.meta +11 -11
- package/Runtime/Entity/Request.meta +8 -8
- package/Runtime/Entity/Response/CustomOperationResponse.cs +84 -63
- package/Runtime/Entity/Response/CustomOperationResponse.cs.meta +11 -11
- package/Runtime/Entity/Response.meta +8 -8
- package/Runtime/Entity.meta +8 -8
- package/Runtime/GNNetwork.cs +501 -182
- package/Runtime/GNNetwork.cs.meta +11 -11
- package/Runtime/GNNetworkApi.cs +38 -19
- package/Runtime/GNNetworkApi.cs.meta +11 -11
- package/Runtime/GNNetworkAuthenticateApi.cs +531 -98
- package/Runtime/GNNetworkAuthenticateApi.cs.meta +11 -11
- package/Runtime/GNNetworkCharacterPlayerApi.cs +1587 -762
- package/Runtime/GNNetworkCharacterPlayerApi.cs.meta +11 -11
- package/Runtime/GNNetworkCloudScriptApi.cs +181 -0
- package/Runtime/GNNetworkCloudScriptApi.cs.meta +11 -0
- package/Runtime/GNNetworkContentApi.cs +238 -132
- package/Runtime/GNNetworkContentApi.cs.meta +11 -11
- package/Runtime/GNNetworkDashboardApi.cs +278 -117
- package/Runtime/GNNetworkDashboardApi.cs.meta +11 -11
- package/Runtime/GNNetworkGamePlayerApi.cs +1558 -747
- package/Runtime/GNNetworkGamePlayerApi.cs.meta +11 -11
- package/Runtime/GNNetworkGroupApi.cs +1228 -582
- package/Runtime/GNNetworkGroupApi.cs.meta +11 -11
- package/Runtime/GNNetworkInventoryApi.cs +1048 -507
- package/Runtime/GNNetworkInventoryApi.cs.meta +11 -11
- package/Runtime/GNNetworkMasterPlayerApi.cs +2586 -1067
- package/Runtime/GNNetworkMasterPlayerApi.cs.meta +11 -11
- package/Runtime/GNNetworkMultiplayerApi.cs +328 -147
- package/Runtime/GNNetworkMultiplayerApi.cs.meta +11 -11
- package/Runtime/GNNetworkStoreInventoryApi.cs +388 -162
- package/Runtime/GNNetworkStoreInventoryApi.cs.meta +11 -11
- package/Runtime/Helper/CodeHelper.cs +140 -98
- package/Runtime/Helper/CodeHelper.cs.meta +11 -11
- package/Runtime/Helper/ConverterService.cs +236 -52
- package/Runtime/Helper/ConverterService.cs.meta +11 -11
- package/Runtime/Helper/ParseGNHelper.cs +451 -451
- package/Runtime/Helper/ParseGNHelper.cs.meta +11 -11
- package/Runtime/Helper.meta +8 -8
- package/Runtime/Logger/GNDebug.cs +92 -49
- package/Runtime/Logger/GNDebug.cs.meta +11 -11
- package/Runtime/Logger.meta +8 -8
- package/Runtime/Networking/AuthenticateStatus.cs +57 -35
- package/Runtime/Networking/AuthenticateStatus.cs.meta +11 -11
- package/Runtime/Networking/Handler/IServerEventHandler.cs +25 -25
- package/Runtime/Networking/Handler/IServerEventHandler.cs.meta +11 -11
- package/Runtime/Networking/Handler/OnCharacterPlayerFriendUpdateEventHandler.cs +61 -32
- package/Runtime/Networking/Handler/OnCharacterPlayerFriendUpdateEventHandler.cs.meta +11 -11
- package/Runtime/Networking/Handler/OnCharacterPlayerGroupUpdateEventHandler.cs +54 -33
- package/Runtime/Networking/Handler/OnCharacterPlayerGroupUpdateEventHandler.cs.meta +11 -11
- package/Runtime/Networking/Handler/OnGamePlayerFriendUpdateEventHandler.cs +54 -32
- package/Runtime/Networking/Handler/OnGamePlayerFriendUpdateEventHandler.cs.meta +11 -11
- package/Runtime/Networking/Handler/OnGamePlayerGroupUpdateEventHandler.cs +54 -32
- package/Runtime/Networking/Handler/OnGamePlayerGroupUpdateEventHandler.cs.meta +11 -11
- package/Runtime/Networking/Handler/OnGroupMemberUpdateEventHandler.cs +48 -29
- package/Runtime/Networking/Handler/OnGroupMemberUpdateEventHandler.cs.meta +11 -11
- package/Runtime/Networking/Handler/OnGroupMessageUpdateEventHandler.cs +47 -29
- package/Runtime/Networking/Handler/OnGroupMessageUpdateEventHandler.cs.meta +11 -11
- package/Runtime/Networking/Handler.meta +8 -8
- package/Runtime/Networking/Http/HttpPeer.cs +68 -25
- package/Runtime/Networking/Http/HttpPeer.cs.meta +11 -11
- package/Runtime/Networking/Http/NetworkingHttpPeerBase.cs +65 -25
- package/Runtime/Networking/Http/NetworkingHttpPeerBase.cs.meta +11 -11
- package/Runtime/Networking/Http/NetworkingPeerHttpClientRequest.cs +513 -486
- package/Runtime/Networking/Http/NetworkingPeerHttpClientRequest.cs.meta +11 -11
- package/Runtime/Networking/Http/NetworkingPeerHttpRequest.cs +172 -142
- package/Runtime/Networking/Http/NetworkingPeerHttpRequest.cs.meta +11 -11
- package/Runtime/Networking/Http/NetworkingPeerUnityWebRequest.cs +225 -188
- package/Runtime/Networking/Http/NetworkingPeerUnityWebRequest.cs.meta +11 -11
- package/Runtime/Networking/Http.meta +8 -8
- package/Runtime/Networking/IPeer.cs +41 -19
- package/Runtime/Networking/IPeer.cs.meta +11 -11
- package/Runtime/Networking/NetworkingPeer.cs +198 -144
- package/Runtime/Networking/NetworkingPeer.cs.meta +11 -11
- package/Runtime/Networking/NetworkingPeerAPI.cs +20 -21
- package/Runtime/Networking/NetworkingPeerAPI.cs.meta +11 -11
- package/Runtime/Networking/OperationPending.cs +159 -95
- package/Runtime/Networking/OperationPending.cs.meta +11 -11
- package/Runtime/Networking/PeerBase.cs +305 -242
- package/Runtime/Networking/PeerBase.cs.meta +11 -11
- package/Runtime/Networking/Socket/NetworkingPeerSocketV2.cs +222 -185
- package/Runtime/Networking/Socket/NetworkingPeerSocketV2.cs.meta +11 -11
- package/Runtime/Networking/Socket/NetworkingPeerSocketV3.cs +235 -177
- package/Runtime/Networking/Socket/NetworkingPeerSocketV3.cs.meta +11 -11
- package/Runtime/Networking/Socket/NetworkingSocketPeerBase.cs +165 -23
- package/Runtime/Networking/Socket/NetworkingSocketPeerBase.cs.meta +11 -11
- package/Runtime/Networking/Socket/SocketPeer.cs +242 -197
- package/Runtime/Networking/Socket/SocketPeer.cs.meta +11 -11
- package/Runtime/Networking/Socket.meta +8 -8
- package/Runtime/Networking.meta +8 -8
- package/Runtime/Unity/ServiceCoroutine.cs +10 -0
- package/Runtime/Unity/ServiceCoroutine.cs.meta +11 -0
- package/Runtime/Unity/ServiceUpdate.cs +33 -20
- package/Runtime/Unity/ServiceUpdate.cs.meta +11 -11
- package/Runtime/Unity.meta +8 -8
- package/Runtime/XmobiTea.GN.runtime.asmdef +16 -16
- package/Runtime/XmobiTea.GN.runtime.asmdef.meta +7 -7
- package/package.json +1 -1
|
@@ -1,302 +1,387 @@
|
|
|
1
|
-
namespace XmobiTea.GN.Common
|
|
2
|
-
{
|
|
3
|
-
using System;
|
|
4
|
-
using System.Collections.Generic;
|
|
5
|
-
using System.Text;
|
|
6
|
-
|
|
7
|
-
/// <summary>
|
|
8
|
-
///
|
|
9
|
-
/// </summary>
|
|
10
|
-
public class GNArray : GNData
|
|
11
|
-
{
|
|
12
|
-
/// <summary>
|
|
13
|
-
///
|
|
14
|
-
/// </summary>
|
|
15
|
-
public class Builder
|
|
16
|
-
{
|
|
17
|
-
/// <summary>
|
|
18
|
-
/// The
|
|
19
|
-
/// </summary>
|
|
20
|
-
private List<object> array;
|
|
21
|
-
|
|
22
|
-
/// <summary>
|
|
23
|
-
///
|
|
24
|
-
/// </summary>
|
|
25
|
-
/// <param name="value">The value
|
|
26
|
-
/// <returns
|
|
27
|
-
public Builder add(object value)
|
|
28
|
-
{
|
|
29
|
-
this.array.Add(value);
|
|
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
|
-
return
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
return
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
public
|
|
225
|
-
{
|
|
226
|
-
return this.get(k, defaultValue);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
public
|
|
241
|
-
{
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
public
|
|
257
|
-
{
|
|
258
|
-
return (
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
1
|
+
namespace XmobiTea.GN.Common
|
|
2
|
+
{
|
|
3
|
+
using System;
|
|
4
|
+
using System.Collections.Generic;
|
|
5
|
+
using System.Text;
|
|
6
|
+
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// Represents a GNData array, which can be used for request or response data.
|
|
9
|
+
/// </summary>
|
|
10
|
+
public class GNArray : GNData
|
|
11
|
+
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
/// A builder class to help construct a GNArray.
|
|
14
|
+
/// </summary>
|
|
15
|
+
public class Builder
|
|
16
|
+
{
|
|
17
|
+
/// <summary>
|
|
18
|
+
/// The internal list representing the array.
|
|
19
|
+
/// </summary>
|
|
20
|
+
private List<object> array;
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
/// Adds a value to the internal array.
|
|
24
|
+
/// </summary>
|
|
25
|
+
/// <param name="value">The value to add, must be a supported type.</param>
|
|
26
|
+
/// <returns>The current Builder instance.</returns>
|
|
27
|
+
public Builder add(object value)
|
|
28
|
+
{
|
|
29
|
+
this.array.Add(value);
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/// <summary>
|
|
34
|
+
/// Adds a collection of values to the internal array.
|
|
35
|
+
/// </summary>
|
|
36
|
+
/// <param name="list">The list of values to add.</param>
|
|
37
|
+
/// <returns>The current Builder instance.</returns>
|
|
38
|
+
public Builder addAll(System.Collections.IList list)
|
|
39
|
+
{
|
|
40
|
+
foreach (var o in list)
|
|
41
|
+
{
|
|
42
|
+
this.add(o);
|
|
43
|
+
}
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/// <summary>
|
|
48
|
+
/// Builds and returns the GNArray.
|
|
49
|
+
/// </summary>
|
|
50
|
+
/// <returns>The constructed GNArray instance.</returns>
|
|
51
|
+
public GNArray build()
|
|
52
|
+
{
|
|
53
|
+
var answer = new GNArray();
|
|
54
|
+
foreach (var o in this.array)
|
|
55
|
+
{
|
|
56
|
+
answer.add(o);
|
|
57
|
+
}
|
|
58
|
+
return answer;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/// <summary>
|
|
62
|
+
/// Initializes a new instance of the Builder class.
|
|
63
|
+
/// </summary>
|
|
64
|
+
public Builder()
|
|
65
|
+
{
|
|
66
|
+
this.array = new List<object>();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/// <summary>
|
|
71
|
+
/// The internal array storing the data.
|
|
72
|
+
/// </summary>
|
|
73
|
+
private List<object> array;
|
|
74
|
+
|
|
75
|
+
/// <summary>
|
|
76
|
+
/// Initializes a new instance of the GNArray class.
|
|
77
|
+
/// </summary>
|
|
78
|
+
public GNArray()
|
|
79
|
+
{
|
|
80
|
+
this.array = new List<object>();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/// <summary>
|
|
84
|
+
/// Adds a value to the GNArray.
|
|
85
|
+
/// </summary>
|
|
86
|
+
/// <param name="value">The value to add.</param>
|
|
87
|
+
public void add(object value)
|
|
88
|
+
{
|
|
89
|
+
this.array.Add(GNData.createUseDataFromOriginData(value));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/// <summary>
|
|
93
|
+
/// Gets or sets a value in the GNArray by index.
|
|
94
|
+
/// </summary>
|
|
95
|
+
/// <param name="index">The index of the value.</param>
|
|
96
|
+
/// <returns>The value at the specified index.</returns>
|
|
97
|
+
public object this[int index]
|
|
98
|
+
{
|
|
99
|
+
get => this.get<object>(index);
|
|
100
|
+
set => this.array[index] = GNData.createUseDataFromOriginData(value);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/// <summary>
|
|
104
|
+
/// Gets all values in the GNArray as a collection.
|
|
105
|
+
/// </summary>
|
|
106
|
+
/// <returns>A collection of all values in the GNArray.</returns>
|
|
107
|
+
public ICollection<object> values()
|
|
108
|
+
{
|
|
109
|
+
return this.array;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/// <summary>
|
|
113
|
+
/// Clears all elements in the GNArray.
|
|
114
|
+
/// </summary>
|
|
115
|
+
public void clear()
|
|
116
|
+
{
|
|
117
|
+
this.array.Clear();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/// <summary>
|
|
121
|
+
/// Removes a value at the specified index.
|
|
122
|
+
/// </summary>
|
|
123
|
+
/// <param name="index">The index of the value to remove.</param>
|
|
124
|
+
/// <returns>True if the value was removed.</returns>
|
|
125
|
+
public bool remove(int index)
|
|
126
|
+
{
|
|
127
|
+
this.array.RemoveAt(index);
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/// <summary>
|
|
132
|
+
/// Gets the number of elements in the GNArray.
|
|
133
|
+
/// </summary>
|
|
134
|
+
/// <returns>The number of elements.</returns>
|
|
135
|
+
public int count()
|
|
136
|
+
{
|
|
137
|
+
return this.array.Count;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/// <summary>
|
|
141
|
+
/// Gets a value at the specified index.
|
|
142
|
+
/// </summary>
|
|
143
|
+
/// <typeparam name="T">The expected type of the value.</typeparam>
|
|
144
|
+
/// <param name="k">The index.</param>
|
|
145
|
+
/// <param name="defaultValue">The default value to return if the index is invalid.</param>
|
|
146
|
+
/// <returns>The value at the index or the default value.</returns>
|
|
147
|
+
protected object get<T>(int k, T defaultValue = default(T))
|
|
148
|
+
{
|
|
149
|
+
if (k < 0 || k > this.array.Count - 1) return defaultValue;
|
|
150
|
+
|
|
151
|
+
var value = this.array[k];
|
|
152
|
+
if (value == null) return defaultValue;
|
|
153
|
+
|
|
154
|
+
return value is T t ? t : value;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/// <summary>
|
|
158
|
+
/// Converts the GNArray to an array of the specified type.
|
|
159
|
+
/// </summary>
|
|
160
|
+
/// <typeparam name="T">The target type.</typeparam>
|
|
161
|
+
/// <returns>An array of the target type.</returns>
|
|
162
|
+
public T[] toArray<T>()
|
|
163
|
+
{
|
|
164
|
+
var answer = new T[this.array.Count];
|
|
165
|
+
for (var i = 0; i < this.array.Count; i++)
|
|
166
|
+
{
|
|
167
|
+
answer[i] = (T)this.customGet(i);
|
|
168
|
+
}
|
|
169
|
+
return answer;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/// <summary>
|
|
173
|
+
/// Converts the GNArray to a list of the specified type.
|
|
174
|
+
/// </summary>
|
|
175
|
+
/// <typeparam name="T">The target type.</typeparam>
|
|
176
|
+
/// <returns>A list of the target type.</returns>
|
|
177
|
+
public IList<T> toList<T>()
|
|
178
|
+
{
|
|
179
|
+
var answer = new List<T>();
|
|
180
|
+
for (var i = 0; i < this.array.Count; i++)
|
|
181
|
+
{
|
|
182
|
+
answer.Add((T)this.customGet(i));
|
|
183
|
+
}
|
|
184
|
+
return answer;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/// <summary>
|
|
188
|
+
/// Helper method to retrieve and convert a value at a specified index based on its type.
|
|
189
|
+
/// </summary>
|
|
190
|
+
/// <param name="k">The index of the value.</param>
|
|
191
|
+
/// <returns>The converted value or null if the index is invalid.</returns>
|
|
192
|
+
private object customGet(int k)
|
|
193
|
+
{
|
|
194
|
+
var obj = this.get<object>(k);
|
|
195
|
+
if (obj == null) return null;
|
|
196
|
+
|
|
197
|
+
var objType = obj.GetType();
|
|
198
|
+
if (objType == typeof(byte)) return this.getByte(k);
|
|
199
|
+
else if (objType == typeof(sbyte)) return this.getSByte(k);
|
|
200
|
+
else if (objType == typeof(short)) return this.getShort(k);
|
|
201
|
+
else if (objType == typeof(int)) return this.getInt(k);
|
|
202
|
+
else if (objType == typeof(float)) return this.getFloat(k);
|
|
203
|
+
else if (objType == typeof(long)) return this.getLong(k);
|
|
204
|
+
else if (objType == typeof(double)) return this.getDouble(k);
|
|
205
|
+
else if (objType == typeof(bool)) return this.getBool(k);
|
|
206
|
+
else if (objType == typeof(string)) return this.getString(k);
|
|
207
|
+
else if (objType == typeof(GNArray) || objType == typeof(System.Collections.IList)) return this.getGNArray(k);
|
|
208
|
+
else if (objType == typeof(GNHashtable) || objType == typeof(System.Collections.IDictionary)) return this.getGNHashtable(k);
|
|
209
|
+
|
|
210
|
+
return obj;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/// <summary>
|
|
214
|
+
/// Retrieves a byte value at the specified index.
|
|
215
|
+
/// </summary>
|
|
216
|
+
public byte getByte(int k, byte defaultValue = 0)
|
|
217
|
+
{
|
|
218
|
+
return Convert.ToByte(this.get(k, defaultValue));
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/// <summary>
|
|
222
|
+
/// Retrieves an sbyte value at the specified index.
|
|
223
|
+
/// </summary>
|
|
224
|
+
public sbyte getSByte(int k, sbyte defaultValue = 0)
|
|
225
|
+
{
|
|
226
|
+
return Convert.ToSByte(this.get(k, defaultValue));
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/// <summary>
|
|
230
|
+
/// Retrieves a short value at the specified index.
|
|
231
|
+
/// </summary>
|
|
232
|
+
public short getShort(int k, short defaultValue = 0)
|
|
233
|
+
{
|
|
234
|
+
return Convert.ToInt16(this.get(k, defaultValue));
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/// <summary>
|
|
238
|
+
/// Retrieves an int value at the specified index.
|
|
239
|
+
/// </summary>
|
|
240
|
+
public int getInt(int k, int defaultValue = 0)
|
|
241
|
+
{
|
|
242
|
+
return Convert.ToInt32(this.get(k, defaultValue));
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/// <summary>
|
|
246
|
+
/// Retrieves a float value at the specified index.
|
|
247
|
+
/// </summary>
|
|
248
|
+
public float getFloat(int k, float defaultValue = 0)
|
|
249
|
+
{
|
|
250
|
+
return Convert.ToSingle(this.get(k, defaultValue));
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/// <summary>
|
|
254
|
+
/// Retrieves a long value at the specified index.
|
|
255
|
+
/// </summary>
|
|
256
|
+
public long getLong(int k, long defaultValue = 0)
|
|
257
|
+
{
|
|
258
|
+
return Convert.ToInt64(this.get(k, defaultValue));
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/// <summary>
|
|
262
|
+
/// Retrieves a double value at the specified index.
|
|
263
|
+
/// </summary>
|
|
264
|
+
public double getDouble(int k, double defaultValue = 0)
|
|
265
|
+
{
|
|
266
|
+
return Convert.ToDouble(this.get(k, defaultValue));
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/// <summary>
|
|
270
|
+
/// Retrieves a bool value at the specified index.
|
|
271
|
+
/// </summary>
|
|
272
|
+
public bool getBool(int k, bool defaultValue = false)
|
|
273
|
+
{
|
|
274
|
+
return Convert.ToBoolean(this.get(k, defaultValue));
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/// <summary>
|
|
278
|
+
/// Retrieves a string value at the specified index.
|
|
279
|
+
/// </summary>
|
|
280
|
+
public string getString(int k, string defaultValue = null)
|
|
281
|
+
{
|
|
282
|
+
return Convert.ToString(this.get(k, defaultValue));
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/// <summary>
|
|
286
|
+
/// Retrieves an object value at the specified index.
|
|
287
|
+
/// </summary>
|
|
288
|
+
public object getObject(int k, object defaultValue = null)
|
|
289
|
+
{
|
|
290
|
+
return this.get(k, defaultValue);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/// <summary>
|
|
294
|
+
/// Retrieves an array of the specified type at the specified index.
|
|
295
|
+
/// </summary>
|
|
296
|
+
public T[] getArray<T>(int k, T[] defaultValue = null)
|
|
297
|
+
{
|
|
298
|
+
var value0 = this.getGNArray(k);
|
|
299
|
+
if (value0 != null)
|
|
300
|
+
{
|
|
301
|
+
return value0.toArray<T>();
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
return defaultValue;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/// <summary>
|
|
308
|
+
/// Retrieves a list of the specified type at the specified index.
|
|
309
|
+
/// </summary>
|
|
310
|
+
public IList<T> getList<T>(int k, IList<T> defaultValue = null)
|
|
311
|
+
{
|
|
312
|
+
var value0 = this.getGNArray(k);
|
|
313
|
+
if (value0 != null)
|
|
314
|
+
{
|
|
315
|
+
return value0.toList<T>();
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
return defaultValue;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/// <summary>
|
|
322
|
+
/// Retrieves a GNArray value at the specified index.
|
|
323
|
+
/// </summary>
|
|
324
|
+
public GNArray getGNArray(int k, GNArray defaultValue = null)
|
|
325
|
+
{
|
|
326
|
+
return (GNArray)this.get(k, defaultValue);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/// <summary>
|
|
330
|
+
/// Retrieves a GNHashtable value at the specified index.
|
|
331
|
+
/// </summary>
|
|
332
|
+
public GNHashtable getGNHashtable(int k, GNHashtable defaultValue = null)
|
|
333
|
+
{
|
|
334
|
+
return (GNHashtable)this.get(k, defaultValue);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/// <summary>
|
|
338
|
+
/// Converts the GNArray into a data object suitable for serialization.
|
|
339
|
+
/// </summary>
|
|
340
|
+
public override object toData()
|
|
341
|
+
{
|
|
342
|
+
var answer = new List<object>();
|
|
343
|
+
|
|
344
|
+
foreach (var c in this.array)
|
|
345
|
+
{
|
|
346
|
+
answer.Add(GNData.createDataFromUseData(c));
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
return answer;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/// <summary>
|
|
353
|
+
/// Converts the GNArray into a string representation.
|
|
354
|
+
/// </summary>
|
|
355
|
+
public override string toString()
|
|
356
|
+
{
|
|
357
|
+
var stringBuilder = new StringBuilder();
|
|
358
|
+
stringBuilder.Append("[");
|
|
359
|
+
|
|
360
|
+
for (var i = 0; i < this.array.Count; i++)
|
|
361
|
+
{
|
|
362
|
+
if (i != 0) stringBuilder.Append(",");
|
|
363
|
+
|
|
364
|
+
var value = this.array[i];
|
|
365
|
+
|
|
366
|
+
if (value == null) stringBuilder.Append("null");
|
|
367
|
+
else if (value is GNData gnData) stringBuilder.Append(gnData.ToString());
|
|
368
|
+
else if (value is string valueStr) stringBuilder.Append("\"" + valueStr + "\"");
|
|
369
|
+
else if (value is bool boolValue) stringBuilder.Append(boolValue.ToString().ToLower());
|
|
370
|
+
else stringBuilder.Append(value);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
stringBuilder.Append("]");
|
|
374
|
+
return stringBuilder.ToString();
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/// <summary>
|
|
378
|
+
/// Returns the string representation of the GNArray.
|
|
379
|
+
/// </summary>
|
|
380
|
+
public override string ToString()
|
|
381
|
+
{
|
|
382
|
+
return this.toString();
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
}
|