Esempio n. 1
0
        /// <summary>
        ///   Reads an unknown task from xml and tries to capsule it into a ReferenceTask object. If no task description for the task type was found, null is returned.
        /// </summary>
        /// <param name="reader"> Xml reader. </param>
        /// <param name="availableTaskDescriptions"> Available task descriptions. </param>
        /// <returns> Reference task which capsules the unknown task; null if no task description for the type of the unknown task was found. </returns>
        public static ReferenceTask ReadUnknownTask(XmlReader reader, TaskDescriptionSet availableTaskDescriptions)
        {
            string typeString = reader.GetAttribute("type");

            TaskDescription taskDescription =
                availableTaskDescriptions.Descriptions.Find(description => description.TypeName == typeString);

            if (taskDescription == null)
            {
                reader.Skip();
                return(null);
            }

            ReferenceTask referenceTask = new ReferenceTask {
                TaskDescription = taskDescription
            };

            if (reader.IsEmptyElement)
            {
                reader.Skip();
                return(referenceTask);
            }

            reader.ReadStartElement();
            referenceTask.ReadXml(reader);
            reader.ReadEndElement();

            return(referenceTask);
        }
Esempio n. 2
0
        /// <summary>
        ///   The equals.
        /// </summary>
        /// <param name="other"> The other. </param>
        /// <returns> The System.Boolean. </returns>
        public bool Equals(ReferenceTask other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(CollectionUtils.SequenceEqual(other.parameterValues, this.parameterValues) &&
                   Equals(other.taskDescription, this.taskDescription) &&
                   Equals(other.DecoratorTask, this.DecoratorTask) && Equals(other.Name, this.Name));
        }