コード例 #1
0
        public override async void KeyPressed(KeyPayload payload)
        {
            Logger.Instance.LogMessage(TracingLevel.INFO, "Key Pressed");

            try
            {
                if (TeamSpeak3Telnet.TS3_CLIENT == null || !TeamSpeak3Telnet.TS3_CLIENT.IsConnected)
                {
                    TeamSpeak3Telnet.SetupTelnetClient(_settings.ApiKey);
                    if (TeamSpeak3Telnet.TS3_CLIENT == null)
                    {
                        return;
                    }
                }

                if (payload.IsInMultiAction)
                {
                    await ToggleMicMuteLocally((int)payload.UserDesiredState);
                }
                else
                {
                    await ToggleMicMuteLocally(payload.State == 1? 0 : 1);
                }
            }
            catch (Exception)
            {
                TeamSpeak3Telnet.TS3_CLIENT?.Dispose();
                TeamSpeak3Telnet.TS3_CLIENT = null;
                await SetInputStatusStateLocally();
            }
        }
コード例 #2
0
        public override async void OnTick()
        {
            try
            {
                if (TeamSpeak3Telnet.TS3_CLIENT == null || !TeamSpeak3Telnet.TS3_CLIENT.IsConnected)
                {
                    TeamSpeak3Telnet.SetupTelnetClient(_settings.ApiKey);
                    if (TeamSpeak3Telnet.TS3_CLIENT == null)
                    {
                        return;
                    }
                }

                var clientId = TeamSpeak3Telnet.GetClientId();
                if (clientId == -1)
                {
                    TeamSpeak3Telnet.TS3_CLIENT?.Dispose();
                    TeamSpeak3Telnet.TS3_CLIENT = null;
                    return;
                }

                var inputMuteStatus = TeamSpeak3Telnet.GetInputMuteStatus(clientId);
                if (inputMuteStatus == _savedSatus)
                {
                    await SetInputStatusState(inputMuteStatus);

                    return;
                }

                switch (inputMuteStatus)
                {
                case -1:
                    return;

                case 0:
                    await SetInputStatusState();

                    break;

                case 1:
                    await SetInputStatusState(1);

                    break;
                }

                _savedSatus = inputMuteStatus;
            }
            catch (Exception)
            {
                TeamSpeak3Telnet.TS3_CLIENT?.Dispose();
                TeamSpeak3Telnet.TS3_CLIENT = null;
                await SetInputStatusState();
            }
        }
        public override async void KeyPressed(KeyPayload payload)
        {
            Logger.Instance.LogMessage(TracingLevel.INFO, "Key Pressed");

            try
            {
                if (TeamSpeak3Telnet.TS3_CLIENT == null || !TeamSpeak3Telnet.TS3_CLIENT.IsConnected)
                {
                    TeamSpeak3Telnet.SetupTelnetClient(_settings.ApiKey);
                    if (TeamSpeak3Telnet.TS3_CLIENT == null)
                    {
                        return;
                    }
                }

                ChannelSwitch();
            }
            catch (Exception)
            {
                TeamSpeak3Telnet.TS3_CLIENT?.Dispose();
                TeamSpeak3Telnet.TS3_CLIENT = null;
            }
        }