/// <summary> /// Removes policy module flags from a specified Certification Authority. Multiple /// flags can be removed at the time. /// </summary> /// <param name="flags">One or more flags defined in <see cref="PolicyModuleFlagEnum"/> enumeration.</param> public void Remove(PolicyModuleFlagEnum flags) { Int32[] existing = EnumFlags.GetEnabled(typeof(PolicyModuleFlagEnum), (Int32)EditFlags); Int32[] newf = EnumFlags.GetEnabled(typeof(PolicyModuleFlagEnum), (Int32)flags); foreach (Int32 item in newf.Where(item => EnumFlags.Contains(existing, item))) { EditFlags = (PolicyModuleFlagEnum)((Int32)EditFlags - item); IsModified = true; } }
/// <summary> /// Adds policy module flags to enable on a specified Certification Authority. Multiple /// flags can be added at the time. /// </summary> /// <param name="flags">One or more flags defined in <see cref="PolicyModuleFlagEnum"/> enumeration.</param> /// <exception cref="UninitializedObjectException">If the object is not initialized through one of the class constructors.</exception> /// <exception cref="ArgumentException">The data in the <strong>flags</strong> parameter /// contains policy module flags that are not supported by a current Certification Authority version.</exception> public void Add(PolicyModuleFlagEnum flags) { Int32[] existing = EnumFlags.GetEnabled(typeof(PolicyModuleFlagEnum), (Int32)EditFlags); Int32[] newf = EnumFlags.GetEnabled(typeof(PolicyModuleFlagEnum), (Int32)flags); if (version == CertSrvPlatformVersion.Win2003 && ((Int32)flags & (Int32)PolicyModuleFlagEnum.EnableOCSPRevNoCheck) != 0 || ((Int32)flags & (Int32)PolicyModuleFlagEnum.EnableRenewOnBehalfOf) != 0 ) { throw new ArgumentException("This certification authority version do not support specified flag or flags."); } if (version == CertSrvPlatformVersion.Win2008 && ((Int32)flags & (Int32)PolicyModuleFlagEnum.EnableRenewOnBehalfOf) != 0) { throw new ArgumentException(); } foreach (Int32 item in newf.Where(item => !EnumFlags.Contains(existing, item))) { EditFlags = (PolicyModuleFlagEnum)((Int32)EditFlags + item); IsModified = true; } }