コード例 #1
0
        /// <summary>
        /// Returns a tree of channels and contained clients by calling GetChannelList() and GetClientList() on QueryRunner when useCachedData is set to false. Otherwise the data retrieved by previous calls is used.
        /// </summary>
        /// <param name="useCachedData">whether to use cached data from previous calls or to query the data again to get fresh data</param>
        /// <returns></returns>
        public List <ChannelTreeItem> GetChannelTree(bool useCachedData)
        {
            if (!useCachedData || CachedChannelList == null || CachedClientList == null)
            {
                CachedChannelList = QueryRunner.GetChannelList(true).Values;
                CachedClientList  = QueryRunner.GetClientList(true).Values;
            }

            return(GetChannelTree(CachedChannelList, CachedClientList));
        }
コード例 #2
0
ファイル: ClientData.cs プロジェクト: deckerbd/TS3-Bot
        /// <summary>
        /// Gets the client list.
        /// </summary>
        /// <returns></returns>
        public List <ClientListEntry> GetClientList()
        {
            lock (Container.lockGetClientList)
            {
                if (Container.ClientList == null)
                {
                    Container.ClientList = QueryRunner.GetClientList(true, true, true, true, false, true, false, true, true)
                                           .Where(m => m.ClientType == 0).ToList();
                    Container.ClientList.Where(m => !IsClientGuest(m.ClientDatabaseId, m.ServerGroups))
                    .ForEach(c => SetLastSeen(c.ClientDatabaseId));
                }

                return(Container.ClientList.ToList());
            }
        }
コード例 #3
0
        private void updateOutput(Object StateInfo = null)
        {
            API.Log(API.LogType.Debug, "Teamspeak.ddl: UpdateOutput");
            currentUser = QueryRunner.SendWhoAmI();
            if (!currentUser.IsErroneous)
            {
                string channelpath = QueryRunner.GetChannelConnectionInfo().Path;
                //look for / not preceded by \
                string[] paths = Regex.Split(channelpath, @"(?<![\\])/");

                ChannelName = paths[paths.Length - 1].Replace(@"\/", "/").Replace("[cspacer]", String.Empty).Trim();

                clients = QueryRunner.GetClientList();

                lock (ThreadLocker)
                {
                    ChannelClientList = new Dictionary <uint, ClientListEntry>();
                    StringBuilder channelcl = new StringBuilder();
                    foreach (ClientListEntry client in clients.Values)
                    {
                        if (client.ChannelId == currentUser.ChannelId)
                        {
                            ChannelClientList.Add(client.ClientId, client);
                            channelcl.AppendLine(client.Nickname);
                        }
                    }
                    ChannelClients = channelcl.ToString();
                }
                //API.Log(API.LogType.Debug, "Teamspeak.ddl: UpdateOutput" + "\r\n" + ChannelName + "\r\n" + ChannelClients);
            }
            else
            {
                //API.Log(API.LogType.Debug, "Teamspeak.ddl: UpdateOutput CurrentUser Error");
                Disconnect();
            }
        }