当前位置: 首页>>代码示例>>C#>>正文


C# XmlDiffPatch.XmlDiffNode类代码示例

本文整理汇总了C#中Microsoft.XmlDiffPatch.XmlDiffNode的典型用法代码示例。如果您正苦于以下问题:C# XmlDiffNode类的具体用法?C# XmlDiffNode怎么用?C# XmlDiffNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XmlDiffNode类属于Microsoft.XmlDiffPatch命名空间,在下文中一共展示了XmlDiffNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: XmlDiffNode

//    internal bool _nodeOrDescendantMatches = false;

// Constructors
    internal XmlDiffNode( int position ) 
	{
        _parent = null;
        _nextSibling = null;
        _position = position;
        _bExpanded = false;
    }
开发者ID:ViniciusConsultor,项目名称:sqlschematool,代码行数:10,代码来源:XmlDiffNodes.cs

示例2: DiffgramAddNode

        // Constructor
        internal DiffgramAddNode( XmlDiffNode targetNode, ulong operationID )
            : base(operationID)
        {
            Debug.Assert( targetNode != null );
            Debug.Assert( targetNode.NodeType == XmlDiffNodeType.Element ||
                      targetNode.NodeType == XmlDiffNodeType.Attribute ||
                      targetNode.NodeType == XmlDiffNodeType.Namespace ||
                      targetNode.NodeType == XmlDiffNodeType.XmlDeclaration ||
                      targetNode.NodeType == XmlDiffNodeType.DocumentType ||
                      targetNode.NodeType == XmlDiffNodeType.EntityReference );

            _targetNode = targetNode;
        }
开发者ID:ariflagiwale,项目名称:PSUpdateXml,代码行数:14,代码来源:DiffgramOperation.cs

示例3: GetRelativeAddressOfNodeset

    internal static string GetRelativeAddressOfNodeset( XmlDiffNode firstNode, XmlDiffNode lastNode )
    {
		Debug.Assert( !( firstNode is XmlDiffAttributeOrNamespace ) &&
			          !( lastNode is XmlDiffAttributeOrNamespace ) );

        int prevPosition = -1;
        bool bInterval = false;
        StringBuilder sb = new StringBuilder();
        XmlDiffNode curNode = firstNode;
        for (;;)
        {
			Debug.Assert( curNode.Position > 0 );

            if ( curNode.Position != prevPosition + 1 ) {
                if ( bInterval ) {
                    sb.Append( prevPosition );
                    bInterval = false;
                    sb.Append( '|' );
                }
                sb.Append( curNode.Position );
                if ( curNode != lastNode ) {
                    if ( curNode._nextSibling.Position == curNode.Position + 1 ) {
                        sb.Append( "-" );
                        bInterval = true;
                    }
                    else
                        sb.Append( '|' );
                }
            }

            if ( curNode == lastNode )
                break;

            prevPosition = curNode.Position;
            curNode = curNode._nextSibling;
        }
        
        if ( bInterval )
            sb.Append( lastNode.Position );

        return sb.ToString();
    }
开发者ID:Podracer,项目名称:DAE-notepad,代码行数:42,代码来源:DiffgramOperation.cs

示例4: PreprocessTree

    private void PreprocessTree( XmlDiffDocument doc, ref XmlDiffNode[] postOrderArray )
    {
        // allocate the array for post-ordered nodes.
        // The index 0 is not used; this is to have the consistent indexing of all arrays in the algorithm;
        postOrderArray = new XmlDiffNode[ doc.NodesCount + 1 ];
        postOrderArray[0] = null;

        // recursivelly process all nodes
        int index = 1;
        PreprocessNode( doc, ref postOrderArray, ref index );

        // root node is a 'key root' node
        doc._bKeyRoot = true;

        Debug.Assert( index - 1 == doc.NodesCount );
    }
开发者ID:Podracer,项目名称:DAE-notepad,代码行数:16,代码来源:XmlDiff.cs

示例5: IdenticalSubtrees

    // returs true if the two subtrees are identical
    private bool IdenticalSubtrees( XmlDiffNode node1, XmlDiffNode node2 )
    {
        if ( node1.HashValue != node2.HashValue )
            return false;
        else
#if VERIFY_HASH_VALUES
            return CompareSubtrees( node1, node2 );
#else
            return true;
#endif
    }
开发者ID:Podracer,项目名称:DAE-notepad,代码行数:12,代码来源:XmlDiff.cs

