public override void Add (string aKey, JSONNode aItem) { var tmp = new JSONClass(); tmp.Add(aKey, aItem); Set(tmp); }
public Response(WWW www, ResponseFormat format = ResponseFormat.Json) { if (www.error != null) { this.success = false; Debug.LogWarning(www.error); return; } this.format = format; switch (format) { case ResponseFormat.Dump: this.success = www.text.StartsWith("SUCCESS"); var returnIndex = www.text.IndexOf ('\n'); if (returnIndex != -1) { this.dump = www.text.Substring(returnIndex + 1); } if (!this.success) { Debug.LogWarning(this.dump); this.dump = null; } break; case ResponseFormat.Json: this.json = JSON.Parse(www.text)["response"]; this.success = this.json["success"].AsBool; if (!this.success) { Debug.LogWarning(this.json["message"]); this.json = null; } break; case ResponseFormat.Raw: this.success = true; this.bytes = www.bytes; break; case ResponseFormat.Texture: this.success = true; this.texture = www.texture; break; default: this.success = false; Debug.LogWarning("Unknown format. Cannot process response."); break; } }
private void Set(JSONNode aVal) { if (m_Key == null) { m_Node.Add(aVal); } else { m_Node.Add(m_Key, aVal); } m_Node = null; // Be GC friendly. }
public override void Add (JSONNode aItem) { var tmp = new JSONArray(); tmp.Add(aItem); Set(tmp); }
public JSONLazyCreator(JSONNode aNode) { m_Node = aNode; m_Key = null; }
public JSONLazyCreator(JSONNode aNode, string aKey) { m_Node = aNode; m_Key = aKey; }
public override void Add(string aKey, JSONNode aItem) { if (!string.IsNullOrEmpty(aKey)) { if (m_Dict.ContainsKey(aKey)) m_Dict[aKey] = aItem; else m_Dict.Add(aKey, aItem); } else m_Dict.Add(Guid.NewGuid().ToString(), aItem); }
public override JSONNode Remove(JSONNode aNode) { try { var item = m_Dict.Where(k => k.Value == aNode).First(); m_Dict.Remove(item.Key); return aNode; } catch { return null; } }
public virtual JSONNode Remove(JSONNode aNode) { return aNode; }
public override JSONNode Remove(JSONNode aNode) { m_List.Remove(aNode); return aNode; }
public override void Add(string aKey, JSONNode aItem) { m_List.Add(aItem); }
public virtual void Add(JSONNode aItem) { Add("", aItem); }
public virtual void Add(string aKey, JSONNode aItem){ }