Пример #1
0
    public void Load()
    {
        string fileFullName = Application.persistentDataPath + "/" + m_datafileMgr;

        XmlDocument root = new XmlDocument();

        m_serialized.Clear();

        root.Load(fileFullName);
        XmlNodeList sectionsList = root.GetElementsByTagName("section");

        for (int i = 0; i < sectionsList.Count; ++i)
        {
            XmlNode section = sectionsList[i];
            string  name    = section.Attributes["name"].Value;

            StorageKey sk = new StorageKey(m_allowedTypes);
            m_serialized.Add(name, sk);

            List <XmlNode> fieldList = XMLUtils.GetNodes(section, "field");
            for (int j = 0; j < fieldList.Count; ++j)
            {
                XmlNode fieldnode = fieldList[j];
                string  strType   = fieldnode.Attributes["type"].Value;
                string  strValuej = fieldnode.Attributes["value"].Value;
                string  fieldName = fieldnode.Attributes["name"].Value;

                sk.Set(fieldName, Deserializer(strType, strValuej));
            }
        }
    }