private void EditInExternalProgram(bool UseDefaultEditor = true) { if (!ActiveTexture.CanEdit || !IsFinished) { return; } ImageProgramSettings settings = new ImageProgramSettings(); settings.LoadImage(ActiveTexture); if (settings.ShowDialog() == DialogResult.OK) { UseDefaultEditor = !settings.OpenDefaultProgramSelection; string UseExtension = settings.GetSelectedExtension(); FormatToChange = settings.GetSelectedImageFormat(); string TemporaryName = Path.GetTempFileName(); Utils.DeleteIfExists(Path.ChangeExtension(TemporaryName, UseExtension)); File.Move(TemporaryName, Path.ChangeExtension(TemporaryName, UseExtension)); TemporaryName = Path.ChangeExtension(TemporaryName, UseExtension); switch (UseExtension) { case ".dds": ActiveTexture.SaveDDS(TemporaryName, true, false, CurArrayDisplayLevel, CurMipDisplayLevel); break; case ".astc": ActiveTexture.SaveASTC(TemporaryName, true, false, CurArrayDisplayLevel, CurMipDisplayLevel); break; case ".tga": ActiveTexture.SaveTGA(TemporaryName, true, false, CurArrayDisplayLevel, CurMipDisplayLevel); break; default: ActiveTexture.SaveBitMap(TemporaryName, true, false, CurArrayDisplayLevel, CurMipDisplayLevel); break; } if (UseDefaultEditor) { Process.Start(TemporaryName); } else { ShowOpenWithDialog(TemporaryName); } FileWatcher.Filter = Path.GetFileName(TemporaryName); //Start watching for changes FileWatcher.EnableRaisingEvents = true; } }