예제 #1
0
    public static void ClearMission(Mission mission)
    {
        string      path   = Application.persistentDataPath + "/Xml/Mission.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("MissionCollection/Missions/Mission");

        foreach (XmlNode node in nodes)
        {
            if (node.Attributes.GetNamedItem("id").Value == mission.id.ToString() || node.Attributes.GetNamedItem("id").Value.Equals(mission.id.ToString()))
            {
                node.SelectSingleNode("Clear").InnerText = mission.clear.ToString().ToLower();
                break;
            }
        }
        // 암호화/////
        var encrpytData = DataSecurityManager.EncryptData(elmRoot.InnerXml);

        elmRoot.InnerText = encrpytData;
        ////////////
        xmlDoc.Save(path);
    }
예제 #2
0
    public static void CreateNode(Map data, XmlDocument xmlDoc, string path)
    {
        // 자식 노드 생성
        XmlNode child = xmlDoc.CreateNode(XmlNodeType.Element, "Map", string.Empty);

        xmlDoc.DocumentElement.FirstChild.AppendChild(child);

        XmlAttribute id = xmlDoc.CreateAttribute("id");

        id.Value = data.id.ToString();
        child.Attributes.Append(id);

        // 자식 노드에 들어갈 속성 생성
        XmlElement clearPoint = xmlDoc.CreateElement("ClearPoint");

        clearPoint.InnerText = data.clearPoint.ToString();
        child.AppendChild(clearPoint);
        XmlElement stageNumber = xmlDoc.CreateElement("StageNumber");

        stageNumber.InnerText = data.stageNumber.ToString();
        child.AppendChild(stageNumber);


        // 암호화/////
        XmlElement elmRoot     = xmlDoc.DocumentElement;
        var        encrpytData = DataSecurityManager.EncryptData(elmRoot.InnerXml);

        elmRoot.InnerText = encrpytData;
        ////////////
        xmlDoc.Save(path);
    }
예제 #3
0
    public static void DeleteEquipItemSave(int id)
    {
        string      path   = Application.persistentDataPath + "/Xml/Item.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("ItemCollection/Items/Item");

        foreach (XmlNode node in nodes)
        {
            if (node.SelectSingleNode("CustomId").InnerText == id.ToString() || node.SelectSingleNode("CustomId").InnerText.Equals(id.ToString()))
            {
                node.ParentNode.RemoveChild(node);
                break;
            }
        }
        // 암호화/////
        var encrpytData = DataSecurityManager.EncryptData(elmRoot.InnerXml);

        elmRoot.InnerText = encrpytData;
        ////////////
        xmlDoc.Save(path);
        Debugging.Log(id + " 의 아이템 데이터 xml 삭제 완료");
    }
예제 #4
0
    public static void SaveCloudData(string data)
    {
        string      path   = Application.persistentDataPath + "/Xml/Item.Xml";
        XmlDocument xmlDoc = new XmlDocument();

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

        //복호화////
        XmlElement elmRoot = xmlDoc.DocumentElement;

        elmRoot.RemoveAll();
        var decrpytData = DataSecurityManager.DecryptData(data);

        elmRoot.InnerXml = decrpytData;
        // 암호화/////
        var encrpytData = DataSecurityManager.EncryptData(elmRoot.InnerXml);

        elmRoot.InnerText = encrpytData;
        ////////////
        xmlDoc.Save(path);
    }
예제 #5
0
    public static string GetUserDataToCloud()
    {
        PlayerData userData   = new PlayerData();
        string     dataStream = JsonConvert.SerializeObject(userData);

        if (!string.IsNullOrEmpty(dataStream))
        {
            string encrpytData = DataSecurityManager.EncryptData(dataStream);
            return(encrpytData);
        }
        return(null);
    }