示例6: QuickSortNodes

	static private void QuickSortNodes( ref XmlDiffNode firstNode, ref XmlDiffNode lastNode, 
		                         int count, XmlDiffNode firstPreviousSibbling, XmlDiffNode lastNextSibling )
	{
		Debug.Assert( count >= MininumNodesForQuicksort );
		Debug.Assert( MininumNodesForQuicksort >= 2 );

		// allocate & fill in the array
		XmlDiffNode[] sortArray = new XmlDiffNode[ count ];
		{
			XmlDiffNode curNode = firstNode;
			for ( int i = 0; i < count; i++, curNode = curNode._nextSibling )
			{
				Debug.Assert( curNode != null );
				sortArray[i] = curNode;
			}
		}

		// sort
		QuickSortNodesRecursion( ref sortArray, 0, count - 1 );

		// link the nodes
		for ( int i = 0; i < count - 1; i++ )
			sortArray[i]._nextSibling = sortArray[i+1];

        if ( firstPreviousSibbling == null )
            firstNode._parent._firstChildNode = sortArray[0];
        else
            firstPreviousSibbling._nextSibling = sortArray[0];

        sortArray[count-1]._nextSibling = lastNextSibling;

        // return
        firstNode = sortArray[0];
        lastNode = sortArray[count-1];
	}
开发者ID:Podracer,项目名称:DAE-notepad,代码行数:35,代码来源:XmlDiff.cs

示例7: SlowSortNodes

	static private void SlowSortNodes( ref XmlDiffNode firstNode, ref XmlDiffNode lastNode, 
		                        XmlDiffNode firstPreviousSibbling, XmlDiffNode lastNextSibling )
	{
        Debug.Assert( firstNode != null );
        Debug.Assert( lastNode != null );

        XmlDiffNode firstSortedNode = firstNode;
        XmlDiffNode lastSortedNode = firstNode;
        XmlDiffNode nodeToSort = firstNode._nextSibling;
		lastSortedNode._nextSibling = null;

        while ( nodeToSort != null )
        {
            XmlDiffNode curNode = firstSortedNode;
            if ( nodeToSort.Position < firstSortedNode.Position )
            {
                XmlDiffNode tmpNode = nodeToSort._nextSibling;
                
                nodeToSort._nextSibling = firstSortedNode;
                firstSortedNode = nodeToSort;

                nodeToSort = tmpNode;
            }
            else
            {
                while ( curNode._nextSibling != null &&
                        nodeToSort.Position > curNode._nextSibling.Position )
                    curNode = curNode._nextSibling;

                XmlDiffNode tmpNode = nodeToSort._nextSibling;

                if ( curNode._nextSibling == null )
                    lastSortedNode = nodeToSort;

                nodeToSort._nextSibling = curNode._nextSibling;
                curNode._nextSibling = nodeToSort;

                nodeToSort = tmpNode;
            }
        }

        // reconnect the sorted part in the tree
        if ( firstPreviousSibbling == null )
            firstNode._parent._firstChildNode = firstSortedNode;
        else
            firstPreviousSibbling._nextSibling = firstSortedNode;

        lastSortedNode._nextSibling = lastNextSibling;

        // return
        firstNode = firstSortedNode;
        lastNode = lastSortedNode;
	}
开发者ID:Podracer,项目名称:DAE-notepad,代码行数:53,代码来源:XmlDiff.cs

示例8: RemoveDescendantsFromHashTable

 private void RemoveDescendantsFromHashTable( Hashtable hashtable, XmlDiffNode parentNode )
 {
     
 }
开发者ID:Podracer,项目名称:DAE-notepad,代码行数:4,代码来源:XmlDiff.cs

示例9: HTRemoveAncestors

 private void HTRemoveAncestors( Hashtable hashtable, XmlDiffNode node )
 {
     XmlDiffNode curAncestorNode = node._parent;
     while ( curAncestorNode != null )
     {
         if ( !HTRemoveNode( hashtable, curAncestorNode ) )
             break;
         curAncestorNode._bSomeDescendantMatches = true;
         curAncestorNode = curAncestorNode._parent;
     }
 }
开发者ID:Podracer,项目名称:DAE-notepad,代码行数:11,代码来源:XmlDiff.cs

