internal ClientJoinedEventArgs(CommandParameterGroupList commandParameterGroupList)
        {
            if (commandParameterGroupList == null)
                throw new ArgumentNullException("commandParameterGroupList");

            ClientId = commandParameterGroupList.GetParameterValue<uint>("clid");
            ChannelId = commandParameterGroupList.GetParameterValue<uint>("ctid");
            ClientUniqueId = commandParameterGroupList.GetParameterValue("client_unique_identifier");
            Nickname = commandParameterGroupList.GetParameterValue("client_nickname");
            IsClientInputMuted = commandParameterGroupList.GetParameterValue("client_input_muted").ToBool();
            IsClientOutputMuted = commandParameterGroupList.GetParameterValue("client_output_muted").ToBool();
            HasClientInputHardware = commandParameterGroupList.GetParameterValue("client_input_hardware").ToBool();
            HasClientOutputHardware = commandParameterGroupList.GetParameterValue("client_output_hardware").ToBool();
            MetaData = commandParameterGroupList.GetParameterValue("client_meta_data");
            IsRecording = commandParameterGroupList.GetParameterValue("client_is_recording").ToBool();
            ClientDatabaseId = commandParameterGroupList.GetParameterValue<uint>("client_database_id");
            ClientChannelGroupId = commandParameterGroupList.GetParameterValue<uint>("client_channel_group_id");
            ServerGroups = commandParameterGroupList.GetParameterValue("client_servergroups").ToIdList();
            IsClientAway = commandParameterGroupList.GetParameterValue("client_away").ToBool();
            ClientAwayMessage = commandParameterGroupList.GetParameterValue("client_away_message");
            ClientType = commandParameterGroupList.GetParameterValue<ushort>("client_type");
            Avatar = commandParameterGroupList.GetParameterValue("client_flag_avatar");
            ClientTalkPower = commandParameterGroupList.GetParameterValue<uint>("client_talk_power");
            IsTalkRequested = commandParameterGroupList.GetParameterValue("client_talk_request").ToBool();
            TalkRequestMessage = commandParameterGroupList.GetParameterValue("client_talk_request_msg");
            Description = commandParameterGroupList.GetParameterValue("client_description");
            IsClientTalker = commandParameterGroupList.GetParameterValue("client_is_talker").ToBool();
            IsPrioritySpeaker = commandParameterGroupList.GetParameterValue("client_is_priority_speaker").ToBool();
            UnreadMessages = commandParameterGroupList.GetParameterValue<uint>("client_unread_messages");
            NicknamePhonetic = commandParameterGroupList.GetParameterValue("client_nickname_phonetic");
            NeededServerQueryViewPower = commandParameterGroupList.GetParameterValue<uint>("client_needed_serverquery_view_power");
            IconId = commandParameterGroupList.GetParameterValue<uint>("client_icon_id");
        }
Beispiel #2
0
        void INotificationHandler.HandleResponse(IQueryClient queryClient, string responseText)
        {
            CommandParameterGroupList parameterGroupList = CommandParameterGroupList.Parse(responseText);

            int?reasonId = parameterGroupList.GetParameterValue <int?>("reasonid") ?? (int)ClientLeftReason.Disconnect;

            switch ((ClientLeftReason)reasonId.Value)
            {
            case ClientLeftReason.Kicked:
                Kicked?.Invoke(queryClient, new ClientKickEventArgs(parameterGroupList));
                break;

            case ClientLeftReason.Banned:
                Banned?.Invoke(queryClient, new ClientBanEventArgs(parameterGroupList));
                break;

            case ClientLeftReason.ConnectionLost:
                ConnectionLost?.Invoke(queryClient, new ClientConnectionLostEventArgs(parameterGroupList));
                break;

            case ClientLeftReason.Disconnect:
                Disconnected?.Invoke(queryClient, new ClientDisconnectEventArgs(parameterGroupList));
                break;
            }
        }
Beispiel #3
0
        private void HandleClientMove(CommandParameterGroupList parameterGroupList)
        {
            int?invokerId = parameterGroupList.GetParameterValue <int?>("invokerid");

            if (!invokerId.HasValue)
            {
                if (ClientMoved != null)
                {
                    ThreadPool.QueueUserWorkItem(x => ClientMoved(this, new ClientMovedEventArgs(parameterGroupList)), null);
                }

                return;
            }

            if (invokerId == 0)
            {
                if (ClientMovedByTemporaryChannelCreate != null)
                {
                    ThreadPool.QueueUserWorkItem(x => ClientMovedByTemporaryChannelCreate(this, new ClientMovedEventArgs(parameterGroupList)), null);
                }
            }
            else
            {
                if (ClientMoveForced != null)
                {
                    ThreadPool.QueueUserWorkItem(x => ClientMoveForced(this, new ClientMovedByClientEventArgs(parameterGroupList)), null);
                }
            }
        }
