Exemple #1
0
 public JsonData this[int index]
 {
     get
     {
         this.EnsureCollection();
         if (this.type == JsonType.Array)
         {
             return(this.inst_array[index] as JsonData);
         }
         return((this.object_list[index] as JsonKeyValuePair).Value);
     }
     set
     {
         this.EnsureCollection();
         if (this.type == JsonType.Array)
         {
             this.inst_array[index] = value;
         }
         else
         {
             JsonKeyValuePair jsonKeyValuePair = this.object_list[index] as JsonKeyValuePair;
             JsonKeyValuePair value2           = new JsonKeyValuePair(jsonKeyValuePair.Key, value);
             this.object_list[index] = value2;
             this.inst_object[jsonKeyValuePair.Key] = value;
         }
         this.json = null;
     }
 }
Exemple #2
0
 public JsonData this[string prop_name]
 {
     get
     {
         this.EnsureDictionary();
         return(this.inst_object[prop_name] as JsonData);
     }
     set
     {
         this.EnsureDictionary();
         JsonKeyValuePair value2 = new JsonKeyValuePair(prop_name, value);
         if (this.inst_object.Contains(prop_name))
         {
             for (int i = 0; i < this.object_list.Count; i++)
             {
                 if ((this.object_list[i] as JsonKeyValuePair).Key == prop_name)
                 {
                     this.object_list[i] = value2;
                     break;
                 }
             }
         }
         else
         {
             this.object_list.Add(value2);
         }
         this.inst_object[prop_name] = value;
         this.json = null;
     }
 }
Exemple #3
0
        /**
         */
        public JsonData this[int index] {
            get {
                EnsureCollection();

                if (type == JsonType.Array)
                {
                    return(inst_array[index] as JsonData);
                }

                return((object_list[index] as JsonKeyValuePair).Value);
            }

            set {
                EnsureCollection();

                if (type == JsonType.Array)
                {
                    inst_array[index] = value;
                }
                else
                {
                    JsonKeyValuePair entry     = object_list[index] as JsonKeyValuePair;
                    JsonKeyValuePair new_entry = new JsonKeyValuePair(entry.Key, value);

                    object_list[index]     = new_entry;
                    inst_object[entry.Key] = value;
                }

                json = null;
            }
        }
Exemple #4
0
        /**
         */
        public JsonData this[string prop_name] {
            get {
                EnsureDictionary();
                return(inst_object[prop_name] as JsonData);
            }

            set {
                EnsureDictionary();

                JsonKeyValuePair entry = new JsonKeyValuePair(prop_name, value);

                if (inst_object.Contains(prop_name))
                {
                    for (int i = 0; i < object_list.Count; i++)
                    {
                        if ((object_list[i] as JsonKeyValuePair).Key == prop_name)
                        {
                            object_list[i] = entry;
                            break;
                        }
                    }
                }
                else
                {
                    object_list.Add(entry);
                }

                inst_object[prop_name] = value;

                json = null;
            }
        }
Exemple #5
0
        void IDictionary.Add(object key, object value)
        {
            JsonData jsonData = this.ToJsonData(value);

            this.EnsureDictionary().Add(key, jsonData);
            JsonKeyValuePair value2 = new JsonKeyValuePair((string)key, jsonData);

            this.object_list.Add(value2);
            this.json = null;
        }
Exemple #6
0
        void IDictionary.Add(object key, object value)
        {
            JsonData data = ToJsonData(value);

            EnsureDictionary().Add(key, data);

            JsonKeyValuePair entry = new JsonKeyValuePair((string)key, data);

            object_list.Add(entry);

            json = null;
        }
Exemple #7
0
        void IDictionary.Add (object key, object value)
        {
        	JsonData data = ToJsonData (value);

            EnsureDictionary ().Add (key, data);

            JsonKeyValuePair entry = new JsonKeyValuePair((string) key, data);
            object_list.Add(entry);

            json = null;
        }
Exemple #8
0
		/**
		 */
		public JsonData this[int index] {
            get {
                EnsureCollection ();

                if (type == JsonType.Array)
                    return inst_array[index] as JsonData;

                return (object_list[index] as JsonKeyValuePair).Value;
            }

            set {
                EnsureCollection ();

                if (type == JsonType.Array)
                    inst_array[index] = value;
                else {
                    JsonKeyValuePair entry = object_list[index] as JsonKeyValuePair;
                    JsonKeyValuePair new_entry = new JsonKeyValuePair(entry.Key, value);

                    object_list[index] = new_entry;
                    inst_object[entry.Key] = value;
                }

                json = null;
                
            }
        }
Exemple #9
0
		/**
		 */
		public JsonData this[string prop_name] {
            get {
            	EnsureDictionary ();
                return inst_object[prop_name] as JsonData;
                
            }

            set {
                EnsureDictionary ();

                JsonKeyValuePair entry = new JsonKeyValuePair(prop_name, value);
               
                if (inst_object.Contains(prop_name)) {
                    for (int i = 0; i < object_list.Count; i++) {
                        if ((object_list[i] as JsonKeyValuePair).Key == prop_name) {
                            object_list[i] = entry;
                            break;
                        }
                    }
                } else {
                    object_list.Add (entry);
                }    

                inst_object[prop_name] = value;

                json = null;
            }
        }