private void button4_Click(object sender, System.Windows.RoutedEventArgs e) { if (_pather == null) { return; } progressBar1.Maximum = 100; progressBar1.Value = 0; for (int y = OriginTileY; y <= OriginTileY + 2; y++) { for (int x = OriginTileX; x <= OriginTileX + 2; x++) { _pather.LoadTile(x, y); } } progressBar1.Value = 30; if (UseCircleTool) { markedLabel.Content = MarkMeshEllipses(PolyArea.Road); } else { markedLabel.Content = MarkMesh(PolyArea.Road); } progressBar1.Value = 60; for (int y = OriginTileY; y <= OriginTileY + 2; y++) { for (int x = OriginTileX; x <= OriginTileX + 2; x++) { byte[] data; if (_pather.RemoveTile(x, y, out data) && data != null) { File.WriteAllBytes(_pather.GetTilePath(x, y), data); } } } progressBar1.Value = 100; }