UpdateInfo determineUpdateInfo(IEnumerable <ReleaseEntry> localReleases, IEnumerable <ReleaseEntry> remoteReleases, bool ignoreDeltaUpdates) { var packageDirectory = Utility.PackageDirectoryForAppDir(rootAppDirectory); localReleases = localReleases ?? Enumerable.Empty <ReleaseEntry>(); if (remoteReleases == null || !remoteReleases.Any()) { this.Log().Warn("Release information couldn't be determined due to remote corrupt RELEASES file"); remoteReleases = localReleases; } var latestFullRelease = Utility.FindCurrentVersion(remoteReleases); var currentRelease = Utility.FindCurrentVersion(localReleases); if (currentRelease != null && latestFullRelease.Version <= currentRelease.Version) { this.Log().Info("No updates"); var info = UpdateInfo.Create(currentRelease, new[] { currentRelease }, packageDirectory); return(info); } else { var vold = currentRelease != null ? currentRelease.Version : null; var vnew = latestFullRelease != null ? latestFullRelease.Version : null; this.Log().Info("Remote version {0} differs from local {1}", vnew, vold); } if (ignoreDeltaUpdates) { remoteReleases = remoteReleases.Where(x => !x.IsDelta); } if (!localReleases.Any()) { this.Log().Warn("First run or local directory is corrupt, starting from scratch"); return(UpdateInfo.Create(currentRelease, new[] { latestFullRelease }, packageDirectory)); } if (localReleases.Max(x => x.Version) > remoteReleases.Max(x => x.Version)) { this.Log().Warn("hwhat, local version is greater than remote version"); return(UpdateInfo.Create(currentRelease, new[] { latestFullRelease }, packageDirectory)); } return(UpdateInfo.Create(currentRelease, remoteReleases, packageDirectory)); }
UpdateInfo determineUpdateInfo(IEnumerable <ReleaseEntry> localReleases, IEnumerable <ReleaseEntry> remoteReleases, bool ignoreDeltaUpdates) { var packageDirectory = Utility.PackageDirectoryForAppDir(rootAppDirectory); localReleases = localReleases ?? Enumerable.Empty <ReleaseEntry>(); if (remoteReleases == null) { this.Log().Warn("Release information couldn't be determined due to remote corrupt RELEASES file"); throw new Exception("Corrupt remote RELEASES file"); } if (localReleases.Count() == remoteReleases.Count()) { this.Log().Info("No updates, remote and local are the same"); var latestFullRelease = findCurrentVersion(remoteReleases); var currentRelease = findCurrentVersion(localReleases); var info = UpdateInfo.Create(currentRelease, new[] { latestFullRelease }, packageDirectory, appFrameworkVersion); return(info); } if (ignoreDeltaUpdates) { remoteReleases = remoteReleases.Where(x => !x.IsDelta); } if (!localReleases.Any()) { this.Log().Warn("First run or local directory is corrupt, starting from scratch"); var latestFullRelease = findCurrentVersion(remoteReleases); return(UpdateInfo.Create(findCurrentVersion(localReleases), new[] { latestFullRelease }, packageDirectory, appFrameworkVersion)); } if (localReleases.Max(x => x.Version) > remoteReleases.Max(x => x.Version)) { this.Log().Warn("hwhat, local version is greater than remote version"); var latestFullRelease = findCurrentVersion(remoteReleases); return(UpdateInfo.Create(findCurrentVersion(localReleases), new[] { latestFullRelease }, packageDirectory, appFrameworkVersion)); } return(UpdateInfo.Create(findCurrentVersion(localReleases), remoteReleases, packageDirectory, appFrameworkVersion)); }