private static ServerVersion ParseServerVersion(string version)
        {
            ServerVersion result;

            if (!SettingsScopeRestriction.TryParseServerVersion(version, out result))
            {
                throw new ConfigurationSettingsUnsupportedVersionException(version);
            }
            return(result);
        }
示例#2
0
        internal override void Validate(IConfigSchema schema)
        {
            if (base.Restriction == null)
            {
                throw new ConfigurationSettingsRestrictionExpectedException(base.GetType().Name);
            }
            if (!string.IsNullOrEmpty(base.Restriction.SubType))
            {
                throw new ConfigurationSettingsRestrictionExtraProperty(base.GetType().Name, "SubType");
            }
            bool flag = false;

            if (!string.IsNullOrEmpty(base.Restriction.MinVersion))
            {
                SettingsScopeRestriction.ValidateAsServerVersion(base.Restriction.MinVersion);
                flag = true;
            }
            if (!string.IsNullOrEmpty(base.Restriction.MaxVersion))
            {
                SettingsScopeRestriction.ValidateAsServerVersion(base.Restriction.MaxVersion);
                flag = true;
            }
            if (!string.IsNullOrEmpty(base.Restriction.NameMatch))
            {
                SettingsScopeRestriction.ValidateNameMatch(base.Restriction.NameMatch);
                flag = true;
            }
            if (base.Restriction.GuidMatch != null)
            {
                flag = true;
            }
            if (!flag)
            {
                throw new ConfigurationSettingsRestrictionExpectedException(base.GetType().Name);
            }
        }
 public static void ValidateAsExchangeVersion(string version)
 {
     SettingsScopeRestriction.ValidateAsExchangeVersion(SettingsScopeRestriction.ParseExchangeVersion(version));
 }
 public static void ValidateAsServerVersion(int version)
 {
     SettingsScopeRestriction.ValidateAsServerVersion(new ServerVersion(version));
 }
 public static void ValidateAsServerVersion(string version)
 {
     SettingsScopeRestriction.ValidateAsServerVersion(SettingsScopeRestriction.ParseServerVersion(version));
 }
 public static void ValidateNameMatch(string expression)
 {
     SettingsScopeRestriction.CreateRegex(expression);
 }