public override async Task <UpdateInfo?> CheckForUpdate(bool grabDeltaUpdates = true) { var releaseFileLocation = Path.Combine(AppMetadata.TempFolder, "RELEASE"); //if this is the case then we clearly haven't downloaded the RELEASE file if (await DownloadReleaseFile(releaseFileLocation) < 0) { return(null); } //Create the UpdateInfo return(ReleaseFileExt.GetUpdateInfo(releaseFileLocation, AppMetadata, grabDeltaUpdates)); }
/// <summary> /// Downloads the release file and creates the <see cref="UpdateInfo"/> /// </summary> /// <param name="tagName">What the tag that contains the RELEASE file is</param> /// <param name="fileSize">How big the RELEASE file should be</param> /// <param name="downloadUrl">The URI with the the RELEASE file</param> /// <param name="grabDeltaUpdates">If we want to grab only delta updates from the RELEASE file (If false we only grab full update files)</param> protected async Task <UpdateInfo?> DownloadAndParseReleaseFile(string tagName, long fileSize, string downloadUrl, bool grabDeltaUpdates) { var releaseFileLocation = Path.Combine(ApplicationMetadata.TempFolder, $"RELEASES-{ApplicationMetadata.ApplicationName}-{tagName}"); var fileLength = await _githubClient.DownloadReleaseFile(releaseFileLocation, downloadUrl); //Just do a sanity check of the file size if (fileLength != fileSize) { Logger.Error("RELEASE file isn't the length as expected, deleting and returning null..."); File.Delete(releaseFileLocation); return(null); } //Create the UpdateInfo return(ReleaseFileExt.GetUpdateInfo(releaseFileLocation, ApplicationMetadata, grabDeltaUpdates, tagName)); }
public override Task <UpdateInfo?> CheckForUpdate(bool grabDeltaUpdates = true) { return(Task.FromResult(ReleaseFileExt.GetUpdateInfo(_releaseFile, AppMetadata, grabDeltaUpdates, folderLocation: _updateFileFolder))); }