Ejemplo n.º 1
0
        public R <ClientDbData> GetDbClientByDbId(ulong clientDbId)
        {
            if (clientDbNames.TryGetValue(clientDbId, out var clientData))
            {
                return(clientData);
            }

            try
            {
                clientData = tsBaseClient.ClientDbInfo(clientDbId);
                clientDbNames.Store(clientDbId, clientData);
                return(clientData);
            }
            catch (Ts3CommandException) { return("No client found."); }
        }
Ejemplo n.º 2
0
        public R <ClientDbData> GetDbClientByDbId(ulong clientDbId)
        {
            if (clientDbNames.TryGetValue(clientDbId, out var clientData))
            {
                return(clientData);
            }

            var result = tsBaseClient.ClientDbInfo(clientDbId);

            if (!result.Ok)
            {
                return("No client found.");
            }
            clientData = result.Value;
            clientDbNames.Store(clientDbId, clientData);
            return(clientData);
        }
Ejemplo n.º 3
0
        public string GetNameByDbId(ulong clientDbId)
        {
            string name;

            if (clientDbNames.TryGetValue(clientDbId, out name))
            {
                return(name);
            }

            try
            {
                var response = tsBaseClient.ClientDbInfo(clientDbId);
                name = response?.NickName ?? string.Empty;
                clientDbNames.Add(clientDbId, name);
                return(name);
            }
            catch (Ts3CommandException) { return(null); }
        }