Beispiel #1
0
        private void GetIcon(object state)
        {
            UserGameInfo game = (UserGameInfo)state;
            Bitmap       bmp;
            string       iconPath = ini.IniReadValue("GameIcons", game.Game.GameName);

            if (!string.IsNullOrEmpty(iconPath))
            {
                if (iconPath.EndsWith(".exe"))
                {
                    Icon icon = Shell32.GetIcon(iconPath, false);
                    bmp = icon.ToBitmap();
                    icon.Dispose();
                }
                else
                {
                    bmp = new Bitmap(iconPath);
                }
            }
            else
            {
                Icon icon = Shell32.GetIcon(game.ExePath, false);
                bmp = icon.ToBitmap();
                icon.Dispose();
            }

            game.Icon = bmp;

            lock (controls)
            {
                if (controls.ContainsKey(game))
                {
                    GameControl control = controls[game];
                    control.Invoke((Action) delegate()
                    {
                        control.Image = game.Icon;
                    });
                }
            }
        }
Beispiel #2
0
        private void GetIcon(object state)
        {
            UserGameInfo game = (UserGameInfo)state;
            Icon         icon = Shell32Interop.GetIcon(game.ExePath, false);

            Bitmap bmp = icon.ToBitmap();

            icon.Dispose();
            game.Icon = bmp;

            lock (controls)
            {
                if (controls.ContainsKey(game))
                {
                    GameControl control = controls[game];
                    control.Invoke((Action) delegate()
                    {
                        control.Image = game.Icon;
                    });
                }
            }
        }