Beispiel #4
0
        protected override void FillFrom(string responseText, params object[] additionalStates)
        {
            CommandParameterGroupList list = CommandParameterGroupList.Parse(BodyText);

            if (list.Count == 0)
            {
                return;
            }

            Uptime                           = TimeSpan.FromSeconds(list.GetParameterValue <ulong>("INSTANCE_UPTIME"));
            UtcTimeStamp                     = new DateTime(1970, 1, 1).AddSeconds(list.GetParameterValue <ulong>("HOST_TIMESTAMP_UTC"));
            VirtualServersCount              = list.GetParameterValue <uint>("VIRTUALSERVERS_RUNNING_TOTAL");
            FileTransferBandwidthSent        = list.GetParameterValue <ulong>("CONNECTION_FILETRANSFER_BANDWIDTH_SENT");
            FileTransferBandwidthReceived    = list.GetParameterValue <ulong>("CONNECTION_FILETRANSFER_BANDWIDTH_RECEIVED");
            AmountOfPacketsSendTotal         = list.GetParameterValue <ulong>("CONNECTION_PACKETS_SENT_TOTAL");
            AmountOfPacketsReceivedTotal     = list.GetParameterValue <ulong>("CONNECTION_PACKETS_RECEIVED_TOTAL");
            AmountOfBytesSendTotal           = list.GetParameterValue <ulong>("CONNECTION_BYTES_SENT_TOTAL");
            AmountOfBytesReceivedTotal       = list.GetParameterValue <ulong>("CONNECTION_BYTES_RECEIVED_TOTAL");
            BandWidthSentLastSecondTotal     = list.GetParameterValue <ulong>("CONNECTION_BANDWIDTH_SENT_LAST_SECOND_TOTAL");
            BandWidthReceivedLastSecondTotal = list.GetParameterValue <ulong>("CONNECTION_BANDWIDTH_RECEIVED_LAST_SECOND_TOTAL");
            BandWidthSentLastMinuteTotal     = list.GetParameterValue <ulong>("CONNECTION_BANDWIDTH_SENT_LAST_MINUTE_TOTAL");
            BandWidthReceivedLastMinuteTotal = list.GetParameterValue <ulong>("CONNECTION_BANDWIDTH_RECEIVED_LAST_MINUTE_TOTAL");
            TotalMaxClients                  = list.GetParameterValue <uint>("virtualservers_total_maxclients");
            TotalClientsOnline               = list.GetParameterValue <uint>("virtualservers_total_clients_online");
            TotalChannelsOnline              = list.GetParameterValue <uint>("virtualservers_total_channels_online");

            FileTransferBytesSentTotal     = list.GetParameterValue <ulong>("connection_filetransfer_bytes_sent_total");
            FileTransferBytesReceivedTotal = list.GetParameterValue <ulong>("connection_filetransfer_bytes_received_total");
        }
        internal TokenUsedEventArgs(CommandParameterGroupList commandParameterGroupList)
        {
            if (commandParameterGroupList == null)
                throw new ArgumentNullException("commandParameterGroupList");

            const string PATTERN = @"ident=(?<ident>[^\s=]+)\s+(?<value>value=.*)";

            string customSettingsString = commandParameterGroupList.GetParameterValue("tokencustomset");
            Dictionary<string, string> customSettings = new Dictionary<string, string>();

            if (!customSettingsString.IsNullOrTrimmedEmpty())
            {
                foreach (string splittedSetting in customSettingsString.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    Match match = Regex.Match(splittedSetting, PATTERN, RegexOptions.Singleline | RegexOptions.IgnoreCase);

                    if (!match.Success)
                        continue;

                    customSettings[match.Groups["ident"].Value] = match.Groups["value"].Value;
                }
            }

            ClientId = commandParameterGroupList.GetParameterValue<uint>("clid");
            ClientUniqueId = commandParameterGroupList.GetParameterValue("cluid");
            ClientDatabaseId = commandParameterGroupList.GetParameterValue<uint>("cldbid");
            TokenText = commandParameterGroupList.GetParameterValue("token");
            GroupId = commandParameterGroupList.GetParameterValue<uint>("token1");
            ChannelId = commandParameterGroupList.GetParameterValue<uint>("token2");
            CustomSettings = customSettings.AsReadOnly();
        }
Beispiel #6
0
 private void HandleChannelDeleted(CommandParameterGroupList parameterGroupList)
 {
     if (ChannelDeleted != null)
     {
         ThreadPool.QueueUserWorkItem(x => ChannelDeleted(this, new ChannelDeletedEventArgs(parameterGroupList)), null);
     }
 }
