Exemplo n.º 1
0
        public static void Save(string pstr_FullPathFileName, MatrixMapCell mtxMapCell, List <Brick> lstBricks, int pint_TileWidth, int pint_TileHeight)
        {
            string path = FileControler.GetPath(pstr_FullPathFileName);

            SaveBricks(lstBricks, path);
            MapInformation info        = new MapInformation(mtxMapCell, lstBricks, pint_TileWidth, pint_TileHeight);
            XmlSerializer  xSerializer = new XmlSerializer(typeof(MapInformation));

            System.IO.StreamWriter sWriter = new System.IO.StreamWriter(pstr_FullPathFileName, false);
            xSerializer.Serialize(sWriter, info);
            sWriter.Close();
        }
Exemplo n.º 2
0
        private static void SaveBricks(List <Brick> lstBricks, string path)
        {
            DirectoryInfo dir = new DirectoryInfo(path);

            path = Path.Combine(path, "Bricks");
            if (!Directory.Exists(path))
            {
                dir.CreateSubdirectory("Bricks");
            }

            for (int i = 0; i < lstBricks.Count; i++)
            {
                Brick brk = lstBricks[i];
                if (brk.IsNew && FileControler.GetPath(brk.ImagePath) != path)
                {
                    brk.Image.Save(Path.Combine(path, brk.ImagePath));
                }
                brk.IsNew     = false;
                brk.ImagePath = FileControler.GetFileName(brk.ImagePath);
            }
        }