示例#1
0
        public XmlOldGpib()
        {
            xmlNode = new SelfManagedXmlElement("GPIB");

            systemControllerElement = new BooleanXmlElement("SystemController", true);
            xmlNode.AddChild(systemControllerElement);

            boardIndexElement = new IntegerXmlElement("BoardIndex", 0);
            xmlNode.AddChild(boardIndexElement);

            boardPrimaryAddressElement = new IntegerXmlElement("BoardPrimaryAddress", 0);
            xmlNode.AddChild(boardPrimaryAddressElement);

            boardSecondaryAddressElement = new IntegerXmlElement("BoardSecondaryAddress", 0); // 0 is NONE
            xmlNode.AddChild(boardSecondaryAddressElement);

            devicePrimaryAddressElement = new IntegerXmlElement("DevicePrimaryAddress", 1);
            xmlNode.AddChild(devicePrimaryAddressElement);

            deviceSecondaryAddressElement = new IntegerXmlElement("DeviceSecondaryAddress", 0); // 0 is NONE
            xmlNode.AddChild(deviceSecondaryAddressElement);

            isEoiElement = new BooleanXmlElement("IsEOI", true);
            xmlNode.AddChild(isEoiElement);

            isEosElement = new BooleanXmlElement("IsEOS", false);
            xmlNode.AddChild(isEosElement);

            eightBitEosElement = new BooleanXmlElement("EightBitEOS", false);
            xmlNode.AddChild(eightBitEosElement);

            eosCharElement = new IntegerXmlElement("EowChar", 0);
            xmlNode.AddChild(eosCharElement);
        }
示例#2
0
        public XmlOldTcpIp()
        {
            xmlNode = new SelfManagedXmlElement("TcpIp");

            hostNameElement = new StringXmlElement("Hostname", "localhost");
            xmlNode.AddChild(hostNameElement);

            portElement = new IntegerXmlElement("Port", 4000);
            xmlNode.AddChild(portElement);
        }
        public XmlOldSerial()
        {
            xmlNode = new SelfManagedXmlElement("SerialPort");

            portNameElement = new StringXmlElement("PortName", "COM1");
            xmlNode.AddChild(portNameElement);

            baudRateElement = new IntegerXmlElement("BaudRate", 19200);
            xmlNode.AddChild(baudRateElement);

            parityElement = new EnumXmlElement<Parity>("Parity", Parity.None);
            xmlNode.AddChild(parityElement);

            dataBitsElement = new IntegerXmlElement("DataBits", 7);
            xmlNode.AddChild(dataBitsElement);

            stopBitsElement = new EnumXmlElement<StopBits>("StopBit", StopBits.One);
            xmlNode.AddChild(stopBitsElement);

            separatorElement = new StringXmlElement("Separator", "\\LF");
            xmlNode.AddChild(separatorElement);
        }
 public override void AddChild(SelfManagedXmlNode child)
 {
     throw new InvalidOperationException("Can not add children to this type of node.");
 }
 /// <summary>
 /// Adds child to this node.
 /// Can throw <code>InvalidOperationException</code>
 /// when the type of the instance does not support adding children.
 /// </summary>
 /// <param name="child">The child node to add.</param>
 public virtual void AddChild(SelfManagedXmlNode child)
 {
     lock (childrenLock)
     {
         if (children == null)
             children = new List<SelfManagedXmlNode>();
         children.Add(child);
         child.path = this.path + "/" + child.path;
     }
 }
 /// <summary>
 /// Unsupported for attributes, throws <code>InvalidOperationException</code>.
 /// </summary>
 /// <param name="child">The child node.</param>
 public override void AddChild(SelfManagedXmlNode child)
 {
     throw new InvalidOperationException("Can not add children to XML attributes.");
 }