Exemplo n.º 1
0
        private void UpdateConfiguration()
        {
            ThrowWhenNotConnected();


            // ReSharper disable once UseObjectOrCollectionInitializer
            var configPacket         = new ConfigPacket();
            var configResponsePacket = new ConfigResponsePacket();


            for (int i = 0; i < _masterInterface.InputModes.Length; i++)
            {
                configPacket.UniversalInputs[i].Mode = _masterInterface.InputModes[i];
            }
            for (int i = 0; i < _masterInterface.InputIsDigital.Length; i++)
            {
                configPacket.UniversalInputs[i].Digital = _masterInterface.InputIsDigital[i];
            }

            for (int i = 0; i < _masterInterface.OutputModes.Length; i++)
            {
                configPacket.Motor[i] = _masterInterface.OutputModes[i];
            }

            try
            {
                TxCommunication.SendPacket(configPacket, configResponsePacket);
            }
            catch (Exception e)
            {
                HandleException(e);
            }

            _configurationChanged = false;
        }
Exemplo n.º 2
0
        private int port = Convert.ToInt32(ConfigurationManager.AppSettings["listenerPort"]); //9191;
        /// <summary>
        /// prepares distributed configuration injection to connected threads
        /// </summary>
        /// <param name="cp">configuraton to be injected</param>
        public static void InjectClientsConfiguration(ConfigPacket cp)
        {
            foreach (Thread t in threadsList)
            {
#if (DEBUG)
                Console.WriteLine("set cp: " + cp.ToString() + "on thread: " + t.ToString());
#endif
                configInjects.Add(t, cp);
            }
        }
Exemplo n.º 3
0
 //ConfigPacket
 private static void HandlePacket(ConfigPacket packet)
 {
     Options.LoadFromServer(packet.Config);
 }
Exemplo n.º 4
0
 //ConfigPacket
 private static void HandlePacket(ConfigPacket packet)
 {
     Options.LoadFromServer(packet.Config);
     Globals.Bank = new Item[Options.MaxBankSlots];
     Graphics.InitInGame();
 }