Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new s_instance of the <see cref="IOItemDefinition"/> class.
 /// </summary>
 /// <param name="name">The name of input item.</param>
 /// <param name="type">The type of input item.</param>
 /// <param name="description">The description.</param>
 public IOItemDefinition(string name, string type, string description, TraceLabSDK.IOSpecType ioType)
 {
     Name        = name;
     Type        = type;
     Description = description;
     IOType      = ioType;
 }
Exemplo n.º 2
0
        private void ReadOldVersion(XPathNavigator nav)
        {
            var def = nav.SelectSingleNode("/InputItemDefinition");

            if (def != null)
            {
                IOType = TraceLabSDK.IOSpecType.Input;
            }
            else
            {
                def    = nav.SelectSingleNode("/OutputItemDefinition");
                IOType = TraceLabSDK.IOSpecType.Output;
            }

            Name = def.GetAttribute("Name", String.Empty);
            Type = def.GetAttribute("Type", String.Empty);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Generates an object from its XML representation.
        /// </summary>
        /// <param name="reader">The <see cref="T:System.Xml.XmlReader"/> stream from which the object is deserialized.</param>
        public void ReadXml(System.Xml.XmlReader reader)
        {
            XPathDocument  doc = new XPathDocument(reader);
            XPathNavigator nav = doc.CreateNavigator();

            var def = nav.SelectSingleNode("/IOItemDefinition");

            if (def == null)
            {
                ReadOldVersion(nav);
            }
            else
            {
                Name   = def.GetAttribute("Name", String.Empty);
                Type   = def.GetAttribute("Type", String.Empty);
                IOType = (TraceLabSDK.IOSpecType)Enum.Parse(typeof(TraceLabSDK.IOSpecType), def.GetAttribute("IOType", String.Empty));
            }
        }
        private void ReadOldVersion(XPathNavigator nav)
        {
            var def = nav.SelectSingleNode("/InputItemDefinition");
            if (def != null)
            {
                IOType = TraceLabSDK.IOSpecType.Input;
            }
            else
            {
                def = nav.SelectSingleNode("/OutputItemDefinition");
                IOType = TraceLabSDK.IOSpecType.Output;
            }

            Name = def.GetAttribute("Name", String.Empty);
            Type = def.GetAttribute("Type", String.Empty);
        }
 /// <summary>
 /// Generates an object from its XML representation.
 /// </summary>
 /// <param name="reader">The <see cref="T:System.Xml.XmlReader"/> stream from which the object is deserialized.</param>
 public void ReadXml(System.Xml.XmlReader reader)
 {
     XPathDocument doc = new XPathDocument(reader);
     XPathNavigator nav = doc.CreateNavigator();
     
     var def = nav.SelectSingleNode("/IOItemDefinition");
     if (def == null)
     {
         ReadOldVersion(nav);
     }
     else
     {
         Name = def.GetAttribute("Name", String.Empty);
         Type = def.GetAttribute("Type", String.Empty);
         IOType = (TraceLabSDK.IOSpecType)Enum.Parse(typeof(TraceLabSDK.IOSpecType), def.GetAttribute("IOType", String.Empty));
     }
 }