Beispiel #7
0
        public ServerEditedEventArgs(CommandParameterGroupList commandParameterGroupList)
        {
            if (commandParameterGroupList == null)
            {
                throw new ArgumentNullException(nameof(commandParameterGroupList));
            }

            ReasonId        = commandParameterGroupList.GetParameterValue <uint>("reasonid");
            InvokerId       = commandParameterGroupList.GetParameterValue <uint>("invokerid");
            InvokerName     = commandParameterGroupList.GetParameterValue <string>("invokername");
            InvokerUniqueId = commandParameterGroupList.GetParameterValue <string>("invokeruid");

            Name = commandParameterGroupList.GetParameterValue <string>("virtualserver_name");
            DefaultServerGroupId  = commandParameterGroupList.GetParameterValue <uint?>("virtualserver_default_server_group");
            DefaultChannelGroupId = commandParameterGroupList.GetParameterValue <uint?>("virtualserver_default_channel_group");
            HostBannerUrl         = commandParameterGroupList.GetParameterValue <string>("virtualserver_hostbanner_url");
            HostBannerGraphicsUrl = commandParameterGroupList.GetParameterValue <string>("virtualserver_hostbanner_gfx_url");

            HostBannerGraphicsInterval      = commandParameterGroupList.GetParameterValue <uint?>("virtualserver_hostbanner_gfx_interval");
            PrioritySpeakerDimmModification = commandParameterGroupList.GetParameterValue <double?>("virtualserver_priority_speaker_dimm_modificator");
            HostButtonTooltip     = commandParameterGroupList.GetParameterValue("virtualserver_hostbutton_tooltip");
            HostButtonUrl         = commandParameterGroupList.GetParameterValue("virtualserver_hostbutton_url");
            PhoneticName          = commandParameterGroupList.GetParameterValue("virtualserver_name_phonetic");
            IconId                = commandParameterGroupList.GetParameterValue <uint?>("virtualserver_icon_id");
            HostButtonGraphicsUrl = commandParameterGroupList.GetParameterValue <string>("virtualserver_hostbutton_gfx_url");
            HostBannerMode        = (HostBannerMode?)commandParameterGroupList.GetParameterValue <uint?>("virtualserver_hostbanner_mode");
        }
        internal TokenUsedEventArgs(CommandParameterGroupList commandParameterGroupList)
        {
            if (commandParameterGroupList == null)
            {
                throw new ArgumentNullException(nameof(commandParameterGroupList));
            }

            const string PATTERN = @"ident=(?<ident>[^\s=]+)\s+(?<value>value=.*)";

            string customSettingsString = commandParameterGroupList.GetParameterValue("tokencustomset");
            Dictionary <string, string> customSettings = new Dictionary <string, string>();

            if (!customSettingsString.IsNullOrTrimmedEmpty())
            {
                foreach (string splittedSetting in customSettingsString.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    Match match = Regex.Match(splittedSetting, PATTERN, RegexOptions.Singleline | RegexOptions.IgnoreCase);

                    if (!match.Success)
                    {
                        continue;
                    }

                    customSettings[match.Groups["ident"].Value] = match.Groups["value"].Value;
                }
            }

            ClientId         = commandParameterGroupList.GetParameterValue <uint>("clid");
            ClientUniqueId   = commandParameterGroupList.GetParameterValue("cluid");
            ClientDatabaseId = commandParameterGroupList.GetParameterValue <uint>("cldbid");
            TokenText        = commandParameterGroupList.GetParameterValue("token");
            GroupId          = commandParameterGroupList.GetParameterValue <uint>("token1");
            ChannelId        = commandParameterGroupList.GetParameterValue <uint>("token2");
            CustomSettings   = customSettings.AsReadOnly();
        }
Beispiel #9
0
 private void HandleTokenUsed(CommandParameterGroupList parameterGroupList)
 {
     if (TokenUsed != null)
     {
         ThreadPool.QueueUserWorkItem(x => TokenUsed(this, new TokenUsedEventArgs(parameterGroupList)), null);
     }
 }
Beispiel #10
0
        private void HandleMessages(CommandParameterGroupList parameterGroupList)
        {
            MessageTarget messageTarget = (MessageTarget)parameterGroupList.GetParameterValue <uint>("targetmode");

            switch (messageTarget)
            {
            case MessageTarget.Client:
                if (ClientMessageReceived != null)
                {
                    ThreadPool.QueueUserWorkItem(x => ClientMessageReceived(this, new MessageReceivedEventArgs(parameterGroupList)), null);
                }
                break;

            case MessageTarget.Channel:
                if (ChannelMessageReceived != null)
                {
                    ThreadPool.QueueUserWorkItem(x => ChannelMessageReceived(this, new MessageReceivedEventArgs(parameterGroupList)), null);
                }
                break;

            case MessageTarget.Server:
                if (ServerMessageReceived != null)
                {
                    ThreadPool.QueueUserWorkItem(x => ServerMessageReceived(this, new MessageReceivedEventArgs(parameterGroupList)), null);
                }
                break;
            }
        }
        internal ClientJoinedEventArgs(CommandParameterGroupList commandParameterGroupList)
        {
            if (commandParameterGroupList == null)
            {
                throw new ArgumentNullException(nameof(commandParameterGroupList));
            }

            ClientId                = commandParameterGroupList.GetParameterValue <uint>("clid");
            ChannelId               = commandParameterGroupList.GetParameterValue <uint>("ctid");
            ClientUniqueId          = commandParameterGroupList.GetParameterValue("client_unique_identifier");
            Nickname                = commandParameterGroupList.GetParameterValue("client_nickname");
            IsClientInputMuted      = commandParameterGroupList.GetParameterValue("client_input_muted").ToBool();
            IsClientOutputMuted     = commandParameterGroupList.GetParameterValue("client_output_muted").ToBool();
            HasClientInputHardware  = commandParameterGroupList.GetParameterValue("client_input_hardware").ToBool();
            HasClientOutputHardware = commandParameterGroupList.GetParameterValue("client_output_hardware").ToBool();
            MetaData                = commandParameterGroupList.GetParameterValue("client_meta_data");
            IsRecording             = commandParameterGroupList.GetParameterValue("client_is_recording").ToBool();
            ClientDatabaseId        = commandParameterGroupList.GetParameterValue <uint>("client_database_id");
            ClientChannelGroupId    = commandParameterGroupList.GetParameterValue <uint>("client_channel_group_id");
            ServerGroups            = commandParameterGroupList.GetParameterValue("client_servergroups").ToIdList();
            IsClientAway            = commandParameterGroupList.GetParameterValue("client_away").ToBool();
            ClientAwayMessage       = commandParameterGroupList.GetParameterValue("client_away_message");
            ClientType              = commandParameterGroupList.GetParameterValue <ushort>("client_type");
            Avatar                     = commandParameterGroupList.GetParameterValue("client_flag_avatar");
            ClientTalkPower            = commandParameterGroupList.GetParameterValue <uint>("client_talk_power");
            IsTalkRequested            = commandParameterGroupList.GetParameterValue("client_talk_request").ToBool();
            TalkRequestMessage         = commandParameterGroupList.GetParameterValue("client_talk_request_msg");
            Description                = commandParameterGroupList.GetParameterValue("client_description");
            IsClientTalker             = commandParameterGroupList.GetParameterValue("client_is_talker").ToBool();
            IsPrioritySpeaker          = commandParameterGroupList.GetParameterValue("client_is_priority_speaker").ToBool();
            UnreadMessages             = commandParameterGroupList.GetParameterValue <uint>("client_unread_messages");
            NicknamePhonetic           = commandParameterGroupList.GetParameterValue("client_nickname_phonetic");
            NeededServerQueryViewPower = commandParameterGroupList.GetParameterValue <uint>("client_needed_serverquery_view_power");
            IconId                     = commandParameterGroupList.GetParameterValue <uint>("client_icon_id");
        }
