public static bool AddClient(AuthClient client) { if (!Directory.Exists(_dataFolder)) { Directory.CreateDirectory(_dataFolder); } List <AuthClient> clients = ReadClientsFromDisk(_clientsFile); if (clients == null) { clients = new List <AuthClient>(); } clients.Add(client); return(WriteClientsToDisk(clients)); }
public static bool RemoveClient(AuthClient client) { if (!Directory.Exists(_dataFolder)) { return(false); } List <AuthClient> clients = ReadClientsFromDisk(_clientsFile); if (clients == null) { return(false); } var lookd = clients.Where(ip => ip.IPaddress.Equals(client.IPaddress)).FirstOrDefault(); clients.Remove(lookd); return(WriteClientsToDisk(clients)); }