UpdateHref() public method

public UpdateHref ( Uri baseUri ) : void
baseUri System.Uri
return void
コード例 #1
0
ファイル: XRefMapDownloader.cs プロジェクト: zikunfan/docfx
 public static void UpdateHref(XRefMap map, Uri uri)
 {
     if (!string.IsNullOrEmpty(map.BaseUrl))
     {
         if (!Uri.TryCreate(map.BaseUrl, UriKind.Absolute, out Uri baseUri))
         {
             throw new InvalidDataException($"Xref map file (from {uri.AbsoluteUri}) has an invalid base url: {map.BaseUrl}.");
         }
         map.UpdateHref(baseUri);
         return;
     }
     if (uri.Scheme == "http" || uri.Scheme == "https")
     {
         map.UpdateHref(uri);
         return;
     }
     throw new InvalidDataException($"Xref map file (from {uri.AbsoluteUri}) missing base url.");
 }
コード例 #2
0
ファイル: BasicXRefMapReader.cs プロジェクト: z784916/docfx-1
 public BasicXRefMapReader(XRefMap map)
 {
     Map = map ?? throw new ArgumentNullException(nameof(map));
     if (map.HrefUpdated != true &&
         map.BaseUrl != null)
     {
         if (!Uri.TryCreate(map.BaseUrl, UriKind.Absolute, out Uri baseUri))
         {
             throw new InvalidDataException($"Xref map file has an invalid base url: {map.BaseUrl}.");
         }
         map.UpdateHref(baseUri);
     }
 }
コード例 #3
0
ファイル: XRefMapDownloader.cs プロジェクト: dotnet/docfx
 public static void UpdateHref(XRefMap map, Uri uri)
 {
     if (!string.IsNullOrEmpty(map.BaseUrl))
     {
         Uri baseUri;
         if (!Uri.TryCreate(map.BaseUrl, UriKind.Absolute, out baseUri))
         {
             throw new InvalidDataException($"Xref map file (from {uri.AbsoluteUri}) has an invalid base url: {map.BaseUrl}.");
         }
         map.UpdateHref(baseUri);
         return;
     }
     if (uri.Scheme == "http" || uri.Scheme == "https")
     {
         map.UpdateHref(uri);
         return;
     }
     throw new InvalidDataException($"Xref map file (from {uri.AbsoluteUri}) missing base url.");
 }