Beispiel #1
0
        public void LoadScripts()
        {
            _Delegates.Clear();
            Logger.Global.SystemMessage(LogType.Information, "Loading scripts", string.Empty);
            if (!string.IsNullOrEmpty(_RuleDirectory))
            {
                foreach (string file in Directory.GetFiles(_RuleDirectory, "*.rule", SearchOption.AllDirectories))
                {
                    try
                    {
                        ServerRule rule = RuleEditorPresenter.LoadRule <ServerRule>(file);

                        if (rule.Script.Length > 0)
                        {
                            if (!_Delegates.ContainsKey(rule.ServerEvent))
                            {
                                _Delegates.Add(rule.ServerEvent, new ThreadSafeDictionary <ServerRule, ScriptObject>());
                            }
                            _Delegates[rule.ServerEvent].Add(rule, null);
                        }
                    }
                    catch (Exception e)
                    {
                        Logger.Global.SystemException(string.Empty, e);
                    }
                }
            }
        }
Beispiel #2
0
        public void Initialize(AdvancedSettings advancedSettings, ServerSettings Settings, string ServerDirectory)
        {
            _AdvancedSettings = advancedSettings;
            _Settings         = Settings;

            Module.InitializeLicense();
            DicomEngine.Startup();
            DicomNet.Startup();
            Module.InitializeFailureDirectory(ServerDirectory);
            Module.ServiceName      = Settings.ServiceName;
            Module.ServiceDirectory = ServerDirectory;

            try
            {
                if (Settings != null)
                {
                    Module.ServiceName = Settings.ServiceName;
                }
                Module.ServiceDirectory = ServerDirectory;
                Module.ConfigureRuleProcessor(_AdvancedSettings);

                _dlgConfigure              = new ConfigureDialog();
                _dlgConfigure.FormClosing += new FormClosingEventHandler(_dlgConfigure_FormClosing);
                _Presenter = new RuleEditorPresenter(Module._Options, ServerDirectory);
                _Presenter.RunView(_dlgConfigure, advancedSettings);
            }
            catch (Exception e)
            {
                Logger.Global.Exception(Module.Source, e);
            }
        }