C# Class Microsoft.Protocols.TestSuites.MS_OXORULE.AdapterHelper

Help method collection.
Show file Open project: OfficeDev/Interop-TestSuites

Public Methods

Method Description
AllocFlatUID_r ( FlatUID_r fuid_r ) : IntPtr

Allocate memory for GUIDs.

AllocPropertyTagArray_r ( PropertyTagArray_r pta_r ) : IntPtr

Allocate memory for the specific property values.

AllocStat ( STAT stat ) : IntPtr

Allocate memory for stat instance.

ConvertStringToBytes ( string str ) : byte[]

This method converts a string to a byte array, the string is consist of hex16 values which are separated by ",".

GenerateContentRestriction ( TaggedPropertyValue taggedPValue ) : byte[]

Build a RestrictionData as single ContentRestriction.

GenerateExtendedRuleTestData ( string rulename, int ruleSequence, uint ruleState, string provider, ActionType actionType, IActionData actionData, string contentRestrictSubjectName, NamedPropertyInfo namedPropertyInfo ) : Microsoft.Protocols.TestSuites.Common.TaggedPropertyValue[]

Generate test data for creating extended rule.

GenerateRecipientPropertiesBlock ( string userName, string userDN ) : Microsoft.Protocols.TestSuites.Common.TaggedPropertyValue[]

Generate property value on recipient.

GenerateRuleInfoPropertiesOfDAM ( ) : Microsoft.Protocols.TestSuites.Common.PropertyTag[]

Generate PropertyTag arrays for rule properties of DAM.

GenerateRuleProperties ( ITestSite site, string name ) : RuleProperties

Generate rule properties value.

GenerateValidRuleData ( ActionType actionType, TestRuleDataType ruleDataType, int ruleSequence, RuleState ruleState, IActionData actionData, RuleProperties otherInfo, ulong ruleId ) : RuleData

Generate RuleData from ptf config base on different action Type.

GenerateValidRuleDataWithFlavor ( ActionType actionType, int ruleSequence, RuleState ruleState, IActionData actionData, uint actionFlavor, RuleProperties otherInfo ) : RuleData

Generate RuleData from ptf config base on different action Type.

IsContainSameValue ( uint uintArray ) : bool

This method is used to determine whether there are two elements of the same value in a uint array.

ParseBinaryArray_r ( IntPtr ptr ) : BinaryArray_r

Parse BinaryArray_r structure.

ParseBinary_r ( IntPtr ptr ) : Binary_r

Parse Binary_r structure.

ParseEphemeralEntryIDFromBytes ( byte bytes ) : EphemeralEntryID

Parse EphemeralEntryID structure from byte array.

ParseFlatUIDArray_r ( IntPtr ptr ) : FlatUIDArray_r

Parse FlatUIDArray_r structure.

ParseFlatUID_r ( IntPtr ptr ) : FlatUID_r

Parse GUIDs.

ParseLongArray_r ( IntPtr ptr ) : LongArray_r

Parse LongArray_r structure.

ParsePROP_VAL_UNION ( AddressBookPropertyValue propertyValue, PropertyTypeValue proptype ) : PROP_VAL_UNION

Parse PROP_VAL_UNION structure.

ParsePROP_VAL_UNION ( IntPtr ptr, PropertyTypeValue proptype ) : PROP_VAL_UNION

Parse PROP_VAL_UNION structure.

ParsePermanentEntryIDFromBytes ( byte bytes ) : PermanentEntryID

Parse PermanentEntryID structure from byte array.

ParsePropertyRowSet_r ( IntPtr ptr ) : PropertyRowSet_r

Parse PropertyRowSet_r structure.

ParsePropertyRowSet_r ( LargePropTagArray columns, uint rowCount, AddressBookPropertyRow rowData ) : PropertyRowSet_r

Parse PropertyRowSet_r structure.

ParsePropertyRowSet_r ( uint rowsCount, AddressBookPropValueList rows ) : PropertyRowSet_r

Parse PropertyRowSet_r structure.

ParsePropertyRow_r ( AddressBookPropValueList row ) : PropertyRow_r

Parse the PropertyRow_r structure.

ParsePropertyRow_r ( IntPtr ptr ) : PropertyRow_r

