@@ -372,28 +372,9 @@ private void PerformDNSLookupHostnameAction()
372372
373373 private void CustomCommandAction ( object guid )
374374 {
375- Debug . WriteLine ( guid . ToString ( ) ) ;
376-
377- if ( guid is Guid id )
378- {
379- CustomCommandInfo info = ( CustomCommandInfo ) CustomCommands . FirstOrDefault ( x => x . ID == id ) . Clone ( ) ;
380-
381- if ( info == null )
382- return ; // ToDo: Log and error message
383-
384- // Replace vars
385- string hostname = ! string . IsNullOrEmpty ( SelectedHostResult . Hostname ) ? SelectedHostResult . Hostname . TrimEnd ( '.' ) : "" ;
386- string ipAddress = SelectedHostResult . PingInfo . IPAddress . ToString ( ) ;
387-
388- info . FilePath = Regex . Replace ( info . FilePath , "\\ $\\ $hostname\\ $\\ $" , hostname , RegexOptions . IgnoreCase ) ;
389- info . FilePath = Regex . Replace ( info . FilePath , "\\ $\\ $ipaddress\\ $\\ $" , ipAddress , RegexOptions . IgnoreCase ) ;
390- info . Arguments = Regex . Replace ( info . Arguments , "\\ $\\ $hostname\\ $\\ $" , hostname , RegexOptions . IgnoreCase ) ;
391- info . Arguments = Regex . Replace ( info . Arguments , "\\ $\\ $ipaddress\\ $\\ $" , ipAddress , RegexOptions . IgnoreCase ) ;
392-
393- CustomCommand . Run ( info ) ;
394- }
375+ CustomCommand ( guid ) ;
395376 }
396-
377+
397378 public ICommand AddProfileSelectedHostCommand => new RelayCommand ( p => AddProfileSelectedHostAction ( ) ) ;
398379 private async void AddProfileSelectedHostAction ( )
399380 {
@@ -609,6 +590,28 @@ private void ScanFinished()
609590 IsScanRunning = false ;
610591 }
611592
593+ private void CustomCommand ( object guid )
594+ {
595+ if ( guid is Guid id )
596+ {
597+ CustomCommandInfo info = ( CustomCommandInfo ) CustomCommands . FirstOrDefault ( x => x . ID == id ) . Clone ( ) ;
598+
599+ if ( info == null )
600+ return ; // ToDo: Log and error message
601+
602+ // Replace vars
603+ string hostname = ! string . IsNullOrEmpty ( SelectedHostResult . Hostname ) ? SelectedHostResult . Hostname . TrimEnd ( '.' ) : "" ;
604+ string ipAddress = SelectedHostResult . PingInfo . IPAddress . ToString ( ) ;
605+
606+ info . FilePath = Regex . Replace ( info . FilePath , "\\ $\\ $hostname\\ $\\ $" , hostname , RegexOptions . IgnoreCase ) ;
607+ info . FilePath = Regex . Replace ( info . FilePath , "\\ $\\ $ipaddress\\ $\\ $" , ipAddress , RegexOptions . IgnoreCase ) ;
608+ info . Arguments = Regex . Replace ( info . Arguments , "\\ $\\ $hostname\\ $\\ $" , hostname , RegexOptions . IgnoreCase ) ;
609+ info . Arguments = Regex . Replace ( info . Arguments , "\\ $\\ $ipaddress\\ $\\ $" , ipAddress , RegexOptions . IgnoreCase ) ;
610+
611+ Utilities . CustomCommand . Run ( info ) ;
612+ }
613+ }
614+
612615 private void AddHostToHistory ( string ipRange )
613616 {
614617 // Create the new list
0 commit comments