GetData() private method

private GetData ( ) : byte[]
return byte[]
Beispiel #1
0
        public void TestRun()
        {
            // Download the file
            var download = new DownloadMemory(Server.FileUri);
            download.Run();

            // Ensure the download was successful and the file is identical
            download.State.Should().Be(TaskState.Complete);
            download.GetData().Should().Equal(GetTestFileStream().ToArray());
        }
Beispiel #2
0
        public void TestRun()
        {
            // Download the file
            var download = new DownloadMemory(Server.FileUri);

            download.Run();

            // Ensure the download was successful and the file is identical
            download.State.Should().Be(TaskState.Complete);
            download.GetData().Should().Equal(GetTestFileStream().ToArray());
        }
        /// <inheritdoc/>
        public Catalog DownloadCatalog(FeedUri source)
        {
            #region Sanity checks
            if (source == null) throw new ArgumentNullException("source");
            #endregion

            if (source.IsFile) return XmlStorage.LoadXml<Catalog>(source.LocalPath);

            var download = new DownloadMemory(source);
            _handler.RunTask(download);
            var data = download.GetData();
            _trustManager.CheckTrust(data, source);
            return XmlStorage.LoadXml<Catalog>(new MemoryStream(data));
        }
 /// <summary>
 /// Downloads and imports a remote key file.
 /// </summary>
 /// <exception cref="WebException">The key file could not be downloaded from the internet.</exception>
 /// <exception cref="SignatureException">The downloaded key file is damaged.</exception>
 /// <exception cref="IOException">A problem occurs while writing trust configuration.</exception>
 /// <exception cref="UnauthorizedAccessException">Write access to the trust configuration is not permitted.</exception>
 private void DownloadKey([NotNull] Uri keyUri)
 {
     var download = new DownloadMemory(keyUri);
     _handler.RunTask(download);
     try
     {
         _openPgp.ImportKey(download.GetData());
     }
         #region Error handling
     catch (InvalidDataException ex)
     {
         // Wrap exception since only certain exception types are allowed
         throw new SignatureException(ex.Message, ex);
     }
     #endregion
 }
        private void Download(FeedUri feedUri)
        {
            SetLastCheckAttempt(feedUri);

            try
            {
                var download = new DownloadMemory(feedUri);
                _handler.RunTask(download);
                ImportFeed(download.GetData(), feedUri);
            }
            catch (WebException ex)
            {
                if (feedUri.IsLoopback) throw;
                Log.Warn(string.Format(Resources.FeedDownloadError, feedUri) + " " + Resources.TryingFeedMirror);
                try
                {
                    var download = new DownloadMemory(GetMirrorUrl(feedUri));
                    _handler.RunTask(download);
                    ImportFeed(download.GetData(), feedUri);
                }
                catch (WebException)
                {
                    // Report the original problem instead of mirror errors
                    ex.Rethrow();
                }
            }
        }