diff --git a/HyperbolicDownloaderApi/Commands/FileCommands.cs b/HyperbolicDownloaderApi/Commands/FileCommands.cs index 20f2884..0416a91 100644 --- a/HyperbolicDownloaderApi/Commands/FileCommands.cs +++ b/HyperbolicDownloaderApi/Commands/FileCommands.cs @@ -90,6 +90,19 @@ public class FileCommands public void ListFilesRemote(string args) { + if (int.TryParse(args, out int index)) + { + List 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++;