/// <summary>
        ///     Download information to repair the current installation
        /// </summary>
        /// <returns>Return the information required by the downloader to scan the current files and find differences</returns>
        public async Task <UpdatePackageFilebase> RepairAsync()
        {
            var version = VersionProvider.GetVersion();

            HttpClientSetHeaders(version);

            var uri = new Uri($"packages/{Uri.EscapeDataString(version.ToString())}/files", UriKind.Relative);

            var platforms = PlatformProvider?.GetEncodedPlatforms();

            if (platforms != null)
            {
                uri = uri.AddQueryParameters("platforms", platforms.Value.ToString());
            }

            var response = await _httpClient.Value.GetAsync(uri);

            if (!response.IsSuccessStatusCode)
            {
                throw await UpdateSystemResponseExtensions.GetResponseException(response, this);
            }

            var result = await response.Content.ReadAsStringAsync();

            var jwtResponse =
                JsonConvert.DeserializeObject <JwtResponse <List <SignedFileInformation> > >(result,
                                                                                             _jsonSerializerSettings);

            HttpClientSetJwt(jwtResponse);
            return(new UpdatePackageFilebase(jwtResponse.Result, this, version));
        }
        /// <summary>
        ///     Search for new update packages with the given options
        /// </summary>
        /// <returns>Return the result of the update search</returns>
        public async Task <UpdatePackageSearchResult> SearchForNewUpdatePackagesAsync()
        {
            var versionFilter = VersionFilter?.GetSupportedPrereleases();

            if (versionFilter?.Length > 10)
            {
                throw new ArgumentException("A maximum of 10 version filters is allowed.");
            }

            var httpClient = _httpClient.Value;
            var version    = VersionProvider.GetVersion();

            HttpClientSetHeaders(version);

            try
            {
                var uri = new Uri($"packages/{Uri.EscapeDataString(version.ToString())}/check", UriKind.Relative);

                var platforms = PlatformProvider?.GetEncodedPlatforms();
                if (platforms != null)
                {
                    uri = uri.AddQueryParameters("platforms", platforms.Value.ToString());
                }

                if (versionFilter?.Length > 0)
                {
                    uri = uri.AddQueryParameters("versionFilter",
                                                 Uri.EscapeDataString(JsonConvert.SerializeObject(versionFilter)));
                }

                var response = await httpClient.GetAsync(uri);

                if (!response.IsSuccessStatusCode)
                {
                    throw await UpdateSystemResponseExtensions.GetResponseException(response, this);
                }

                var result = await response.Content.ReadAsStringAsync();

                var jwtResponse =
                    JsonConvert.DeserializeObject <JwtResponse <UpdatePackageSearchResult> >(result,
                                                                                             _jsonSerializerSettings);

                HttpClientSetJwt(jwtResponse);
                var searchResult = jwtResponse.Result;
                searchResult.Initialize(this);

                if (!searchResult.IsUpdateAvailable)
                {
                    Settings?.NoUpdatesFoundCleanup(ProjectId);
                }

                return(searchResult);
            }
            finally
            {
                httpClient.DefaultRequestHeaders.AcceptLanguage.Clear();
            }
        }