Microsoft.Protocols.TestSuites.MS_OXORULE.MS_OXORULEAdapter.QueryPropertiesInTable C# (CSharp) Method

QueryPropertiesInTable() public method

Query properties in contents table.
public QueryPropertiesInTable ( uint tableHandle, PropertyTag propertyTags ) : RopQueryRowsResponse
tableHandle uint Handle of a specific contents table.
propertyTags Microsoft.Protocols.TestSuites.Common.PropertyTag Array of PropertyTag structures. This field specifies the property values that are visible in table rows.
return Microsoft.Protocols.TestSuites.Common.RopQueryRowsResponse
        public RopQueryRowsResponse QueryPropertiesInTable(uint tableHandle, PropertyTag[] propertyTags)
        {
            // Set the properties in propertyTags to be visible.
            RopSetColumnsResponse setColumnsResponse = this.RopSetColumns(tableHandle, 0x00, propertyTags);

            // Query properties values specified in propertyTags.
            RopQueryRowsResponse queryRowsResponse = this.RopQueryRows(tableHandle, 0x00, 0x01, 1000);

            // That the two Rops are successful means that the propertyTags in request is correct
            if (setColumnsResponse.ReturnValue == 0 && queryRowsResponse.ReturnValue == 0 && queryRowsResponse.RowData.PropertyRows != null)
            {
                // Verify PropertyTags
                this.VerifyPropertiesInTable(propertyTags, queryRowsResponse);

                for (int i = 0; i < propertyTags.Length; i++)
                {
                    // If the property queried is PidTagRuleActions
                    if (propertyTags[i].PropertyId == (ushort)PropertyId.PidTagRuleActions)
                    {
                        for (int j = 0; j < queryRowsResponse.RowData.PropertyRows.Count; j++)
                        {
                            // Verify structure RuleAction 
                            RuleAction ruleAction = new RuleAction();
                            ruleAction.Deserialize(queryRowsResponse.RowData.PropertyRows[j].PropertyValues[i].Value);
                            this.VerifyRuleAction(ruleAction);
                        }
                    }

                    // If the property queried is PidTagExtendedRuleMessageActions
                    if (propertyTags[i].PropertyId == (ushort)PropertyId.PidTagExtendedRuleMessageActions)
                    {
                        for (int j = 0; j < queryRowsResponse.RowData.PropertyRows.Count; j++)
                        {
                            if (BitConverter.ToUInt32(queryRowsResponse.RowData.PropertyRows[j].PropertyValues[i].Value, 0) != (uint)ErrorCodeValue.NotFound)
                            {
                                // Verify structure RuleAction 
                                ExtendedRuleActions ruleAction = new ExtendedRuleActions();
                                byte[] extendedRuleMessageActionBuffer = new byte[queryRowsResponse.RowData.PropertyRows[j].PropertyValues[i].Value.Length - 2];
                                Array.Copy(queryRowsResponse.RowData.PropertyRows[j].PropertyValues[i].Value, 2, extendedRuleMessageActionBuffer, 0, queryRowsResponse.RowData.PropertyRows[j].PropertyValues[i].Value.Length - 2);
                                ruleAction.Deserialize(extendedRuleMessageActionBuffer);
                                this.VerifyExtendRuleAction(ruleAction.RuleActionBuffer);
                            }
                        }
                    }
                }
            }

            return queryRowsResponse;
        }