示例10: WalkTreeOnMatchNode

 private void WalkTreeOnMatchNode( DiffgramParentOperation diffParent, XmlDiffNode sourceNode, XmlDiffNode targetNode, ref XmlDiffNode needPositionSourceNode )
 {
     if ( sourceNode.HasChildNodes || targetNode.HasChildNodes ) {
     DiffgramPosition diffMatch = new DiffgramPosition( sourceNode );
     WalkTreeGenerateDiffgramMatch( diffMatch, (XmlDiffParentNode)sourceNode, (XmlDiffParentNode)targetNode );
     diffParent.InsertAtEnd( diffMatch );
     needPositionSourceNode = null;
     }
     else {
     if ( sourceNode.NodeType == XmlDiffNodeType.ShrankNode ) {
         needPositionSourceNode = ((XmlDiffShrankNode)sourceNode)._lastNode;
     }
     else {
         needPositionSourceNode = sourceNode;
     }
     }
 }
开发者ID:ariflagiwale,项目名称:PSUpdateXml,代码行数:17,代码来源:DiffgramGenerator.cs

示例11: WalkTreeOnChangeNode

        private void WalkTreeOnChangeNode( DiffgramParentOperation diffParent, XmlDiffNode sourceNode, XmlDiffNode targetNode, XmlDiffOperation op )
        {
            Debug.Assert( sourceNode.NodeType != XmlDiffNodeType.Element && targetNode.NodeType != XmlDiffNodeType.Element );

            DiffgramChangeNode changeOp = new DiffgramChangeNode( sourceNode, targetNode, op, 0 );
            if ( sourceNode.HasChildNodes || targetNode.HasChildNodes ) {
            WalkTreeGenerateDiffgramMatch( changeOp, (XmlDiffParentNode) sourceNode, (XmlDiffParentNode) targetNode );
            }
            diffParent.InsertAtEnd( changeOp );
        }
开发者ID:ariflagiwale,项目名称:PSUpdateXml,代码行数:10,代码来源:DiffgramGenerator.cs

示例12: WalkTreeOnAddNode

        private void WalkTreeOnAddNode( DiffgramParentOperation diffParent, XmlDiffNode targetNode, XmlDiffNode sourcePositionNode )
        {
            bool bShrankNode = targetNode is XmlDiffShrankNode;

            if ( _bChildOrderSignificant ) {
            if ( sourcePositionNode != null ) {
                diffParent.InsertAtEnd( new DiffgramPosition( sourcePositionNode ) );
            }
            }
            else {
            if ( diffParent._firstChildOp == null && diffParent is Diffgram ) {
                diffParent.InsertAtEnd( new DiffgramPosition( sourcePositionNode ) );
            }
            }

            if ( targetNode._bSomeDescendantMatches && !bShrankNode ) {
            DiffgramOperation addOp = GenerateDiffgramAddWhenDescendantMatches( (XmlDiffParentNode)targetNode );
            diffParent.InsertAtEnd( addOp );
            }
            else {
            // shrank node -> output as 'move' operation
            if ( bShrankNode ) {
                ulong opid = 0;
                XmlDiffShrankNode shrankNode = (XmlDiffShrankNode) targetNode;
                if ( shrankNode.MoveOperationId == 0 )
                    shrankNode.MoveOperationId = GenerateOperationID( XmlDiffDescriptorType.Move );
                opid = shrankNode.MoveOperationId;

                diffParent.InsertAtEnd( new DiffgramCopy( shrankNode.MatchingShrankNode, true, opid ) );
            }
            else {
                switch ( targetNode.NodeType ) {
                    case XmlDiffNodeType.XmlDeclaration:
                    case XmlDiffNodeType.DocumentType:
                    case XmlDiffNodeType.EntityReference:
                        diffParent.InsertAtEnd( new DiffgramAddNode( targetNode, 0 ) );
                        break;
                    default:
                        if ( !diffParent.MergeAddSubtreeAtEnd( targetNode ) ) {
                            diffParent.InsertAtEnd( new DiffgramAddSubtrees( targetNode, 0, !_xmlDiff.IgnoreChildOrder ) );
                        }
                        break;
                }
            }
            }
        }
开发者ID:ariflagiwale,项目名称:PSUpdateXml,代码行数:46,代码来源:DiffgramGenerator.cs