예제 #6
0
    public static void CreateNodes(List <Mission> data, XmlDocument xmlDoc, string path)
    {
        for (var i = 0; i < data.Count; i++)
        {
            // 자식 노드 생성
            XmlNode child = xmlDoc.CreateNode(XmlNodeType.Element, "Mission", string.Empty);
            xmlDoc.DocumentElement.FirstChild.AppendChild(child);

            XmlAttribute id = xmlDoc.CreateAttribute("id");
            id.Value = data[i].id.ToString();
            child.Attributes.Append(id);

            // 자식 노드에 들어갈 속성 생성
            XmlElement type = xmlDoc.CreateElement("MissionType");
            type.InnerText = data[i].missionType.ToString();
            child.AppendChild(type);
            XmlElement level = xmlDoc.CreateElement("MissionLevel");
            level.InnerText = data[i].missionLevel.ToString();
            child.AppendChild(level);
            XmlElement point = xmlDoc.CreateElement("Point");
            point.InnerText = data[i].point.ToString();
            child.AppendChild(point);
            XmlElement clearPoint = xmlDoc.CreateElement("ClearPoint");
            clearPoint.InnerText = data[i].clearPoint.ToString();
            child.AppendChild(clearPoint);
            XmlElement clearType = xmlDoc.CreateElement("ClearType");
            clearType.InnerText = data[i].clearType.ToString();
            child.AppendChild(clearType);
            XmlElement clear = xmlDoc.CreateElement("Clear");
            clear.InnerText = data[i].clear.ToString().ToLower();
            child.AppendChild(clear);
            XmlElement enable = xmlDoc.CreateElement("Enable");
            enable.InnerText = data[i].enable.ToString().ToLower();
            child.AppendChild(enable);
            XmlElement rewardType = xmlDoc.CreateElement("RewardType");
            rewardType.InnerText = data[i].rewardType.ToString();
            child.AppendChild(rewardType);
            XmlElement rewardItem = xmlDoc.CreateElement("RewardItemId");
            rewardItem.InnerText = data[i].rewardItemId.ToString();
            child.AppendChild(rewardItem);
            XmlElement rewardItemCount = xmlDoc.CreateElement("RewardItemCount");
            rewardItemCount.InnerText = data[i].rewardItemCount.ToString();
            child.AppendChild(rewardItemCount);
        }
        // 암호화/////
        XmlElement elmRoot     = xmlDoc.DocumentElement;
        var        encrpytData = DataSecurityManager.EncryptData(elmRoot.InnerXml);

        elmRoot.InnerText = encrpytData;
        ////////////
        xmlDoc.Save(path);
    }
예제 #7
0
    public static void SaveUser(int id)
    {
        string      path   = Application.persistentDataPath + "/Xml/Heros.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("HeroCollection/Heros/Hero");

        foreach (XmlNode node in nodes)
        {
            if (node.Attributes.GetNamedItem("id").Value == id.ToString() || node.Attributes.GetNamedItem("id").Value.Equals(id.ToString()))
            {
                HeroData hd = HeroSystem.GetUserHero(id);
                if (hd != null)
                {
                    node.SelectSingleNode("Level").InnerText         = hd.level.ToString();
                    node.SelectSingleNode("Exp").InnerText           = hd.exp.ToString();
                    node.SelectSingleNode("Strength").InnerText      = hd.strength.ToString();
                    node.SelectSingleNode("Intelligent").InnerText   = hd.intelligent.ToString();
                    node.SelectSingleNode("Physical").InnerText      = hd.physical.ToString();
                    node.SelectSingleNode("Agility").InnerText       = hd.agility.ToString();
                    node.SelectSingleNode("EquipmentItem").InnerText = hd.equipmentItem.ToString();
                }
                break;
            }
        }
        // 암호화/////
        var encrpytData = DataSecurityManager.EncryptData(elmRoot.InnerXml);

        elmRoot.InnerText = encrpytData;
        ////////////
        xmlDoc.Save(path);
        Debugging.Log(id + " 영웅의 단일 xml 저장 완료");
    }
