Beispiel #1
0
 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);
 }
Beispiel #2
0
        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);
                }
            }
        }
Beispiel #3
0
        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);
            }
        }