示例#1
0
        public static bool LoadMapPack(string filename)
        {
            if (!File.Exists(filename))
            {
                return(false);
            }

            try
            {
                XmlSerializer serializer = new XmlSerializer(typeof(XboxMapPack));
                FileStream    fs         = new FileStream(filename, FileMode.Open);

                XboxMapPack maps = (XboxMapPack)serializer.Deserialize(fs);

                xboxMaps = maps.Maps;

                fs.Close();

                foreach (XboxMap map in maps.Maps)
                {
                    map.UpdateMapLinks();
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        }
示例#2
0
        public static void SaveMapPack(string filename)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(XboxMapPack));
            StreamWriter  sw         = new StreamWriter(filename);
            XboxMapPack   mapPack    = new XboxMapPack();

            mapPack.Maps = xboxMaps;


            serializer.Serialize(sw, mapPack);

            sw.Close();
        }
        public static void SaveMapPack( string filename)
        {
            var serializer = new XmlSerializer(typeof(XboxMapPack));
            var sw = new StreamWriter(filename);
            var mapPack = new XboxMapPack();

            mapPack.Maps = xboxMaps;

            serializer.Serialize(sw, mapPack);

            sw.Close();
        }