mirror of
https://github.com/Stone-Red-Code/HyperbolicDownloader.git
synced 2026-09-04 00:56:09 +02:00
Add host index support to list files remote command
This commit is contained in:
@@ -90,6 +90,19 @@ public class FileCommands
|
||||
|
||||
public void ListFilesRemote(string args)
|
||||
{
|
||||
if (int.TryParse(args, out int index))
|
||||
{
|
||||
List<NetworkSocket> hosts = hostsManager.ToList();
|
||||
|
||||
if (index < 1 || index > hosts.Count)
|
||||
{
|
||||
ApiManager.SendNotificationMessageNewLine("Invalid index!", NotificationMessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
args = $"{hosts[index - 1].IPAddress}:{hosts[index - 1].Port}";
|
||||
}
|
||||
|
||||
string[] parts = args.Split(":");
|
||||
|
||||
if (parts.Length != 2)
|
||||
@@ -145,8 +158,6 @@ public class FileCommands
|
||||
return;
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
|
||||
foreach (HyperFileDto fileInfo in fileInfos)
|
||||
{
|
||||
index++;
|
||||
|
||||
Reference in New Issue
Block a user