public async Task UpdateAsync(UpdateCheckArgs args)
        {
            // Check for available update
            var update = await CheckForUpdateAsync(args);

            if (update != null)
            {
                // Download the update side by side
                var file = await DownloadAsync(update, progress, cancellationToken);

                // Launch the downloaded update
                await LaunchAsync(new LaunchArgs(file.Filename));
            }
        }
        public async Task <UpdateInfo> CheckForUpdateAsync(UpdateCheckArgs args = null)
        {
            var assetName       = args?.AssetName ?? Path.GetFileName(fileVersionInfo.FileName);
            var allowPreRelease = args != null && args.AllowPreRelease;
            var ignoreTags      = args?.IgnoreTags ?? new string[] { };
            var uri             = args?.Uri ?? defaultUri;

            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/vnd.github.v3+json"));
            client.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(assetName, fileVersionInfo.FileVersion));

            // Get the latest releases from GitHub
            using (var response = await client.GetAsync(uri, HttpCompletionOption.ResponseHeadersRead))
            {
                var content = await response.Content.ReadAsStringAsync();

                response.EnsureSuccessStatusCode();

                var serializer = new JavaScriptSerializer();
                var results    = serializer.Deserialize <List <GitHubRelease> >(content);

                var latest = results.FirstOrDefault(x => (allowPreRelease || !x.prerelease) &&
                                                    !ignoreTags.Any(tag => tag.Equals(x.tag_name, StringComparison.OrdinalIgnoreCase)));
                if (latest == null)
                {
                    Trace.TraceWarning("Couldn't find a release from the list returned by GitHub");
                    return(null);
                }

                var asset = latest.assets.FirstOrDefault(x => x.name.Equals(assetName, StringComparison.OrdinalIgnoreCase));
                if (asset == null)
                {
                    Trace.TraceWarning($"Couldn't find '${assetName}' in the release assets for " + latest.name);
                    return(null);
                }

                var info = new UpdateInfo
                {
                    Version        = new SemanticVersion(latest.tag_name),
                    Uri            = asset.browser_download_url.ToString(),
                    IsPreRelease   = latest.prerelease,
                    Name           = asset.name,
                    CurrentVersion = new SemanticVersion(fileVersionInfo.ProductVersion)
                };

                return(info);
            }
        }