示例#1
0
 /// <summary>
 /// Resets the PluginFactory. Should olny be used in test classes.
 /// </summary>
 public static void Reset()
 {
     Info.Clear();
     ParserFactories.Clear();
     Analyzers.Clear();
     PanelFactories.Clear();
 }
        /// <summary>
        /// Starts the engine. Reads <see cref="AnalyzeRule"/>s from storage and builds a collection of <see cref="ProgramAnalyzer"/>s to hold them.
        /// </summary>
        /// <param name="ruleStorage">The <see cref="AnalyzeRule"/> storage.</param>
        /// <param name="alarmMessageManager">The alarm manager.</param>
        public void StartEngine(IRuleStorage ruleStorage, AlarmMessageManager alarmMessageManager)
        {
            AddMessage($"Starting {nameof(AnalyzerEngine)} {Guid.NewGuid()}");
            RuleStorage         = ruleStorage;
            AlarmMessageManager = alarmMessageManager;
            Analyzers.Clear();
            var allRules = RuleStorage.GetAllRules();

            if (allRules.Count == 0)
            {
                AddMessage("Starting with no rules.");
            }
            else
            {
                AddRulesToAnalyzer(allRules);
            }
            foreach (var analyzer in Analyzers)
            {
                analyzer.Value.StartAnalyzer();
            }
            StartEngine();
        }