Esempio n. 1
0
        /// <summary>
        /// Generates output data in html form when the node has not changed
        /// </summary>
        /// <param name="writer">output data stream</param>
        /// <param name="indent">size of indentation</param>
        internal void DrawHtmlNoChange(XmlWriter writer, int indent)
        {
            Debug.Assert(this.NodeType != XmlNodeType.Element && this.NodeType != XmlNodeType.Attribute);
            Debug.Assert(this.Operation != XmlDiffViewOperation.Change);
            XmlDiffView.HtmlStartRow(writer);
            this.DrawLinkNode(writer);

            for (int i = 0; i < 2; i++)
            {
                XmlDiffView.HtmlStartCell(writer, indent);
                if (XmlDiffView.HtmlWriteToPane[(int)this.Operation, i])
                {
                    bool closeElement = this.OutputNavigationHtml(writer);
                    XmlDiffView.HtmlWriteString(
                        writer,
                        this.Operation,
                        this.OuterXml);
                    if (closeElement)
                    {
                        writer.WriteEndElement();
                    }
                }
                else
                {
                    XmlDiffView.HtmlWriteEmptyString(writer);
                }
                XmlDiffView.HtmlEndCell(writer);
            }
            XmlDiffView.HtmlEndRow(writer);
        }
 internal void DrawHtmlNoChange(XmlWriter writer, int indent)
 {
     Debug.Assert(_nodeType != XmlNodeType.Element && _nodeType != XmlNodeType.Attribute);
     Debug.Assert(_op != XmlDiffViewOperation.Change);
     XmlDiffView.HtmlStartRow(writer);
     for (int i = 0; i < 2; i++)
     {
         XmlDiffView.HtmlStartCell(writer, indent);
         if (XmlDiffView.HtmlWriteToPane[(int)_op, i])
         {
             bool bCloseElement = OutputNavigation(writer);
             XmlDiffView.HtmlWriteString(writer, _op, OuterXml);
             if (bCloseElement)
             {
                 writer.WriteEndElement();
             }
         }
         else
         {
             XmlDiffView.HtmlWriteEmptyString(writer);
         }
         XmlDiffView.HtmlEndCell(writer);
     }
     XmlDiffView.HtmlEndRow(writer);
 }
        private void DrawHtmlAttributes(XmlWriter writer, int paneNo)
        {
            if (_attributes == null)
            {
                return;
            }

            string attrIndent = string.Empty;

            if (_attributes._nextSibbling != null)
            {
                attrIndent = XmlDiffView.GetIndent(_name.Length + 2);
            }
            XmlDiffViewAttribute curAttr = _attributes;

            while (curAttr != null)
            {
                if (XmlDiffView.HtmlWriteToPane[(int)curAttr._op, paneNo])
                {
                    if (curAttr == _attributes)
                    {
                        writer.WriteString(" ");
                    }
                    else
                    {
                        writer.WriteRaw(attrIndent);
                    }

                    if (curAttr._op == XmlDiffViewOperation.Change)
                    {
                        if (paneNo == 0)
                        {
                            DrawHtmlAttributeChange(writer, curAttr, curAttr._localName, curAttr._prefix, curAttr._value);
                        }
                        else
                        {
                            DrawHtmlAttributeChange(writer, curAttr, curAttr._changeInfo._localName, curAttr._changeInfo._prefix,
                                                    curAttr._changeInfo._value);
                        }
                    }
                    else
                    {
                        DrawHtmlAttribute(writer, curAttr, curAttr._op);
                    }
                }
                else
                {
                    XmlDiffView.HtmlWriteEmptyString(writer);
                }

                curAttr = (XmlDiffViewAttribute)curAttr._nextSibbling;
                if (curAttr != null)
                {
                    XmlDiffView.HtmlBr(writer);
                }
            }
        }
Esempio n. 4
0
        private void DrawHtmlAttributes(XmlWriter writer, int paneNo)
        {
            if (this._attributes == null)
            {
                return;
            }
            var data = string.Empty;

            if (this._attributes._nextSibbling != null)
            {
                data = XmlDiffView.GetIndent(this._name.Length + 2);
            }
            var attr = this._attributes;

            while (attr != null)
            {
                if (XmlDiffView.HtmlWriteToPane[(int)attr._op, paneNo])
                {
                    if (attr == this._attributes)
                    {
                        writer.WriteString(" ");
                    }
                    else
                    {
                        writer.WriteRaw(data);
                    }
                    if (attr._op == XmlDiffViewOperation.Change)
                    {
                        if (paneNo == 0)
                        {
                            this.DrawHtmlAttributeChange(writer, attr, attr._localName, attr._prefix, attr._value);
                        }
                        else
                        {
                            this.DrawHtmlAttributeChange(writer, attr, attr._changeInfo._localName, attr._changeInfo._prefix, attr._changeInfo._value);
                        }
                    }
                    else
                    {
                        this.DrawHtmlAttribute(writer, attr, attr._op);
                    }
                }
                else
                {
                    XmlDiffView.HtmlWriteEmptyString(writer);
                }
                attr = (XmlDiffViewAttribute)attr._nextSibbling;
                if (attr != null)
                {
                    XmlDiffView.HtmlBr(writer);
                }
            }
        }
