UpdateHref() public method

public UpdateHref ( Uri baseUri ) : void
baseUri System.Uri
return void
示例#1
0
 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
 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
 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.");
 }