Update Console.Commander.NET to the newest version

This commit is contained in:
Stone_Red
2022-04-25 11:15:23 +02:00
parent 826c6fc7ee
commit f5dd85e38c
2 changed files with 21 additions and 20 deletions
@@ -12,7 +12,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Console.Commander.NET" Version="1.0.0" /> <PackageReference Include="Console.Commander.NET" Version="1.0.1" />
<PackageReference Include="Stone_Red-C-Sharp-Utilities" Version="1.0.3.1" /> <PackageReference Include="Stone_Red-C-Sharp-Utilities" Version="1.0.3.1" />
</ItemGroup> </ItemGroup>
+20 -19
View File
@@ -20,30 +20,31 @@ internal class InputHandler
DownloadCommands downloadCommands = new DownloadCommands(hostsManager, filesManager); DownloadCommands downloadCommands = new DownloadCommands(hostsManager, filesManager);
ClientCommands clientCommands = new ClientCommands(); ClientCommands clientCommands = new ClientCommands();
commander.Register((_) => Console.Clear(), "clear", "cls"); commander.Register(input => commander.PrintHelp(input), "help");
commander.Register((_) => exit = true, "exit", "quit"); commander.Register(_ => Console.Clear(), (HelpText)"Clears the console.", "clear", "cls");
commander.Register(clientCommands.ShowInfo, "info", "inf"); commander.Register(_ => exit = true, (HelpText)"Exits the application.", "exit", "quit");
commander.Register(hostCommands.Discover, "discover", "disc"); commander.Register(clientCommands.ShowInfo, (HelpText)"Displays the private and public IP address.", "info", "inf");
commander.Register(hostCommands.Discover, (HelpText)"Tries to find other active hosts on the local network.", "discover", "disc");
Command getCommand = commander.Register(downloadCommands.GetFile, "get"); Command getCommand = commander.Register(downloadCommands.GetFile, (HelpText)"Attempts to retrieve a file from another host using a hash.", "get");
getCommand.Register(downloadCommands.GetFileFrom, "from"); getCommand.Register(downloadCommands.GetFileFrom, (HelpText)"Attempts to retrieve a file from another host using a .hyper file.", "from");
Command generateCommad = commander.Register(fileCommands.GenerateFileFull, "generate", "gen"); Command generateCommad = commander.Register(fileCommands.GenerateFileFull, (HelpText)"Generates a .hyper file from a file hash.", "generate", "gen");
generateCommad.Register(fileCommands.GenerateFileSingle, "noscan"); generateCommad.Register(fileCommands.GenerateFileSingle, (HelpText)"Generates a .hyper file from a file hash without checking the known hosts. This adds only the local host to the file.", "noscan");
Command addCommand = commander.Register(fileCommands.AddFile, "add"); Command addCommand = commander.Register(fileCommands.AddFile, (HelpText)"Adds a file to the tracking list.", "add");
addCommand.Register(hostCommands.AddHost, "host"); addCommand.Register(fileCommands.AddFile, (HelpText)"Adds a file to the tracking list.", "file");
addCommand.Register(fileCommands.AddFile, "file"); addCommand.Register(hostCommands.AddHost, (HelpText)"Adds a host to the list of known hosts.", "host");
Command removeCommand = commander.Register(fileCommands.RemoveFile, "remove", "rm"); Command removeCommand = commander.Register(fileCommands.RemoveFile, (HelpText)"Removes a file from the tracking list.", "remove", "rm");
removeCommand.Register(hostCommands.RemoveHost, "host"); removeCommand.Register(fileCommands.RemoveFile, (HelpText)"Removes a file from the tracking list.", "file");
removeCommand.Register(fileCommands.RemoveFile, "file"); removeCommand.Register(hostCommands.RemoveHost, (HelpText)"Removes a host from the list of known hosts.", "host");
Command listCommand = commander.Register(fileCommands.ListFiles, "list", "ls"); Command listCommand = commander.Register(fileCommands.ListFiles, (HelpText)"Lists all files.", "list", "ls");
listCommand.Register(fileCommands.ListFiles, "files"); listCommand.Register(fileCommands.ListFiles, (HelpText)"Lists all files.", "files");
listCommand.Register(hostCommands.ListHosts, "hosts"); listCommand.Register(hostCommands.ListHosts, (HelpText)"lists all hosts.", "hosts");
commander.Register(hostCommands.CheckActiveHosts, "status", "check"); commander.Register(hostCommands.CheckActiveHosts, (HelpText)"Checks the status of known hosts.", "status", "check");
} }
public void ReadInput() public void ReadInput()
@@ -59,7 +60,7 @@ internal class InputHandler
Console.CursorVisible = false; Console.CursorVisible = false;
try try
{ {
if (!commander.Execute(input)) if (!commander.Execute(input, out _))
{ {
ConsoleExt.WriteLine("Unknown command!", ConsoleColor.Red); ConsoleExt.WriteLine("Unknown command!", ConsoleColor.Red);
} }