예제 #8
0
    public static void CreateXml(Map data, string path)
    {
        XmlDocument xmlDoc = new XmlDocument();

        // Xml을 선언한다(xml의 버전과 인코딩 방식을 정해준다.)
        xmlDoc.AppendChild(xmlDoc.CreateXmlDeclaration("1.0", "utf-8", "yes"));

        // 루트 노드 생성
        XmlNode root = xmlDoc.CreateNode(XmlNodeType.Element, "MapCollection", string.Empty);

        xmlDoc.AppendChild(root);

        XmlNode root2 = xmlDoc.CreateNode(XmlNodeType.Element, "Maps", string.Empty);

        root.AppendChild(root2);

        // 자식 노드 생성
        XmlNode child = xmlDoc.CreateNode(XmlNodeType.Element, "Map", string.Empty);

        root2.AppendChild(child);

        XmlAttribute id = xmlDoc.CreateAttribute("id");

        id.Value = data.id.ToString();
        child.Attributes.Append(id);

        // 자식 노드에 들어갈 속성 생성
        XmlElement clearPoint = xmlDoc.CreateElement("ClearPoint");

        clearPoint.InnerText = data.clearPoint.ToString();
        child.AppendChild(clearPoint);
        XmlElement stageNumber = xmlDoc.CreateElement("StageNumber");

        stageNumber.InnerText = data.stageNumber.ToString();
        child.AppendChild(stageNumber);

        // 암호화/////
        XmlElement elmRoot     = xmlDoc.DocumentElement;
        var        encrpytData = DataSecurityManager.EncryptData(elmRoot.InnerXml);

        elmRoot.InnerText = encrpytData;
        ////////////
        xmlDoc.Save(path);
    }
예제 #9
0
    public static void CreateNode(Item data, XmlDocument xmlDoc, string path)
    {
        // 자식 노드 생성
        XmlNode child = xmlDoc.CreateNode(XmlNodeType.Element, "Item", string.Empty);

        xmlDoc.DocumentElement.FirstChild.AppendChild(child);

        XmlAttribute id = xmlDoc.CreateAttribute("id");

        id.Value = data.id.ToString();
        child.Attributes.Append(id);

        // 자식 노드에 들어갈 속성 생성
        XmlElement customId = xmlDoc.CreateElement("CustomId");

        customId.InnerText = data.customId.ToString();
        child.AppendChild(customId);
        XmlElement equipCharacterId = xmlDoc.CreateElement("EquipCharacterId");

        equipCharacterId.InnerText = data.equipCharacterId.ToString();
        child.AppendChild(equipCharacterId);
        XmlElement count = xmlDoc.CreateElement("Count");

        count.InnerText = data.count.ToString();
        child.AppendChild(count);
        XmlElement enable = xmlDoc.CreateElement("Enable");

        enable.InnerText = data.enable.ToString().ToLower();
        child.AppendChild(enable);
        XmlElement itemClass = xmlDoc.CreateElement("Class");

        itemClass.InnerText = data.itemClass.ToString();
        child.AppendChild(itemClass);

        // 암호화/////
        XmlElement elmRoot     = xmlDoc.DocumentElement;
        var        encrpytData = DataSecurityManager.EncryptData(elmRoot.InnerXml);

        elmRoot.InnerText = encrpytData;
        ////////////
        xmlDoc.Save(path);
    }
예제 #10
0
    public static void EquipItemSave(int dismountId, int equipId, int targetCharacterId)
    {
        string      path   = Application.persistentDataPath + "/Xml/Item.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("ItemCollection/Items/Item");

        Debugging.Log(equipId + "아이템 장착 데이터 xml 저장중..");
        foreach (XmlNode node in nodes)
        {
            if (dismountId != 0)
            {
                if (node.SelectSingleNode("CustomId").InnerText == dismountId.ToString() || node.SelectSingleNode("CustomId").InnerText.Equals(dismountId.ToString()))
                {
                    node.SelectSingleNode("EquipCharacterId").InnerText = "0";
                }
            }
            if (node.SelectSingleNode("CustomId").InnerText == equipId.ToString() || node.SelectSingleNode("CustomId").InnerText.Equals(equipId.ToString()))
            {
                node.SelectSingleNode("EquipCharacterId").InnerText = targetCharacterId.ToString();
            }
        }
        // 암호화/////
        var encrpytData = DataSecurityManager.EncryptData(elmRoot.InnerXml);

        elmRoot.InnerText = encrpytData;
        ////////////
        xmlDoc.Save(path);
        Debugging.Log(equipId + " 의 아이템 장착 데이터 xml 저장 완료");
    }
