Пример #1
0
        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));
        }
Пример #2
0
        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));
        }