@@ -1617,7 +1617,6 @@ public void ExportNodesToNodeSet2(ISession session, IList<INode> nodes, string f
16171617 stopwatch . ElapsedMilliseconds ) ;
16181618 }
16191619
1620-
16211620 /// <summary>
16221621 /// Exports nodes to separate NodeSet2 XML files, one per namespace.
16231622 /// Excludes OPC Foundation companion specifications (namespaces starting with http://opcfoundation.org/UA/).
@@ -1664,10 +1663,10 @@ public async Task<IReadOnlyDictionary<string, string>> ExportNodesToNodeSet2PerN
16641663 . GroupBy ( node => node . NodeId . NamespaceIndex )
16651664 . Where ( group =>
16661665 {
1667- var namespaceUri = session . NamespaceUris . GetString ( group . Key ) ;
1666+ string namespaceUri = session . NamespaceUris . GetString ( group . Key ) ;
16681667 // Exclude OPC Foundation companion specifications
16691668 return ! string . IsNullOrEmpty ( namespaceUri ) &&
1670- ! namespaceUri . StartsWith ( "http://opcfoundation.org/UA/" , StringComparison . OrdinalIgnoreCase ) ;
1669+ ! namespaceUri . StartsWith ( "http://opcfoundation.org/UA/" , StringComparison . OrdinalIgnoreCase ) ;
16711670 } )
16721671 . ToDictionary (
16731672 group => group . Key ,
@@ -1676,16 +1675,16 @@ public async Task<IReadOnlyDictionary<string, string>> ExportNodesToNodeSet2PerN
16761675 var exportedFiles = new Dictionary < string , string > ( ) ;
16771676
16781677 // Export each namespace to its own file
1679- foreach ( var kvp in nodesByNamespace )
1678+ foreach ( KeyValuePair < ushort , List < INode > > kvp in nodesByNamespace )
16801679 {
16811680 cancellationToken . ThrowIfCancellationRequested ( ) ;
16821681
1683- var namespaceUri = session . NamespaceUris . GetString ( kvp . Key ) ;
1684-
1682+ string namespaceUri = session . NamespaceUris . GetString ( kvp . Key ) ;
1683+
16851684 // Create a safe filename from the namespace URI
1686-
1687- var fileName = CreateSafeFileName ( namespaceUri , kvp . Key ) ;
1688- var filePath = Path . Combine ( outputDirectory , fileName ) ;
1685+
1686+ string fileName = CreateSafeFileName ( namespaceUri , kvp . Key ) ;
1687+ string filePath = Path . Combine ( outputDirectory , fileName ) ;
16891688
16901689 m_logger . LogInformation (
16911690 "Exporting namespace {NamespaceIndex} ({NamespaceUri}): {Count} nodes to {FilePath}" ,
@@ -1729,14 +1728,13 @@ await Task.Run(() =>
17291728 private static string CreateSafeFileName ( string namespaceUri , ushort namespaceIndex )
17301729 {
17311730 // Extract meaningful part from URI
1732- var fileName = namespaceUri
1733- . Replace ( "http://" , "" )
1734- . Replace ( "https://" , "" )
1735- . Replace ( "urn:" , "" ) ;
1731+ string fileName = namespaceUri
1732+ . Replace ( "http://" , string . Empty , StringComparison . OrdinalIgnoreCase )
1733+ . Replace ( "https://" , string . Empty , StringComparison . OrdinalIgnoreCase )
1734+ . Replace ( "urn:" , string . Empty , StringComparison . OrdinalIgnoreCase ) ;
17361735
17371736 // Replace invalid filename characters
1738- var invalidChars = Path . GetInvalidFileNameChars ( ) ;
1739- foreach ( var c in invalidChars )
1737+ foreach ( char c in Path . GetInvalidFileNameChars ( ) )
17401738 {
17411739 fileName = fileName . Replace ( c , '_' ) ;
17421740 }
0 commit comments