예제 #11
0
    public static void CreateNode(Ability data, XmlDocument xmlDoc, string path)
    {
        // 자식 노드 생성
        XmlNode child = xmlDoc.CreateNode(XmlNodeType.Element, "Ability", string.Empty);

        xmlDoc.DocumentElement.FirstChild.AppendChild(child);

        XmlAttribute id = xmlDoc.CreateAttribute("id");

        id.Value = data.id.ToString();
        child.Attributes.Append(id);

        // 자식 노드에 들어갈 속성 생성
        XmlElement level = xmlDoc.CreateElement("Level");

        level.InnerText = "1";
        child.AppendChild(level);
        XmlElement type = xmlDoc.CreateElement("AbilityType");

        type.InnerText = data.abilityType.ToString();
        child.AppendChild(type);
        XmlElement powerType = xmlDoc.CreateElement("PowerType");

        powerType.InnerText = data.powerType.ToString();
        child.AppendChild(powerType);
        XmlElement power = xmlDoc.CreateElement("Power");

        power.InnerText = data.power.ToString();
        child.AppendChild(power);
        XmlElement image = xmlDoc.CreateElement("Image");

        image.InnerText = data.image;
        child.AppendChild(image);

        // 암호화/////
        XmlElement elmRoot     = xmlDoc.DocumentElement;
        var        encrpytData = DataSecurityManager.EncryptData(elmRoot.InnerXml);

        elmRoot.InnerText = encrpytData;
        ////////////
        xmlDoc.Save(path);
    }
예제 #12
0
    public static void SaveAllUser(List <HeroData> herodatas)
    {
        string      path   = Application.persistentDataPath + "/Xml/Heros.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("HeroCollection/Heros/Hero");

        foreach (XmlNode node in nodes)
        {
            for (int i = 0; i < herodatas.Count; i++)
            {
                if (node.Attributes.GetNamedItem("id").Value == herodatas[i].id.ToString() || node.Attributes.GetNamedItem("id").Value.Equals(herodatas[i].id.ToString()))
                {
                    node.SelectSingleNode("Level").InnerText       = herodatas[i].level.ToString();
                    node.SelectSingleNode("Exp").InnerText         = herodatas[i].exp.ToString();
                    node.SelectSingleNode("Strength").InnerText    = herodatas[i].strength.ToString();
                    node.SelectSingleNode("Intelligent").InnerText = herodatas[i].intelligent.ToString();
                    node.SelectSingleNode("Physical").InnerText    = herodatas[i].physical.ToString();
                    node.SelectSingleNode("Agility").InnerText     = herodatas[i].agility.ToString();
                    break;
                }
            }
        }
        // 암호화/////
        var encrpytData = DataSecurityManager.EncryptData(elmRoot.InnerXml);

        elmRoot.InnerText = encrpytData;
        ////////////
        xmlDoc.Save(path);
        Debugging.Log(herodatas.Count + " 영웅들의 일괄 xml 저장 완료");
    }
예제 #13
0
    public static void PointSave(List <Mission> missons)
    {
        string      path   = Application.persistentDataPath + "/Xml/Mission.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("MissionCollection/Missions/Mission");

        foreach (XmlNode node in nodes)
        {
            foreach (var mission in missons)
            {
                if (node.Attributes.GetNamedItem("id").Value.Equals(mission.id.ToString()))
                {
                    node.SelectSingleNode("ClearPoint").InnerText   = mission.clearPoint.ToString();
                    node.SelectSingleNode("Point").InnerText        = mission.point.ToString();
                    node.SelectSingleNode("Enable").InnerText       = mission.enable.ToString().ToLower();
                    node.SelectSingleNode("MissionLevel").InnerText = mission.missionLevel.ToString();
                    break;
                }
            }
        }
        // 암호화/////
        var encrpytData = DataSecurityManager.EncryptData(elmRoot.InnerXml);

        elmRoot.InnerText = encrpytData;
        ////////////
        xmlDoc.Save(path);
        Debugging.Log("미션포인트 xml 저장 완료");
    }
