public void Init(string IsosPath, string CachePath)
{
if (IsosPath == null)
{
return;
}
var ProgressForm = new ProgressForm();
try
{
ThreadPool.QueueUserWorkItem((state) =>
{
var GameList = new GameList();
Console.WriteLine("Reading ISOs...");
GameList.Progress += (Title, Current, Total) =>
{
//Console.WriteLine("Progress: {0}, {1}/{2}", Title, Current, Total);
ProgressForm.SetProgress(Title, Current, Total);
};
var List = new List<GameList.GameEntry>();
GameList.EntryAdded += (Entry, Cached) =>
{
//Console.WriteLine("aaaaaaaa");
List.Add(Entry);
if (!Cached)
{
objectListView1.AddObject(Entry);
}
};
GameList.ScanPath(IsosPath, CachePath);
this.Invoke(new Action(() =>
{
objectListView1.SetObjects(List);
objectListView1.Sort(TitleColumn, SortOrder.Ascending);
}));
Console.WriteLine("Done");
/*
foreach (var Entry in GameList.Entries)
{
Console.WriteLine(Entry.TITLE);
}
*/
ProgressForm.End();
}, null);
this.Invoke(new Action(() =>
{
ProgressForm.ShowDialog();
}));
}
finally
{
ProgressForm.End();
}
}