Parse PropertyRow_r structure.

ParsePropertyValue_r ( IntPtr ptr ) : PropertyValue_r

Parse PropertyValue_r structure.

ParseShortArray_r ( IntPtr ptr ) : ShortArray_r

Parse ShortArray_r structure.

ParseStat ( IntPtr ptr ) : STAT

Parse a STAT structure instance from pointer.

ParseStringArray_r ( IntPtr ptr ) : StringArray_r

Parse StringArray_r structure.

ParseString_r ( IntPtr ptr ) : byte[]

Parse String_r structure.

ParseWStringArray_r ( IntPtr ptr ) : WStringArray_r

Parse WStringArray_r structure.

ParseWString_r ( IntPtr ptr ) : byte[]

Parse WString_r structure.

PropertyValueConvertToBinary ( byte byteArray ) : byte[]

This method help to convert the property value, which is of variable bytes, to binary value.

PropertyValueConvertToBool ( byte byteArray ) : bool

This method help to convert the property value, which is of 1 byte, to Boolean value.

PropertyValueConvertToExtendedRuleActions ( byte byteArray ) : ExtendedRuleActions

This method help to convert the property value, which is of variable bytes, to ExtendedRuleActions structure.

PropertyValueConvertToExtendedRuleCondition ( byte byteArray ) : ExtendedRuleCondition

This method help to convert the property value, which is of variable bytes, to ExtendedRuleCondition structure.

PropertyValueConvertToInt ( byte byteArray ) : int

This method helps to convert the property value, which is of 4 bytes, to int value.

PropertyValueConvertToRuleAction ( byte byteArray ) : RuleAction

This method help to convert the property value, which is of variable bytes, to RuleAction structure.

PropertyValueConvertToString ( byte byteArray ) : string

This method help to convert the property value, which is of variable bytes, to string value.

PropertyValueConvertToUint ( byte byteArray ) : uint

This method helps to convert the property value, which is of 4 bytes, to unsigned integer value.

PropertyValueConvertToUint64 ( byte byteArray ) : ulong

This method helps to convert the property value, which is of 8 bytes, to unsigned long value.

ReadTaggedProperty ( byte buffer ) : TaggedPropertyValue

Get a TaggedPropertyValue structure from buffer.

ReadValueByType ( ushort type, byte buffer ) : byte[]

Read a value from buffer for special Type.

SerializeRecipientProperties ( ) : uint[]

Serialize recipient properties.

Private Methods

Method Description
AddRuleAction ( IList list, ActionType actionType, IActionData actionData, uint actionFlavor, uint actionFlags ) : void

Add rule action to the properties list.

AddRuleCondition ( IList list, string mailSubjectContent ) : void

Add ruleCondition to the properties list.

GetRuleAction ( ActionType actionType, CountByte countBytes, IActionData actionDataBufferValue, uint actionFlavor, uint actionFlags ) : RuleAction

Generate a rule action.

Method Details

AllocFlatUID_r() public static method

Allocate memory for GUIDs.
public static AllocFlatUID_r ( FlatUID_r fuid_r ) : IntPtr
fuid_r FlatUID_r Instance of GUIDs.
return System.IntPtr

AllocPropertyTagArray_r() public static method

Allocate memory for the specific property values.
public static AllocPropertyTagArray_r ( PropertyTagArray_r pta_r ) : IntPtr
pta_r PropertyTagArray_r PropertyTagArray_r instance.
return System.IntPtr

AllocStat() public static method

Allocate memory for stat instance.
public static AllocStat ( STAT stat ) : IntPtr
stat STAT The stat instance.
return System.IntPtr

ConvertStringToBytes() public static method

This method converts a string to a byte array, the string is consist of hex16 values which are separated by ",".
public static ConvertStringToBytes ( string str ) : byte[]
str string A string to be converted.
return byte[]

GenerateContentRestriction() public static method

Build a RestrictionData as single ContentRestriction.
public static GenerateContentRestriction ( TaggedPropertyValue taggedPValue ) : byte[]
taggedPValue Microsoft.Protocols.TestSuites.Common.TaggedPropertyValue A TaggedPropertyValue of this restriction.
return byte[]

GenerateExtendedRuleTestData() public static method

