private void VerifyPropertiesInRuleData(RuleData ruleData)
{
// RuleData contains a list of properties.
for (int i = 0; i < ruleData.PropertyValues.Length; i++)
{
// propertyId indicates the Id of a property.
ushort propertyId = (ruleData.PropertyValues[i] as TaggedPropertyValue).PropertyTag.PropertyId;
// propertyType indicates the Type of a property.
ushort propertyType = (ruleData.PropertyValues[i] as TaggedPropertyValue).PropertyTag.PropertyType;
// propertyValue indicates the value of a property.
byte[] propertyValue = (ruleData.PropertyValues[i] as TaggedPropertyValue).Value;
switch (propertyId)
{
// If propertyId is 0x6679, it means the property is PidTagRuleCondition.
case 0x6679:
{
RuleCondition ruleCondition = new RuleCondition();
ruleCondition.Deserialize(propertyValue);
// Add the debug information.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2705, the value of the propertyType is {0}.", propertyType);
// Verify MS-OXCDATA requirement: MS-OXCDATA_R2705.
// Stack De-serialize this structure as this requirement, if ruleCondition is not null,
// "a byte array representing one or more Restriction structures" can be covered.
bool isVerifyR2705 = ruleCondition != null && propertyType == 0x00FD;
Site.CaptureRequirementIfIsTrue(
isVerifyR2705,
"MS-OXCDATA",
2705,
@"[In Property Value Types] PtypRestriction (PT_SRESTRICT) is that variable size; a byte array representing one or more Restriction structures as specified in section 2.12. with Property Type Value 0x00FD,%xFD.00.");
}
break;
// If propertyId is 0x6680, it means the property is PidTagRuleActions.
case 0x6680:
{
RuleAction ruleAction = new RuleAction();
ruleAction.Deserialize(propertyValue);
// Add the debug information.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2706, the value of the propertyType is {0}.", propertyType);
// Verify MS-OXCDATA requirement: MS-OXCDATA_R2706.
// Stack De-serialize this structure as this requirement, if ruleAction is not null,
// "a 16-bit COUNT of actions (not bytes) followed by that many Rule Action structures" can be covered.
bool isVerifyR2706 = ruleAction != null && propertyType == 0x00FE;
Site.CaptureRequirementIfIsTrue(
isVerifyR2706,
"MS-OXCDATA",
2706,
@"[In Property Value Types] PtypRuleAction (PT_ACTIONS) is that variable size; a 16-bit COUNT field followed by that many rule (2) action (2) structures, as specified in [MS-OXORULE] section 2.2.5. with Property Type Value 0x00FE,%xFE.00.");
}
break;
// If propertyId is 0x6674, it means the property is PidTagRuleId.
case 0x6674:
{
// Add the debug information.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2699", "The length({0}) of the propertyValue should be 8 and the value of the propertyType({1}) should be 0x0014.", propertyValue.Length, propertyType);
// Verify MS-OXCDATA requirement: MS-OXCDATA_R2699.
bool isVerifyR2699 = propertyValue.Length == 8 && propertyType == 0x0014;
Site.CaptureRequirementIfIsTrue(
isVerifyR2699,
"MS-OXCDATA",
2699,
@"[In Property Data Types] PtypInteger64 (PT_LONGLONG, PT_I8, i8, ui8) is that 8 bytes; a 64-bit integer [MS-DTYP]: LONGLONG with Property Type Value 0x0014,%x14.00.");
}
break;
}
}
}