Fix output of add host command

This commit is contained in:
Stone_Red
2023-12-12 12:25:51 +01:00
parent 8ec9a7964a
commit a5983e427c
2 changed files with 21 additions and 6 deletions
@@ -10,23 +10,33 @@ public class HostsManager
private List<NetworkSocket> hosts = new List<NetworkSocket>();
public int Count => hosts.Count;
public void AddRange(IEnumerable<NetworkSocket> hosts)
public int AddRange(IEnumerable<NetworkSocket> hosts)
{
int newHosts = 0;
foreach (NetworkSocket host in hosts)
{
Add(host);
if (Add(host))
{
newHosts++;
}
}
SaveHosts();
return newHosts;
}
public void Add(NetworkSocket host)
public bool Add(NetworkSocket host)
{
if (!Contains(host))
{
hosts.Add(host);
return true;
}
SaveHosts();
return false;
}
public void Remove(NetworkSocket host, bool forceRemove = false)