/// <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; }
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)); } }