public void AddClient(MinerClient client) { logger.Information("Start AddClient."); if (client == null) { logger.Error("New Client should not be null"); throw new ArgumentNullException("New Client should not be null"); } if (client.Machine == null) { logger.Error("New Client Machine should not be null"); throw new ArgumentNullException("New Client Machine should not be null"); } client.StatusChanged += ClientStatusChanged; client.MachineFullName = client.Machine.FullName; MinerMachine newMachine = client.Machine; MachineCredential newCredential = newMachine.Credential; if (newCredential != null) { newMachine.CredentialId = managerInfo.AddOrUpdateCredential(newMachine.Credential); } managerInfo.AddOrUpdateMachine(newMachine); this.ClientList.Add(client); this.SaveCurrentInfo(); }
public void RemoveClient(MinerClient client) { logger.Information("Start AddClient."); if (client == null) { logger.Error("Client should not be null"); throw new ArgumentNullException("Client should not be null"); } this.ClientList.Remove(client); this.SaveCurrentInfo(); }