Пример #1
0
 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);
 }
Пример #2
0
 /// <summary>
 /// Returns true if requested version is installed
 /// </summary>
 /// <param name="versionNo"></param>
 /// <param name="settings"></param>
 /// <returns></returns>
 static bool IsInstalled(int versionNo, Settings settings)
 {
     foreach (var version in settings.InstalledVersions)
     {
         if (version.VersionNumber == versionNo)
         {
             return(true);
         }
     }
     return(false);
 }