Ejemplo n.º 1
0
        public static void ValidateStorageDomainLabel(string storageDomainLabel)
        {
            if (storageDomainLabel.Length < 1 || storageDomainLabel.Length > 63)
            {
                throw new ArgumentOutOfRangeException("storageDomainName", string.Format("The length {0} of the label {1} in storage domain name is invalid.", storageDomainLabel.Length, storageDomainLabel));
            }
            int invalidCharInName = StorageStampHelpers.GetInvalidCharInName(storageDomainLabel, StorageStampHelpers.DOMAIN_LABEL_ALLOWED_PATTERN, true);

            if (invalidCharInName >= 0)
            {
                throw new ArgumentOutOfRangeException("storageDomainName", string.Format("The character '{0}' at index {1} is not allowed in the storage domain label {2}", StorageStampHelpers.MakeXmlFriendlyString(storageDomainLabel[invalidCharInName]), invalidCharInName, storageDomainLabel));
            }
        }