Ejemplo n.º 1
0
        public void putJSONArray(String key, JSONArray value)
        {
            if (!this.Contains(key))
            {
                pcontents = pcontents.Substring(0, pcontents.Length - 1) + ",\"" + key + "\": " + value.toString() + "}";
                pcontents = Regex.Replace(pcontents, "\\{\\s*,", "{");
                format();
                return;
            }
            int startInd = 0;

            while (pcontents.Substring(startInd).Contains("\"" + key + "\""))
            {
                startInd = pcontents.IndexOf("\"" + key + "\":", startInd) + 1;
                if (new bottleJson().checkJson(" {" + pcontents.Substring(startInd, pcontents.Length - startInd) + " ") && new bottleJson().checkJson(" " + pcontents.Substring(0, startInd) + "} "))
                {
                    startInd = pcontents.IndexOf("[", startInd + key.Length + 2);
                    int endInd = startInd;
                    while (pcontents.Substring(endInd + 1).Contains("]"))
                    {
                        endInd = pcontents.IndexOf("]", endInd + 1);
                        if (new bottleJson().checkJson(" [" + pcontents.Substring(endInd + 1, pcontents.Length - endInd - 1) + " ") && new bottleJson().checkJson(" " + pcontents.Substring(0, endInd + 1) + "] "))
                        {
                            break;
                        }
                    }
                    pcontents = pcontents.Substring(0, startInd) + value.toString() + pcontents.Substring(endInd + 1);
                }
            }
            format();
        }
Ejemplo n.º 2
0
 public void putJSONArray(int index, JSONArray value)
 {
     ArrList[index] = value.toString();
     ReGen();
 }