Exemple #1
0
        public static void CheckContainerName(string containerName, ContainerType containerType, bool isSummaryContainer)
        {
            int num;

            if (string.IsNullOrEmpty(containerName))
            {
                if (!isSummaryContainer)
                {
                    throw new ArgumentNullException("containerName");
                }
                return;
            }
            if (containerName.Length > 63 || containerName.Length < 3)
            {
                if (!isSummaryContainer)
                {
                    throw new XStoreArgumentOutOfRangeException("containerName", string.Format("containerName must be at least {0} characters and at most {1} characters", 3, 63), "The specified resource name length is not within the permissible limits.");
                }
                return;
            }
            if ((containerType == ContainerType.BlobContainer || containerType == ContainerType.FileContainer) && SpecialNames.IsBlobContainerSpecialName(containerName))
            {
                return;
            }
            if (containerType == ContainerType.TableContainer && SpecialNames.IsTableContainerSpecialName(containerName))
            {
                return;
            }
            num = (containerType != ContainerType.TableContainer ? StorageStampHelpers.GetContainerNameInvalidChar(containerName) : StorageStampHelpers.GetTableNameInvalidChar(containerName));
            if (num < 0)
            {
                return;
            }
            if (!isSummaryContainer)
            {
                throw new InvalidResourceNameException(string.Format("The character '{0}' at index {1} is not allowed in the container name", StorageStampHelpers.MakeXmlFriendlyString(containerName[num]), num));
            }
        }