示例#1
0
        private static void InitTS()
        {
            var identityData = Ts3Crypt.DeobfuscateAndImportTs3Identity(config.Secret.TSIdentity);

            if (!string.IsNullOrEmpty(identityData.Error))
            {
                Console.WriteLine(identityData.Error);
            }
            else
            {
                connectionData = new ConnectionDataFull()
                {
                    Identity = identityData.Unwrap()
                };

                if (!string.IsNullOrEmpty(config.Secret.TSAddress))
                {
                    connectionData.Address = config.Secret.TSAddress;
                }

                if (!string.IsNullOrEmpty(config.Secret.TSServerPassword))
                {
                    connectionData.ServerPassword = config.Secret.TSServerPassword;
                }

                if (!string.IsNullOrEmpty(config.Secret.TSUsername))
                {
                    connectionData.Username = config.Secret.TSUsername;
                }

                if (!string.IsNullOrEmpty(config.Secret.TSDefaultChannel))
                {
                    connectionData.DefaultChannel = config.Secret.TSDefaultChannel;
                }

                if (!string.IsNullOrEmpty(config.Secret.TSDefaultChannelPassword))
                {
                    connectionData.DefaultChannelPassword = config.Secret.TSDefaultChannelPassword;
                }

                client                    = new Ts3FullClient(EventDispatchType.AutoThreadPooled);
                client.OnConnected       += client_OnConnected;
                client.OnDisconnected    += client_OnDisconnected;
                client.OnErrorEvent      += client_OnErrorEvent;
                client.OnEachTextMessage += client_OnEachTextMessage;
                client.OnClientEnterView += Client_OnClientEnterView;

                client.OnEachClientMoved += Client_OnEachClientMoved;

                client.Connect(connectionData);
            }
        }