Skip to content

Commit

Permalink
Use better code for getting thumbnail paths
Browse files Browse the repository at this point in the history
  • Loading branch information
frxctura committed May 23, 2023
1 parent 32ea388 commit 60b9fe5
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3398,14 +3398,17 @@ public async void gamesListView_SelectedIndexChanged(object sender, EventArgs e)
keyheld = true;
}

string[] imageExtensions = { ".jpg", ".png" };
string ImagePath = "";
if (File.Exists($"{SideloaderRCLONE.ThumbnailsFolder}\\{CurrentPackageName}.jpg"))
{
ImagePath = $"{SideloaderRCLONE.ThumbnailsFolder}\\{CurrentPackageName}.jpg";
}
else if (File.Exists($"{SideloaderRCLONE.ThumbnailsFolder}\\{CurrentPackageName}.png"))

foreach (string extension in imageExtensions)
{
ImagePath = $"{SideloaderRCLONE.ThumbnailsFolder}\\{CurrentPackageName}.png";
string path = Path.Combine(SideloaderRCLONE.ThumbnailsFolder, $"{CurrentPackageName}{extension}");
if (File.Exists(path))
{
ImagePath = path;
break;
}
}

if (gamesPictureBox.BackgroundImage != null)
Expand Down

0 comments on commit 60b9fe5

Please sign in to comment.