Пример #1
0
        /** インデックス配列にアイテム設定。
         *
         *      上書き。
         *
         */
        public void SetItem(int a_index, JsonItem a_item, bool a_clone)
        {
            if (this.jsonstring != null)
            {
                this.JsonStringToValue();
            }

            System.Collections.Generic.List <JsonItem> t_indexarray = this.value.GetIndexArray();
            if (t_indexarray != null)
            {
                if ((0 <= a_index) && (a_index < t_indexarray.Count))
                {
                    if ((a_clone == true) && (a_item != null))
                    {
                        t_indexarray[a_index] = a_item.Clone();
                    }
                    else
                    {
                        t_indexarray[a_index] = a_item;
                    }
                }
                else
                {
                    Tool.Assert(false);
                }
            }
        }
Пример #2
0
        /** 連想配列にアイテム設定。
         *
         *      上書き、追加。
         *
         */
        public void SetItem(string a_itemname, JsonItem a_item, bool a_clone)
        {
            if (this.jsonstring != null)
            {
                this.JsonStringToValue();
            }

            System.Collections.Generic.Dictionary <string, JsonItem> t_associativearray = this.value.GetAssociativeArray();
            if (t_associativearray != null)
            {
                if ((a_clone == true) && (a_item != null))
                {
                    if (t_associativearray.ContainsKey(a_itemname) == true)
                    {
                        t_associativearray[a_itemname] = a_item.Clone();
                    }
                    else
                    {
                        t_associativearray.Add(a_itemname, a_item.Clone());
                    }
                }
                else
                {
                    if (t_associativearray.ContainsKey(a_itemname) == true)
                    {
                        t_associativearray[a_itemname] = a_item;
                    }
                    else
                    {
                        t_associativearray.Add(a_itemname, a_item);
                    }
                }
            }
        }
Пример #3
0
        /** インデックス配列にアイテム追加。
         */
        public void AddItem(JsonItem a_item, bool a_clone)
        {
            if (this.jsonstring != null)
            {
                this.JsonStringToValue();
            }

            System.Collections.Generic.List <JsonItem> t_indexarray = this.value.GetIndexArray();
            if (t_indexarray != null)
            {
                if ((a_clone == true) && (a_item != null))
                {
                    t_indexarray.Add(a_item.Clone());
                }
                else
                {
                    t_indexarray.Add(a_item);
                }
            }
        }
Пример #4
0
        /** クローン。
         */
        public JsonItem Clone()
        {
            JsonItem t_new_jsonitem = new JsonItem(this.ConvertToJsonString());

            return(t_new_jsonitem);
        }