Beispiel #12
0
 private void HandleUnknownNotificationReceived(CommandParameterGroupList parameterGroupList)
 {
     if (UnknownNotificationReceived != null)
     {
         ThreadPool.QueueUserWorkItem(x => UnknownNotificationReceived(this, new UnknownNotificationEventArgs(parameterGroupList.First()?.First()?.Name, parameterGroupList)), null);
     }
 }
Beispiel #13
0
        public ChannelCreatedEventArgs(CommandParameterGroupList commandParameterGroupList)
        {
            if (commandParameterGroupList == null)
            {
                throw new ArgumentNullException(nameof(commandParameterGroupList));
            }

            ChannelId                     = commandParameterGroupList.GetParameterValue <int?>("cid");
            ParentId                      = commandParameterGroupList.GetParameterValue <int?>("cpid");
            Name                          = commandParameterGroupList.GetParameterValue <string>("channel_name");
            Topic                         = commandParameterGroupList.GetParameterValue <string>("channel_topic");
            NamePhonetic                  = commandParameterGroupList.GetParameterValue <string>("channel_name_phonetic");
            Codec                         = commandParameterGroupList.GetParameterValue <int?>("channel_codec");
            CodecQuality                  = commandParameterGroupList.GetParameterValue <int?>("channel_codec_quality");
            FlagPermanent                 = commandParameterGroupList.GetParameterValue <int?>("channel_flag_permanent");
            FlagDefault                   = commandParameterGroupList.GetParameterValue <int?>("channel_flag_default");
            NeededTalkPower               = commandParameterGroupList.GetParameterValue <int?>("channel_needed_talk_power");
            Order                         = commandParameterGroupList.GetParameterValue <int?>("channel_order");
            CodecIsUnencrypted            = commandParameterGroupList.GetParameterValue <int?>("channel_codec_is_unencrypted");
            FlagMaxFamilyClientsUnlimited = commandParameterGroupList.GetParameterValue <int?>("channel_flag_maxfamilyclients_unlimited");
            FlagMaxFamilyClientsInherited = commandParameterGroupList.GetParameterValue <int?>("channel_flag_maxfamilyclients_inherited");
            InvokerId                     = commandParameterGroupList.GetParameterValue <int?>("invokerid");
            InvokerName                   = commandParameterGroupList.GetParameterValue <string>("invokername");
            InvokerUniqueId               = commandParameterGroupList.GetParameterValue <string>("invokeruid");
            DeleteDelay                   = commandParameterGroupList.GetParameterValue <int?>("channel_delete_delay");
            FlagPassword                  = commandParameterGroupList.GetParameterValue <int?>("channel_flag_password");
            FlagPermanent                 = commandParameterGroupList.GetParameterValue <int?>("channel_flag_permanent");
            FlagSemiPermanent             = commandParameterGroupList.GetParameterValue <int?>("channel_flag_semi_permanent");
            MaxClients                    = commandParameterGroupList.GetParameterValue <int?>("channel_maxclients");
            MaxFamilyClients              = commandParameterGroupList.GetParameterValue <int?>("channel_maxfamilyclients");
            FlagMaxClientsUnlimited       = commandParameterGroupList.GetParameterValue <int?>("channel_flag_maxclients_unlimited");
        }
