示例#1
0
文件: IOItem.cs 项目: thbin/TraceLab
        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;
                }
            }
        }
示例#2
0
文件: IOItem.cs 项目: thbin/TraceLab
        /// <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);
        }
示例#3
0
文件: IOItem.cs 项目: thbin/TraceLab
        /// <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();
        }
示例#4
0
        /// <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;
        }
示例#7
0
文件: IOItem.cs 项目: thbin/TraceLab
        /// <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;
            }
        }
示例#8
0
 /// <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;
 }
示例#9
0
        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;
                }
            }
        }
示例#10
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 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;
            }
        }
        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);
            }
        }
示例#12
0
文件: IOItem.cs 项目: thbin/TraceLab
 /// <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;
 }