コード例 #1
0
        /// <summary>
        ///   The read xml.
        /// </summary>
        /// <param name="reader"> The reader. </param>
        public void ReadXml(XmlReader reader)
        {
            this.list = new List <ITask>();
            if (reader.IsEmptyElement)
            {
                reader.Skip();
                return;
            }

            reader.ReadStartElement();
            while (reader.NodeType != XmlNodeType.EndElement)
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (reader.Name == "Child")
                    {
                        XmlWrapper wrapper = new XmlWrapper();
                        wrapper.ReadXml(reader);
                        this.list.Add(wrapper.Task);
                    }
                    else
                    {
                        reader.Skip();
                    }
                }
                else
                {
                    reader.Skip();
                }
            }

            reader.ReadEndElement();
        }
コード例 #2
0
ファイル: XmlWrapper.cs プロジェクト: xmshaka/slash-framework
        /// <summary>
        ///   The equals.
        /// </summary>
        /// <param name="other"> The other. </param>
        /// <returns> The System.Boolean. </returns>
        public bool Equals(XmlWrapper other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

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

            return(Equals(other.task, this.task));
        }
コード例 #3
0
        /// <summary>
        ///   The write xml.
        /// </summary>
        /// <param name="writer"> The writer. </param>
        public void WriteXml(XmlWriter writer)
        {
            foreach (ITask task in this.list)
            {
                if (task == null)
                {
                    continue;
                }

                // Wrap task.
                XmlWrapper wrapper = new XmlWrapper(task);
                writer.WriteStartElement("Child");
                wrapper.WriteXml(writer);
                writer.WriteEndElement();
            }
        }
コード例 #4
0
        /// <summary>
        ///   The equals.
        /// </summary>
        /// <param name="other"> The other. </param>
        /// <returns> The System.Boolean. </returns>
        public bool Equals(XmlWrapper other)
        {
            if (ReferenceEquals(null, other))
            {
                return false;
            }

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

            return Equals(other.task, this.task);
        }
コード例 #5
0
        /// <summary>
        ///   The read xml.
        /// </summary>
        /// <param name="reader"> The reader. </param>
        public void ReadXml(XmlReader reader)
        {
            this.list = new List<ITask>();
            if (reader.IsEmptyElement)
            {
                reader.Skip();
                return;
            }

            reader.ReadStartElement();
            while (reader.NodeType != XmlNodeType.EndElement)
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (reader.Name == "Child")
                    {
                        XmlWrapper wrapper = new XmlWrapper();
                        wrapper.ReadXml(reader);
                        this.list.Add(wrapper.Task);
                    }
                    else
                    {
                        reader.Skip();
                    }
                }
                else
                {
                    reader.Skip();
                }
            }

            reader.ReadEndElement();
        }
コード例 #6
0
        /// <summary>
        ///   The write xml.
        /// </summary>
        /// <param name="writer"> The writer. </param>
        public void WriteXml(XmlWriter writer)
        {
            foreach (ITask task in this.list)
            {
                if (task == null)
                {
                    continue;
                }

                // Wrap task.
                XmlWrapper wrapper = new XmlWrapper(task);
                writer.WriteStartElement("Child");
                wrapper.WriteXml(writer);
                writer.WriteEndElement();
            }
        }