Beispiel #14
0
        protected override void FillFrom(string responseText, params object[] additionalStates)
        {
            CommandParameterGroupList list = CommandParameterGroupList.Parse(BodyText);

            if (list.Count == 0)
            {
                return;
            }

            FileTransferBandwidthSent     = list.GetParameterValue <uint>("connection_filetransfer_bandwidth_sent");
            FileTransferBandwidthReceived = list.GetParameterValue <uint>("connection_filetransfer_bandwidth_received");
            PacketsSentTotal            = list.GetParameterValue <ulong>("connection_packets_sent_total");
            PacketsReceivedTotal        = list.GetParameterValue <ulong>("connection_bytes_sent_total");
            BytesSentTotal              = list.GetParameterValue <ulong>("connection_packets_received_total");
            BytesReceivedTotal          = list.GetParameterValue <ulong>("connection_bytes_received_total");
            BandwidthSentLastSecond     = list.GetParameterValue <uint>("connection_bandwidth_sent_last_second_total");
            BandwidthSentLastMinute     = list.GetParameterValue <uint>("connection_bandwidth_sent_last_minute_total");
            BandwidthReceivedLastSecond = list.GetParameterValue <uint>("connection_bandwidth_received_last_second_total");
            BandwidthReceivedLastMinute = list.GetParameterValue <uint>("connection_bandwidth_received_last_minute_total");
            ConnectionDuration          = TimeSpan.FromMilliseconds(list.GetParameterValue <uint>("connection_connected_time"));

            FileTransferBytesSentTotal     = list.GetParameterValue <ulong>("connection_filetransfer_bytes_sent_total");
            FileTransferBytesReceivedTotal = list.GetParameterValue <ulong>("connection_filetransfer_bytes_received_total");
            PacketLossTotal = list.GetParameterValue <double>("connection_packetloss_total");
            Ping            = list.GetParameterValue <double>("connection_ping");
        }
        protected override void FillFrom(string responseText, params object[] additionalStates)
        {
            CommandParameterGroupList list = CommandParameterGroupList.Parse(BodyText);

            if (list.Count == 0)
            {
                return;
            }

            ParentChannelId             = list.GetParameterValue <uint>("pid");
            Name                        = list.GetParameterValue("channel_name");
            Topic                       = list.GetParameterValue("channel_topic");
            Description                 = list.GetParameterValue("channel_description");
            PasswordHash                = list.GetParameterValue("channel_password");
            Codec                       = list.GetParameterValue <ushort>("channel_codec");
            CodecQuality                = list.GetParameterValue <double>("channel_codec_quality");
            MaxClients                  = list.GetParameterValue <int>("channel_maxclients");
            MaxFamilyClients            = list.GetParameterValue <int>("channel_maxfamilyclients");
            Order                       = list.GetParameterValue <uint>("channel_order");
            IsDefaultChannel            = list.GetParameterValue("channel_flag_default").ToBool();
            IsPasswordProtected         = list.GetParameterValue("channel_flag_password").ToBool();
            IsPermanent                 = list.GetParameterValue("channel_flag_permanent").ToBool();
            IsSemiPermanent             = list.GetParameterValue("channel_flag_semi_permanent").ToBool();
            IsMaxClientsUnlimited       = list.GetParameterValue("channel_flag_maxclients_unlimited").ToBool();
            IsMaxFamilyClientsUnlimited = list.GetParameterValue("channel_flag_maxfamilyclients_unlimited").ToBool();
            IsMaxFamilyClientsInherited = list.GetParameterValue("channel_flag_maxfamilyclients_inherited").ToBool();
            FilePath                    = list.GetParameterValue("channel_filepath");
            NeededTalkPower             = list.GetParameterValue <uint>("channel_needed_talk_power");
            ForcedSilence               = list.GetParameterValue("channel_forced_silence").ToBool();
            PhoneticName                = list.GetParameterValue("channel_name_phonetic");
            IconId                      = list.GetParameterValue <uint>("channel_icon_id");
        }
Beispiel #16
0
 private void HandleServerEdited(CommandParameterGroupList parameterGroupList)
 {
     if (ServerEdited != null)
     {
         ThreadPool.QueueUserWorkItem(x => ServerEdited(this, new ServerEditedEventArgs(parameterGroupList)), null);
     }
 }
Beispiel #17
0
 private void HandleClientJoin(CommandParameterGroupList parameterGroupList)
 {
     if (ClientJoined != null)
     {
         ThreadPool.QueueUserWorkItem(x => ClientJoined(this, new ClientJoinedEventArgs(parameterGroupList)), null);
     }
 }
        internal ClientMovedEventArgs(CommandParameterGroupList commandParameterGroupList)
        {
            if (commandParameterGroupList == null)
                throw new ArgumentNullException("commandParameterGroupList");

            ClientId = commandParameterGroupList.GetParameterValue<uint>("clid");
            TargetChannelId = commandParameterGroupList.GetParameterValue<uint>("ctid");
        }
Beispiel #19
0
        protected override void FillFrom(string responseText, params object[] additionalStates)
        {
            base.FillFrom(responseText, additionalStates);

            CommandParameterGroupList list = CommandParameterGroupList.Parse(BodyText);

            LastIP = list.GetParameterValue("client_lastip");
        }
Beispiel #20
0
        public ChannelDescriptionChangedEventArgs(CommandParameterGroupList commandParameterGroupList)
        {
            if (commandParameterGroupList == null)
            {
                throw new ArgumentNullException(nameof(commandParameterGroupList));
            }

            ChannelId = commandParameterGroupList.GetParameterValue <uint>("cid");
        }
