ZeroInstall.Central.WinForms.SyncWizard.CheckCryptoKey C# (CSharp) Method

CheckCryptoKey() private method

private CheckCryptoKey ( ) : void
return void
        private void CheckCryptoKey()
        {
            var appListUri = new Uri(_server.Uri, new Uri("app-list", UriKind.Relative));

            using (var webClient = new WebClientTimeout
            {
                Credentials = _server.Credentials,
                CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore)
            })
            {
                try
                {
                    AppList.LoadXmlZip(new MemoryStream(webClient.DownloadData(appListUri)), _cryptoKey);
                }
                    #region Error handling
                catch (WebException ex)
                    when (ex.Status == WebExceptionStatus.ProtocolError && (ex.Response as HttpWebResponse)?.StatusCode == HttpStatusCode.Unauthorized)
                {
                    // Wrap exception to add context information
                    throw new WebException(Resources.SyncCredentialsInvalid, ex, ex.Status, ex.Response);
                }
                catch (ZipException ex)
                {
                    // Wrap exception to add context information
                    if (ex.Message == "Invalid password for AES") throw new InvalidDataException(Resources.SyncCryptoKeyInvalid);
                    else throw new InvalidDataException(Resources.SyncServerDataDamaged, ex);
                }
                #endregion
            }
        }
        #endregion