Skip to content

Latest commit

 

History

History
40 lines (37 loc) · 1.15 KB

README.md

File metadata and controls

40 lines (37 loc) · 1.15 KB

UpdateChecker

Channel Status
CI CI
NuGet.org NuGet.org

Usage

GitHub Releases

var updaterChecker = new GitHubReleasesUpdateChecker(
		@"TCPingInfoView", // Owner
		@"TCPingInfoView-Classic", // Repo
		false, // Is pre-release
		@"1.6.0", // Current app version string
		tag => tag.Replace(@"v", string.Empty), // Tag to version string
		new DefaultVersionComparer() // Version comparer
);
try
{
	var res = await updaterChecker.CheckAsync(default);
	//var res = await updaterChecker.CheckAsync(new HttpClient(), new CancellationToken());
	if (res)
	{
		// Update Found

		var latestVersion = updaterChecker.LatestVersion;
		var latestVersionUrl = updaterChecker.LatestVersionUrl;
		var assetsUrl = updaterChecker.LatestRelease.assets.Select(asset => asset.browser_download_url);
	}
	else
	{
		// No newer version was found
	}
}
catch (Exception ex)
{
	// Network exception or cannot find any correct tag.
}