Generate test data for creating extended rule.
public static GenerateExtendedRuleTestData ( string rulename, int ruleSequence, uint ruleState, string provider, ActionType actionType, IActionData actionData, string contentRestrictSubjectName, NamedPropertyInfo namedPropertyInfo ) : Microsoft.Protocols.TestSuites.Common.TaggedPropertyValue[]
rulename string The rule name.
ruleSequence int The rule sequence.
ruleState uint The rule state.
provider string The rule provider.
actionType ActionType The rule action Type.
actionData IActionData The rule action data.
contentRestrictSubjectName string The subject name of the rule content restriction.
namedPropertyInfo NamedPropertyInfo The namedPropertyInfo that needed for construct the rule data.
return Microsoft.Protocols.TestSuites.Common.TaggedPropertyValue[]

GenerateRecipientPropertiesBlock() public static method

Generate property value on recipient.
public static GenerateRecipientPropertiesBlock ( string userName, string userDN ) : Microsoft.Protocols.TestSuites.Common.TaggedPropertyValue[]
userName string Recipient user name.
userDN string Recipient user dn.
return Microsoft.Protocols.TestSuites.Common.TaggedPropertyValue[]

GenerateRuleInfoPropertiesOfDAM() public static method

Generate PropertyTag arrays for rule properties of DAM.
public static GenerateRuleInfoPropertiesOfDAM ( ) : Microsoft.Protocols.TestSuites.Common.PropertyTag[]
return Microsoft.Protocols.TestSuites.Common.PropertyTag[]

GenerateRuleProperties() public static method

Generate rule properties value.
public static GenerateRuleProperties ( ITestSite site, string name ) : RuleProperties
site ITestSite An instance of interface ITestSite which provides logging, assertions, /// and adapters for test code onto its execution context.
name string Rule name.
return RuleProperties

GenerateValidRuleData() public static method

Generate RuleData from ptf config base on different action Type.
public static GenerateValidRuleData ( ActionType actionType, TestRuleDataType ruleDataType, int ruleSequence, RuleState ruleState, IActionData actionData, RuleProperties otherInfo, ulong ruleId ) : RuleData
actionType ActionType ActionType in a rule.
ruleDataType TestRuleDataType The type of the rule data.
ruleSequence int Rule sequence in PidTagRuleSequence of the RuleData.
ruleState RuleState Specifies value of PidTagRuleState of the RuleData.
actionData IActionData The actionData needed to construct the RuleData.
otherInfo RuleProperties /// An array of Other needed information of Actions. /// Index may be from 0-4 /// 0. Rule name /// 1. Rule provider /// 2. Rule user Flags /// 3. Rule provider data /// 4. Subject name of content restriction ///
ruleId ulong A 64-bit unsigned integer represents the rule.
return Microsoft.Protocols.TestSuites.Common.RuleData

GenerateValidRuleDataWithFlavor() public static method

Generate RuleData from ptf config base on different action Type.
public static GenerateValidRuleDataWithFlavor ( ActionType actionType, int ruleSequence, RuleState ruleState, IActionData actionData, uint actionFlavor, RuleProperties otherInfo ) : RuleData
actionType ActionType ActionType in a rule.
ruleSequence int Rule sequence in PidTagRuleSequence of the RuleData.
ruleState RuleState Specifies value of PidTagRuleState of the RuleData.
actionData IActionData The actionData needed to construct the RuleData.
actionFlavor uint The actionFlavor of the rule action.
otherInfo RuleProperties /// An array of Other needed information of Actions. /// Index may be from 0-4 /// 0. Rule name /// 1. Rule provider /// 2. Rule user Flags /// 3. Rule provider data /// 4. Subject name of content restriction ///
return Microsoft.Protocols.TestSuites.Common.RuleData

IsContainSameValue() public static method

This method is used to determine whether there are two elements of the same value in a uint array.
public static IsContainSameValue ( uint uintArray ) : bool
uintArray uint The unsigned integer array to be evaluated.
return bool

ParseBinaryArray_r() public static method

Parse BinaryArray_r structure.
public static ParseBinaryArray_r ( IntPtr ptr ) : BinaryArray_r
ptr System.IntPtr A pointer points to the allocated memory.
return BinaryArray_r

