private void Run()
{
String[] paths = Directory.GetFiles(regionDir, "*.mca", SearchOption.TopDirectoryOnly);
String format = String.Format("{{0}} region {{1}} of {0}", paths.Length);
int count = 0;
foreach (String path in paths)
{
UpdateStatus(String.Format(format, "Reading", count));
UpdateProgress(count, paths.Length);
RegionFile region = new RegionFile(path);
UpdateStatus(String.Format(format, replace ? "Replacing" : "Filling", count));
if (!replace)
{
RegionUtil.Fill(region, null, Color.Black, biome1, worldSeed);
}
else
{
RegionUtil.Replace(region, null, Color.Black, ((BiomeType)biome1).ID, biome2, worldSeed);
}
UpdateStatus(String.Format(format, "Saving", count));
mutex.WaitOne();
region.Write(true);
mutex.ReleaseMutex();
count++;
}
UpdateProgress(paths.Length, paths.Length);
UpdateStatus("Done");
}