Beispiel #1
0
        void updateEmuInfo()
        {
            EmulatorInfo lEmuInfo = new EmulatorScraperHandler().UpdateEmuInfo(platformComboBox.Text, (o) =>
            {
                EmulatorInfo emuInfo = (EmulatorInfo)o;
                if (logo != null)
                {
                    logo.Dispose();
                    logo = null;
                }
                if (fanart != null)
                {
                    fanart.Dispose();
                    fanart = null;
                }
                logo   = ImageHandler.BitmapFromWeb(emuInfo.LogoUrl);
                fanart = ImageHandler.BitmapFromWeb(emuInfo.FanartUrl);
                return(true);
            });

            if (lEmuInfo != null)
            {
                txt_Title.Text       = lEmuInfo.Title;
                txt_company.Text     = lEmuInfo.Developer;
                txt_description.Text = lEmuInfo.GetDescription();
                int grade;
                if (int.TryParse(lEmuInfo.Grade, out grade))
                {
                    gradeUpDown.Value = grade;
                }

                return;
            }
        }
        void updateEmuInfo()
        {
            if (selectedEmulator == null)
            {
                return;
            }

            updateEmulator();
            updateProfile();

            EmulatorInfo lEmuInfo = new EmulatorScraperHandler().UpdateEmuInfo(selectedEmulator.PlatformTitle, (o) =>
            {
                EmulatorInfo emuInfo = (EmulatorInfo)o;
                if (emuInfo == null)
                {
                    return(false);
                }

                if (!string.IsNullOrEmpty(emuInfo.Title))
                {
                    selectedEmulator.Title = emuInfo.Title;
                }

                if (!string.IsNullOrEmpty(emuInfo.Developer))
                {
                    selectedEmulator.Company = emuInfo.Developer;
                }

                int grade;
                if (!string.IsNullOrEmpty(emuInfo.Grade) && int.TryParse(emuInfo.Grade, out grade))
                {
                    selectedEmulator.Grade = grade;
                }

                string description = emuInfo.GetDescription();
                if (!string.IsNullOrEmpty(description))
                {
                    selectedEmulator.Description = description;
                }

                using (ThumbGroup thumbGroup = new ThumbGroup(selectedEmulator))
                {
                    if (!string.IsNullOrEmpty(emuInfo.LogoUrl))
                    {
                        thumbGroup.FrontCover.Path = emuInfo.LogoUrl;
                        thumbGroup.SaveThumb(ThumbType.FrontCover);
                    }
                    if (!string.IsNullOrEmpty(emuInfo.FanartUrl))
                    {
                        thumbGroup.Fanart.Path = emuInfo.FanartUrl;
                        thumbGroup.SaveThumb(ThumbType.Fanart);
                    }
                }

                selectedEmulator.Save();
                return(true);
            });

            if (lEmuInfo != null)
            {
                setEmulatorToPanel(selectedListItem);
            }
        }