コード例 #1
0
        private CDeviceRS232 CreateRS232Device(IChannelDataProvider clients)
        {
            bool result;

            result = config.LoadConfigFromFile(Path.Combine(_configFileFolderPath, "RS232.conf"));
            Assert.IsTrue(result);

            result = config.CheckConfig();
            Assert.IsTrue(result);

            result = config.BuildConfig(mockServer, clients, devices, lights);
            Assert.IsTrue(result);
            Assert.AreEqual(1, devices.Count);
            Assert.IsInstanceOf <CDeviceRS232>(devices[0]);

            return((CDeviceRS232)devices[0]);
        }
コード例 #2
0
        protected void Startup(string configFileName)
        {
            bool result;

            result = _config.LoadConfigFromFile(Path.Combine(_configFileFolderPath, configFileName));
            Assert.IsTrue(result);

            result = _config.CheckConfig();
            Assert.IsTrue(result);

            result = _config.BuildConfig(_clientsHandler, _clientsHandler, _devices, _lights);
            Assert.IsTrue(result);

            _clientsHandler.Process(); // First time just opens the server socket
            _serverThread.Start();     // now run the server

            _socket.Connect(_clientsHandler.m_address, _clientsHandler.m_port);
        }