private void VerifyExtendedRuleMessageCondition(ExtendedRuleCondition extendedRuleCondition)
{
// Get all of the Named Properties contained in this condition property value.
PropertyName[] propertyNames = extendedRuleCondition.NamedPropertyInformation.NamedProperty;
if (extendedRuleCondition.RuleRestriction != null)
{
// Add the debug information.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R215");
// Verify MS-OXORULE requirement: MS-OXORULE_R215.
// If the value of the restrictionType is less than 0x0c means the RuleRestriction is one of the restriction structure.
bool isVerifyR215 = (uint)extendedRuleCondition.RuleRestriction.RestrictType < 0x0c;
Site.CaptureRequirementIfIsTrue(
isVerifyR215,
215,
@"[In PidTagExtendedRuleMessageCondition Property] RuleRestriction (variable): The condition is expressed as a restriction, as specified in [MS-OXCDATA] section 2.12.");
// Add the debug information.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R214");
// Verify MS-OXORULE requirement: MS-OXORULE_R214.
// The condition is a ContentRestriction type, so if RuleRestriction in the extendRuleCondition is a ContentRestriction type R214 can be verified.
Site.CaptureRequirementIfAreEqual<Type>(
typeof(ContentRestriction),
extendedRuleCondition.RuleRestriction.GetType(),
214,
@"[In PidTagExtendedRuleMessageCondition Property] RuleRestriction (variable): A structure containing the condition to be evaluated.");
}
// If the propertyNames exists, check whether the names' value contained in this structure are all in Unicode format.
if (propertyNames != null)
{
// isContainNameValue is used to indicate whether exist nameValue in the PropertyName array.
bool isContainNameValue = false;
bool isVerifyR198 = true;
// Check whether every name value contained in the PropertyName structure is in Unicode format.
for (int i = 0; i < propertyNames.Length; i++)
{
// Get the name value contained in the action buffer.
// Name is a string value.
byte[] nameValue = propertyNames[i].Name;
if (nameValue != null)
{
isContainNameValue = true;
// If the nameValue cannot be converted to a Unicode string, it means the name value is not in Unicode format.
if (Encoding.Unicode.GetString(nameValue) == null)
{
isVerifyR198 = false;
break;
}
}
}
if (isContainNameValue)
{
// Add the debug information.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R198");
// Verify MS-OXORULE requirement: MS-OXORULE_R198.
Site.CaptureRequirementIfIsTrue(
isVerifyR198,
198,
@"[In PidTagExtendedRuleMessageCondition Property] All string values contained in any part of this condition property value MUST be in Unicode format.");
}
}
this.VerifyNamedPropertyInformation(extendedRuleCondition.NamedPropertyInformation);
// Add the debug information.
// The format of the PidTagExtendedRuleMessageCondition property: NamedPropertyInformation, RuleRestriction has been verified by above capture code, so R200 can be verified directly.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R200");
// Verify MS-OXORULE requirement: MS-OXORULE_R200.
Site.CaptureRequirement(
200,
@"[In PidTagExtendedRuleMessageCondition Property] The format of the PidTagExtendedRuleMessageCondition property is as follows: NamedPropertyInformation, RuleRestriction.");
}