Пример #1
0
        private static void SetValues(Controller controller, XmlTemplate xmlTemplate)
        {
            var serialPortList = SerialPortStream.GetPortNames();

            if (serialPortList.Contains(xmlTemplate.RelayerPortAName))
            {
                controller.SerialPortHandler.SelectedRelayerPortAName = xmlTemplate.RelayerPortAName;
            }

            if (serialPortList.Contains(xmlTemplate.RelayerPortBName))
            {
                controller.SerialPortHandler.SelectedRelayerPortBName = xmlTemplate.RelayerPortBName;
            }

            if (serialPortList.Contains(xmlTemplate.SnifferPortABName))
            {
                controller.SerialPortHandler.SelectedSnifferPortABName = xmlTemplate.SnifferPortABName;
            }

            if (serialPortList.Contains(xmlTemplate.SnifferPortBAName))
            {
                controller.SerialPortHandler.SelectedSnifferPortBAName = xmlTemplate.SnifferPortBAName;
            }

            controller.SerialPortHandler.SelectedBaudRate = xmlTemplate.BaudRate;
        }
Пример #2
0
        private static XmlTemplate GetValues(Controller controller)
        {
            var template = new XmlTemplate();

            template.RelayerPortAName  = controller.SerialPortHandler.SelectedRelayerPortAName;
            template.RelayerPortBName  = controller.SerialPortHandler.SelectedRelayerPortBName;
            template.SnifferPortABName = controller.SerialPortHandler.SelectedSnifferPortABName;
            template.SnifferPortBAName = controller.SerialPortHandler.SelectedSnifferPortBAName;
            template.BaudRate          = controller.SerialPortHandler.SelectedBaudRate;
            return(template);
        }