Ejemplo n.º 1
0
    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);
    }
Ejemplo n.º 2
0
 public void AddData(string strKey, string strData)
 {
     if (m_RootNode == null)
     {
         m_RootNode = JSONDataStruct.MakeDictionary();
     }
     m_RootNode.Add(strKey, strData);
 }
Ejemplo n.º 3
0
    public void MakeMainNode(string strMainKey)
    {
        if (m_RootNode == null)
        {
            m_RootNode = JSONDataStruct.MakeDictionary();
        }

        JSONObject classNode = JSONDataStruct.MakeDictionary();

        m_RootNode.Add(strMainKey, classNode);
    }
Ejemplo n.º 4
0
    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));
    }
Ejemplo n.º 5
0
    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));
    }
Ejemplo n.º 6
0
    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);
    }