sockscape/server/ServerList.cs

32 lines
790 B
C#
Raw Normal View History

2017-06-16 21:00:01 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
2017-07-22 19:27:41 +00:00
namespace SockScape {
class ServerList {
public static Dictionary<int, Server> Servers { get; }
= new Dictionary<int, Server>();
2017-06-16 21:00:01 +00:00
public Server this[int i] {
get => Servers.ContainsKey(i) ? Servers[i] : null;
set => Servers[i] = value;
}
public bool HasId(int id)
=> Servers.ContainsKey(id);
public void Clear()
=> Servers.Clear();
}
class Server {
public ushort Id { get; set; }
public ushort UserCount { get; set; }
public IPEndPoint Address { get; set; }
public IPEndPoint Owner { get; set; }
2017-06-16 21:00:01 +00:00
}
}