public JSONNode GetDataSet(string strKey, bool bMake = false) { if (m_RootNode == null) { return(null); } foreach (JSONNode nodeData in m_RootNode.Children) { JSONObject data = nodeData[strKey] as JSONObject; if (data != null) { return(data); } else if (bMake) { JSONObject classData = JSONDataStruct.MakeDictionary(); nodeData[strKey] = classData; return(classData); } } return(null); }
public void AddData(string strKey, string strData) { if (m_RootNode == null) { m_RootNode = JSONDataStruct.MakeDictionary(); } m_RootNode.Add(strKey, strData); }
public void MakeMainNode(string strMainKey) { if (m_RootNode == null) { m_RootNode = JSONDataStruct.MakeDictionary(); } JSONObject classNode = JSONDataStruct.MakeDictionary(); m_RootNode.Add(strMainKey, classNode); }
public JSONNode AddDataSet(string strKey) { if (m_RootNode == null) { return(null); } JSONNode newData = JSONDataStruct.MakeDictionary(); foreach (JSONNode nodeData in m_RootNode.Children) { nodeData.Add(strKey, newData); break; } return(GetDataSet(strKey)); }
public JSONNode AddDataSet(int nIndex) { if (m_RootNode == null) { return(null); } JSONNode newData = JSONDataStruct.MakeDictionary(); foreach (JSONNode nodeData in m_RootNode.Children) { nodeData.Add(nIndex.ToString(), newData); break; } return(GetDataSet(nIndex)); }
public static JSONObject DicToJSON(Dictionary <int, int> dicData) { JSONObject dic = JSONDataStruct.MakeDictionary(); if (dicData == null) { return(dic); } var enumerator = dicData.GetEnumerator(); while (enumerator.MoveNext()) { dic.Add(enumerator.Current.Key.ToString(), enumerator.Current.Value); } return(dic); }