Beispiel #21
0
        protected override void FillFrom(string responseText, params object[] additionalStates)
        {
            base.FillFrom(responseText, additionalStates);

            CommandParameterGroupList list = CommandParameterGroupList.Parse(BodyText);

            if (list.Count == 0)
            {
                return;
            }

            Version           = list.GetParameterValue("client_version");
            Platform          = list.GetParameterValue("client_platform");
            InputMuted        = list.GetParameterValue("client_input_muted").ToBool();
            OutputMuted       = list.GetParameterValue("client_output_muted").ToBool();
            OuputOnlyMuted    = list.GetParameterValue("client_outputonly_muted").ToBool();
            HasInputHardware  = list.GetParameterValue("client_input_hardware").ToBool();
            HasOutputHardware = list.GetParameterValue("client_output_hardware").ToBool();
            IsRecording       = list.GetParameterValue("client_is_recording").ToBool();
            IsAway            = list.GetParameterValue("client_away").ToBool();
            IsTalker          = list.GetParameterValue("client_is_talker").ToBool();
            IsPrioritySpeaker = list.GetParameterValue("client_is_priority_speaker").ToBool();
            AwayMessage       = list.GetParameterValue("client_away_message");

            DefaultChannel     = list.GetParameterValue("client_default_channel");
            MetaData           = list.GetParameterValue("client_meta_data");
            LoginName          = list.GetParameterValue("client_login_name");
            TalkRequestMessage = list.GetParameterValue("client_talk_request_msg");
            NicknamePhonetic   = list.GetParameterValue("client_nickname_phonetic");

            FileTransferBandwidthSent        = list.GetParameterValue <ulong>("CONNECTION_FILETRANSFER_BANDWIDTH_SENT");
            FileTransferBandwidthReceived    = list.GetParameterValue <ulong>("CONNECTION_FILETRANSFER_BANDWIDTH_RECEIVED");
            AmountOfPacketsSendTotal         = list.GetParameterValue <ulong>("CONNECTION_PACKETS_SENT_TOTAL");
            AmountOfPacketsReceivedTotal     = list.GetParameterValue <ulong>("CONNECTION_PACKETS_RECEIVED_TOTAL");
            AmountOfBytesSendTotal           = list.GetParameterValue <ulong>("CONNECTION_BYTES_SENT_TOTAL");
            AmountOfBytesReceivedTotal       = list.GetParameterValue <ulong>("CONNECTION_BYTES_RECEIVED_TOTAL");
            BandWidthSentLastSecondTotal     = list.GetParameterValue <ulong>("CONNECTION_BANDWIDTH_SENT_LAST_SECOND_TOTAL");
            BandWidthReceivedLastSecondTotal = list.GetParameterValue <ulong>("CONNECTION_BANDWIDTH_RECEIVED_LAST_SECOND_TOTAL");
            BandWidthSentLastMinuteTotal     = list.GetParameterValue <ulong>("CONNECTION_BANDWIDTH_SENT_LAST_MINUTE_TOTAL");
            BandWidthReceivedLastMinuteTotal = list.GetParameterValue <ulong>("CONNECTION_BANDWIDTH_RECEIVED_LAST_MINUTE_TOTAL");

            DatabaseId     = list.GetParameterValue <uint>("client_database_id");
            ChannelId      = list.GetParameterValue <uint>("cid");
            ChannelGroupId = list.GetParameterValue <uint>("client_channel_group_id");

            ServerGroups = list.GetParameterValue("client_servergroups").ToIdList();
            Type         = list.GetParameterValue <uint>("client_type");
            TalkPower    = list.GetParameterValue <uint>("client_talk_power");
            TalkRequests = list.GetParameterValue <uint>("client_talk_request");
            NeededServerQueryViewPower = list.GetParameterValue <uint>("client_needed_serverquery_view_power");

            Avatar        = list.GetParameterValue("client_flag_avatar");
            IdleTime      = TimeSpan.FromMilliseconds(list.GetParameterValue <uint>("client_idle_time"));
            ConnectedTime = TimeSpan.FromMilliseconds(list.GetParameterValue <uint>("connection_connected_time"));
            ClientIP      = list.GetParameterValue("connection_client_ip");
            ClientCountry = list.GetParameterValue("client_country");
        }
        internal MessageReceivedEventArgs(CommandParameterGroupList commandParameterGroupList)
        {
            if (commandParameterGroupList == null)
                throw new ArgumentNullException("commandParameterGroupList");

            Message = commandParameterGroupList.GetParameterValue("msg");
            InvokerClientId = commandParameterGroupList.GetParameterValue<uint>("invokerid");
            InvokerUniqueId = commandParameterGroupList.GetParameterValue("invokeruid");
            InvokerNickname = commandParameterGroupList.GetParameterValue("invokername");
        }
        internal ClientDisconnectEventArgs(CommandParameterGroupList commandParameterGroupList)
        {
            if (commandParameterGroupList == null)
                throw new ArgumentNullException("commandParameterGroupList");

            SourceChannelId = commandParameterGroupList.GetParameterValue<uint>("cfid");
            TargetChannelId = commandParameterGroupList.GetParameterValue<uint>("ctid");
            ClientId = commandParameterGroupList.GetParameterValue<uint>("clid");
            LeaveMessage = commandParameterGroupList.GetParameterValue("reasonmsg");
        }
        public ClientMovedEventArgs(CommandParameterGroupList commandParameterGroupList)
        {
            if (commandParameterGroupList == null)
            {
                throw new ArgumentNullException("commandParameterGroupList");
            }

            ClientId        = commandParameterGroupList.GetParameterValue <uint>("clid");
            TargetChannelId = commandParameterGroupList.GetParameterValue <uint>("ctid");
        }
Beispiel #25
0
        private void HandleTalkStatusChange(CommandParameterGroupList parameterGroupList)
        {
            TalkStatusEventArgs eventArgs = new TalkStatusEventArgs(parameterGroupList);

            OnTalkStatusChanged(eventArgs);

            if (eventArgs.IsWisper)
                OnWisperTalkStatusChanged(eventArgs);
            else
                OnChannelTalkStatusChanged(eventArgs);
        }
Beispiel #26
0
        public ChannelDeletedEventArgs(CommandParameterGroupList commandParameterGroupList)
        {
            if (commandParameterGroupList == null)
            {
                throw new ArgumentNullException(nameof(commandParameterGroupList));
            }

            ChannelId   = commandParameterGroupList.GetParameterValue <int?>("cid");
            InvokerId   = commandParameterGroupList.GetParameterValue <int?>("invokerid");
            InvokerName = commandParameterGroupList.GetParameterValue <string>("invokername");
        }
        protected override void FillFrom(string responseText, params object[] additionalStates)
        {
            CommandParameterGroupList list = CommandParameterGroupList.Parse(BodyText);

            if (list.Count == 0)
                return;

            ClientUniqueId = list.GetParameterValue("cluid");
            NickName = list.GetParameterValue("name");
            ClientId = list.GetParameterValue<uint>("clid");
        }
        public MessageReceivedEventArgs(CommandParameterGroupList commandParameterGroupList)
        {
            if (commandParameterGroupList == null)
            {
                throw new ArgumentNullException("commandParameterGroupList");
            }

            Message         = commandParameterGroupList.GetParameterValue("msg");
            InvokerClientId = commandParameterGroupList.GetParameterValue <uint>("invokerid");
            InvokerUniqueId = commandParameterGroupList.GetParameterValue("invokeruid");
            InvokerNickname = commandParameterGroupList.GetParameterValue("invokername");
        }
