@@ -199,6 +199,16 @@ public static object getTypeValue(string val)
199
199
return val ;
200
200
201
201
}
202
+
203
+ public static bool isCommon ( Type returnType )
204
+ {
205
+ return returnType == typeof ( string ) || returnType == typeof ( bool ) ||
206
+ returnType == typeof ( float )
207
+ || returnType == typeof ( double ) || returnType == typeof ( String ) ||
208
+ returnType == typeof ( Vector )
209
+ || returnType == typeof ( int ) || returnType == typeof ( long ) || returnType == typeof ( char )
210
+ || returnType == typeof ( byte ) || returnType == typeof ( short ) ;
211
+ }
202
212
}
203
213
204
214
public class HandleDo : Handler
@@ -207,6 +217,16 @@ public JsonSetting[] handle(object api, Dictionary<string, string> mapper)
207
217
{
208
218
Type type = api . GetType ( ) ;
209
219
MethodInfo info = type . GetMethod ( mapper [ "do" ] ) ;
220
+ if ( mapper . ContainsKey ( "args" ) )
221
+ {
222
+ string [ ] args = Lib . getArray ( mapper [ "args" ] ) ;
223
+ object [ ] dArgs = new object [ args . Length ] ;
224
+ for ( int i = 0 ; i < args . Length ; i ++ )
225
+ {
226
+ dArgs [ i ] = Utils . getTypeValue ( args [ i ] ) ;
227
+ }
228
+ info . Invoke ( api , dArgs ) ;
229
+ }
210
230
info . Invoke ( api , null ) ;
211
231
return null ;
212
232
}
@@ -305,12 +325,7 @@ public JsonSetting[] handle(object api, Dictionary<string, string> mapper)
305
325
}
306
326
307
327
Type returnType = obj . GetType ( ) ;
308
- bool isCommonType = returnType == typeof ( string ) || returnType == typeof ( bool ) ||
309
- returnType == typeof ( float )
310
- || returnType == typeof ( double ) || returnType == typeof ( String ) ||
311
- returnType == typeof ( Vector )
312
- || returnType == typeof ( int ) || returnType == typeof ( long ) || returnType == typeof ( char )
313
- || returnType == typeof ( byte ) || returnType == typeof ( short ) ;
328
+ bool isCommonType = Utils . isCommon ( returnType ) ;
314
329
if ( isCommonType )
315
330
{
316
331
return Utils . getOne ( mapper [ "id" ] , obj , null ) ;
@@ -320,16 +335,23 @@ public JsonSetting[] handle(object api, Dictionary<string, string> mapper)
320
335
321
336
string fieldName = mapper [ "field" ] ;
322
337
string val = mapper [ fieldName ] ;
323
- object result = Utils . getTypeValue ( val ) ;
324
- if ( mapper . ContainsKey ( "apiId" ) )
338
+ //object result = Utils.getTypeValue(val);
339
+ object result ;
340
+ PropertyInfo info2 = type . GetProperty ( fieldName ) ;
341
+ Type returnType2 = info2 . PropertyType ;
342
+ if ( Utils . isCommon ( returnType2 ) )
325
343
{
326
- result = ProxyHandler . handler . apiMapping [ val ] ;
344
+ result = Utils . getTypeValue ( val ) ;
327
345
}
328
- PropertyInfo info2 = type . GetProperty ( fieldName ) ;
329
- if ( info2 != null )
346
+ else
330
347
{
331
- info2 . SetValue ( api , result ) ;
348
+ result = JsonConvert . DeserializeObject ( val , returnType2 ) ;
349
+ }
350
+ if ( mapper . ContainsKey ( "apiId" ) )
351
+ {
352
+ result = ProxyHandler . handler . apiMapping [ val ] ;
332
353
}
354
+ info2 . SetValue ( api , result ) ;
333
355
return null ;
334
356
}
335
357
}
0 commit comments