예제 #1
0
    public void Store()
    {
        string fileFullName = Application.persistentDataPath + "/" + m_datafileMgr;
        string data         = "<save>\n";

        foreach (KeyValuePair <string, StorageKey> sectionPair in m_serialized)
        {
            StorageKey sk = sectionPair.Value;
            data += "\t<section name=\"" + sectionPair.Key + "\">\n";
            List <KeyValuePair <string, object> > pairList = sk.GetList();
            foreach (KeyValuePair <string, object> pairStrObj in pairList)
            {
                System.Type type     = pairStrObj.Value.GetType();
                string      strType  = type.ToString();
                string      strValue = pairStrObj.Value.ToString();
                data += "\t\t<field name=\"" + pairStrObj.Key + "\" type=\"" + strType + "\" value=\"" + strValue + "\"/>\n";
            }
            data += "\t</section>\n";
        }
        data += "</save>";
        System.IO.File.WriteAllText(fileFullName, data);
    }