Beispiel #29
0
        public Command(string commandName, params string[] options)
        {
            if (commandName.IsNullOrTrimmedEmpty())
            {
                throw new ArgumentException("commandName is null or emtpy", nameof(commandName));
            }

            Name            = commandName;
            ParameterGroups = new CommandParameterGroupList();
            Options         = new List <string>();
            options.ForEach(AddOption);
        }
Beispiel #30
0
        protected override void FillFrom(string responseText, params object[] additionalStates)
        {
            CommandParameterGroupList list = CommandParameterGroupList.Parse(BodyText);

            if (list.Count == 0)
            {
                return;
            }

            ClientId  = list.GetParameterValue <uint>("clid");
            ChannelId = list.GetParameterValue <uint>("cid");
        }
Beispiel #31
0
        protected override void FillFrom(string responseText, params object[] additionalStates)
        {
            CommandParameterGroupList list = CommandParameterGroupList.Parse(BodyText);

            if (list.Count == 0)
            {
                return;
            }

            Path     = list.GetParameterValue("path");
            Password = list.GetParameterValue("password");
        }
Beispiel #32
0
        protected override void FillFrom(string responseText, params object[] additionalStates)
        {
            CommandParameterGroupList list = CommandParameterGroupList.Parse(BodyText);

            if (list.Count == 0 || additionalStates == null || additionalStates.Length == 0)
            {
                Value = default(T);
                return;
            }

            Value = list.GetParameterValue(additionalStates[0].ToString()).ChangeTypeInvariant(default(T));
        }
        internal ClientConnectionLostEventArgs(CommandParameterGroupList commandParameterGroupList)
        {
            if (commandParameterGroupList == null)
            {
                throw new ArgumentNullException(nameof(commandParameterGroupList));
            }

            SourceChannelId = commandParameterGroupList.GetParameterValue <uint>("cfid");
            TargetChannelId = commandParameterGroupList.GetParameterValue <uint>("ctid");
            ClientId        = commandParameterGroupList.GetParameterValue <uint>("clid");
            ReasonMessage   = commandParameterGroupList.GetParameterValue("reasonmsg");
        }
Beispiel #34
0
        protected override void FillFrom(string responseText, params object[] additionalStates)
        {
            CommandParameterGroupList list = CommandParameterGroupList.Parse(BodyText);

            if (list.Count == 0)
            {
                return;
            }

            PermissionId    = list.GetParameterValue <uint>("permid");
            PermissionName  = list.GetParameterValue("permsid");
            PermissionValue = list.GetParameterValue <int>("permvalue");
        }
        protected override void FillFrom(string responseText, params object[] additionalStates)
        {
            CommandParameterGroupList list = CommandParameterGroupList.Parse(BodyText);

            if (list.Count == 0)
            {
                return;
            }

            Version  = list.GetParameterValue("version");
            Build    = list.GetParameterValue("build");
            Platform = list.GetParameterValue("platform");
        }
        protected override void FillFrom(string responseText, params object[] additionalStates)
        {
            CommandParameterGroupList list = CommandParameterGroupList.Parse(BodyText);

            if (list.Count == 0)
            {
                return;
            }

            ServerId   = list.GetParameterValue <uint>("sid");
            ServerPort = list.GetParameterValue <ushort>("virtualserver_port");
            Token      = list.GetParameterValue("token");
        }
        internal ClientKickEventArgs(CommandParameterGroupList commandParameterGroupList)
        {
            if (commandParameterGroupList == null)
                throw new ArgumentNullException("commandParameterGroupList");

            SourceChannelId = commandParameterGroupList.GetParameterValue<uint>("cfid");
            TargetChannelId = commandParameterGroupList.GetParameterValue<uint>("ctid");
            InvokerClientId = commandParameterGroupList.GetParameterValue<uint>("invokerid");
            VictimClientId = commandParameterGroupList.GetParameterValue<uint>("clid");

            KickReason = commandParameterGroupList.GetParameterValue("reasonmsg");
            InvokerUniqueId = commandParameterGroupList.GetParameterValue("invokeruid");
            InvokerNickname = commandParameterGroupList.GetParameterValue("invokername");
        }
