예제 #1
0
        public bool saveSkill(string skillPath, bool xml = true)
        {
            FileStream fs = null;

            try
            {
                if (xml)
                {
                    XmlPack pack = new XmlPack();
                    pack.skill = new List <GameSkill>();
                    pack.skill.AddRange(skills.Values);
                    AraleSerizlize.saveXml(pack, skillPath);
                }
                else
                {
                    fs = new FileStream(skillPath, FileMode.Create);
                    BinaryWriter w = new BinaryWriter(fs);
                    w.Write(new byte[] { 0x73, 0x6b, 0x69, 0x6c, 0x6c });
                    w.Write(ver);
                    AraleSerizlize.write <GameSkill>(skills, w);
                    fs.Close();
                }
                return(true);
            }
            catch (System.Exception e)
            {
                Log.e(e.Message, Log.Tag.Skill, e);
                if (fs != null)
                {
                    fs.Close();
                }
                return(false);
            }
        }
예제 #2
0
 bool loadSkills(string ctx)
 {
     try
     {
         XmlPack pack = AraleSerizlize.fromXml(typeof(XmlPack), ctx) as XmlPack;
         for (int i = 0; i < pack.skill.Count; ++i)
         {
             skills[pack.skill[i].id] = pack.skill[i];
         }
         return(true);
     }
     catch (System.Exception e)
     {
         Log.e(e.Message, Log.Tag.Skill, e);
         return(false);
     }
 }