예제 #1
0
            private JsonList ParseArray()
            {
                Json.Parser.TOKEN nextToken;
                JsonList          jsonList = new JsonList();

                this.json.Read();
                bool flag = true;

Label1:
                while (flag)
                {
                    nextToken = this.NextToken;
                    switch (nextToken)
                    {
                    case Json.Parser.TOKEN.SQUARED_CLOSE:
                    {
                        flag = false;
                        continue;
                    }

                    case Json.Parser.TOKEN.COMMA:
                    {
                        continue;
                    }

                    default:
                    {
                        if (nextToken == Json.Parser.TOKEN.NONE)
                        {
                            break;
                        }
                        else
                        {
                            goto Label0;
                        }
                    }
                    }
                    return(null);
                }
                return(jsonList);

Label0:
                object obj = this.ParseByToken(nextToken);

                jsonList.Add(obj);
                if (obj == null)
                {
                    this.json.Read();
                }
                goto Label1;
            }
예제 #2
0
            private void SerializeArray(JsonList anArray)
            {
                this.builder.Append('[');
                bool flag = true;

                for (int i = 0; i < anArray.get_Count(); i++)
                {
                    object value = anArray.get_Item(i);
                    if (!flag)
                    {
                        this.builder.Append(',');
                    }
                    this.SerializeValue(value);
                    flag = false;
                }
                this.builder.Append(']');
            }
예제 #3
0
 private void SerializeValue(object value)
 {
     if (value != null)
     {
         string str  = value as string;
         string str1 = str;
         if (str != null)
         {
             this.SerializeString(str1);
         }
         else if (!(value is bool))
         {
             JsonList jsonList  = value as JsonList;
             JsonList jsonList1 = jsonList;
             if (jsonList == null)
             {
                 JsonNode jsonNode  = value as JsonNode;
                 JsonNode jsonNode1 = jsonNode;
                 if (jsonNode != null)
                 {
                     this.SerializeObject(jsonNode1);
                 }
                 else if (!(value is char))
                 {
                     this.SerializeOther(value);
                 }
                 else
                 {
                     this.SerializeString(new string((char)value, 1));
                 }
             }
             else
             {
                 this.SerializeArray(jsonList1);
             }
         }
         else
         {
             this.builder.Append((!(bool)value ? "false" : "true"));
         }
     }
     else
     {
         this.builder.Append("null");
     }
 }
예제 #4
0
            private void SerializeArray(JsonList anArray)
            {
                this.builder.Append('[');
                bool flag = true;

                for (int i = 0; i < anArray.Count; i++)
                {
                    object item = anArray[i];
                    if (!flag)
                    {
                        this.builder.Append(',');
                    }
                    this.SerializeValue(item);
                    flag = false;
                }
                this.builder.Append(']');
            }
예제 #5
0
            private JsonList ParseArray()
            {
                JsonList jsonList = new JsonList();

                this.json.Read();
                bool flag = true;

                while (flag)
                {
                    Json.Parser.TOKEN nextToken = this.NextToken;
                    Json.Parser.TOKEN tOKEN     = nextToken;
                    switch (tOKEN)
                    {
                    case Json.Parser.TOKEN.SQUARED_CLOSE:
                        flag = false;
                        continue;

                    case Json.Parser.TOKEN.COLON:
IL_38:
                        if (tOKEN != Json.Parser.TOKEN.NONE)
                        {
                            object obj = this.ParseByToken(nextToken);
                            jsonList.Add(obj);
                            if (obj == null)
                            {
                                this.json.Read();
                            }
                            continue;
                        }
                        return(null);

                    case Json.Parser.TOKEN.COMMA:
                        continue;
                    }
                    goto IL_38;
                }
                return(jsonList);
            }
예제 #6
0
            private JsonList ParseArray()
            {
                JsonList jsonList = new JsonList();

                this.json.Read();
                bool flag = true;

                while (flag)
                {
                    Json.Parser.TOKEN nextToken = this.NextToken;
                    switch (nextToken)
                    {
                    case Json.Parser.TOKEN.SQUARED_CLOSE:
                        flag = false;
                        break;

                    default:
                    {
                        if (nextToken == Json.Parser.TOKEN.NONE)
                        {
                            return(null);
                        }
                        object obj = this.ParseByToken(nextToken);
                        jsonList.Add(obj);
                        if (obj == null)
                        {
                            this.json.Read();
                        }
                        break;
                    }

                    case Json.Parser.TOKEN.COMMA:
                        break;
                    }
                }
                return(jsonList);
            }