Beispiel #38
0
        public Command(string commandName, params string[] options)
        {
            if (commandName.IsNullOrTrimmedEmpty())
                throw new ArgumentException("commandName is null or emtpy", "commandName");

            Name = commandName;
            ParameterGroups = new CommandParameterGroupList();
            Options = new List<string>();

            if (options != null && options.Length > 0)
            {
                foreach (string option in options)
                {
                    AddOption(option);
                }
            }
        }
        internal ClientBanEventArgs(CommandParameterGroupList commandParameterGroupList)
        {
            if (commandParameterGroupList == null)
                throw new ArgumentNullException("commandParameterGroupList");

            SourceChannelId = commandParameterGroupList.GetParameterValue<uint>("cfid");
            TargetChannelId = commandParameterGroupList.GetParameterValue<uint>("ctid");
            InvokerClientId = commandParameterGroupList.GetParameterValue<uint>("invokerid");
            VictimClientId = commandParameterGroupList.GetParameterValue<uint>("clid");

            BanReason = commandParameterGroupList.GetParameterValue("reasonmsg");
            InvokerUniqueId = commandParameterGroupList.GetParameterValue("invokeruid");
            InvokerNickname = commandParameterGroupList.GetParameterValue("invokername");
            uint banTimeInSeconds = commandParameterGroupList.GetParameterValue<uint>("bantime");

            BanDuration = banTimeInSeconds == 0 ? null : (TimeSpan?) TimeSpan.FromSeconds(banTimeInSeconds);
        }
 internal ClientMovedByClientEventArgs(CommandParameterGroupList commandParameterGroupList) : base(commandParameterGroupList)
 {
     InvokerClientId = commandParameterGroupList.GetParameterValue<uint>("invokerid");
     InvokerNickname = commandParameterGroupList.GetParameterValue("invokername");
     InvokerUniqueId = commandParameterGroupList.GetParameterValue("invokeruid");
 }
 protected TalkStatusEventArgsBase(CommandParameterGroupList commandParameterGroupList)
 {
     ServerConnectionHandlerId = commandParameterGroupList.GetParameterValue<uint>("schandlerid");
     TalkStatus = (TalkStatus) commandParameterGroupList.GetParameterValue<byte>("status");
     ClientId = commandParameterGroupList.GetParameterValue<uint>("clid");
 }
        private void HandleMessages(CommandParameterGroupList parameterGroupList)
        {
            MessageTarget messageTarget = (MessageTarget)parameterGroupList.GetParameterValue<uint>("targetmode");

            switch (messageTarget)
            {
                case MessageTarget.Client:
                    if (ClientMessageReceived != null)
                        ThreadPool.QueueUserWorkItem(x => ClientMessageReceived(this, new MessageReceivedEventArgs(parameterGroupList)), null);
                    break;
                case MessageTarget.Channel:
                    if (ChannelMessageReceived != null)
                        ThreadPool.QueueUserWorkItem(x => ChannelMessageReceived(this, new MessageReceivedEventArgs(parameterGroupList)), null);
                    break;
                case MessageTarget.Server:
                    if (ServerMessageReceived != null)
                        ThreadPool.QueueUserWorkItem(x => ServerMessageReceived(this, new MessageReceivedEventArgs(parameterGroupList)), null);
                    break;
            }
        }
Beispiel #43
0
 private void HandleTextMessage(CommandParameterGroupList parameterGroupList)
 {
     TS3QueryLib.Core.Server.Notification.EventArgs.MessageReceivedEventArgs eventArgs = new TS3QueryLib.Core.Server.Notification.EventArgs.MessageReceivedEventArgs(parameterGroupList);
     OnTextMessage(eventArgs);
 }
        private void HandleClientMove(CommandParameterGroupList parameterGroupList)
        {
            int? invokerId = parameterGroupList.GetParameterValue<int?>("invokerid");

            if (!invokerId.HasValue)
            {
                if (ClientMoved != null)
                    ThreadPool.QueueUserWorkItem(x => ClientMoved(this, new ClientMovedEventArgs(parameterGroupList)), null);

                return;
            }

            if (invokerId == 0)
            {
                if (ClientMovedByTemporaryChannelCreate != null)
                    ThreadPool.QueueUserWorkItem(x => ClientMovedByTemporaryChannelCreate(this, new ClientMovedEventArgs(parameterGroupList)), null);
            }
            else
            {
                if (ClientMoveForced != null)
                    ThreadPool.QueueUserWorkItem(x => ClientMoveForced(this, new ClientMovedByClientEventArgs(parameterGroupList)), null);
            }
        }
Beispiel #45
0
        private void HandleClientMoved(CommandParameterGroupList parameterGroupList)
        {
            TS3QueryLib.Core.Server.Notification.EventArgs.ClientMovedEventArgs eventArgs = new TS3QueryLib.Core.Server.Notification.EventArgs.ClientMovedEventArgs(parameterGroupList);

            OnClientMoved(eventArgs);
        }
        private void HandleClientLeave(CommandParameterGroupList parameterGroupList)
        {
            int? reasonId = parameterGroupList.GetParameterValue<int?>("reasonid");

            if (!reasonId.HasValue)
            {
                // do something here later ;)
                return;
            }

            switch ((ClientLeftReason) reasonId.Value)
            {
                case ClientLeftReason.Kicked:
                    if (ClientKick != null)
                        ThreadPool.QueueUserWorkItem(x => ClientKick(this, new ClientKickEventArgs(parameterGroupList)), null);
                    break;
                case ClientLeftReason.Banned:
                    if (ClientBan != null)
                        ThreadPool.QueueUserWorkItem(x => ClientBan(this, new ClientBanEventArgs(parameterGroupList)), null);
                    break;
                case ClientLeftReason.ConnectionLost:
                    if (ClientConnectionLost != null)
                        ThreadPool.QueueUserWorkItem(x => ClientConnectionLost(this, new ClientConnectionLostEventArgs(parameterGroupList)), null);
                    break;
                case ClientLeftReason.Disconnect:
                    if (ClientDisconnect != null)
                        ThreadPool.QueueUserWorkItem(x => ClientDisconnect(this, new ClientDisconnectEventArgs(parameterGroupList)), null);
                    break;
            }
        }
 private void HandleTokenUsed(CommandParameterGroupList parameterGroupList)
 {
     if (TokenUsed != null)
         ThreadPool.QueueUserWorkItem(x => TokenUsed(this, new TokenUsedEventArgs(parameterGroupList)), null);
 }
 private void HandleClientJoin(CommandParameterGroupList parameterGroupList)
 {
     if (ClientJoined != null)
         ThreadPool.QueueUserWorkItem(x => ClientJoined(this, new ClientJoinedEventArgs(parameterGroupList)), null);
 }