From 37d4e9e279a5b1d489962f2b479abb0f809bfd50 Mon Sep 17 00:00:00 2001 From: thewhobox <45664417+thewhobox@users.noreply.github.com> Date: Tue, 2 Jan 2024 17:16:55 +0100 Subject: [PATCH] translated to german --- Argument.cs | 10 ++++------ Arguments.cs | 34 ++++++++++++++++++++-------------- KnxFileTransferClient.csproj | 4 ++-- Program.cs | 18 +++++++++--------- 4 files changed, 35 insertions(+), 31 deletions(-) diff --git a/Argument.cs b/Argument.cs index 7648d72..f697249 100644 --- a/Argument.cs +++ b/Argument.cs @@ -14,16 +14,14 @@ public enum ArgumentType public enum ConnectionType { - Search, - Auto, - Tunneling, - Routing + search, + auto, + tunneling, + routing } public string Name { get; set; } public string Display { get; set; } - public string Question { get; set; } = ""; - public string Regex { get; set; } = ""; public object Value { get; set; } public ArgumentType Type { get; set; } public bool WasSet { get; set; } = false; diff --git a/Arguments.cs b/Arguments.cs index 013379a..727d843 100644 --- a/Arguments.cs +++ b/Arguments.cs @@ -7,18 +7,18 @@ namespace KnxFileTransferClient; internal class Arguments{ private static List arguments = new List { - new("delay", "Delay", Argument.ArgumentType.Int, 0), - new("pkg", "Package Size", Argument.ArgumentType.Int, 128), - new("force", "Force", Argument.ArgumentType.Bool, false), - new("connect", "Verbindung", Argument.ArgumentType.Enum, Argument.ConnectionType.Search), + new("delay", "Verzögerung", Argument.ArgumentType.Int, 0), + new("pkg", "Telegrammgröße", Argument.ArgumentType.Int, 128), + new("force", "Erzwingen", Argument.ArgumentType.Bool, false), + new("connect", "Verbindung", Argument.ArgumentType.Enum, Argument.ConnectionType.search), new("verbose", "Verbose", Argument.ArgumentType.Bool, false), - 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})$"}, + new("pa", "Physikalische Adresse", Argument.ArgumentType.String, "1.1.255", true), new("port", "Port", Argument.ArgumentType.Int, 3671), new("gw", "Gateway IP", Argument.ArgumentType.String, "192.168.178.2", true), new("ga", "Gateway PA", Argument.ArgumentType.String, "1.1.0", true), new("gs", "Routing Source Address", Argument.ArgumentType.String, "0.0.1", true), new("config", "Konfigurationsname", Argument.ArgumentType.String, ""), - new("interactive", "All arguments need to be set by user", Argument.ArgumentType.Bool, false) + new("interactive", "Alle Argumente müssen vom Benutzer eingegeben werden", Argument.ArgumentType.Bool, false) }; public UnicastAddress? PhysicalAddress { get; private set; } = null; @@ -27,7 +27,7 @@ internal class Arguments{ public string Target { get; private set; } = ""; public string Command { get; private set; } = ""; public bool IsRouting { get; private set; } = false; - private static readonly List toSave = new() { "connect", "port", "gw", "ga", "gs", "pkg", "delay" }; + private static readonly List toSave = new() { "connect", "pa", "port", "gw", "ga", "gs", "pkg", "delay" }; public async Task Init(string[] args, bool isOpen = false) { @@ -60,32 +60,32 @@ public async Task Init(string[] args, bool isOpen = false) arg.WasSet = false; if(!GetRaw("pa").WasSet) - 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})$"); + 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})$"); if(!GetRaw("connect").WasSet) { Console.ForegroundColor = ConsoleColor.DarkGray; Console.WriteLine("(Auto|Search|Tunneling|Routing)"); Console.ResetColor(); - GetInputArg("connect", "Verbindungstyp: ", @"(Auto|Search|Tunneling|Routing)"); + GetInputArg("connect", "Verbindungstyp: ", @"(auto|search|tunneling|routing)"); } switch(Get("connect")) { - case Argument.ConnectionType.Auto: + case Argument.ConnectionType.auto: await SearchGateways(true); break; - case Argument.ConnectionType.Search: + case Argument.ConnectionType.search: await SearchGateways(); break; - case Argument.ConnectionType.Tunneling: + case Argument.ConnectionType.tunneling: if(!GetRaw("gw").WasSet) GetInputArg("gw", "IP-Adresse der Schnittstelle", @"((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}"); break; - case Argument.ConnectionType.Routing: + case Argument.ConnectionType.routing: if(!GetRaw("gw").WasSet) GetInputArg("gw", "IP-Adresse des Routers", @"((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}"); if(!GetRaw("ga").WasSet) @@ -287,6 +287,12 @@ private void ParseArgs(List argL) arg.Value = argL[index + 1]; break; } + + case Argument.ArgumentType.Enum: + { + arg.Value = (Argument.ConnectionType)Enum.Parse(argL[index + 1].ToLower()); + break; + } } } @@ -320,7 +326,7 @@ private bool GetInputArg(string name, string input, string regex) } Console.ResetColor(); - answer = Console.ReadLine(); + answer = Console.ReadLine().ToLower(); if(string.IsNullOrEmpty(answer)) answer = arg.Value.ToString(); } while(!CheckInput(answer, regex)); diff --git a/KnxFileTransferClient.csproj b/KnxFileTransferClient.csproj index 35dccd7..ea75f5e 100644 --- a/KnxFileTransferClient.csproj +++ b/KnxFileTransferClient.csproj @@ -11,8 +11,8 @@ enable enable - 0.2.0.0 - 0.2.0.0 + 0.2.1.0 + 0.2.1.0 diff --git a/Program.cs b/Program.cs index a787740..3af1292 100644 --- a/Program.cs +++ b/Program.cs @@ -262,7 +262,7 @@ private static int help() Arguments args = new Arguments(); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Yellow; - Console.WriteLine($"KnxFileTransferClient "); + Console.WriteLine($"KnxFileTransferClient "); Console.Write($" "); foreach(Argument arg in args.GetArguments()) @@ -275,14 +275,14 @@ private static int help() Console.ResetColor(); Console.WriteLine($"In Session:"); Console.ForegroundColor = ConsoleColor.Yellow; - Console.WriteLine($" "); + Console.WriteLine($" "); Console.ResetColor(); Console.WriteLine(); - Console.WriteLine("Command: Command to execute"); + Console.WriteLine("Befehl: Folgende Befehle sind vorhanden"); Console.WriteLine(" format/exists/rename/list/mkdir/rmdir/open/close"); Console.WriteLine(" upload/download/fwupdate/delete"); - Console.WriteLine("Source*: Path to the file on the host"); - Console.WriteLine("Target**: Path to the file on the knx device"); + Console.WriteLine("Quelle*: Pfad zur Datei auf dem Host"); + Console.WriteLine("Ziel**: Pfad zur Datei auf dem KNX-Gerät"); int maxLength = 17; @@ -301,11 +301,11 @@ private static int help() Console.WriteLine(); Console.ForegroundColor = ConsoleColor.DarkGray; - Console.WriteLine("* only at command upload/download"); - Console.WriteLine("** only at command exists/rename/upload/download/list/mkdir/rmdir"); + Console.WriteLine("* nur bei Befehl upload/download"); + Console.WriteLine("** nur bei Befehl exists/rename/upload/download/list/mkdir/rmdir"); Console.WriteLine(); - Console.WriteLine("Open = Session Start"); - Console.WriteLine("Close = Session End"); + Console.WriteLine("Open = Session Öffnen"); + Console.WriteLine("Close = Session Beenden"); Console.ResetColor(); return 0; }