Esempio n. 5
0
 internal void DrawHtmlNoChange(XmlWriter writer, int indent)
 {
     XmlDiffView.HtmlStartRow(writer);
     for (var index = 0; index < 2; ++index)
     {
         XmlDiffView.HtmlStartCell(writer, indent);
         if (XmlDiffView.HtmlWriteToPane[(int)this._op, index])
         {
             var flag = this.OutputNavigation(writer);
             XmlDiffView.HtmlWriteString(writer, this._op, this.OuterXml);
             if (flag)
             {
                 writer.WriteEndElement();
             }
         }
         else
         {
             XmlDiffView.HtmlWriteEmptyString(writer);
         }
         XmlDiffView.HtmlEndCell(writer);
     }
     XmlDiffView.HtmlEndRow(writer);
 }
        internal override void DrawHtml(XmlWriter writer, int indent)
        {
            XmlDiffViewOperation opForColor = _op;
            bool bCloseElement = false;

            XmlDiffView.HtmlStartRow(writer);
            for (int i = 0; i < 2; i++)
            {
                XmlDiffView.HtmlStartCell(writer, indent);
                if (XmlDiffView.HtmlWriteToPane[(int)_op, i])
                {
                    bCloseElement = OutputNavigation(writer);

                    if (_op == XmlDiffViewOperation.Change)
                    {
                        opForColor = XmlDiffViewOperation.Match;
                        XmlDiffView.HtmlWriteString(writer, opForColor, "<");
                        if (i == 0)
                        {
                            DrawHtmlNameChange(writer, _localName, _prefix);
                        }
                        else
                        {
                            DrawHtmlNameChange(writer, _changeInfo._localName, _changeInfo._prefix);
                        }
                    }
                    else
                    {
                        DrawHtmlName(writer, opForColor, "<", string.Empty);
                    }

                    if (bCloseElement)
                    {
                        writer.WriteEndElement();
                        bCloseElement = false;
                    }

                    // attributes
                    DrawHtmlAttributes(writer, i);

                    // close start tag
                    if (_childNodes != null)
                    {
                        XmlDiffView.HtmlWriteString(writer, opForColor, ">");
                    }
                    else
                    {
                        XmlDiffView.HtmlWriteString(writer, opForColor, "/>");
                    }
                }
                else
                {
                    XmlDiffView.HtmlWriteEmptyString(writer);
                }
                XmlDiffView.HtmlEndCell(writer);
            }
            XmlDiffView.HtmlEndRow(writer);

            // child nodes
            if (_childNodes != null)
            {
                HtmlDrawChildNodes(writer, indent + XmlDiffView.DeltaIndent);

                // end element
                XmlDiffView.HtmlStartRow(writer);
                for (int i = 0; i < 2; i++)
                {
                    XmlDiffView.HtmlStartCell(writer, indent);
                    if (XmlDiffView.HtmlWriteToPane[(int)_op, i])
                    {
                        if (_op == XmlDiffViewOperation.Change)
                        {
                            Debug.Assert(opForColor == XmlDiffViewOperation.Match);
                            XmlDiffView.HtmlWriteString(writer, opForColor, "</");
                            if (i == 0)
                            {
                                DrawHtmlNameChange(writer, _localName, _prefix);
                            }
                            else
                            {
                                DrawHtmlNameChange(writer, _changeInfo._localName, _changeInfo._prefix);
                            }
                            XmlDiffView.HtmlWriteString(writer, opForColor, ">");
                        }
                        else
                        {
                            DrawHtmlName(writer, opForColor, "</", ">");
                        }
                    }
                    else
                    {
                        XmlDiffView.HtmlWriteEmptyString(writer);
                    }
                    XmlDiffView.HtmlEndCell(writer);
                }
                XmlDiffView.HtmlEndRow(writer);
            }
        }
