예제 #1
0
        private void _InitConfig()
        {
            Ruanal.Core.Config.BuildClientId();
            _DoHostListening = Ruanal.Core.Config.GetSystemConfig(Ruanal.Core.ConfigConst.DispatchDoListeningName, "true").ToLower() == "true";
            //api地址 监听地址 ping间隔
            string[] listenstring = Ruanal.Core.Config.GetSystemConfig(Ruanal.Core.ConfigConst.NotifyListenName, "").Trim().Split(':');
            if (listenstring.Length == 2)
            {
                _ListenAddress = listenstring[0];
                _ListenPort    = RLib.Utils.Converter.StrToInt(listenstring[1]);
            }
            string[] hostlistenstring = Ruanal.Core.Config.GetSystemConfig(Ruanal.Core.ConfigConst.NotifyHostListenName, "").Trim().Split(':');
            if (hostlistenstring.Length == 2)
            {
                listenHostAddress = hostlistenstring[0];
                listenHostPort    = RLib.Utils.Converter.StrToInt(hostlistenstring[1]);
            }


            var strSeconds = Ruanal.Core.Config.GetSystemConfig(Ruanal.Core.ConfigConst.PingSecondsName, Ruanal.Core.ConfigConst.PING_TIMESPAN_SECONDS.ToString());

            _PingSeconds               = Math.Max(5, RLib.Utils.Converter.StrToInt(strSeconds));
            taskRouter                 = new Core.CommandRouter();
            taskRouter.OnStartTask    += TaskRouter_OnStartTask;
            taskRouter.OnStopTask     += TaskRouter_OnStopTask;
            taskRouter.OnDeleteTask   += TaskRouter_OnDeleteTask;
            taskRouter.OnConfigUpdate += TaskRouter_OnConfigUpdate;
        }