示例#1
0
        public static void XMLSerialize(String filename, ProjectileData arg)
        {
            filename = Store.BaseDirection + filename;
            XmlSerializer serializer = null;
            FileStream    stream     = null;

            serializer = new XmlSerializer(typeof(ProjectileData));
            stream     = new FileStream(filename, FileMode.Create, FileAccess.Write);
            serializer.Serialize(stream, arg);
            if (stream != null)
            {
                stream.Close();
            }
        }
示例#2
0
        public static ProjectileData XMLDeserialize(String filename)
        {
            filename = Store.BaseDirection + filename;
            XmlSerializer  serializer = null;
            FileStream     stream     = null;
            ProjectileData emp        = new ProjectileData();

            serializer = new XmlSerializer(typeof(ProjectileData));
            stream     = new FileStream(filename, FileMode.Open);
            emp        = (ProjectileData)serializer.Deserialize(stream);
            if (stream != null)
            {
                stream.Close();
            }

            return(emp);
        }