Ejemplo n.º 1
0
        public static bool RestartListener(bool newSSL, int newPort, EcoHandler handle)
        {
            ServicesAPI.StopEcoService();
            bool flag = ServicesAPI.StartEcoService(newSSL, newPort, handle);

            if (flag)
            {
                Common.WriteLine(string.Concat(new object[]
                {
                    "Eco Listener is restarted successfully, ssl=",
                    newSSL,
                    ", port=",
                    newPort
                }), new string[0]);
            }
            else
            {
                Common.WriteLine(string.Concat(new object[]
                {
                    "Failed to restart Eco Listener, ssl=",
                    newSSL,
                    ", port=",
                    newPort
                }), new string[0]);
            }
            return(flag);
        }
Ejemplo n.º 2
0
        public static bool StartDispatcher(int port, bool useSSL = true)
        {
            bool result;

            lock (DispatchAPI._lockDispatch)
            {
                try
                {
                    DispatchAPI._isServerRole = true;
                    if (port == 0)
                    {
                        DispatchAPI._localConnection = true;
                    }
                    else
                    {
                        DispatchAPI.ExtractCertificate("MonitorServers.pfx");
                    }
                    SessionAPI.StartSessionManager();
                    DispatchAPI._ecoHandler = new EcoHandler();
                    DispatchAPI._ecoHandler.Start(true);
                    DeviceInfo.cbOnDBUpdated          = new DeviceInfo.DelegateOnDbUpdate(DispatchAPI._ecoHandler.OnReloadDBData);
                    DevAccessCfg._cbOnAutoModeUpdated = new DevAccessCfg.DelegateOnAutoModeUpdate(DispatchAPI._ecoHandler.OnAutoDiscovery);
                    bool flag2 = ServicesAPI.StartEcoService(useSSL, port, DispatchAPI._ecoHandler);
                    result = flag2;
                }
                catch (Exception ex)
                {
                    Common.WriteLine("StartDispatcher: {0}", new string[]
                    {
                        ex.Message
                    });
                    result = false;
                }
            }
            return(result);
        }