Ejemplo n.º 1
0
        /// <remarks>
        /// Support scheme: http, https, ftp, file, embedded.
        /// </remarks>
        protected virtual async Task <IXRefContainer> DownloadBySchemeAsync(Uri uri)
        {
            IXRefContainer result = null;

            if (uri.IsFile)
            {
                result = DownloadFromLocal(uri);
            }
            else if (uri.Scheme == Uri.UriSchemeHttp ||
                     uri.Scheme == Uri.UriSchemeHttps ||
                     uri.Scheme == Uri.UriSchemeFtp)
            {
                result = await DownloadFromWebAsync(uri);
            }
            else if (uri.Scheme == "embedded")
            {
                result = DownloadFromAssembly(uri);
            }
            else
            {
                throw new ArgumentException($"Unsupported scheme {uri.Scheme}, expected: http, https, ftp, file, embedded.", nameof(uri));
            }
            if (result == null)
            {
                throw new InvalidDataException($"Invalid yaml file from {uri}.");
            }
            return(result);
        }
Ejemplo n.º 2
0
 private void AddRedirections(string uid, Stack <string> checkList, IXRefContainer current)
 {
     foreach (var r in current.GetRedirections().Reverse())
     {
         if (r.UidPrefix == null ||
             uid.StartsWith(r.UidPrefix))
         {
             if (r.Href != null)
             {
                 checkList.Push(r.Href);
             }
         }
     }
 }
Ejemplo n.º 3
0
 private void AddRedirections(string uid, Stack<string> checkList, IXRefContainer current)
 {
     foreach (var r in current.GetRedirections().Reverse())
     {
         if (r.UidPrefix == null ||
             uid.StartsWith(r.UidPrefix))
         {
             if (r.Href != null)
             {
                 checkList.Push(r.Href);
             }
         }
     }
 }