Esempio n. 1
0
        public void Save()
        {
            List <Anim> list = this.Anims;

            for (int i = 0; i < list.Count; ++i)
            {
                Anim a = list[i];
                a.name = a.name.Replace("\\", "/");
            }

            XmlSerializer s = new XmlSerializer(typeof(puppetdata));

            using (System.IO.Stream stream = System.IO.File.Open(FileName, System.IO.FileMode.Create))
            {
                s.Serialize(stream, this);
            }
        }
Esempio n. 2
0
        public static puppetdata Load(string filename)
        {
            XmlSerializer s = new XmlSerializer(typeof(puppetdata));

            using (System.IO.Stream stream = System.IO.File.OpenRead(filename))
            {
                var r = s.Deserialize(stream) as puppetdata;
                if (r != null)
                {
                    List <Anim> list = r.Anims;
                    for (int i = 0; i < list.Count; ++i)
                    {
                        Anim a = list[i];
                        a.name = a.name.Replace("\\", "/");
                    }


                    r.FileName = filename;
                    return(r);
                }
            }
            return(null);
        }
Esempio n. 3
0
        public static puppetdata LoadFormString(string xml)
        {
            XmlSerializer s = new XmlSerializer(typeof(puppetdata));


            using (System.IO.StringReader reader = new System.IO.StringReader(xml))
            {
                var r = s.Deserialize(reader) as puppetdata;
                if (r != null)
                {
                    List <Anim> list = r.Anims;
                    for (int i = 0; i < list.Count; ++i)
                    {
                        Anim a = list[i];
                        a.name = a.name.Replace("\\", "/");
                    }


                    r.FileName = "whatever";
                    return(r);
                }
            }
            return(null);
        }