I am making a file explorer and for the thumbnail view it requires the icon of a file. I have gotten an icon for all of the files except for steam games. I have looked around and cannot find a way to get the icon like Windows does.
Edit: This is what i currently use to get my file icons:
public static Bitmap GetBigImage(string path, Size size)
{
Bitmap bmp;
string ext = System.IO.Path.GetExtension(path);
if (ext == ".exe")
{
Icon ico = Icon.ExtractAssociatedIcon(path);
bmp = ico.ToBitmap();
ico.Dispose();
}
else
{
if (imageType.Contains(ext.Replace(".", "")))
{
Image img = Image.FromFile(path);
bmp = new Bitmap(img, new Size(size.Width - 20, 80));
img.Dispose();
}
else
{
Icon ico = Win32.GetLargeIconForExtension(ext);
bmp = ico.ToBitmap();
ico.Dispose();
}
}
return bmp;
}
This is the path I am trying to get steam://rungameid/209170
In GetBigImage, if I see if the path contains steam:// (in either of the if statements) the method still returns no icon.
There is a Database of Steam Games here. Each entry leads to a page that includes a link to the game's icon.
Your ID leads to this page where this link points to the icon.
Note that there usually is a real icon under the field 'clienticon' and also a plain jpg strangely named 'icon'!
For an explorer type app I recommend caching those icon.
Hope this helps.