Inheritance: RetrievalMethod, IRecipeStep
 /// <inheritdoc/>
 protected bool Equals(DownloadRetrievalMethod other)
 {
     if (other == null)
     {
         return(false);
     }
     return(base.Equals(other) && other.Href == Href && other.Size == Size);
 }
示例#2
0
        private void Retrieve(DownloadRetrievalMethod retrievalMethod, string localPath)
        {
            _feedBuilder.RetrievalMethod = retrievalMethod;

            using (var handler = new GuiTaskHandler(this))
            {
                _feedBuilder.TemporaryDirectory = (localPath == null)
                    ? retrievalMethod.DownloadAndApply(handler)
                    : retrievalMethod.LocalApply(localPath, handler);
            }
        }
        /// <inheritdoc/>
        protected override TemporaryFile Download(DownloadRetrievalMethod retrievalMethod, object tag = null)
        {
            #region Sanity checks
            if (retrievalMethod == null) throw new ArgumentNullException("retrievalMethod");
            #endregion

            try
            {
                return base.Download(retrievalMethod, tag);
            }
            catch (WebException ex)
            {
                Log.Warn(ex);
                if (retrievalMethod.Href.IsLoopback) throw;
                Log.Info("Trying mirror");

                try
                {
                    var mirrored = (DownloadRetrievalMethod)retrievalMethod.CloneRecipeStep();
                    mirrored.Href = GetMirrorUrl(retrievalMethod.Href);
                    return Download(mirrored, tag);
                }
                catch (WebException)
                {
                    // Report the original problem instead of mirror errors
                    ex.Rethrow();
                    throw;
                }
            }
        }
 /// <inheritdoc/>
 protected bool Equals(DownloadRetrievalMethod other)
 {
     if (other == null) return false;
     return base.Equals(other) && other.Href == Href && other.Size == Size;
 }