Esempio n. 7
0
        internal override void DrawHtml(XmlWriter writer, int indent)
        {
            var diffViewOperation = this._op;
            var flag1             = false;

            XmlDiffView.HtmlStartRow(writer);
            for (var paneNo = 0; paneNo < 2; ++paneNo)
            {
                XmlDiffView.HtmlStartCell(writer, indent);
                if (XmlDiffView.HtmlWriteToPane[(int)this._op, paneNo])
                {
                    var flag2 = this.OutputNavigation(writer);
                    if (this._op == XmlDiffViewOperation.Change)
                    {
                        diffViewOperation = XmlDiffViewOperation.Match;
                        XmlDiffView.HtmlWriteString(writer, diffViewOperation, "<");
                        if (paneNo == 0)
                        {
                            this.DrawHtmlNameChange(writer, this._localName, this._prefix);
                        }
                        else
                        {
                            this.DrawHtmlNameChange(writer, this._changeInfo._localName, this._changeInfo._prefix);
                        }
                    }
                    else
                    {
                        this.DrawHtmlName(writer, diffViewOperation, "<", string.Empty);
                    }
                    if (flag2)
                    {
                        writer.WriteEndElement();
                        flag1 = false;
                    }
                    this.DrawHtmlAttributes(writer, paneNo);
                    if (this._childNodes != null)
                    {
                        XmlDiffView.HtmlWriteString(writer, diffViewOperation, ">");
                    }
                    else
                    {
                        XmlDiffView.HtmlWriteString(writer, diffViewOperation, "/>");
                    }
                }
                else
                {
                    XmlDiffView.HtmlWriteEmptyString(writer);
                }
                XmlDiffView.HtmlEndCell(writer);
            }
            XmlDiffView.HtmlEndRow(writer);
            if (this._childNodes == null)
            {
                return;
            }
            this.HtmlDrawChildNodes(writer, indent + XmlDiffView.DeltaIndent);
            XmlDiffView.HtmlStartRow(writer);
            for (var index = 0; index < 2; ++index)
            {
                XmlDiffView.HtmlStartCell(writer, indent);
                if (XmlDiffView.HtmlWriteToPane[(int)this._op, index])
                {
                    if (this._op == XmlDiffViewOperation.Change)
                    {
                        Debug.Assert(diffViewOperation == XmlDiffViewOperation.Match);
                        XmlDiffView.HtmlWriteString(writer, diffViewOperation, "</");
                        if (index == 0)
                        {
                            this.DrawHtmlNameChange(writer, this._localName, this._prefix);
                        }
                        else
                        {
                            this.DrawHtmlNameChange(writer, this._changeInfo._localName, this._changeInfo._prefix);
                        }
                        XmlDiffView.HtmlWriteString(writer, diffViewOperation, ">");
                    }
                    else
                    {
                        this.DrawHtmlName(writer, diffViewOperation, "</", ">");
                    }
                }
                else
                {
                    XmlDiffView.HtmlWriteEmptyString(writer);
                }
                XmlDiffView.HtmlEndCell(writer);
            }
            XmlDiffView.HtmlEndRow(writer);
        }