示例13: PostponedRemoveSubtrees

        private void PostponedRemoveSubtrees( XmlDiffNode sourceNode, ulong operationID,
            int startSourceIndex, int endSourceIndex)
        {
            Debug.Assert( _bBuildingAddTree );
            Debug.Assert( sourceNode != null );

            if ( operationID == 0 &&
             _postponedEditScript._firstES != null )
            {
            Debug.Assert( _postponedEditScript._lastES._startSourceIndex > endSourceIndex );

            DiffgramRemoveSubtrees remSubtrees = _postponedEditScript._lastES._diffOperation as DiffgramRemoveSubtrees;
            if ( remSubtrees != null  &&
                remSubtrees.SetNewFirstNode( sourceNode ) )
            {
                _postponedEditScript._lastES._startSourceIndex = startSourceIndex;
                _postponedEditScript._startSourceIndex = startSourceIndex;
                return;
            }
            }

            PostponedOperation( new DiffgramRemoveSubtrees( sourceNode, operationID, !_xmlDiff.IgnoreChildOrder ), startSourceIndex, endSourceIndex );
        }
开发者ID:ariflagiwale,项目名称:PSUpdateXml,代码行数:23,代码来源:DiffgramGenerator.cs

示例14: ReplaceNodeIntervalWithShrankNode

	private XmlDiffShrankNode ReplaceNodeIntervalWithShrankNode( XmlDiffNode firstNode, 
		                                                         XmlDiffNode lastNode,
		                                                         XmlDiffNode previousSibling,
                                                                 ulong hashValue )
	{
		XmlDiffShrankNode shrankNode = new XmlDiffShrankNode( firstNode, lastNode, hashValue );
		XmlDiffParentNode parent = firstNode._parent;

		// find previous sibling node
		if ( previousSibling == null  &&
			 firstNode != parent._firstChildNode )
		{
			previousSibling = parent._firstChildNode;
			while ( previousSibling._nextSibling != firstNode )
				previousSibling = previousSibling._nextSibling;
		}

		// insert shrank node
		if ( previousSibling == null )
		{
			Debug.Assert( firstNode == parent._firstChildNode );

			shrankNode._nextSibling = parent._firstChildNode;
			parent._firstChildNode = shrankNode;
		}
		else
		{
			shrankNode._nextSibling = previousSibling._nextSibling;
			previousSibling._nextSibling = shrankNode;
		}
        shrankNode._parent = parent;

		// remove the node interval & count the total number of nodes
		XmlDiffNode tmpNode;
        int totalNodesCount = 0;
        do
        {
            tmpNode = shrankNode._nextSibling;
            totalNodesCount += tmpNode.NodesCount;
			shrankNode._nextSibling = shrankNode._nextSibling._nextSibling;

        } while ( tmpNode != lastNode );

        // adjust nodes count
        Debug.Assert( totalNodesCount > 0 );
        if ( totalNodesCount > 1 )
        {
            totalNodesCount--;
            while ( parent != null )
            {
                parent.NodesCount -= totalNodesCount;
                parent = parent._parent;
            }
        }

		return shrankNode;
	}
开发者ID:Podracer,项目名称:DAE-notepad,代码行数:57,代码来源:XmlDiff.cs

示例15: WalkTreeOnRemoveNode

        private void WalkTreeOnRemoveNode( DiffgramParentOperation diffParent, XmlDiffNode sourceNode )
        {
            bool bShrankNode = sourceNode is XmlDiffShrankNode;

            if ( sourceNode._bSomeDescendantMatches && !bShrankNode )
            {
            DiffgramOperation removeOp = GenerateDiffgramRemoveWhenDescendantMatches( (XmlDiffParentNode)sourceNode );
            diffParent.InsertAtEnd( removeOp );
            }
            else
            {
            ulong opid = 0;
            // shrank node -> output as 'move' operation
            if ( bShrankNode )
            {
                XmlDiffShrankNode shrankNode = (XmlDiffShrankNode) sourceNode;
                if ( shrankNode.MoveOperationId == 0 )
                    shrankNode.MoveOperationId = GenerateOperationID( XmlDiffDescriptorType.Move );
                opid = shrankNode.MoveOperationId;
            }

            if ( opid != 0 ||
                !diffParent.MergeRemoveSubtreeAtEnd( sourceNode ) )
            {
                diffParent.InsertAtEnd( new DiffgramRemoveSubtrees( sourceNode, opid, !_xmlDiff.IgnoreChildOrder ) );
            }
            }
        }
开发者ID:ariflagiwale,项目名称:PSUpdateXml,代码行数:28,代码来源:DiffgramGenerator.cs


注:本文中的Microsoft.XmlDiffPatch.XmlDiffNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。