/// <summary>
        /// Called once per classification run with the rule list and the property definition list
        /// </summary>
        /// <param name="Rules"></param>
        /// <param name="propertyDefinitions"></param>
        public void UseRulesAndDefinitions(
            IFsrmCollection Rules,
            IFsrmCollection propertyDefinitions
            )
        {
            m_dictAllRules      = new Dictionary <Guid, PowerShellRuleHoster>();
            m_dictAllProperties = new Dictionary <Guid, IFsrmPropertyDefinition>();
            Dictionary <string, IFsrmPropertyDefinition> dictPropertyName = new Dictionary <string, IFsrmPropertyDefinition>();

            foreach (IFsrmPropertyDefinition fsrmPropertyDefinition in propertyDefinitions)
            {
                m_dictAllProperties.Add(fsrmPropertyDefinition.id, fsrmPropertyDefinition);
                dictPropertyName[fsrmPropertyDefinition.Name] = fsrmPropertyDefinition;
            }

            foreach (IFsrmClassificationRule fsrmClsRule in Rules)
            {
                if (fsrmClsRule.RuleType == _FsrmRuleType.FsrmRuleType_Classification)
                {
                    Guid ruleId = fsrmClsRule.id;
                    PowerShellRuleHoster newRule = new PowerShellRuleHoster(
                        m_moduleDefinition,
                        fsrmClsRule,
                        dictPropertyName[fsrmClsRule.PropertyAffected]);

                    m_dictAllRules.Add(ruleId, newRule);
                }
            }
        }
예제 #2
0
        /*++
         *
         *  Routine RegexClassifier::UseRulesAndDefinitions
         *
         * Description:
         *
         *  This routine implements the IFsrmClassifierModuleImplementation interface UseRulesAndDefinitions.
         *  It is called by the pipeline to indicate to the classifier that the following rules apply to it for this run.
         *
         * Arguments:
         *
         *  Rules - The FSRM classification rules that apply to this classifier for this run.
         *  propertyDefinitions - The property definitions affected by the above rules.
         *
         * Return value:
         *
         *  void
         *
         * Notes:
         *
         *
         * --*/

        public void UseRulesAndDefinitions(
            IFsrmCollection Rules,
            IFsrmCollection propertyDefinitions
            )
        {
            m_dictAllRules = new Dictionary <Guid, FsrmClassificationRule>();

            // loop through all rules and save them along with thier
            // parameter descriptions
            foreach (IFsrmClassificationRule fsrmClsRule in Rules)
            {
                if (fsrmClsRule.RuleType == _FsrmRuleType.FsrmRuleType_Classification)
                {
                    Guid ruleId = fsrmClsRule.id;

                    foreach (string param in fsrmClsRule.Parameters)
                    {
                        string[] splitParams = param.Split("=".ToCharArray(), 2);

                        string paramKey = splitParams[0];
                        string paramVal = splitParams[1];

                        if (paramVal != null)
                        {
                            if (paramKey.Equals(
                                    "RegularExpression",
                                    StringComparison.OrdinalIgnoreCase)
                                )
                            {
                                //Create a new internal rule object and store it
                                FsrmClassificationRule newRuleToAdd = new FsrmClassificationRule(
                                    paramVal,
                                    (RegexOptions)m_iValRegexOptions
                                    );
                                m_dictAllRules.Add(ruleId, newRuleToAdd);
                            }
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Called once per classification run with the rule list and the property definition list
        /// </summary>
        /// <param name="Rules"></param>
        /// <param name="propertyDefinitions"></param>
        public void UseRulesAndDefinitions(
            IFsrmCollection Rules,
            IFsrmCollection propertyDefinitions
            )
        {
            m_dictAllRules = new Dictionary<Guid, PowerShellRuleHoster>();
            m_dictAllProperties = new Dictionary<Guid,IFsrmPropertyDefinition>();
            Dictionary<string,IFsrmPropertyDefinition> dictPropertyName = new Dictionary<string,IFsrmPropertyDefinition>();
            foreach (IFsrmPropertyDefinition fsrmPropertyDefinition in propertyDefinitions)
            {
                m_dictAllProperties.Add(fsrmPropertyDefinition.id, fsrmPropertyDefinition);
                dictPropertyName[fsrmPropertyDefinition.Name] = fsrmPropertyDefinition;
            }

            foreach (IFsrmClassificationRule fsrmClsRule in Rules) {

                if (fsrmClsRule.RuleType == _FsrmRuleType.FsrmRuleType_Classification)
                {
                    Guid ruleId = fsrmClsRule.id;
                    PowerShellRuleHoster newRule = new PowerShellRuleHoster(
                                                        m_moduleDefinition,
                                                        fsrmClsRule,
                                                        dictPropertyName[fsrmClsRule.PropertyAffected]);

                    m_dictAllRules.Add( ruleId, newRule );
                }
            }
        }
        /*++

            Routine RegexClassifier::UseRulesAndDefinitions

        Description:

            This routine implements the IFsrmClassifierModuleImplementation interface UseRulesAndDefinitions.
            It is called by the pipeline to indicate to the classifier that the following rules apply to it for this run.

        Arguments:

            Rules - The FSRM classification rules that apply to this classifier for this run.
            propertyDefinitions - The property definitions affected by the above rules.

        Return value:

            void

        Notes:

        --*/
        public void UseRulesAndDefinitions(
            IFsrmCollection Rules,
            IFsrmCollection propertyDefinitions
            )
        {
            m_dictAllRules = new Dictionary<Guid, FsrmClassificationRule>();

            // loop through all rules and save them along with thier
            // parameter descriptions
            foreach (IFsrmClassificationRule fsrmClsRule in Rules) {

                if (fsrmClsRule.RuleType == _FsrmRuleType.FsrmRuleType_Classification) {
                    Guid ruleId = fsrmClsRule.id;

                    foreach (string param in fsrmClsRule.Parameters) {
                        string[] splitParams = param.Split( "=".ToCharArray(), 2 );

                        string paramKey = splitParams[0];
                        string paramVal = splitParams[1];

                        if (paramVal != null) {
                            if (paramKey.Equals(
                                "RegularExpression",
                                StringComparison.OrdinalIgnoreCase )
                                ) {

                                //Create a new internal rule object and store it
                                FsrmClassificationRule newRuleToAdd = new FsrmClassificationRule(
                                                                                paramVal,
                                                                                (RegexOptions)m_iValRegexOptions
                                                                                );
                                m_dictAllRules.Add( ruleId, newRuleToAdd );
                            }
                        }
                    }
                }
            }
        }