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;
}
var file = OpenFileDialog(
filename,
PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null),
"Tas Project Files",
"tasproj");
if (file != null)
// need to be fancy here, so call the ofd constructor directly instead of helper
var all = "*." + string.Join(";*.", MovieService.MovieExtensions.Reverse());
var ofd = new OpenFileDialog
{
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);
if (result1 == DialogResult.OK)
{
StartNewMovieWrapper(false, movie);
ConvertCurrentMovieToTasproj();
SetUpColumns();
return true;
}
else
{
return false;
}
}
else
{
MessageBox.Show("This is not a BizHawk movie!", "Movie load error", MessageBoxButtons.OK, MessageBoxIcon.Error);