public void Setup() { SetupDialog dialog = new SetupDialog(this.m_selectedPort, this.m_setupNode); if (dialog.ShowDialog() == DialogResult.OK) { this.m_selectedPort = dialog.SelectedPort; this.m_setupData.SetString(this.m_setupNode, "name", this.m_selectedPort.PortName); this.m_setupData.SetInteger(this.m_setupNode, "baud", this.m_selectedPort.BaudRate); this.m_setupData.SetString(this.m_setupNode, "parity", this.m_selectedPort.Parity.ToString()); this.m_setupData.SetInteger(this.m_setupNode, "data", this.m_selectedPort.DataBits); this.m_setupData.SetString(this.m_setupNode, "stop", this.m_selectedPort.StopBits.ToString()); } XmlNode contextNode = this.m_setupNode.SelectSingleNode("Controllers"); contextNode.RemoveAll(); int num = 0; foreach (string str in dialog.Controllers) { XmlAttribute attribute; XmlNode nodeAlways = Xml.GetNodeAlways(contextNode, "Controller"); nodeAlways.Attributes.Append(attribute = nodeAlways.OwnerDocument.CreateAttribute("id")); attribute.InnerText = num.ToString(); num++; nodeAlways.Attributes.Append(attribute = nodeAlways.OwnerDocument.CreateAttribute("config")); attribute.InnerText = str; } }