Пример #1
0
        // Token: 0x06000093 RID: 147 RVA: 0x00003EE8 File Offset: 0x000020E8
        public TreeNode CreateSubtree()
        {
            ScopeNode        scopeNode = null;
            RangeNode <long> rangeNode = new RangeNode <long>();

            rangeNode.StartInclusive = new bool?(true);
            rangeNode.Start          = this.CountMinimum;
            rangeNode.EndInclusive   = new bool?(true);
            rangeNode.End            = this.CountMaximum;
            ScopeNode scopeNode2 = new ScopeNode("ClassificationCount");

            scopeNode2.FirstChild = rangeNode;
            if (!this.isDefaultConfidenceRange)
            {
                RangeNode <long> rangeNode2 = new RangeNode <long>();
                rangeNode2.StartInclusive = new bool?(true);
                rangeNode2.Start          = this.ConfidenceMinimum;
                rangeNode2.EndInclusive   = new bool?(true);
                rangeNode2.End            = this.ConfidenceMaximum;
                scopeNode            = new ScopeNode("ClassificationConfidence");
                scopeNode.FirstChild = rangeNode2;
            }
            TreeNode treeNode;

            if (this.isDefaultConfidenceRange)
            {
                treeNode = scopeNode2;
            }
            else if (this.isDefaultCountRange)
            {
                treeNode = scopeNode;
            }
            else
            {
                AndNode andNode = new AndNode();
                andNode.AddNode(scopeNode2);
                andNode.AddNode(scopeNode);
                treeNode = andNode;
            }
            if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100))
            {
                ULS.SendTraceTag(6121180U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "ClassificationDecoding.CreateSubtree :: subtree={0}; Result of transforming the query.", new object[]
                {
                    treeNode
                });
            }
            return(treeNode);
        }
        // Token: 0x06000017 RID: 23 RVA: 0x000027A4 File Offset: 0x000009A4
        public void SetClassificationResults(ICAClassificationResultCollection results)
        {
            if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100))
            {
                ULS.SendTraceTag(4850008U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "FASTClassificationItem.SetClassificationResults :: saving results for [{0}]", new object[]
                {
                    this.ItemId
                });
            }
            IUpdateableBucketField updateableBucketField = this.record[this.managedPropertiesPosition] as IUpdateableBucketField;

            if (updateableBucketField != null)
            {
                if (this.persistClassificationData)
                {
                    updateableBucketField.AddField(this.lastScanPropertyName, StandardFields.GetStandardDateTimeField(new DateTime?(DateTime.UtcNow)), BuiltInTypes.DateTimeType);
                }
                ICollection <long?>  collection  = new List <long?>();
                ICollection <long?>  collection2 = new List <long?>();
                ICollection <string> collection3 = new List <string>();
                HashSet <long>       hashSet     = new HashSet <long>();
                if (results != null && results.Count > 0)
                {
                    this.resultCount = results.Count;
                    for (int i = 0; i < this.resultCount; i++)
                    {
                        ICAClassificationResult icaclassificationResult = results[i + 1];
                        if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100))
                        {
                            ULS.SendTraceTag(4850009U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "FASTClassificationItem.SetClassificationResults :: Results Found :: package={0} ruleId={1}", new object[]
                            {
                                icaclassificationResult.RulePackageID,
                                icaclassificationResult.ID
                            });
                        }
                        long?resultBase = this.ruleStore.GetResultBase(icaclassificationResult.RulePackageID, icaclassificationResult.ID);
                        if (resultBase == null)
                        {
                            ULS.SendTraceTag(6038295U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "FASTClassificationItem.SetClassificationResults :: Unkwown rule ID in result (should not happen). :: package={0} ruleId={1}", new object[]
                            {
                                icaclassificationResult.RulePackageID,
                                icaclassificationResult.ID
                            });
                        }
                        else
                        {
                            long value = resultBase.Value;
                            if (!hashSet.Add(value))
                            {
                                ULS.SendTraceTag(5833436U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "FASTClassificationItem.SetClassificationResults :: Duplicate rule entry is being ignored.  Duplicate rule entries should not happen. :: package={0} ruleId={1}", new object[]
                                {
                                    icaclassificationResult.RulePackageID,
                                    icaclassificationResult.ID
                                });
                            }
                            else
                            {
                                long value2 = value + (long)((int)icaclassificationResult.GetAttributeValue("BD770258-EA9C-4162-B79C-7AD408EC7CD5"));
                                long value3 = value + (long)((int)icaclassificationResult.GetAttributeValue("AFF85B32-1BA9-4EDE-9286-F08A7EE5A421"));
                                collection.Add(new long?(value2));
                                collection2.Add(new long?(value3));
                                collection3.Add(icaclassificationResult.ID);
                            }
                        }
                    }
                    if (this.persistClassificationData && this.resultCount > 0)
                    {
                        if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100))
                        {
                            ULS.SendTraceTag(4850010U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "FASTClassificationItem.SetClassificationResults :: Updating managed properties");
                        }
                        IUpdateableListField <long?> updateableListField = (IUpdateableListField <long?>)StandardFields.ListDescriptor <long?>(BuiltInTypes.Int64Type).CreateField();
                        updateableListField.Value = collection;
                        updateableBucketField.AddField(this.countPropertyName, updateableListField, BuiltInTypes.ListType(BuiltInTypes.Int64Type));
                        updateableListField       = (IUpdateableListField <long?>)StandardFields.ListDescriptor <long?>(BuiltInTypes.Int64Type).CreateField();
                        updateableListField.Value = collection2;
                        updateableBucketField.AddField(this.confidencePropertyName, updateableListField, BuiltInTypes.ListType(BuiltInTypes.Int64Type));
                        IUpdateableListField <string> updateableListField2 = (IUpdateableListField <string>)StandardFields.ListDescriptor <string>(BuiltInTypes.StringType).CreateField();
                        updateableListField2.Value = collection3;
                        updateableBucketField.AddField(this.typePropertyName, updateableListField2, BuiltInTypes.ListType(BuiltInTypes.StringType));
                    }
                }
            }
        }
        // Token: 0x060000BF RID: 191 RVA: 0x00004FEC File Offset: 0x000031EC
        protected override TreeNode ProcessScopeSubQueryTree(TreeNode scopeSubQueryTree)
        {
            if (scopeSubQueryTree == null)
            {
                throw new ArgumentNullException("scopeSubQueryTree");
            }
            ScopeNode scopeNode = scopeSubQueryTree as ScopeNode;

            if (scopeNode == null || scopeNode.Scope == null)
            {
                ULS.SendTraceTag(5884049U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 20, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: argument={0}; Erroneously entered ProcessScopeSubQueryTree with an argument that is not a ScopeNode.  This should not have happened because the scopes of the associated operator should prevent it.", new object[]
                {
                    scopeSubQueryTree.ToString()
                });
                return(base.ProcessScopeSubQueryTree(scopeSubQueryTree));
            }
            if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100))
            {
                ULS.SendTraceTag(5884050U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: scope={0}; Processing a tree (or subtree) for data loss prevention translation from a virtual property to the actual index property.", new object[]
                {
                    scopeNode.Scope
                });
            }
            string scope = scopeNode.Scope;

            if (string.Equals("SensitiveType", scope, StringComparison.OrdinalIgnoreCase))
            {
                BoundaryNode boundaryNode = scopeNode.Node as BoundaryNode;
                StringNode   stringNode;
                TokenNode    tokenNode;
                if (boundaryNode != null)
                {
                    if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100))
                    {
                        ULS.SendTraceTag(6038296U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: Boundary operator mode:{0}; Processing a boundary node in the query tree." + boundaryNode.BoundaryMode);
                    }
                    if (boundaryNode.BoundaryMode != 2 && boundaryNode.BoundaryMode != null)
                    {
                        ULS.SendTraceTag(5884051U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: Unexpected boundary operator mode.  For 'SensitiveType' queries, only equality is legal.  Boundary operator mode: " + boundaryNode.BoundaryMode);
                        return(base.ProcessScopeSubQueryTree(scopeSubQueryTree));
                    }
                    stringNode = (boundaryNode.Node as StringNode);
                    tokenNode  = (boundaryNode.Node as TokenNode);
                }
                else
                {
                    stringNode = (scopeNode.Node as StringNode);
                    tokenNode  = (scopeNode.Node as TokenNode);
                }
                string text;
                if (stringNode != null)
                {
                    text = stringNode.Text;
                }
                else
                {
                    if (tokenNode == null)
                    {
                        ULS.SendTraceTag(5884052U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: Unexpected node type.  The query looks like it is a 'SensitiveType' style query, but the value portion is not a StringNode or a TokenNode.  Node type: " + boundaryNode.Node.GetType());
                        return(base.ProcessScopeSubQueryTree(scopeSubQueryTree));
                    }
                    text = tokenNode.Token;
                }
                if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100))
                {
                    ULS.SendTraceTag(5884053U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: encoding={0}; About to parse the encoding.", new object[]
                    {
                        text
                    });
                }
                SensitiveTypeWildcardExpander sensitiveTypeWildcardExpander = new SensitiveTypeWildcardExpander(text, DLPQuerySensitiveTypeTranslationOperator.Store);
                if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100))
                {
                    ULS.SendTraceTag(5884054U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: About to create the new subtree.");
                }
                return(sensitiveTypeWildcardExpander.CreateSubtree());
            }
            if (string.Equals("SensitiveMatchConfidence", scope, StringComparison.OrdinalIgnoreCase) || string.Equals("SensitiveMatchCount", scope, StringComparison.OrdinalIgnoreCase))
            {
                throw new ArgumentException(scope + " is illegal to use in a query.  You may use it as a select property.  In queries, use SensitiveType");
            }
            ULS.SendTraceTag(5884055U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 20, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: scope={0}; This is not a legal scope for this producer.  There must be some error in which the operator has the wrong scopes or a code change is incorrect.  Ignoring and continuing.", new object[]
            {
                scope
            });
            return(base.ProcessScopeSubQueryTree(scopeSubQueryTree));
        }