File tree Expand file tree Collapse file tree
Advanced PortChecker/Windows Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33using System . Diagnostics ;
44using System . Linq ;
55using System . Reflection ;
6+ using System . Text ;
67using System . Windows ;
78using System . Windows . Input ;
89using System . Windows . Shell ;
@@ -339,8 +340,22 @@ private void BtnCopy_Click(object sender, RoutedEventArgs e)
339340 {
340341 if ( LvPorts . SelectedItems . Count == 0 ) return ;
341342
342- LvCheck selected = ( LvCheck ) LvPorts . SelectedItems [ 0 ] ;
343- Clipboard . SetText ( selected . Address + " " + selected . Port + " " + selected . HostName + " " + selected . Type + " " + selected . Description ) ;
343+ List < LvCheck > selected = LvPorts . SelectedItems . Cast < LvCheck > ( ) . ToList ( ) ;
344+ StringBuilder sb = new StringBuilder ( ) ;
345+
346+ for ( int i = 0 ; i < selected . Count ; i ++ )
347+ {
348+ if ( i != selected . Count - 1 )
349+ {
350+ sb . AppendLine ( selected [ i ] . Address + " " + selected [ i ] . Port + " " + selected [ i ] . HostName + " " + selected [ i ] . Type + " " + selected [ i ] . Description ) ;
351+ }
352+ else
353+ {
354+ sb . Append ( selected [ i ] . Address + " " + selected [ i ] . Port + " " + selected [ i ] . HostName + " " + selected [ i ] . Type + " " + selected [ i ] . Description ) ;
355+ }
356+ }
357+
358+ Clipboard . SetText ( sb . ToString ( ) ) ;
344359 }
345360
346361 /// <summary>
You can’t perform that action at this time.
0 commit comments