DownloadAsync() public method

Download xref map file from uri (async).
public DownloadAsync ( Uri uri ) : Task
uri System.Uri The uri of xref map file.
return Task
コード例 #1
0
ファイル: XRefArchiveBuilder.cs プロジェクト: xuan2261/docfx
        private async Task <string> DownloadCoreAsync(Uri uri, XRefArchive xa, bool isMajor)
        {
            IXRefContainer container;

            container = await _downloader.DownloadAsync(uri);

            if (!(container is XRefMap map))
            {
                // not support download an xref archive, or reference to an xref archive
                return(null);
            }
            if (map.Redirections?.Count > 0)
            {
                await RewriteRedirections(uri, xa, map);
            }
            if (map.References?.Count > 0 && map.HrefUpdated != true)
            {
                if (string.IsNullOrEmpty(map.BaseUrl))
                {
                    XRefMapDownloader.UpdateHref(map, uri);
                }
            }
            lock (_syncRoot)
            {
                if (isMajor)
                {
                    return(xa.CreateMajor(map));
                }
                else
                {
                    return(xa.CreateMinor(map, GetNames(uri, map)));
                }
            }
        }
コード例 #2
0
ファイル: XRefCollection.cs プロジェクト: diev/dotnet-docfx
 private void AddToDownloadList(IEnumerable <Uri> uris)
 {
     foreach (var uri in uris)
     {
         if (uri.IsAbsoluteUri)
         {
             if (_set.Add(uri.AbsoluteUri))
             {
                 var task = _downloader.DownloadAsync(uri);
                 _processing[task] = uri;
             }
         }
         else if (_set.Add(uri.OriginalString))
         {
             var task = _downloader.DownloadAsync(uri);
             _processing[task] = uri;
         }
     }
 }