예제 #14
0
    public static void SaveAbility(int id)
    {
        string      path   = Application.persistentDataPath + "/Xml/Ability.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("AbilityCollection/Abilitys/Ability");

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

        elmRoot.InnerText = encrpytData;
        ////////////
        xmlDoc.Save(path);
        Debugging.Log(id + " 영웅의 단일 xml 저장 완료");
    }
예제 #15
0
    public static void CreateXml(Skill data, string path)
    {
        XmlDocument xmlDoc = new XmlDocument();

        // Xml을 선언한다(xml의 버전과 인코딩 방식을 정해준다.)
        xmlDoc.AppendChild(xmlDoc.CreateXmlDeclaration("1.0", "utf-8", "yes"));

        // 루트 노드 생성
        XmlNode root = xmlDoc.CreateNode(XmlNodeType.Element, "SkillCollection", string.Empty);

        xmlDoc.AppendChild(root);

        XmlNode root2 = xmlDoc.CreateNode(XmlNodeType.Element, "Skills", string.Empty);

        root.AppendChild(root2);

        XmlNode child = xmlDoc.CreateNode(XmlNodeType.Element, "Skill", string.Empty);

        xmlDoc.DocumentElement.FirstChild.AppendChild(child);

        XmlAttribute id = xmlDoc.CreateAttribute("id");

        id.Value = data.id.ToString();
        child.Attributes.Append(id);
        // 자식 노드에 들어갈 속성 생성
        XmlElement level = xmlDoc.CreateElement("Level");

        level.InnerText = "1";
        child.AppendChild(level);

        // 암호화/////
        XmlElement elmRoot     = xmlDoc.DocumentElement;
        var        encrpytData = DataSecurityManager.EncryptData(elmRoot.InnerXml);

        elmRoot.InnerText = encrpytData;
        ////////////
        xmlDoc.Save(path);
    }
예제 #16
0
    public static void ItemSave(int id)
    {
        string      path   = Application.persistentDataPath + "/Xml/Item.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("ItemCollection/Items/Item");

        Debugging.Log(id + "아이템 데이터 xml 저장중..");
        foreach (XmlNode node in nodes)
        {
            if (node.Attributes.GetNamedItem("id").Value == id.ToString() || node.Attributes.GetNamedItem("id").Value.Equals(id.ToString()))
            {
                node.SelectSingleNode("Enable").InnerText = ItemSystem.GetUserItem(id).enable.ToString().ToLower();
                node.SelectSingleNode("Count").InnerText  = ItemSystem.GetUserItem(id).count.ToString();
                break;
            }
        }
        // 암호화/////
        var encrpytData = DataSecurityManager.EncryptData(elmRoot.InnerXml);

        elmRoot.InnerText = encrpytData;
        ////////////
        xmlDoc.Save(path);
        Debugging.Log(id + " 의 아이템 데이터 xml 저장 완료");
    }
예제 #17
0
    public static void CreateXml(string path)
    {
        XmlDocument xmlDoc = new XmlDocument();

        // Xml을 선언한다(xml의 버전과 인코딩 방식을 정해준다.)
        xmlDoc.AppendChild(xmlDoc.CreateXmlDeclaration("1.0", "utf-8", "yes"));

        // 루트 노드 생성
        XmlNode root = xmlDoc.CreateNode(XmlNodeType.Element, "ItemCollection", string.Empty);

        xmlDoc.AppendChild(root);

        XmlNode root2 = xmlDoc.CreateNode(XmlNodeType.Element, "Items", string.Empty);

        root.AppendChild(root2);

        // 암호화/////
        XmlElement elmRoot     = xmlDoc.DocumentElement;
        var        encrpytData = DataSecurityManager.EncryptData(elmRoot.InnerXml);

        elmRoot.InnerText = encrpytData;
        ////////////
        xmlDoc.Save(path);
    }
