コード例 #1
0
ファイル: JSONParser.cs プロジェクト: zunaalabaya/TAC-BOT
 private static object parseArray(JSONParser.Context ctx, Type elementType)
 {
     if ((object)elementType == (object)typeof(int))
     {
         return(JSONParser.parseValueArray <int>(ctx, new JSONParser.ParseElement <int>(JSONParser.intParser)));
     }
     if ((object)elementType == (object)typeof(long))
     {
         return(JSONParser.parseValueArray <long>(ctx, new JSONParser.ParseElement <long>(JSONParser.longParser)));
     }
     if ((object)elementType == (object)typeof(float))
     {
         return(JSONParser.parseValueArray <float>(ctx, new JSONParser.ParseElement <float>(JSONParser.floatParser)));
     }
     if ((object)elementType == (object)typeof(double))
     {
         return(JSONParser.parseValueArray <double>(ctx, new JSONParser.ParseElement <double>(JSONParser.doubleParser)));
     }
     if ((object)elementType == (object)typeof(short))
     {
         return(JSONParser.parseValueArray <short>(ctx, new JSONParser.ParseElement <short>(JSONParser.shortParser)));
     }
     if ((object)elementType == (object)typeof(byte))
     {
         return(JSONParser.parseValueArray <byte>(ctx, new JSONParser.ParseElement <byte>(JSONParser.byteParser)));
     }
     if ((object)elementType == (object)typeof(string))
     {
         return(JSONParser.parseObjectArray(ctx, new JSONParser.ParseElement <object>(JSONParser.stringParser), elementType));
     }
     if ((object)elementType != null && elementType.IsValueType)
     {
         throw new JSONParser.UnsupportedTypeException(ctx);
     }
     if ((object)elementType == null)
     {
         return(JSONParser.parseObjectArray(ctx, new JSONParser.ParseElement <object>(JSONParser.ignoreValue), (Type)null));
     }
     return(JSONParser.parseObjectArray(ctx, new JSONParser.ParseElement <object>(JSONParser.objectParser), elementType));
 }