Exemplo n.º 1
0
        private static Uri ConstructHostStyleNephosUri(Uri hostSuffix, NephosUriComponents uriComponents)
        {
            if (uriComponents.AccountName == null)
            {
                return(hostSuffix);
            }
            string accountName = uriComponents.AccountName;

            if (uriComponents.IsSecondaryAccountAccess)
            {
                accountName = uriComponents.GetSecondaryAccountName();
            }
            Uri           uri           = HttpRequestAccessorJuly09.ConstructHostStyleAccountUri(hostSuffix, accountName);
            StringBuilder stringBuilder = new StringBuilder(string.Empty);

            if (uriComponents.ContainerName != null)
            {
                stringBuilder.Append(uriComponents.ContainerName);
            }
            if (uriComponents.RemainingPart != null)
            {
                if (uriComponents.ContainerName != null)
                {
                    stringBuilder.Append("/");
                }
                stringBuilder.Append(uriComponents.RemainingPart);
            }
            return(HttpRequestAccessorJuly09.ConstructUriFromUriAndString(uri, stringBuilder.ToString()));
        }
Exemplo n.º 2
0
        public static NephosUriComponents GetNephosHostStyleUriComponents(Uri uri, string accountName)
        {
            string str;
            string str1;
            NephosUriComponents nephosUriComponent = new NephosUriComponents(accountName);

            string[]            uriPathSubStrings   = HttpRequestAccessorJuly09.GetUriPathSubStrings(uri, 2);
            NephosUriComponents nephosUriComponent1 = nephosUriComponent;

            if ((int)uriPathSubStrings.Length <= 0 || string.IsNullOrEmpty(uriPathSubStrings[0]))
            {
                str = null;
            }
            else
            {
                str = uriPathSubStrings[0];
            }
            nephosUriComponent1.ContainerName = str;
            NephosUriComponents nephosUriComponent2 = nephosUriComponent;

            if ((int)uriPathSubStrings.Length <= 1 || string.IsNullOrEmpty(uriPathSubStrings[1]))
            {
                str1 = null;
            }
            else
            {
                str1 = uriPathSubStrings[1];
            }
            nephosUriComponent2.RemainingPart = str1;
            nephosUriComponent.IsRemainingPartPresentButEmpty = ((int)uriPathSubStrings.Length <= 1 || uriPathSubStrings[1] == null ? false : uriPathSubStrings[1].Length == 0);
            return(nephosUriComponent);
        }
Exemplo n.º 3
0
 public static Uri ConstructNephosUri(Uri endpoint, NephosUriComponents uriComponents, bool pathStyleUri)
 {
     NephosAssertionException.Assert(endpoint != null);
     NephosAssertionException.Assert(uriComponents != null);
     if (!pathStyleUri)
     {
         return(HttpRequestAccessorJuly09.ConstructHostStyleNephosUri(endpoint, uriComponents));
     }
     return(HttpRequestAccessorJuly09.ConstructPathStyleNephosUri(endpoint, uriComponents));
 }
Exemplo n.º 4
0
        public static void GetContainerNameAndRemainingPart(Uri uri, bool uriIsPathStyle, out string containerName, out string remainingPart)
        {
            containerName = null;
            remainingPart = null;
            int num = (uriIsPathStyle ? 1 : 0);

            string[] uriPathSubStrings = HttpRequestAccessorJuly09.GetUriPathSubStrings(uri, num + 2);
            if (uriPathSubStrings != null && (int)uriPathSubStrings.Length > num)
            {
                containerName = uriPathSubStrings[num];
                if ((int)uriPathSubStrings.Length > num + 1)
                {
                    remainingPart = uriPathSubStrings[num + 1];
                }
            }
        }
Exemplo n.º 5
0
        public static NephosUriComponents GetNephosPathStyleUriComponents(Uri uri)
        {
            string str;
            string str1;
            string str2;
            NephosUriComponents nephosUriComponent = new NephosUriComponents()
            {
                IsUriPathStyle = true
            };

            string[]            uriPathSubStrings   = HttpRequestAccessorJuly09.GetUriPathSubStrings(uri, 3);
            NephosUriComponents nephosUriComponent1 = nephosUriComponent;

            if ((int)uriPathSubStrings.Length > 0)
            {
                str = HttpRequestAccessorCommon.TrimEndSlash(uriPathSubStrings[0]);
            }
            else
            {
                str = null;
            }
            nephosUriComponent1.AccountName = str;
            NephosUriComponents nephosUriComponent2 = nephosUriComponent;

            if ((int)uriPathSubStrings.Length <= 1 || string.IsNullOrEmpty(uriPathSubStrings[1]))
            {
                str1 = null;
            }
            else
            {
                str1 = uriPathSubStrings[1];
            }
            nephosUriComponent2.ContainerName = str1;
            NephosUriComponents nephosUriComponent3 = nephosUriComponent;

            if ((int)uriPathSubStrings.Length <= 2 || string.IsNullOrEmpty(uriPathSubStrings[2]))
            {
                str2 = null;
            }
            else
            {
                str2 = uriPathSubStrings[2];
            }
            nephosUriComponent3.RemainingPart = str2;
            nephosUriComponent.IsRemainingPartPresentButEmpty = ((int)uriPathSubStrings.Length <= 2 || uriPathSubStrings[2] == null ? false : uriPathSubStrings[2].Length == 0);
            return(nephosUriComponent);
        }
