public HttpQuery Clear(LinkText key) { var newPairsByKey = _pairsByKey.ToDictionary(); newPairsByKey.Remove(key); return(new HttpQuery(newPairsByKey)); }
public HttpQuery Set(LinkText key, LinkText value) { var newPairsByKey = _pairsByKey.ToDictionary(); newPairsByKey[key] = HttpQueryPair.From(key, value); return(new HttpQuery(newPairsByKey)); }
public static FolderLink From(LinkText root, string resource) { if (!TryFrom(root, resource, out var link)) { throw new FormatException($"Failed to parse folder resource: {resource}"); } return(link); }
public static HttpQueryPair From(LinkText key, LinkText value) => new HttpQueryPair(key, value);
public static bool ExtensionIs(this FileName fileName, LinkText extension) { return(fileName.Extension == extension); }
public static HttpDomain From(LinkText name) => new HttpDomain(name);
public static bool ExtensionIs(this FileResource file, LinkText extension) => file.Name.ExtensionIs(extension);
public static FileName From(LinkText text, LinkText extension) { return(new FileName(text, extension)); }
public static bool TryFrom(LinkText root, string resource, out FolderLink link) { link = From(root, FolderResource.From(resource)); return(true); }
public static bool HasUncPrefix(LinkText root) => root.ToString().StartsWith(UncPrefix);
public static FolderLink From(LinkText root, FolderResource resource) => new FolderLink(root, resource);
FolderLink(LinkText root, FolderResource resource, bool isUnc = false) { Root = root; Resource = resource; IsUnc = isUnc; }
public static FolderLink From(LinkText root, string resource, bool strict = true) { var parsedResource = FolderResource.From(resource, strict); return(parsedResource == null ? null : From(root, resource)); }
// // Factory // public static FolderLink From(LinkText root, FolderResource resource) { return(new FolderLink(root, resource)); }
public static FileName From(LinkText text, LinkText extension) => new FileName(text, extension);
public HttpResource WithQuery(LinkText key, LinkText value) => new HttpResource(Path, Query.Set(key, value));
private FileName(LinkText text, LinkText extension) { Text = text; Extension = extension; }
public HttpResource WithoutQuery(LinkText key) => new HttpResource(Path, Query.Clear(key));
public static bool ExtensionIs(this FileName fileName, LinkText extension) => fileName.Extension == extension;
public LinkText this[LinkText key] => _pairsByKey[key].Value;
HttpDomain(LinkText name) { Name = name; }
public bool ContainsKey(LinkText key) => _pairsByKey.ContainsKey(key);
public static LinkText WithSeparator(LinkText extension) { return(extension.Value.StartsWith(Separator) ? extension : new LinkText(Separator + extension.Value)); }
public bool TryGet(LinkText key, out LinkText value) { value = _pairsByKey.TryGetValue(key, out var pair) ? pair.Value : null; return(value != null); }
public static bool ExtensionIs(this FileResource file, LinkText extension) { return(file.Name.ExtensionIs(extension)); }
HttpQueryPair(LinkText key, LinkText value) { Key = key; Value = value; }