StorageExtensions
using Azure.Core;
using Azure.Core.Pipeline;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
namespace Azure.Storage.Shared
{
internal static class StorageExtensions
{
public static string (this string path, bool trimOuterSlashes = true)
{
if (path == null)
return null;
path = (trimOuterSlashes ? path.Trim('/') : path);
string[] array = path.Split('/', StringSplitOptions.None);
for (int i = 0; i < array.Length; i++) {
array[i] = Uri.EscapeDataString(array[i]);
}
return string.Join("/", array);
}
public static string (this string path, bool trimOuterSlashes = true)
{
if (path == null)
return null;
path = (trimOuterSlashes ? path.Trim('/') : path);
string[] array = path.Split('/', StringSplitOptions.None);
for (int i = 0; i < array.Length; i++) {
array[i] = Uri.UnescapeDataString(array[i]);
}
return string.Join("/", array);
}
public static string (long offset)
{
byte[] array = new byte[48];
BitConverter.GetBytes(offset).CopyTo(array, 0);
return Convert.ToBase64String(array);
}
[AsyncStateMachine(typeof(<GetCopyAuthorizationHeaderAsync>d__3))]
public static Task<HttpAuthorization> (this TokenCredential tokenCredential, CancellationToken cancellationToken = default(CancellationToken))
{
<GetCopyAuthorizationHeaderAsync>d__3 stateMachine = default(<GetCopyAuthorizationHeaderAsync>d__3);
stateMachine.<>t__builder = AsyncTaskMethodBuilder<HttpAuthorization>.Create();
stateMachine.tokenCredential = tokenCredential;
stateMachine.cancellationToken = cancellationToken;
stateMachine.<>1__state = -1;
stateMachine.<>t__builder.Start(ref stateMachine);
return stateMachine.<>t__builder.Task;
}
public static IDisposable (ClientSideEncryptionVersion version)
{
string text;
if ((int)version != 1) {
if ((int)version != 2)
throw Errors.ClientSideEncryption.UnrecognizedVersion();
text = "Azure.Storage.StorageTelemetryPolicy.ClientSideEncryption.V2";
} else
text = "Azure.Storage.StorageTelemetryPolicy.ClientSideEncryption.V1";
string key = text;
return HttpPipeline.CreateHttpMessagePropertiesScope((IDictionary<string, object>)new Dictionary<string, object> {
{
key,
true
}
});
}
}
}