} // applyMergeChoices() public void _applyMergeChoicesToNode(MergeInfoData Choices, MergeInfoData.MergeInfoNodePair nodePair, CswNbtNode resultNode) { CswNbtNode Node1 = _CswNbtResources.Nodes[nodePair.Node1Id]; CswNbtNode Node2 = _CswNbtResources.Nodes[nodePair.Node2Id]; if (null != Node1 && null != Node2) { /* * Copy all the values from Node2 into the result and then copy any properties from Node1 into the result that were selected * This is to ensure we copy property values we didn't have to merge. */ resultNode.copyPropertyValuesGeneric(Node2); foreach (MergeInfoData.MergeInfoProperty mergeProp in nodePair.Properties.Where(mergeProp => mergeProp.Choice == 1)) { resultNode.Properties[mergeProp.NodeTypePropId].copyGeneric(Node1.Properties[mergeProp.NodeTypePropId]); } // Set references to new merged node if (Int32.MinValue != nodePair.NodeReferencePropId) { // Find the new nodeid for the value of the reference ICswNbtNodePropNodeReference NodeReferenceProp = resultNode.Properties[nodePair.NodeReferencePropId].AsNodeReference; CswPrimaryKey oldNodeId = NodeReferenceProp.ReferencedNodeId; MergeInfoData.MergeInfoNodePair otherNodePair = Choices.NodePairs.FirstOrDefault(np => np.Node1Id == oldNodeId.ToString() || np.Node2Id == oldNodeId.ToString()); if (null != otherNodePair) { // Set the reference to point to the new merged node NodeReferenceProp.ReferencedNodeId = CswConvert.ToPrimaryKey(otherNodePair.Node2Id); } } // if( Int32.MinValue != nodePair.NodeReferencePropId ) } // if( null != Node1 && null != Node2 ) } // _applyMergeChoicesToNode()