ParseBinary_r() public static method

Parse Binary_r structure.
public static ParseBinary_r ( IntPtr ptr ) : Binary_r
ptr System.IntPtr A pointer points to the allocated memory.
return Binary_r

ParseEphemeralEntryIDFromBytes() public static method

Parse EphemeralEntryID structure from byte array.
public static ParseEphemeralEntryIDFromBytes ( byte bytes ) : EphemeralEntryID
bytes byte The byte array to be parsed.
return EphemeralEntryID

ParseFlatUIDArray_r() public static method

Parse FlatUIDArray_r structure.
public static ParseFlatUIDArray_r ( IntPtr ptr ) : FlatUIDArray_r
ptr System.IntPtr A pointer points to the allocated memory.
return FlatUIDArray_r

ParseFlatUID_r() public static method

Parse GUIDs.
public static ParseFlatUID_r ( IntPtr ptr ) : FlatUID_r
ptr System.IntPtr A pointer points to the allocated memory.
return FlatUID_r

ParseLongArray_r() public static method

Parse LongArray_r structure.
public static ParseLongArray_r ( IntPtr ptr ) : LongArray_r
ptr System.IntPtr A pointer points to the allocated memory.
return LongArray_r

ParsePROP_VAL_UNION() public static method

Parse PROP_VAL_UNION structure.
public static ParsePROP_VAL_UNION ( AddressBookPropertyValue propertyValue, PropertyTypeValue proptype ) : PROP_VAL_UNION
propertyValue AddressBookPropertyValue The property value used for parsing.
proptype PropertyTypeValue The Property Types used for parsing.
return PROP_VAL_UNION

ParsePROP_VAL_UNION() public static method

Parse PROP_VAL_UNION structure.
public static ParsePROP_VAL_UNION ( IntPtr ptr, PropertyTypeValue proptype ) : PROP_VAL_UNION
ptr System.IntPtr A pointer points to the allocated memory.
proptype PropertyTypeValue Property Types.
return PROP_VAL_UNION

ParsePermanentEntryIDFromBytes() public static method

Parse PermanentEntryID structure from byte array.
public static ParsePermanentEntryIDFromBytes ( byte bytes ) : PermanentEntryID
bytes byte The byte array to be parsed.
return PermanentEntryID

ParsePropertyRowSet_r() public static method

Parse PropertyRowSet_r structure.
public static ParsePropertyRowSet_r ( IntPtr ptr ) : PropertyRowSet_r
ptr System.IntPtr A pointer points to the allocated memory.
return PropertyRowSet_r

ParsePropertyRowSet_r() public static method

Parse PropertyRowSet_r structure.
public static ParsePropertyRowSet_r ( LargePropTagArray columns, uint rowCount, AddressBookPropertyRow rowData ) : PropertyRowSet_r
columns LargePropTagArray The columns which contain property tags.
rowCount uint The row count of the PropertyRowSet_r.
rowData AddressBookPropertyRow The row data which contain the property values.
return PropertyRowSet_r

ParsePropertyRowSet_r() public static method

Parse PropertyRowSet_r structure.
public static ParsePropertyRowSet_r ( uint rowsCount, AddressBookPropValueList rows ) : PropertyRowSet_r
rowsCount uint The row count of the PropertyRowSet_r.
rows AddressBookPropValueList The rows which contains property tags and property values.
return PropertyRowSet_r

ParsePropertyRow_r() public static method

Parse the PropertyRow_r structure.
public static ParsePropertyRow_r ( AddressBookPropValueList row ) : PropertyRow_r
row AddressBookPropValueList The row which contains property tags and property values
return PropertyRow_r

ParsePropertyRow_r() public static method

Parse PropertyRow_r structure.
public static ParsePropertyRow_r ( IntPtr ptr ) : PropertyRow_r
ptr System.IntPtr A pointer points to the allocated memory.
return PropertyRow_r

ParsePropertyValue_r() public static method

Parse PropertyValue_r structure.
public static ParsePropertyValue_r ( IntPtr ptr ) : PropertyValue_r
ptr System.IntPtr A pointer points to the allocated memory.
return PropertyValue_r

ParseShortArray_r() public static method

