/// <summary> /// /// </summary> /// <param name="parent"></param> /// <param name="model"></param> internal static void DownloadCompatibilityStatus(Form parent, Model.Model model) { using (FormWebpageDownload dlc = new FormWebpageDownload("http://compat.cemu.info/", "Game Status")) { dlc.ShowDialog(parent); List <GameInformation> currentGames = null; string url = ""; foreach (var line in dlc.Result.Split('\n')) { if (line.Contains("<td class=\"title\">")) { string name = line.Substring(line.LastIndexOf("\">", StringComparison.Ordinal) + 2, line.LastIndexOf("/a", StringComparison.Ordinal) - line.LastIndexOf("\">", StringComparison.Ordinal) - 3).Replace("&", "&"); url = line.Substring(line.IndexOf("http", StringComparison.Ordinal), (line.LastIndexOf("\">", StringComparison.Ordinal) - line.IndexOf("http", StringComparison.Ordinal))).Replace("&", "&"); currentGames = Persistence.GetGames(model, name); } if (line.Contains("<td class=\"rating\">")) { string rating = line.Substring(line.LastIndexOf("title=", StringComparison.Ordinal) + 7, line.LastIndexOf("\"", StringComparison.Ordinal) - line.LastIndexOf("title=", StringComparison.Ordinal) - 7); if (currentGames != null) { SetGameStatus(currentGames, rating, url); currentGames.Clear(); } } } } }
internal static void DownloadLatestGraphicsPack(Form form, Model.Model modelIn, bool showMessage = true) { try { using (FormWebpageDownload dlc = new FormWebpageDownload("https://api.github.com/repos/slashiee/cemu_graphic_packs/releases/latest", "Latest Graphic Pack")) { if (dlc.ShowDialog(form) == DialogResult.OK) { DownloadLatestGraphicPack(form, dlc.Result, showMessage); string pack = ""; foreach (var dir in Directory.EnumerateDirectories("graphicsPacks")) { string folder = dir.Replace("graphicsPacks" + Path.DirectorySeparatorChar, ""); if (folder.StartsWith("graphicPacks_2-")) { pack = folder.Replace("graphicPacks_2-", ""); } } if (pack != "") { modelIn.Settings.GraphicsPackRevision = pack; FolderScanner.FindGraphicsPacks(new DirectoryInfo(Path.Combine("graphicsPacks", "graphicPacks_2-" + modelIn.Settings.GraphicsPackRevision)), modelIn.GraphicsPacks); } } } } catch (Exception) { MessageBox.Show(Resources.FormMainWindow_DownloadLatestGraphicsPack_Unable_to_download_graphic_packs_at_this_time___Try_again_later_or_upgrate_to_latest_version_of_Budford); } }
internal static bool DownloadLatestVersion(Form parent, Settings settings) { using (FormWebpageDownload dlc = new FormWebpageDownload(CemuUrl, "Latest Version")) { dlc.ShowDialog(parent); foreach (var line in dlc.Result.Split('\n')) { if (line.Contains("name=\"download\"")) { string[] toks = line.Split('='); string ver = toks[1].Substring(1, toks[1].LastIndexOf('\"') - 1); int currentVersion = InstalledVersion.GetVersionNumber(Path.GetFileName(ver)); if (!IsInstalled(currentVersion, settings)) { return(true); } else { MessageBox.Show(Resources.CemuFeatures_DownloadLatestVersion_The_latest_version_of_Cemu_is_already_installed_, Resources.CemuFeatures_DownloadLatestVersion_Information___); return(false); } } } } return(false); }