Skip to content

Commit

Permalink
translated to german
Browse files Browse the repository at this point in the history
  • Loading branch information
thewhobox committed Jan 2, 2024
1 parent db80d46 commit 37d4e9e
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 31 deletions.
10 changes: 4 additions & 6 deletions Argument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
34 changes: 20 additions & 14 deletions Arguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ namespace KnxFileTransferClient;
internal class Arguments{

private static List<Argument> arguments = new List<Argument> {
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;
Expand All @@ -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<string> toSave = new() { "connect", "port", "gw", "ga", "gs", "pkg", "delay" };
private static readonly List<string> toSave = new() { "connect", "pa", "port", "gw", "ga", "gs", "pkg", "delay" };

public async Task Init(string[] args, bool isOpen = false)
{
Expand Down Expand Up @@ -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<Argument.ConnectionType>("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)
Expand Down Expand Up @@ -287,6 +287,12 @@ private void ParseArgs(List<string> argL)
arg.Value = argL[index + 1];
break;
}

case Argument.ArgumentType.Enum:
{
arg.Value = (Argument.ConnectionType)Enum.Parse<Argument.ConnectionType>(argL[index + 1].ToLower());
break;
}
}
}

Expand Down Expand Up @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions KnxFileTransferClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<Version>0.2.0.0</Version>
<AssemblyVersion>0.2.0.0</AssemblyVersion>
<Version>0.2.1.0</Version>
<AssemblyVersion>0.2.1.0</AssemblyVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
18 changes: 9 additions & 9 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ private static int help()
Arguments args = new Arguments();
Console.WriteLine();
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine($"KnxFileTransferClient <Command> <Source?> <Target?>");
Console.WriteLine($"KnxFileTransferClient <Befehl> <Quelle?> <Ziel?>");

Console.Write($" ");
foreach(Argument arg in args.GetArguments())
Expand All @@ -275,14 +275,14 @@ private static int help()
Console.ResetColor();
Console.WriteLine($"In Session:");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine($"<Command> <Source?> <Target?>");
Console.WriteLine($"<Befehl> <Quelle?> <Ziel?>");
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;

Expand All @@ -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;
}
Expand Down

0 comments on commit 37d4e9e

Please sign in to comment.