Ejemplo n.º 1
0
        internal void Init()
        {
            try
            {
                if (!IsInitialized && Status == ConnectionStatusEnum.STATUS_CONNECTION_ESTABLISHED)
                {
                    Log("INIT");
                    Functions.getClientID(ID, ref LocalClientId);
                    var localClient = GetClient(LocalClientId);
                    localClient.IsLocalClient = true;
                    localClient.Update();
                    LocalClient     = localClient;
                    LocalClientName = localClient.Name;
                    Log("Local client id {0}", LocalClientId);

                    IntPtr retVal = IntPtr.Zero;
                    Functions.getClientList(ID, ref retVal);
                    var newClients = TeamSpeakBase.ReadShortIDList <Client>(retVal, GetClient);
                    Log($"{newClients.Count} Clients");
                    newClients.ForEach(cl => cl.Update());
                    var cu = newClients.Select(cl => cl.ID).ToArray();
                    Log($"{cu.Length} Unmute Clients");
                    DoUnmuteList(cu);
                    LocalClient.UpdateChannel();
                    Functions.systemset3DListenerAttributes(ID, new TSVector(), new TSVector(), new TSVector());
                    IsInitialized = true;
                    Log("ENDINIT");
                }
            }
            catch (Exception ex)
            {
                Log(ex.ToString());
            }
        }
Ejemplo n.º 2
0
        internal void Init()
        {
            if (!IsInitialized)
            {
                Functions.getClientID(ID, ref LocalClientId);
                var localClient = GetClient(LocalClientId);
                localClient.IsLocalClient = true;
                localClient.Update();
                LocalClient     = localClient;
                LocalClientName = localClient.Name;
                Log("Local client id {0}", LocalClientId);

                IntPtr retVal = IntPtr.Zero;
                Functions.getClientList(ID, ref retVal);
                var newClients = TeamSpeakBase.ReadShortIDList <Client>(retVal, GetClient);
                Log($"{newClients.Count} Clients");
                newClients.ForEach(cl => cl.Update());
                var cu = newClients.Select(cl => cl.ID).ToArray();
                Log($"{cu.Length} Unmute Clients");
                DoUnmuteList(cu);
                LocalClient.UpdateChannel();
                Functions.systemset3DListenerAttributes(ID, new TSVector(), new TSVector(), new TSVector());
                IsInitialized = true;
            }
        }