/// <summary> /// Get any client by clid /// </summary> public TS3Models.Client GetAnyClient(int clid) { if (IsConnected()) { List <TS3Models.Client> allClients = GetClientList(); Dictionary <int, List <TS3Models.ClientProperties> > clientVars = new Dictionary <int, List <TS3Models.ClientProperties> >(); clientVars.Add(clid, null); List <TS3Models.Client> clients = ClientVariable(clientVars); if (clients != null && clients.Count != 0 && allClients != null && allClients.Count != 0 && allClients.Exists(s => s.ClId == clid)) { Dictionary <int, List <TS3Models.ChannelProperties> > channelVars = new Dictionary <int, List <TS3Models.ChannelProperties> >(); channelVars.Add(allClients.Find(s => s.ClId == clid).Channel.CId, null); List <TS3Models.Channel> channels = ChannelVariable(channelVars); if (channels != null && channels.Count != 0) { TS3Models.Client client = clients.First(); client.Channel = channels.First(); return(client); } } } return(null); }
/// <summary> /// Get my client /// </summary> public TS3Models.Client GetMyClient() { if (IsConnected()) { TS3Models.Client client = GetWhoami(); Dictionary <int, List <TS3Models.ClientProperties> > clientVars = new Dictionary <int, List <TS3Models.ClientProperties> >(); clientVars.Add(client.ClId, null); List <TS3Models.Client> clients = ClientVariable(clientVars); if (clients != null && clients.Count != 0) { Dictionary <int, List <TS3Models.ChannelProperties> > channelVars = new Dictionary <int, List <TS3Models.ChannelProperties> >(); channelVars.Add(client.Channel.CId, null); List <TS3Models.Channel> channels = ChannelVariable(channelVars); if (channels != null && channels.Count != 0) { client = clients.First(); client.Channel = channels.First(); return(client); } } } return(null); }
private void btnConnect_Click(object sender, EventArgs e) { if (client.Connect()) { me = client.GetWhoami(); comboBoxTab.DataSource = client.ServerConnectionHandlerList(); comboBoxClient.DataSource = client.GetClientList(); client.ClientNotifyRegister(client.CurrentHandlerId, Notifications.notifytextmessage); client.Notifier.OnTextMessage += Notifier_OnTextMessage; btnConnect.Enabled = false; comboBoxTab.Enabled = true; btnCapture.Enabled = true; comboBoxClient.Enabled = true; btnTcpCapture.Enabled = true; btnImageCapture.Enabled = true; } else MessageBox.Show("Error"); }