Class ResourceUrlHelpers
- Namespace
- Acuit.Pinpoint.ResourceManagement
- Assembly
- Acuit.Pinpoint.ResourceManagement.Abstractions.dll
Helpers for working with resource URLs.
public static class ResourceUrlHelpers
- Inheritance
-
ResourceUrlHelpers
- Inherited Members
Methods
FormatUrl(string, params string[])
Formats a URL that specifies an absolute path to a resource, without an authority or query information.
public static Uri FormatUrl(string schemeName, params string[] segments)
Parameters
Returns
Examples
var uri = ResourceUrlHelpers.FormatUrl("com.contoso.pinpoint", "testparameters", "MODEL1234");
Will yield a Uri for: com.contoso.pinpoint:/testparameters/MODEL1234
Exceptions
- ArgumentNullException
schemeNameis null.- ArgumentNullException
segmentsis null.
FormatUrl(string, string[], string)
Formats a URL that specifies an absolute path to a resource, without an authority, with query information.
public static Uri FormatUrl(string schemeName, string[] segments, string query)
Parameters
schemeNamestringThe scheme.
segmentsstring[]The path segments.
querystringThe query information (without the leading '?').
Returns
Examples
var uri = ResourceUrlHelpers.FormatUrl("com.contoso.pinpoint", "testparameters", "MODEL1234");
Will yield a Uri for: com.contoso.pinpoint:/testparameters/MODEL1234
Exceptions
- ArgumentNullException
schemeNameis null.- ArgumentNullException
segmentsis null.- ArgumentNullException
queryis null.
TryParseUrl(Uri, string, string, int, out string[])
Tries to parse a resource URL that specifies an absolute path to a resource with a specific root segment optionally followed by a certain number of additional segments, and without an authority or query information.
public static bool TryParseUrl(Uri url, string schemeName, string rootSegment, int additionalSegmentCount, out string[] segments)
Parameters
urlUriThe URL.
schemeNamestringThe expected scheme. This is compared ignoring case.
rootSegmentstringThe expected root segment. This is compared ignoring case.
additionalSegmentCountintThe number of expected additional segments.
segmentsstring[]When this method returns, the array of path segments, including the root segment, upon success, or null if unsuccessful.
Returns
Exceptions
- ArgumentNullException
urlis null.- ArgumentNullException
schemeNameis null.- ArgumentNullException
rootSegmentis null.- ArgumentOutOfRangeException
additionalSegmentCountis less than zero.
TryParseUrl(Uri, string, string, int, out string[], out string)
Tries to parse a resource URL that specifies an absolute path to a resource with a specific root segment optionally followed by a certain number of additional segments, without an authority, and with optional query information.
public static bool TryParseUrl(Uri url, string schemeName, string rootSegment, int additionalSegmentCount, out string[] segments, out string query)
Parameters
urlUriThe URL.
schemeNamestringThe expected scheme. This is compared ignoring case.
rootSegmentstringThe expected root segment. This is compared ignoring case.
additionalSegmentCountintThe number of expected additional segments.
segmentsstring[]When this method returns, the array of path segments, including the root segment, upon success, or null if unsuccessful.
querystringWhen this method returns, the query information, or null if unsuccessful.
Returns
Exceptions
- ArgumentNullException
urlis null.- ArgumentNullException
schemeNameis null.- ArgumentNullException
rootSegmentis null.- ArgumentOutOfRangeException
additionalSegmentCountis less than zero.