Attempt to have the Play movie dialog preload movies in the Movie directory

This commit is contained in:
andres.delikat 2011-05-13 20:47:59 +00:00
parent 12adf89ca1
commit dc288f4f3b
2 changed files with 25 additions and 8 deletions

View File

@ -121,7 +121,7 @@
//
// columnHeader4
//
this.columnHeader4.Text = "Author";
this.columnHeader4.Text = "Length";
this.columnHeader4.Width = 97;
//
// DetailsView

View File

@ -42,7 +42,7 @@ namespace BizHawk.MultiClient
private void MovieView_QueryItemBkColor(int index, int column, ref Color color)
{
}
private void Cancel_Click(object sender, EventArgs e)
@ -72,15 +72,26 @@ namespace BizHawk.MultiClient
return;
else
{
PreLoadMovieFile(file);
MovieView.ItemCount = MovieList.Count;
UpdateList();
MovieView.SelectedIndices.Clear();
MovieView.setSelection(MovieList.Count-1);
AddMovieToList(ofd.FileName);
}
}
}
private void AddMovieToList(string filename)
{
var file = new FileInfo(filename);
if (!file.Exists)
return;
else
{
PreLoadMovieFile(file);
MovieView.ItemCount = MovieList.Count;
UpdateList();
MovieView.SelectedIndices.Clear();
MovieView.setSelection(MovieList.Count - 1);
}
}
private void PreLoadMovieFile(FileInfo path)
{
Movie m = new Movie(path.FullName, MOVIEMODE.INACTIVE);
@ -105,7 +116,13 @@ namespace BizHawk.MultiClient
private void PlayMovie_Load(object sender, EventArgs e)
{
string d = PathManager.MakeAbsolutePath(Global.Config.MoviesPath, "");
if (!Directory.Exists(d))
Directory.CreateDirectory(d);
foreach (string f in Directory.GetFiles(d, "*.tas"))
{
AddMovieToList(f);
}
}
private void MovieView_SelectedIndexChanged(object sender, EventArgs e)