Example #1
0
        public GlobalMap(int w, int h, string mapPath, string appPath, List <List <ITile> > tiles)
        {
            Width     = w;
            Height    = h;
            PathToMap = mapPath ?? throw new ArgumentNullException(nameof(mapPath), "No path provided");
            PathToApp = appPath ?? throw new ArgumentNullException(nameof(appPath), "No path provided");

            path1        = PathToMap.Replace("map.png", "map1.png");
            path2        = PathToMap.Replace("map.png", "map2.png");
            originalPath = PathToMap;
            PathToMap    = path1;
            SetupGrid(tiles);
            map = new Global_Map(PathToMap);
        }
Example #2
0
        private void CopyToNewLocation(Bitmap newImage)
        {
            var originalPath = PathToMap;
            var tempPath     = PathToMap.Replace(".png", "temp.png");

            File.Move(originalPath, tempPath);
            try
            {
                newImage.Save(originalPath, ImageFormat.Bmp);
            }
            catch
            {
                File.Move(originalPath, tempPath);
                throw;
            }
            finally
            {
                newImage.Dispose();
            }
            File.Delete(tempPath);
        }