Exemplo n.º 1
0
        internal new static void ValidateName(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new FormatException(DataStrings.CmdletFullNameFormatException(name ?? string.Empty));
            }
            int num = name.IndexOf(',');

            if (-1 == num)
            {
                if (RoleEntry.ContainsInvalidChars(name))
                {
                    throw new FormatException(DataStrings.CmdletFullNameFormatException(name));
                }
            }
            else
            {
                if (num == 0 || name.Length - 1 == num)
                {
                    throw new FormatException(DataStrings.CmdletFullNameFormatException(name));
                }
                if (RoleEntry.ContainsInvalidChars(name, 0, num))
                {
                    throw new FormatException(DataStrings.CmdletFullNameFormatException(name));
                }
                if (RoleEntry.ContainsInvalidChars(name, 1 + num, name.Length - num - 1))
                {
                    throw new FormatException(DataStrings.CmdletFullNameFormatException(name));
                }
            }
        }