private bool FindRelease(Release[] releases, out Release release) { var smallestExiledVersion = FindSmallestExiledVersion(); if (smallestExiledVersion != null) { Log.Info($"Found the smallest version of Exiled - {smallestExiledVersion.FullName}"); var includePRE = Config.ShouldDownloadTestingReleases || OneOfExiledIsPrerelease(releases); for (int z = 0; z < releases.Length; z++) { release = releases[z]; #if DEBUG var version = Version.Parse(release.TagName); Log.Debug($"TV - {version} | CV - {smallestExiledVersion.Version} | TV >= CV - {VersionComparer.CustomVersionGreaterOrEquals(version, smallestExiledVersion.Version)}"); #endif if (release.PreRelease && !includePRE) { continue; } #if DEBUG if (VersionComparer.CustomVersionGreaterOrEquals(version, smallestExiledVersion.Version)) #else if (VersionComparer.CustomVersionGreater(Version.Parse(release.TagName), smallestExiledVersion.Version)) #endif { return(true); } } } else { Log.Error("Couldn't find smallest version of Exiled!"); } release = default; return(false); }
private bool OneOfExiledIsPrerelease(Release[] releases) { var libs = GetExiledLibs(); return(releases.Any(r => r.PreRelease && libs.Any(lib => VersionComparer.CustomVersionEquals(Version.Parse(r.TagName), lib.Version)))); }