Exemple #1
0
        public HttpQuery Clear(LinkText key)
        {
            var newPairsByKey = _pairsByKey.ToDictionary();

            newPairsByKey.Remove(key);

            return(new HttpQuery(newPairsByKey));
        }
Exemple #2
0
        public HttpQuery Set(LinkText key, LinkText value)
        {
            var newPairsByKey = _pairsByKey.ToDictionary();

            newPairsByKey[key] = HttpQueryPair.From(key, value);

            return(new HttpQuery(newPairsByKey));
        }
Exemple #3
0
        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);
        }
Exemple #4
0
 public static HttpQueryPair From(LinkText key, LinkText value) =>
 new HttpQueryPair(key, value);
Exemple #5
0
 public static bool ExtensionIs(this FileName fileName, LinkText extension)
 {
     return(fileName.Extension == extension);
 }
Exemple #6
0
 public static HttpDomain From(LinkText name) =>
 new HttpDomain(name);
Exemple #7
0
 public static bool ExtensionIs(this FileResource file, LinkText extension) =>
 file.Name.ExtensionIs(extension);
Exemple #8
0
 public static FileName From(LinkText text, LinkText extension)
 {
     return(new FileName(text, extension));
 }
Exemple #9
0
        public static bool TryFrom(LinkText root, string resource, out FolderLink link)
        {
            link = From(root, FolderResource.From(resource));

            return(true);
        }
Exemple #10
0
 public static bool HasUncPrefix(LinkText root) =>
 root.ToString().StartsWith(UncPrefix);
Exemple #11
0
 public static FolderLink From(LinkText root, FolderResource resource) =>
 new FolderLink(root, resource);
Exemple #12
0
 FolderLink(LinkText root, FolderResource resource, bool isUnc = false)
 {
     Root     = root;
     Resource = resource;
     IsUnc    = isUnc;
 }
Exemple #13
0
        public static FolderLink From(LinkText root, string resource, bool strict = true)
        {
            var parsedResource = FolderResource.From(resource, strict);

            return(parsedResource == null ? null : From(root, resource));
        }
Exemple #14
0
        //
        // Factory
        //

        public static FolderLink From(LinkText root, FolderResource resource)
        {
            return(new FolderLink(root, resource));
        }
Exemple #15
0
 public static FileName From(LinkText text, LinkText extension) =>
 new FileName(text, extension);
Exemple #16
0
 public HttpResource WithQuery(LinkText key, LinkText value) =>
 new HttpResource(Path, Query.Set(key, value));
Exemple #17
0
 private FileName(LinkText text, LinkText extension)
 {
     Text      = text;
     Extension = extension;
 }
Exemple #18
0
 public HttpResource WithoutQuery(LinkText key) =>
 new HttpResource(Path, Query.Clear(key));
Exemple #19
0
 public static bool ExtensionIs(this FileName fileName, LinkText extension) =>
 fileName.Extension == extension;
Exemple #20
0
 public LinkText this[LinkText key] => _pairsByKey[key].Value;
Exemple #21
0
 HttpDomain(LinkText name)
 {
     Name = name;
 }
Exemple #22
0
 public bool ContainsKey(LinkText key) =>
 _pairsByKey.ContainsKey(key);
Exemple #23
0
 public static LinkText WithSeparator(LinkText extension)
 {
     return(extension.Value.StartsWith(Separator) ? extension : new LinkText(Separator + extension.Value));
 }
Exemple #24
0
        public bool TryGet(LinkText key, out LinkText value)
        {
            value = _pairsByKey.TryGetValue(key, out var pair) ? pair.Value : null;

            return(value != null);
        }
Exemple #25
0
 public static bool ExtensionIs(this FileResource file, LinkText extension)
 {
     return(file.Name.ExtensionIs(extension));
 }
Exemple #26
0
 HttpQueryPair(LinkText key, LinkText value)
 {
     Key   = key;
     Value = value;
 }