Esempio n. 8
0
        /// <summary>
        /// Generates attributes' output data in html form
        /// </summary>
        /// <param name="writer">output stream</param>
        /// <param name="paneNo">Pane number, indicating
        ///  the left (baseline) or right side (actual) of the
        ///  display</param>
        private void DrawHtmlAttributes(
            XmlWriter writer,
            int paneNo)
        {
            if (this.Attributes == null)
            {
                return;
            }
            string attrIndent = string.Empty;

            if (this.Attributes.NextSibbling != null)
            {
                attrIndent = XmlDiffView.GetIndent(this.Name.Length + 2);
            }
            XmlDiffViewAttribute curAttr = this.Attributes;

            while (curAttr != null)
            {
                if (XmlDiffView.HtmlWriteToPane[(int)curAttr.Operation, paneNo])
                {
                    if (curAttr == this.Attributes)
                    {
                        writer.WriteString(" ");
                    }
                    else
                    {
                        writer.WriteRaw(attrIndent);
                    }
                    if (curAttr.Operation == XmlDiffViewOperation.Change)
                    {
                        if (paneNo == 0)
                        {
                            this.DrawHtmlAttributeChange(
                                writer,
                                curAttr,
                                curAttr.LocalName,
                                curAttr.Prefix,
                                curAttr.AttributeValue);
                        }
                        else
                        {
                            this.DrawHtmlAttributeChange(
                                writer,
                                curAttr,
                                curAttr.ChangeInformation.LocalName,
                                curAttr.ChangeInformation.Prefix,
                                curAttr.ChangeInformation.Subset);
                        }
                    }
                    else
                    {
                        this.DrawHtmlAttribute(
                            writer,
                            curAttr,
                            curAttr.Operation);
                    }
                }
                else
                {
                    XmlDiffView.HtmlWriteEmptyString(writer);
                }
                curAttr = (XmlDiffViewAttribute)curAttr.NextSibbling;
                if (curAttr != null)
                {
                    XmlDiffView.HtmlBr(writer);
                }
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Generates  output data in html form
        /// </summary>
        /// <param name="writer">output stream</param>
        /// <param name="indent">number of indentations</param>
        internal override void DrawHtml(XmlWriter writer, int indent)
        {
            XmlDiffViewOperation typeOfDifference = Operation;
            bool closeElement = false;

            XmlDiffView.HtmlStartRow(writer);
            this.DrawLinkNode(writer);

            for (int i = 0; i < 2; i++)
            {
                XmlDiffView.HtmlStartCell(writer, indent);
                if (XmlDiffView.HtmlWriteToPane[(int)Operation, i])
                {
                    closeElement = OutputNavigationHtml(writer);

                    if (Operation == XmlDiffViewOperation.Change)
                    {
                        typeOfDifference = XmlDiffViewOperation.Match;
                        XmlDiffView.HtmlWriteString(
                            writer,
                            typeOfDifference,
                            Tags.XmlOpenBegin);
                        if (i == 0)
                        {
                            this.DrawHtmlNameChange(
                                writer,
                                this.LocalName,
                                this.Prefix);
                        }
                        else
                        {
                            this.DrawHtmlNameChange(
                                writer,
                                ChangeInformation.LocalName,
                                ChangeInformation.Prefix);
                        }
                    }
                    else
                    {
                        this.DrawHtmlName(
                            writer,
                            typeOfDifference,
                            Tags.XmlOpenBegin,
                            string.Empty);
                    }

                    if (closeElement)
                    {
                        // write the closing '</A>' tag.
                        writer.WriteEndElement();
                        closeElement = false;
                    }

                    // attributes
                    this.DrawHtmlAttributes(writer, i);

                    // close start tag
                    if (ChildNodes != null)
                    {
                        XmlDiffView.HtmlWriteString(
                            writer,
                            typeOfDifference,
                            Tags.XmlOpenEnd);
                    }
                    else
                    {
                        XmlDiffView.HtmlWriteString(
                            writer,
                            typeOfDifference,
                            Tags.XmlOpenEndTerse);
                    }
                }
                else
                {
                    XmlDiffView.HtmlWriteEmptyString(writer);
                }
                XmlDiffView.HtmlEndCell(writer);
            }
            XmlDiffView.HtmlEndRow(writer);

            // child nodes
            if (ChildNodes != null)
            {
                HtmlDrawChildNodes(writer, indent + XmlDiffView.DeltaIndent);

                // end element
                XmlDiffView.HtmlStartRow(writer);
                this.DrawLinkNode(writer);

                for (int i = 0; i < 2; i++)
                {
                    XmlDiffView.HtmlStartCell(writer, indent);
                    if (XmlDiffView.HtmlWriteToPane[(int)Operation, i])
                    {
                        if (Operation == XmlDiffViewOperation.Change)
                        {
                            Debug.Assert(typeOfDifference ==
                                         XmlDiffViewOperation.Match);
                            XmlDiffView.HtmlWriteString(
                                writer,
                                typeOfDifference,
                                Tags.XmlCloseBegin);
                            if (i == 0)
                            {
                                this.DrawHtmlNameChange(
                                    writer,
                                    this.LocalName,
                                    this.Prefix);
                            }
                            else
                            {
                                this.DrawHtmlNameChange(
                                    writer,
                                    ChangeInformation.LocalName,
                                    ChangeInformation.Prefix);
                            }
                            XmlDiffView.HtmlWriteString(
                                writer,
                                typeOfDifference,
                                Tags.XmlOpenEnd);
                        }
                        else
                        {
                            this.DrawHtmlName(
                                writer,
                                typeOfDifference,
                                Tags.XmlCloseBegin,
                                Tags.XmlCloseEnd);
                        }
                    }
                    else
                    {
                        XmlDiffView.HtmlWriteEmptyString(writer);
                    }
                    XmlDiffView.HtmlEndCell(writer);
                }
                XmlDiffView.HtmlEndRow(writer);
            }
        }