Exemplo n.º 1
0
        private void recv_car_info(int car_id)
        {
            XmlDocument doc_car = new XmlDocument();

            doc_car.Load(@"../config/carname.xml");
            XmlNode     xn  = doc_car.SelectSingleNode("cars");
            XmlNodeList xnl = xn.ChildNodes;

            bool port_rec_ok;

            foreach (XmlNode xn1 in xnl)
            {
                XmlElement xe       = (XmlElement)xn1;
                int        car      = 0;
                bool       id_juage = int.TryParse(xe.GetAttribute("id"), out car);
                if (car == car_id)
                {
                    port_rec_ok = int.TryParse(xe.GetAttribute("port_rec"), out port_rec);
                    if (car == 1)
                    {
                        rcver.Start(port_rec);
                    }
                    if (car == 2)
                    {
                        rcver2.Start(port_rec);
                    }
                    if (car == 3)
                    {
                        rcver3.Start(port_rec);
                    }
                }
            }
        }
Exemplo n.º 2
0
 public void AddRcver(int _vid, int _local_port)
 {
     if (!DictRcver.ContainsKey(_vid))
     {
         DGramRcver <TUpDgram> rcver = new DGramRcver <TUpDgram>();
         rcver.Start(_local_port);
         DictRcver.Add(_vid, rcver);
     }
 }