Table of Contents

Class UriExtensions

Namespace
Songhay.Extensions
Assembly
SonghayCore.dll

Extensions of Uri

public static class UriExtensions
Inheritance
UriExtensions
Inherited Members

Methods

IsProbablyAFile(Uri?)

Determines whether the Uri is a file.

public static bool IsProbablyAFile(this Uri? input)

Parameters

input Uri

The input.

Returns

bool

Remarks

Recall that IsFile is another way of stating that Uri.Schema == Uri.UriSchemeFile and that System.IO members can process URIs.

Also note that the only way to truly define a directory or folder is with a trailing forward/back slash.

ToAzureStorageCanonicalizedResourceLocation(Uri?, string?)

This part of the signature string represents the storage account targeted by the request. Will also include any additional query parameters/values. For ListContainers, this will return something like this: /storageaccountname/\ncomp:list

public static string ToAzureStorageCanonicalizedResourceLocation(this Uri? uri, string? accountName)

Parameters

uri Uri

The URI of the storage service.

accountName string

The storage account name.

Returns

string

string representing the canonicalized resource.

Remarks

See https://github.com/Azure-Samples/storage-dotnet-rest-api-with-auth/tree/master

See https://docs.microsoft.com/en-us/rest/api/storageservices/authorize-requests-to-azure-storage

See https://docs.microsoft.com/en-us/rest/api/storageservices/authorize-with-shared-key

See “Shared Key format for 2009-09-19 and later” [ https://docs.microsoft.com/en-us/rest/api/storageservices/authorize-with-shared-key#shared-key-format-for-2009-09-19-and-later ]

ToBaseUri(Uri?)

Converts the Uri into a base URI.

public static string? ToBaseUri(this Uri? input)

Parameters

input Uri

The input.

Returns

string

Returns a string like: https://MyServer:8080/

ToExpandedUriAsync(Uri?)

Converts the specified Uri to its ‘expanded’ version.

public static Task<Uri?> ToExpandedUriAsync(this Uri? expandableUri)

Parameters

expandableUri Uri

The expandable Uri.

Returns

Task<Uri>

Remarks

This member will call itself recursively until IsMovedOrRedirected(HttpResponseMessage?) returns true or Location is null.

ToExpandedUriPairAsync(Uri?)

Converts the specified Uri to its ‘expanded’ version.

public static Task<KeyValuePair<Uri?, Uri?>> ToExpandedUriPairAsync(this Uri? expandableUri)

Parameters

expandableUri Uri

The expandable Uri.

Returns

Task<KeyValuePair<Uri, Uri>>

ToFileName(Uri?)

Converts the Uri into its file name.

public static string? ToFileName(this Uri? input)

Parameters

input Uri

The input.

Returns

string

ToRelativeUriFromQuery(Uri?)

Converts the Uri into a relative URI from query.

public static Uri? ToRelativeUriFromQuery(this Uri? input)

Parameters

input Uri

The input.

Returns

Uri