Exemplo n.º 6
0
        public static NephosUriComponents GetNephosUriComponents(Uri uri, string[] hostSuffixes, bool allowPathStyleUri, out bool uriIsPathStyle)
        {
            NephosUriComponents nephosUriComponent = null;

            if (HttpRequestAccessorJuly09.TryGetNephosHostStyleUriComponents(uri, hostSuffixes, out nephosUriComponent))
            {
                uriIsPathStyle = false;
                return(nephosUriComponent);
            }
            if (!allowPathStyleUri)
            {
                uriIsPathStyle = false;
                return(null);
            }
            uriIsPathStyle = true;
            return(HttpRequestAccessorJuly09.GetNephosPathStyleUriComponents(uri));
        }
Exemplo n.º 7
0
        private static Uri ConstructStorageDomainStyleNephosUri(Uri storageDomain, NephosUriComponents uriComponents)
        {
            StringBuilder stringBuilder = new StringBuilder(string.Empty);

            if (uriComponents.ContainerName != null)
            {
                stringBuilder.Append(uriComponents.ContainerName);
            }
            if (uriComponents.RemainingPart != null)
            {
                if (uriComponents.ContainerName != null)
                {
                    stringBuilder.Append("/");
                }
                stringBuilder.Append(uriComponents.RemainingPart);
            }
            return(HttpRequestAccessorJuly09.ConstructUriFromUriAndString(storageDomain, stringBuilder.ToString()));
        }
Exemplo n.º 8
0
        private static bool TryGetNephosHostStyleUriComponents(Uri uri, string[] hostSuffixes, out NephosUriComponents uriComponents)
        {
            uriComponents = null;
            string host = uri.Host;

            string[] strArrays = hostSuffixes;
            for (int i = 0; i < (int)strArrays.Length; i++)
            {
                string str = strArrays[i];
                if (host.EndsWith(str, StringComparison.OrdinalIgnoreCase))
                {
                    string str1 = host.Substring(0, host.Length - str.Length);
                    if (str1.Length > 0 && str1[str1.Length - 1] == HttpRequestAccessorCommon.subDomainDelimiterChar && str1.Length > 1)
                    {
                        string str2 = str1.Substring(0, str1.Length - 1);
                        uriComponents = HttpRequestAccessorJuly09.GetNephosHostStyleUriComponents(uri, str2);
                        return(true);
                    }
                }
            }
            return(false);
        }
Exemplo n.º 9
0
        private static Uri ConstructPathStyleNephosUri(Uri endpoint, NephosUriComponents uriComponents)
        {
            StringBuilder stringBuilder = new StringBuilder(string.Empty);

            if (uriComponents.AccountName != null)
            {
                stringBuilder.Append(uriComponents.AccountName);
                if (uriComponents.IsSecondaryAccountAccess)
                {
                    stringBuilder.Append("-secondary");
                }
                if (uriComponents.ContainerName != null)
                {
                    stringBuilder.Append("/");
                    stringBuilder.Append(uriComponents.ContainerName);
                }
                if (uriComponents.RemainingPart != null)
                {
                    stringBuilder.Append("/");
                    stringBuilder.Append(uriComponents.RemainingPart);
                }
            }
            return(HttpRequestAccessorJuly09.ConstructUriFromUriAndString(endpoint, stringBuilder.ToString()));
        }
Exemplo n.º 10
0
 public static string ConstructCopySourceResource(string accountName, string containerName, string blobName)
 {
     return(HttpRequestAccessorJuly09.ConstructCopySourceResource(accountName, containerName, blobName, null));
 }
Exemplo n.º 11
0
 private static string[] GetUriPathSubStrings(Uri uri, int count)
 {
     return(HttpRequestAccessorJuly09.GetUriPathSubStrings(uri, count, StringSplitOptions.None));
 }
Exemplo n.º 12
0
 public static NephosUriComponents GetNephosUriComponents(HttpWebRequest request, string[] hostSuffixes, bool allowPathStyleUri)
 {
     return(HttpRequestAccessorJuly09.GetNephosUriComponents(request.Address, hostSuffixes, allowPathStyleUri));
 }
Exemplo n.º 13
0
 public static NephosUriComponents GetNephosUriComponents(IHttpListenerRequest request, string[] hostSuffixes, bool allowPathStyleUri)
 {
     return(HttpRequestAccessorJuly09.GetNephosUriComponents(HttpUtilities.GetRequestUri(request), hostSuffixes, allowPathStyleUri));
 }
Exemplo n.º 14
0
        public static NephosUriComponents GetNephosUriComponents(Uri uri, string[] hostSuffixes, bool allowPathStyleUri)
        {
            bool flag;

            return(HttpRequestAccessorJuly09.GetNephosUriComponents(uri, hostSuffixes, allowPathStyleUri, out flag));
        }
Exemplo n.º 15
0
 private static string[] GetAccountUriPathSubStrings(Uri uri, int count)
 {
     return(HttpRequestAccessorJuly09.GetUriPathSubStrings(uri, count, StringSplitOptions.RemoveEmptyEntries));
 }
Exemplo n.º 16
0
 public static Uri ConstructStorageDomainUri(Uri endpoint, NephosUriComponents uriComponents)
 {
     NephosAssertionException.Assert(endpoint != null);
     NephosAssertionException.Assert(uriComponents != null);
     return(HttpRequestAccessorJuly09.ConstructStorageDomainStyleNephosUri(endpoint, uriComponents));
 }