예제 #18
0
    public static void CreateNode(Skill data, XmlDocument xmlDoc, string path)
    {
        // 자식 노드 생성
        XmlNode child = xmlDoc.CreateNode(XmlNodeType.Element, "Skill", string.Empty);

        xmlDoc.DocumentElement.FirstChild.AppendChild(child);

        XmlAttribute id = xmlDoc.CreateAttribute("id");

        id.Value = data.id.ToString();
        child.Attributes.Append(id);
        // 자식 노드에 들어갈 속성 생성
        XmlElement level = xmlDoc.CreateElement("Level");

        level.InnerText = "1";
        child.AppendChild(level);
        // 암호화/////
        XmlElement elmRoot     = xmlDoc.DocumentElement;
        var        encrpytData = DataSecurityManager.EncryptData(elmRoot.InnerXml);

        elmRoot.InnerText = encrpytData;
        ////////////
        xmlDoc.Save(path);
    }
예제 #19
0
    public static void CreateNode(HeroData data, XmlDocument xmlDoc, string path)
    {
        // 자식 노드 생성
        XmlNode child = xmlDoc.CreateNode(XmlNodeType.Element, "Hero", string.Empty);

        xmlDoc.DocumentElement.FirstChild.AppendChild(child);

        XmlAttribute id = xmlDoc.CreateAttribute("id");

        id.Value = data.id.ToString();
        child.Attributes.Append(id);

        // 자식 노드에 들어갈 속성 생성
        XmlElement name = xmlDoc.CreateElement("Name");

        name.InnerText = data.name;
        child.AppendChild(name);

        XmlElement image = xmlDoc.CreateElement("Image");

        image.InnerText = data.image;
        child.AppendChild(image);
        XmlElement enable = xmlDoc.CreateElement("Enable");

        enable.InnerText = data.enable.ToString().ToLower();
        child.AppendChild(enable);
        XmlElement type = xmlDoc.CreateElement("Type");

        type.InnerText = data.type.ToString();
        child.AppendChild(type);
        XmlElement description = xmlDoc.CreateElement("Description");

        description.InnerText = data.description;
        child.AppendChild(description);
        XmlElement level = xmlDoc.CreateElement("Level");

        level.InnerText = data.level.ToString();
        child.AppendChild(level);
        XmlElement exp = xmlDoc.CreateElement("Exp");

        exp.InnerText = data.exp.ToString();
        child.AppendChild(exp);
        XmlElement value = xmlDoc.CreateElement("Value");

        value.InnerText = data.value.ToString();
        child.AppendChild(value);
        XmlElement str = xmlDoc.CreateElement("Strength");

        str.InnerText = data.strength.ToString();
        child.AppendChild(str);
        XmlElement intel = xmlDoc.CreateElement("Intelligent");

        intel.InnerText = data.intelligent.ToString();
        child.AppendChild(intel);
        XmlElement phy = xmlDoc.CreateElement("Physical");

        phy.InnerText = data.physical.ToString();
        child.AppendChild(phy);
        XmlElement agl = xmlDoc.CreateElement("Agility");

        agl.InnerText = data.agility.ToString();
        child.AppendChild(agl);
        XmlElement equipmentItem = xmlDoc.CreateElement("EquipmentItem");

        equipmentItem.InnerText = data.equipmentItem.ToString();
        child.AppendChild(equipmentItem);
        XmlElement skill = xmlDoc.CreateElement("Skill");

        skill.InnerText = data.skill.ToString();
        child.AppendChild(skill);
        XmlElement attackType = xmlDoc.CreateElement("AttackType");

        attackType.InnerText = data.attackType.ToString();
        child.AppendChild(attackType);

        // 암호화/////
        XmlElement elmRoot     = xmlDoc.DocumentElement;
        var        encrpytData = DataSecurityManager.EncryptData(elmRoot.InnerXml);

        elmRoot.InnerText = encrpytData;
        ////////////
        xmlDoc.Save(path);
    }