示例#1
0
 public override JSONNode this[int aIndex]
 {
     get
     {
         if (aIndex < 0 || aIndex >= this.m_Dict.Count)
         {
             return((JSONNode)null);
         }
         return(this.m_Dict.ElementAt <KeyValuePair <string, JSONNode> >(aIndex).Value);
     }
     set
     {
         if (value == (object)null)
         {
             value = (JSONNode)JSONNull.CreateOrGet();
         }
         if (aIndex < 0 || aIndex >= this.m_Dict.Count)
         {
             return;
         }
         this.m_Dict[this.m_Dict.ElementAt <KeyValuePair <string, JSONNode> >(aIndex).Key] = value;
     }
 }
示例#2
0
        private static JSONNode ParseElement(string token, bool quoted)
        {
            if (quoted)
            {
                return((JSONNode)token);
            }
            string lower = token.ToLower();

            if (lower == "false" || lower == "true")
            {
                return((JSONNode)(lower == "true"));
            }
            if (lower == "null")
            {
                return((JSONNode)JSONNull.CreateOrGet());
            }
            double result;

            if (double.TryParse(token, NumberStyles.Float, (IFormatProvider)CultureInfo.InvariantCulture, out result))
            {
                return((JSONNode)result);
            }
            return((JSONNode)token);
        }