Parse ShortArray_r structure.
public static ParseShortArray_r ( IntPtr ptr ) : ShortArray_r
ptr System.IntPtr A pointer points to the allocated memory.
return ShortArray_r

ParseStat() public static method

Parse a STAT structure instance from pointer.
public static ParseStat ( IntPtr ptr ) : STAT
ptr System.IntPtr Pointer points to the memory.
return STAT

ParseStringArray_r() public static method

Parse StringArray_r structure.
public static ParseStringArray_r ( IntPtr ptr ) : StringArray_r
ptr System.IntPtr A pointer points to the allocated memory.
return StringArray_r

ParseString_r() public static method

Parse String_r structure.
public static ParseString_r ( IntPtr ptr ) : byte[]
ptr System.IntPtr A pointer points to the allocated memory.
return byte[]

ParseWStringArray_r() public static method

Parse WStringArray_r structure.
public static ParseWStringArray_r ( IntPtr ptr ) : WStringArray_r
ptr System.IntPtr A pointer points to the allocated memory.
return WStringArray_r

ParseWString_r() public static method

Parse WString_r structure.
public static ParseWString_r ( IntPtr ptr ) : byte[]
ptr System.IntPtr A pointer points to the allocated memory.
return byte[]

PropertyValueConvertToBinary() public static method

This method help to convert the property value, which is of variable bytes, to binary value.
public static PropertyValueConvertToBinary ( byte byteArray ) : byte[]
byteArray byte The byte array to be converted.
return byte[]

PropertyValueConvertToBool() public static method

This method help to convert the property value, which is of 1 byte, to Boolean value.
public static PropertyValueConvertToBool ( byte byteArray ) : bool
byteArray byte The byte array to be converted.
return bool

PropertyValueConvertToExtendedRuleActions() public static method

This method help to convert the property value, which is of variable bytes, to ExtendedRuleActions structure.
public static PropertyValueConvertToExtendedRuleActions ( byte byteArray ) : ExtendedRuleActions
byteArray byte The byte array to be converted.
return ExtendedRuleActions

PropertyValueConvertToExtendedRuleCondition() public static method

This method help to convert the property value, which is of variable bytes, to ExtendedRuleCondition structure.
public static PropertyValueConvertToExtendedRuleCondition ( byte byteArray ) : ExtendedRuleCondition
byteArray byte The byte array to be converted.
return ExtendedRuleCondition

PropertyValueConvertToInt() public static method

This method helps to convert the property value, which is of 4 bytes, to int value.
public static PropertyValueConvertToInt ( byte byteArray ) : int
byteArray byte The byte array to be converted.
return int

PropertyValueConvertToRuleAction() public static method

This method help to convert the property value, which is of variable bytes, to RuleAction structure.
public static PropertyValueConvertToRuleAction ( byte byteArray ) : RuleAction
byteArray byte The byte array to be converted.
return RuleAction

PropertyValueConvertToString() public static method

This method help to convert the property value, which is of variable bytes, to string value.
public static PropertyValueConvertToString ( byte byteArray ) : string
byteArray byte The byte array to be converted.
return string

PropertyValueConvertToUint() public static method

This method helps to convert the property value, which is of 4 bytes, to unsigned integer value.
public static PropertyValueConvertToUint ( byte byteArray ) : uint
byteArray byte The byte array to be converted.
return uint

PropertyValueConvertToUint64() public static method

This method helps to convert the property value, which is of 8 bytes, to unsigned long value.
public static PropertyValueConvertToUint64 ( byte byteArray ) : ulong
byteArray byte The byte array to be converted.
return ulong

ReadTaggedProperty() public static method

Get a TaggedPropertyValue structure from buffer.
public static ReadTaggedProperty ( byte buffer ) : TaggedPropertyValue
buffer byte Buffer contain TaggedPropertyValue instance.
return Microsoft.Protocols.TestSuites.Common.TaggedPropertyValue

ReadValueByType() public static method

Read a value from buffer for special Type.
public static ReadValueByType ( ushort type, byte buffer ) : byte[]
type ushort The Type of value.
buffer byte Buffer contains value.
return byte[]

SerializeRecipientProperties() public static method

Serialize recipient properties.
public static SerializeRecipientProperties ( ) : uint[]
return uint[]