Class FeedUri
- Namespace
- ZeroInstall.Model
- Assembly
- ZeroInstall.Model.dll
Represents a feed or interface URI or local path. Unlike Uri this class only accepts HTTP(S) URLs and absolute local paths.
[TypeConverter(typeof(StringConstructorConverter<FeedUri>))]
[Equatable]
public sealed class FeedUri : Uri, ISpanFormattable, IFormattable, ISerializable, IEquatable<FeedUri>
- Inheritance
-
FeedUri
- Implements
- Inherited Members
Constructors
FeedUri(string)
Creates a feed URI from a string.
public FeedUri(string value)
Parameters
value
stringA string to parse as an HTTP(S) URL or an absolute local path.
Exceptions
- UriFormatException
value
is not a valid HTTP(S) URL or an absolute local path.
FeedUri(Uri)
Creates a feed URI from an existing Uri.
public FeedUri(Uri value)
Parameters
Exceptions
- UriFormatException
value
is not a valid HTTP(S) URL or an absolute local path.
FeedUri(FeedUri)
Passing a FeedUri instance into the FeedUri constructor does nothing useful. Just use the original object.
[Obsolete("Passing a FeedUri instance into the FeedUri constructor does nothing useful. Just use the original object.")]
public FeedUri(FeedUri value)
Parameters
value
FeedUri
Fields
FakePrefix
This is prepended to a FeedUri if it is meant for demo data and should not be used to actually fetch a feed.
public const string FakePrefix = "fake:"
Field Value
- See Also
FromDistributionPrefix
This is prepended to FromFeed if data was pulled from a native package manager rather than the feed itself.
public const string FromDistributionPrefix = "distribution:"
Field Value
- See Also
Properties
IsFake
Indicates whether this is a fake identifier meant for demo data and should not be used to actually fetch a feed.
public bool IsFake { get; }
Property Value
- See Also
IsFromDistribution
Indicates that an ImplementationSelection was generated with data from a native package manager rather than the feed itself.
public bool IsFromDistribution { get; }
Property Value
- See Also
Methods
Equals(object?)
Compares two Uri instances for equality.
public override bool Equals(object? obj)
Parameters
obj
object
Returns
Escape()
Escapes the identifier using URL encoding.
public string Escape()
Returns
Escape(string)
Escapes an identifier using URL encoding.
[Pure]
public static string Escape(string value)
Parameters
value
string
Returns
EscapeComponent()
Convert the identifier to a list of path components. e.g. "http://example.com/foo.xml" becomes ["http", "example.com", "foo.xml"], while "/root/feed.xml" becomes ["file", "root__feed.xml"]. The number of components is determined by the scheme (three for http, two for file). Uses [underscore_escape] to escape each component.
public string[] EscapeComponent()
Returns
- string[]
GetHashCode()
Gets the hash code for the URI.
public override int GetHashCode()
Returns
- int
The hash value generated for this URI.
PrettyEscape()
Escapes the identifier using URL encoding except for slashes (encoded as #) and colons (left as-is on POSIX systems).
public string PrettyEscape()
Returns
PrettyEscape(string)
Escapes an identifier using URL encoding except for slashes (encoded as #) and colons (left as-is on POSIX systems).
[Pure]
public static string PrettyEscape(string value)
Parameters
value
string
Returns
PrettyUnescape(string)
Unescapes an identifier using URL encoding except for slashes (encoded as #).
[Pure]
public static FeedUri PrettyUnescape(string escaped)
Parameters
escaped
string
Returns
ToString()
Returns a string representation of the URI, not adhering to the escaping rules of RFC 2396. Not safe for parsing!
public override string ToString()
Returns
ToStringRfc()
An alternate version of ToString() that produces results escaped according to RFC 2396. Safe for parsing!
public string ToStringRfc()
Returns
Unescape(string)
Unescapes an identifier using URL encoding.
public static FeedUri Unescape(string escaped)
Parameters
escaped
string
Returns
Exceptions
- UriFormatException
The unescaped string is not a valid HTTP(S) URL or an absolute local path.
Operators
operator ==(FeedUri?, FeedUri?)
Indicates whether the object on the left is equal to the object on the right.
public static bool operator ==(FeedUri? left, FeedUri? right)
Parameters
Returns
- bool
true if the objects are equal; otherwise, false.
operator !=(FeedUri?, FeedUri?)
Indicates whether the object on the left is not equal to the object on the right.
public static bool operator !=(FeedUri? left, FeedUri? right)
Parameters
Returns
- bool
true if the objects are not equal; otherwise, false.