@@ -7,18 +7,18 @@ namespace KnxFileTransferClient;
77internal class Arguments {
88
99 private static List < Argument > arguments = new List < Argument > {
10- new ( "delay" , "Delay " , Argument . ArgumentType . Int , 0 ) ,
11- new ( "pkg" , "Package Size " , Argument . ArgumentType . Int , 128 ) ,
12- new ( "force" , "Force " , Argument . ArgumentType . Bool , false ) ,
13- new ( "connect" , "Verbindung" , Argument . ArgumentType . Enum , Argument . ConnectionType . Search ) ,
10+ new ( "delay" , "Verzögerung " , Argument . ArgumentType . Int , 0 ) ,
11+ new ( "pkg" , "Telegrammgröße " , Argument . ArgumentType . Int , 128 ) ,
12+ new ( "force" , "Erzwingen " , Argument . ArgumentType . Bool , false ) ,
13+ new ( "connect" , "Verbindung" , Argument . ArgumentType . Enum , Argument . ConnectionType . search ) ,
1414 new ( "verbose" , "Verbose" , Argument . ArgumentType . Bool , false ) ,
15- new ( "pa" , "Physical Address " , Argument . ArgumentType . String , "1.1.255" , true ) { Question = "PA des Geräts" , Regex = @"^(1[0-5]|[0-9])\.(1[0-5]|[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$" } ,
15+ new ( "pa" , "Physikalische Adresse " , Argument . ArgumentType . String , "1.1.255" , true ) ,
1616 new ( "port" , "Port" , Argument . ArgumentType . Int , 3671 ) ,
1717 new ( "gw" , "Gateway IP" , Argument . ArgumentType . String , "192.168.178.2" , true ) ,
1818 new ( "ga" , "Gateway PA" , Argument . ArgumentType . String , "1.1.0" , true ) ,
1919 new ( "gs" , "Routing Source Address" , Argument . ArgumentType . String , "0.0.1" , true ) ,
2020 new ( "config" , "Konfigurationsname" , Argument . ArgumentType . String , "" ) ,
21- new ( "interactive" , "All arguments need to be set by user " , Argument . ArgumentType . Bool , false )
21+ new ( "interactive" , "Alle Argumente müssen vom Benutzer eingegeben werden " , Argument . ArgumentType . Bool , false )
2222 } ;
2323
2424 public UnicastAddress ? PhysicalAddress { get ; private set ; } = null ;
@@ -27,7 +27,7 @@ internal class Arguments{
2727 public string Target { get ; private set ; } = "" ;
2828 public string Command { get ; private set ; } = "" ;
2929 public bool IsRouting { get ; private set ; } = false ;
30- private static readonly List < string > toSave = new ( ) { "connect" , "port" , "gw" , "ga" , "gs" , "pkg" , "delay" } ;
30+ private static readonly List < string > toSave = new ( ) { "connect" , "pa" , " port", "gw" , "ga" , "gs" , "pkg" , "delay" } ;
3131
3232 public async Task Init ( string [ ] args , bool isOpen = false )
3333 {
@@ -60,32 +60,32 @@ public async Task Init(string[] args, bool isOpen = false)
6060 arg . WasSet = false ;
6161
6262 if ( ! GetRaw ( "pa" ) . WasSet )
63- GetInputArg ( "pa" , "PA des Update- Geräts" , @"^(1[0-5]|[0-9])\.(1[0-5]|[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$" ) ;
63+ GetInputArg ( "pa" , "PA des Geräts" , @"^(1[0-5]|[0-9])\.(1[0-5]|[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$" ) ;
6464
6565 if ( ! GetRaw ( "connect" ) . WasSet )
6666 {
6767 Console . ForegroundColor = ConsoleColor . DarkGray ;
6868 Console . WriteLine ( "(Auto|Search|Tunneling|Routing)" ) ;
6969 Console . ResetColor ( ) ;
70- GetInputArg ( "connect" , "Verbindungstyp: " , @"(Auto|Search|Tunneling|Routing )" ) ;
70+ GetInputArg ( "connect" , "Verbindungstyp: " , @"(auto|search|tunneling|routing )" ) ;
7171 }
7272
7373 switch ( Get < Argument . ConnectionType > ( "connect" ) )
7474 {
75- case Argument . ConnectionType . Auto :
75+ case Argument . ConnectionType . auto :
7676 await SearchGateways ( true ) ;
7777 break ;
7878
79- case Argument . ConnectionType . Search :
79+ case Argument . ConnectionType . search :
8080 await SearchGateways ( ) ;
8181 break ;
8282
83- case Argument . ConnectionType . Tunneling :
83+ case Argument . ConnectionType . tunneling :
8484 if ( ! GetRaw ( "gw" ) . WasSet )
8585 GetInputArg ( "gw" , "IP-Adresse der Schnittstelle" , @"((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}" ) ;
8686 break ;
8787
88- case Argument . ConnectionType . Routing :
88+ case Argument . ConnectionType . routing :
8989 if ( ! GetRaw ( "gw" ) . WasSet )
9090 GetInputArg ( "gw" , "IP-Adresse des Routers" , @"((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}" ) ;
9191 if ( ! GetRaw ( "ga" ) . WasSet )
@@ -287,6 +287,12 @@ private void ParseArgs(List<string> argL)
287287 arg . Value = argL [ index + 1 ] ;
288288 break ;
289289 }
290+
291+ case Argument . ArgumentType . Enum :
292+ {
293+ arg . Value = ( Argument . ConnectionType ) Enum . Parse < Argument . ConnectionType > ( argL [ index + 1 ] . ToLower ( ) ) ;
294+ break ;
295+ }
290296 }
291297 }
292298
@@ -320,7 +326,7 @@ private bool GetInputArg(string name, string input, string regex)
320326 }
321327 Console . ResetColor ( ) ;
322328
323- answer = Console . ReadLine ( ) ;
329+ answer = Console . ReadLine ( ) . ToLower ( ) ;
324330 if ( string . IsNullOrEmpty ( answer ) )
325331 answer = arg . Value . ToString ( ) ;
326332 } while ( ! CheckInput ( answer , regex ) ) ;
0 commit comments