示例#1
0
        private void initializePatterns()
        {
            if (_patterns == null)
            {
                _patterns = new List <PatternBase>();

                foreach (ConfigurableElement patternConfiguration in AcroniManagerConfigurationSection.Instance.Patterns)
                {
                    Type patternType = ConfigurableBase.GetType(patternConfiguration.Class, typeof(PatternBase), "pattern");

                    Data.Matcher matcher = MatcherFactory.GetMatcher(patternConfiguration);

                    if (patternConfiguration.Configurations == null ||
                        patternConfiguration.Configurations.Count == 0)
                    {
                        CreatePattern(patternType, null, matcher);
                    }
                    else
                    {
                        foreach (ParameterizableConfigurationElement executionConfiguration in patternConfiguration.Configurations)
                        {
                            CreatePattern(patternType, executionConfiguration, matcher);
                        }
                    }
                }
            }
        }
示例#2
0
        private void initializeCheckers()
        {
            if (_checkers == null)
            {
                _checkers = new List <CheckerBase>();
                foreach (ConfigurableElement checkerConfiguration in AcroniManagerConfigurationSection.Instance.Checkers)
                {
                    Type      checkerType = ConfigurableBase.GetType(checkerConfiguration.Class, typeof(CheckerBase), "checker");
                    Validator validator   = ValidatorFactory.GetValidator(checkerConfiguration);

                    if (checkerConfiguration.Configurations == null ||
                        checkerConfiguration.Configurations.Count == 0)
                    {
                        CreateChecker(checkerType, null, validator);
                    }
                    else
                    {
                        foreach (ParameterizableConfigurationElement executionConfiguration in checkerConfiguration.Configurations)
                        {
                            CreateChecker(checkerType, executionConfiguration, validator);
                        }
                    }
                }
            }
        }
示例#3
0
        private void initializeLeechers()
        {
            if (_leechers == null)
            {
                _leechers = new List <LeecherBase>();

                foreach (LeecherElement leecherConfiguration in AcroniManagerConfigurationSection.Instance.Leechers)
                {
                    Type leecherType = ConfigurableBase.GetType(leecherConfiguration.Class, typeof(LeecherBase), "leecher");

                    Crawler crawler = CrawlerFactory.GetCrawler(leecherConfiguration);

                    foreach (ExecutionElement executionConfiguration in leecherConfiguration.Executions)
                    {
                        ValidateConfiguration(executionConfiguration);
                        LeecherBase leecher = ConfigurableBase.CreateConfigurableItem <LeecherBase>(leecherType, executionConfiguration.Parameters);
                        leecher.Execution = ExecutionFactory.GetExecution(executionConfiguration, crawler);
                        _leechers.Add(leecher);
                    }
                }
            }
        }