File tree Expand file tree Collapse file tree 1 file changed +9
-15
lines changed
Expand file tree Collapse file tree 1 file changed +9
-15
lines changed Original file line number Diff line number Diff line change 11using System ;
22using System . IO ;
3- #if NET35_OR_GREATER || NETCOREAPP
4- using System . Linq ;
5- #endif
63using BinaryObjectScanner ;
74
85namespace ProtectionScan
@@ -107,25 +104,22 @@ private static void WriteProtectionResultFile(string path, ProtectionDictionary?
107104 Console . WriteLine ( "Could not open protection log file for writing. Only a console log will be provided." ) ;
108105 }
109106
110- #if NET20
111- var keysArr = new string [ protections . Keys . Count ] ;
112- protections . Keys . CopyTo ( keysArr , 0 ) ;
113- Array . Sort ( keysArr ) ;
114- foreach ( string key in keysArr )
115- #else
116- foreach ( string key in protections . Keys . OrderBy ( k => k ) )
117- #endif
107+ // Sort the keys for consistent output
108+ string [ ] keys = [ .. protections . Keys ] ;
109+ Array . Sort ( keys ) ;
110+
111+ // Loop over all keys
112+ foreach ( string key in keys )
118113 {
119114 // Skip over files with no protection
120115 if ( protections [ key ] == null || protections [ key ] . Count == 0 )
121116 continue ;
122117
123- #if NET20
118+ // Sort the detected protections for consistent output
124119 string [ ] fileProtections = [ .. protections [ key ] ] ;
125120 Array . Sort ( fileProtections ) ;
126- #else
127- string [ ] fileProtections = [ .. protections [ key ] . OrderBy ( p => p ) ] ;
128- #endif
121+
122+ // Format and output the line
129123 string line = $ "{ key } : { string . Join ( ", " , fileProtections ) } ";
130124 Console . WriteLine ( line ) ;
131125 sw ? . WriteLine ( line ) ;
You can’t perform that action at this time.
0 commit comments