Esempio n. 1
0
    public static void SaveSkill(int id)
    {
        string      path   = Application.persistentDataPath + "/Xml/Skill.Xml";
        XmlDocument xmlDoc = new XmlDocument();

        if (System.IO.File.Exists(path))
        {
            xmlDoc.LoadXml(System.IO.File.ReadAllText(path));
        }

        //복호화////
        XmlElement elmRoot     = xmlDoc.DocumentElement;
        var        decrpytData = DataSecurityManager.DecryptData(elmRoot.InnerText);

        elmRoot.InnerXml = decrpytData;
        //////////

        XmlNodeList nodes = xmlDoc.SelectNodes("SkillCollection/Skills/Skill");

        foreach (XmlNode node in nodes)
        {
            if (node.Attributes.GetNamedItem("id").Value == id.ToString() || node.Attributes.GetNamedItem("id").Value.Equals(id.ToString()))
            {
                Skill skill = SkillSystem.GetUserSkill(id);
                if (skill != null)
                {
                    node.SelectSingleNode("Level").InnerText = skill.level.ToString();
                }
                break;
            }
        }
        // 암호화/////
        var encrpytData = DataSecurityManager.EncryptData(elmRoot.InnerXml);

        elmRoot.InnerText = encrpytData;
        ////////////
        xmlDoc.Save(path);
        Debugging.Log(id + " 스킬의 단일 xml 저장 완료");
    }