private void ReadOldVersion(XPathNavigator nav) { var itemnav = nav.SelectSingleNode("/InputItem"); if (itemnav != null) { XPathNavigator iter = nav.SelectSingleNode("/InputItem/InputItemDefinition"); IOItemDefinition = new IOItemDefinition(); IOItemDefinition.ReadXml(iter.ReadSubtree()); iter = nav.SelectSingleNode("/InputItem/MappedTo"); MappedTo = iter.Value; } else { itemnav = nav.SelectSingleNode("/OutputItem"); if (itemnav != null) { XPathNavigator iter = nav.SelectSingleNode("/OutputItem/OutputItemDefinition"); IOItemDefinition = new IOItemDefinition(); IOItemDefinition.ReadXml(iter.ReadSubtree()); iter = nav.SelectSingleNode("/OutputItem/OutputAs"); MappedTo = iter.Value; } } }
/// <summary> /// Returns a hash code for this s_instance. /// </summary> /// <returns> /// A hash code for this s_instance, suitable for use in hashing algorithms and data structures like a hash table. /// </returns> public override int GetHashCode() { int inputDefinitionHash = IOItemDefinition.GetHashCode(); int mappedToHash = MappedTo.GetHashCode(); return(inputDefinitionHash ^ mappedToHash); }
/// <summary> /// Converts an object into its XML representation. /// </summary> /// <param name="writer">The <see cref="T:System.Xml.XmlWriter"/> stream to which the object is serialized.</param> public void WriteXml(System.Xml.XmlWriter writer) { writer.WriteStartElement("IOItem"); IOItemDefinition.WriteXml(writer); writer.WriteElementString("MappedTo", MappedTo); writer.WriteEndElement(); }
/// <summary> /// Determines whether the specified <see cref="System.Object"/> is equal to this s_instance. /// </summary> /// <param name="obj">The <see cref="System.Object"/> to compare with this s_instance.</param> /// <returns> /// <c>true</c> if the specified <see cref="System.Object"/> is equal to this s_instance; otherwise, <c>false</c>. /// </returns> public override bool Equals(object obj) { IOItemDefinition other = obj as IOItemDefinition; if (other == null) { return(false); } bool isEqual = true; isEqual &= object.Equals(Name, other.Name); isEqual &= object.Equals(Type, other.Type); return(isEqual); }
private void ReadOldIODefinitions(XPathNavigator nav) { XPathNodeIterator inputItemsIterator = nav.Select("/CompositeComponentMetadataDefinition/Input//InputItemDefinition"); while (inputItemsIterator.MoveNext()) { IOItemDefinition item = new IOItemDefinition(); item.ReadXml(inputItemsIterator.Current.ReadSubtree()); IOSpecDefinition.Input.Add(item.Name, item); } XPathNodeIterator outputItemsIterator = nav.Select("/CompositeComponentMetadataDefinition/Output//OutputItemDefinition"); while (outputItemsIterator.MoveNext()) { IOItemDefinition item = new IOItemDefinition(); item.ReadXml(outputItemsIterator.Current.ReadSubtree()); IOSpecDefinition.Output.Add(item.Name, item); } }
public static IOSpecFilter CreateIOSpecFilter(IOItemDefinition item, ObservableCollection<IOSpecFilter> currentIoSpecFilters, IEnumerable<KeyValuePair<string, string>> allAvailableTypes) { bool requiresOutput = false; bool requiresInput = false; if (item.IOType == TraceLabSDK.IOSpecType.Input) { requiresInput = true; } else if (item.IOType == TraceLabSDK.IOSpecType.Output) { requiresOutput = true; } var newFilter = new IOSpecFilter(item.Type, item.FriendlyType, requiresInput, requiresOutput); newFilter.RefreshCurrentlyAvailableFilterTypes(currentIoSpecFilters, allAvailableTypes); return newFilter; }
/// <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 itemnav = nav.SelectSingleNode("/IOItem"); if (itemnav == null) { ReadOldVersion(nav); } else { XPathNavigator iter = nav.SelectSingleNode("/IOItem/IOItemDefinition"); IOItemDefinition = new IOItemDefinition(); IOItemDefinition.ReadXml(iter.ReadSubtree()); iter = nav.SelectSingleNode("/IOItem/MappedTo"); MappedTo = iter.Value; } }
/// <summary> /// Initializes a new s_instance of the <see cref="IOItem"/> class. /// </summary> /// <param name="ioItemDefinition">The input item definition.</param> /// <param name="mappedTo">What input item is going to be mapped to</param> public IOItem(IOItemDefinition ioItemDefinition, string mappedTo) { IOItemDefinition = ioItemDefinition; MappedTo = mappedTo; }
private void ReadOldVersion(XPathNavigator nav) { var itemnav = nav.SelectSingleNode("/InputItem"); if (itemnav != null) { XPathNavigator iter = nav.SelectSingleNode("/InputItem/InputItemDefinition"); IOItemDefinition = new IOItemDefinition(); IOItemDefinition.ReadXml(iter.ReadSubtree()); iter = nav.SelectSingleNode("/InputItem/MappedTo"); MappedTo = iter.Value; } else { itemnav = nav.SelectSingleNode("/OutputItem"); if(itemnav != null) { XPathNavigator iter = nav.SelectSingleNode("/OutputItem/OutputItemDefinition"); IOItemDefinition = new IOItemDefinition(); IOItemDefinition.ReadXml(iter.ReadSubtree()); iter = nav.SelectSingleNode("/OutputItem/OutputAs"); MappedTo = iter.Value; } } }