Exemplo n.º 1
0
        /// <summary>
        /// Determines whether the given <see cref="vCommands.Manuals.Manual"/> is equal to the current <see cref="vCommands.Manuals.Manual"/>.
        /// </summary>
        /// <param name="obj">The manual to compare with the current manual.</param>
        /// <returns>true if the specified manual is equal to the current manual; otherwise, false.</returns>
        public bool Equals(Manual obj)
        {
            if ((object)obj == null)    //  Casting to object avoids usage of the overloaded operator.
            {
                return(false);
            }

            return((this.title == obj.title) && (this.abstr == obj.abstr) && this.subsro.SequenceEqual(obj.subsro) && this.keysro.SequenceEqual(obj.keysro) && this.refsro.SequenceEqual(obj.refsro));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Parses a <see cref="vCommands.Manuals.Manual"/> from the given <see cref="System.Xml.Linq.XElement"/>.
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public static Manual ParseXElementManual(XElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            if (element.Name != "manual")
            {
                throw new FormatException("Element must be named 'manual'.");
            }

            var aTitle = element.Attribute("title");

            if (aTitle == null)
            {
                throw new FormatException("Manual element must have a 'title' attribute.");
            }

            var eAbstract = element.Element("abstract");

            if (eAbstract == null)
            {
                throw new FormatException("Manual element must have an 'abstract' sub-element.");
            }

            Manual m = new Manual();

            m.Title    = aTitle.Value;
            m.Abstract = eAbstract.Value;

            m.AddSections(from e in element.Elements("section") select ParseXElementSection(e));

            m.Seal();
            return(m);
        }