public UpdateInformationResult2 DownloadUpdate2( UpdateCheckInfo2 info) { try { CheckThrowApiKey(info.ApiKey); LogCentral.Current.LogInfo( string.Format( @"Downloading Update for client with version '{0}', date '{1}'.", info.VersionNumber, info.VersionDate)); var avail = IsUpdateAvailable2(info); var result = new UpdateInformationResult2 { IsPresent = avail.IsPresent, AlternativeFallbackDownloadUrl = avail.DownloadWebsiteUrl, FileName = @"ZetaResourceEditor-setup.exe", FileContent = File.ReadAllBytes(getSetupExeFilePath()) }; return(result); } catch (Exception x) { LogCentral.Current.LogError(@"Error downloading update .", x); throw; } }
public UpdatePresentResult2 IsUpdateAvailable2( UpdateCheckInfo2 info) { try { CheckThrowApiKey(info.ApiKey); var v1 = new Version(info.VersionNumber); var v2 = availableVersion; var url = v1 >= v2 ? string.Empty : ConfigurationManager.AppSettings[@"updateChecker.downloadUrl"]; var web = v1 >= v2 ? string.Empty : ConfigurationManager.AppSettings[@"updateChecker.websiteUrl"]; var result = new UpdatePresentResult2 { IsPresent = v1 < v2, DownloadWebsiteUrl = web }; LogCentral.Current.LogInfo(string.Format(@"Returning download URL '{0}'.", url)); return(result); } catch (Exception x) { LogCentral.Current.LogError(@"Error checking whether an update is available.", x); throw; } }