// Token: 0x06000040 RID: 64 RVA: 0x00002F4C File Offset: 0x0000114C private RULE_PACKAGE_DETAILS LoadRules(string packageId) { ULS.SendTraceTag(4850015U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "FASTClassificationStore.GetDefaultRulePackageDetails :: Loading rules for package [{0}]", new object[] { packageId }); RULE_PACKAGE_DETAILS result = default(RULE_PACKAGE_DETAILS); result.RulePackageID = packageId; result.RulePackageSetID = "NA"; List <string> list = new List <string>(); if (this.defaultRuleSet.PackageId == packageId) { foreach (string text in this.defaultRuleSet.AllRuleIds) { if (VariantConfiguration.IsFeatureEnabled(40, text)) { ULS.SendTraceTag(4850016U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "FASTClassificationStore.GetDefaultRulePackageDetails :: Adding rule [{0}]", new object[] { text }); list.Add(text); } } } result.RuleIDs = list.ToArray(); return(result); }
private static IEnumerable <string> GetInvalidRegexes(MicrosoftClassificationEngine classificationEngine, RulePackageLoader rulePackageLoader, XDocument rulePackXDoc) { foreach (KeyValuePair <string, string> regexProcessor in XmlProcessingUtils.GetRegexesInRulePackage(rulePackXDoc)) { string value = ClassificationEngineValidator.regexTestTemplate.Value; KeyValuePair <string, string> keyValuePair = regexProcessor; string rulePackage = string.Format(value, keyValuePair.Value); RULE_PACKAGE_DETAILS rule_PACKAGE_DETAILS = default(RULE_PACKAGE_DETAILS); rule_PACKAGE_DETAILS.RulePackageSetID = "not-used-here"; KeyValuePair <string, string> keyValuePair2 = regexProcessor; rule_PACKAGE_DETAILS.RulePackageID = keyValuePair2.Key; rule_PACKAGE_DETAILS.RuleIDs = null; RULE_PACKAGE_DETAILS rulePackageDetails = rule_PACKAGE_DETAILS; rulePackageLoader.SetRulePackage(rulePackageDetails.RulePackageID, rulePackage); string badRegex = null; try { RULE_PACKAGE_DETAILS rule_PACKAGE_DETAILS2 = rulePackageDetails; classificationEngine.GetClassificationDefinitions(ref rule_PACKAGE_DETAILS2); } catch (COMException ex) { if (ex.ErrorCode == -2147220978) { KeyValuePair <string, string> keyValuePair3 = regexProcessor; badRegex = keyValuePair3.Key; } } if (badRegex != null) { yield return(badRegex); } } yield break; }
internal static void ValidateRulePackage(XDocument rulePackXDoc, string rulePackContents) { string mceExecutablePath = ClassificationDefinitionUtils.GetMceExecutablePath(true); if (mceExecutablePath == null || !File.Exists(mceExecutablePath)) { throw new COMException("Unable to locate the Microsoft Classification Engine", -2147287038); } try { using (ActivationContextActivator.FromInternalManifest(mceExecutablePath, Path.GetDirectoryName(mceExecutablePath))) { MicrosoftClassificationEngine microsoftClassificationEngine = new MicrosoftClassificationEngine(); PropertyBag propertyBag = new PropertyBag(); RulePackageLoader rulePackageLoader = new RulePackageLoader(); microsoftClassificationEngine.Init(propertyBag, rulePackageLoader); RULE_PACKAGE_DETAILS rule_PACKAGE_DETAILS = default(RULE_PACKAGE_DETAILS); rule_PACKAGE_DETAILS.RulePackageSetID = "not-used-here"; rule_PACKAGE_DETAILS.RulePackageID = "test-rule-pack"; rule_PACKAGE_DETAILS.RuleIDs = null; RULE_PACKAGE_DETAILS rule_PACKAGE_DETAILS2 = rule_PACKAGE_DETAILS; rulePackageLoader.SetRulePackage(rule_PACKAGE_DETAILS2.RulePackageID, rulePackContents); try { MicrosoftClassificationEngine microsoftClassificationEngine2 = microsoftClassificationEngine; RULE_PACKAGE_DETAILS rule_PACKAGE_DETAILS3 = rule_PACKAGE_DETAILS2; microsoftClassificationEngine2.GetClassificationDefinitions(ref rule_PACKAGE_DETAILS3); } catch (COMException ex) { if (ex.ErrorCode == -2147220978) { List <string> value = ClassificationEngineValidator.GetInvalidRegexes(microsoftClassificationEngine, rulePackageLoader, rulePackXDoc).ToList <string>(); ex.Data[ClassificationEngineValidator.BadRegexesKey] = value; } throw ex; } } } catch (ActivationContextActivatorException) { throw new COMException("Unable to instantiate the Microsoft Classification Engine", -2147164127); } }
// Token: 0x06000034 RID: 52 RVA: 0x00002D1C File Offset: 0x00000F1C public RULE_PACKAGE_DETAILS[] GetRulePackageDetails(IClassificationItem classificationItem) { if (classificationItem == null) { return(null); } ULS.SendTraceTag(4850012U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "FASTClassificationStore.GetRulePackageDetails :: ClassificationItem :: {0}", new object[] { classificationItem.ItemId }); RULE_PACKAGE_DETAILS value = this.defaultRuleDetails.Value; if (value.RuleIDs.Length > 0) { return(new RULE_PACKAGE_DETAILS[] { value }); } return(null); }