@@ -2438,19 +2438,6 @@ private string GetExistingCreatedPathName(UANode node)
24382438 return createdPathName ;
24392439 }
24402440
2441- private string EqualizeParentNodeId ( UAInstance node , string parentNodeId )
2442- {
2443- string [ ] parentSplit = parentNodeId . Split ( ";" ) ;
2444- if ( parentSplit . Length > 1 )
2445- {
2446- ModelInfo modelInfo = m_modelManager . FindModel ( node . DecodedNodeId ) ;
2447- parentNodeId = String . Format ( "ns={0};{1}" ,
2448- modelInfo . NamespaceIndex , parentSplit [ 1 ] ) ;
2449- }
2450-
2451- return parentNodeId ;
2452- }
2453-
24542441 private string GetCreatedPathName ( UANode node )
24552442 {
24562443 string pathName = GetExistingCreatedPathName ( node ) ;
@@ -2460,40 +2447,21 @@ private string GetCreatedPathName(UANode node)
24602447 UAInstance uaInstance = node as UAInstance ;
24612448 if ( uaInstance != null )
24622449 {
2463- string parentNodeIdString = string . Empty ;
2464-
2465- if ( uaInstance . ParentNodeId != null )
2466- {
2467- parentNodeIdString = uaInstance . ParentNodeId ;
2468- }
2469- else
2450+ var refList = m_modelManager . FindReferences ( node . DecodedNodeId ) ;
2451+ foreach ( var reference in refList )
24702452 {
2471- var refList = m_modelManager . FindReferences ( node . DecodedNodeId ) ;
2472- int reversePropertyCount = 0 ;
2473- foreach ( var reference in refList )
2453+ if ( reference . IsForward == false &&
2454+ ( reference . ReferenceTypeId . Equals ( HasPropertyNodeId ) ||
2455+ reference . ReferenceTypeId . Equals ( Opc . Ua . ReferenceTypeIds . HasComponent ) ) )
24742456 {
2475- if ( reference . IsForward == false &&
2476- ( reference . ReferenceTypeId . Equals ( HasPropertyNodeId ) ||
2477- reference . ReferenceTypeId . Equals ( Opc . Ua . ReferenceTypeIds . HasComponent ) ) )
2457+ UANode parentNodeId = m_modelManager . FindNode < UANode > ( reference . TargetId ) ;
2458+ if ( parentNodeId != null )
24782459 {
2479- UANode parentNodeId = m_modelManager . FindNode < UANode > ( reference . TargetId ) ;
2480- if ( parentNodeId != null )
2481- {
2482- parentNodeIdString = parentNodeId . NodeId ;
2483- break ;
2484- }
2485-
2486- reversePropertyCount ++ ;
2460+ pathName = GetCreatedPathName ( parentNodeId ) ;
2461+ break ;
24872462 }
24882463 }
24892464 }
2490-
2491- if ( parentNodeIdString . Length > 0 )
2492- {
2493- string parentNodeId = EqualizeParentNodeId ( uaInstance , parentNodeIdString ) ;
2494- UANode parentNode = FindNode < NodeSet . UANode > ( new NodeId ( parentNodeId ) ) ;
2495- pathName = GetCreatedPathName ( parentNode ) ;
2496- }
24972465 }
24982466
24992467 if ( pathName . Length > 0 )
0 commit comments