Recent games: Improve UI responsiveness when disk is slow
This commit is contained in:
parent
a74f2e30d5
commit
63b23a7b22
1 changed files with 12 additions and 12 deletions
|
@ -44,19 +44,19 @@ namespace Mesen.GUI.Controls
|
|||
lblGameName.Text = Path.GetFileNameWithoutExtension(_recentGame.RomName);
|
||||
lblSaveDate.Text = _recentGame.Timestamp.ToString();
|
||||
|
||||
try {
|
||||
ZipArchive zip = new ZipArchive(new MemoryStream(File.ReadAllBytes(_recentGame.FileName)));
|
||||
ZipArchiveEntry entry = zip.GetEntry("Screenshot.png");
|
||||
if(entry != null) {
|
||||
using(Stream stream = entry.Open()) {
|
||||
picPreviousState.Image = Image.FromStream(stream);
|
||||
Task.Run(() => {
|
||||
Image img = null;
|
||||
try {
|
||||
ZipArchive zip = new ZipArchive(new MemoryStream(File.ReadAllBytes(_recentGame.FileName)));
|
||||
ZipArchiveEntry entry = zip.GetEntry("Screenshot.png");
|
||||
if(entry != null) {
|
||||
using(Stream stream = entry.Open()) {
|
||||
img = Image.FromStream(stream);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
picPreviousState.Image = null;
|
||||
}
|
||||
} catch {
|
||||
picPreviousState.Image = null;
|
||||
}
|
||||
} catch { }
|
||||
picPreviousState.Image = img;
|
||||
});
|
||||
|
||||
lblGameName.Visible = true;
|
||||
lblSaveDate.Visible = true;
|
||||
|
|
Loading…
Add table
Reference in a new issue