tastudio: file opener improvements

- fix opening and conversion of a regular movie
- fancy ofn filter, suggesting all available files first
This commit is contained in:
feos 2017-01-20 02:00:27 +03:00
parent ae16703ffc
commit 74adace569
2 changed files with 18 additions and 12 deletions

View File

@ -61,15 +61,21 @@ namespace BizHawk.Client.EmuHawk
filename = string.Empty; filename = string.Empty;
} }
var file = OpenFileDialog( // need to be fancy here, so call the ofd constructor directly instead of helper
filename, var all = "*." + string.Join(";*.", MovieService.MovieExtensions.Reverse());
PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null), var ofd = new OpenFileDialog
"Tas Project Files",
"tasproj");
if (file != null)
{ {
LoadFile(file); FileName = filename,
InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null),
Filter = string.Format(
"All Available Files ({0})|{0}|TAS Project Files (*.{1})|*.{1}|Movie Files (*.{2})|*.{2}|All Files|*.*",
all, TasMovie.Extension, MovieService.DefaultExtension)
};
var result = ofd.ShowHawkDialog();
if (result == DialogResult.OK)
{
LoadFile(new FileInfo(ofd.FileName));
} }
} }
} }

View File

@ -626,13 +626,13 @@ namespace BizHawk.Client.EmuHawk
var result1 = MessageBox.Show("This is a regular movie, a new project must be created from it, in order to use in TAStudio\nProceed?", "Convert movie", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); var result1 = MessageBox.Show("This is a regular movie, a new project must be created from it, in order to use in TAStudio\nProceed?", "Convert movie", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (result1 == DialogResult.OK) if (result1 == DialogResult.OK)
{ {
StartNewMovieWrapper(false, movie);
ConvertCurrentMovieToTasproj(); ConvertCurrentMovieToTasproj();
SetUpColumns();
return true;
} }
else
{
return false; return false;
} }
}
else else
{ {
MessageBox.Show("This is not a BizHawk movie!", "Movie load error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("This is not a BizHawk movie!", "Movie load error", MessageBoxButtons.OK, MessageBoxIcon.Error);