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

            ClientId = commandParameterGroupList.GetParameterValue<uint>("clid");
            TargetChannelId = commandParameterGroupList.GetParameterValue<uint>("ctid");
        }
        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");
        }
        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");
        }
        public ClientMovedEventArgs(CommandParameterGroupList commandParameterGroupList)
        {
            if (commandParameterGroupList == null)
            {
                throw new ArgumentNullException("commandParameterGroupList");
            }

            ClientId        = commandParameterGroupList.GetParameterValue <uint>("clid");
            TargetChannelId = commandParameterGroupList.GetParameterValue <uint>("ctid");
        }
示例#5
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");
        }
示例#7
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");
        }
        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");
        }
        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");
        }
示例#10
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");
        }
示例#11
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;
            }

            ServerId   = list.GetParameterValue <uint>("sid");
            ServerPort = list.GetParameterValue <ushort>("virtualserver_port");
            Token      = list.GetParameterValue("token");
        }
        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");
        }
        public ChannelDeletedEventArgs(CommandParameterGroupList commandParameterGroupList)
        {
            if (commandParameterGroupList == null)
            {
                throw new ArgumentNullException(nameof(commandParameterGroupList));
            }

            List <int> channelIds = commandParameterGroupList.Select(pg => pg.GetParameterValue <int>("cid")).ToList();

            ChannelId        = channelIds.Count > 0 ? (int?)channelIds.Last() : null;
            InvokerId        = commandParameterGroupList.GetParameterValue <int?>("invokerid");
            InvokerName      = commandParameterGroupList.GetParameterValue <string>("invokername");
            SubChannelIdList = channelIds.GetRange(0, Math.Max(0, channelIds.Count - 1));
        }
示例#15
0
        private void DetermineErrorDetails(string statusLine)
        {
            CommandParameterGroupList list = CommandParameterGroupList.Parse(statusLine);

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

            ErrorId            = list.GetParameterValue <uint>("id");
            ErrorMessage       = list.GetParameterValue("msg");
            BanExtraMessage    = list.GetParameterValue("extra_msg");
            FailedPermissionId = list.GetParameterValue <uint?>("failed_permid");
            IsBanned           = ErrorId == 3329 || ErrorId == 3331;
        }
        protected override void FillFrom(string responseText, params object[] additionalStates)
        {
            CommandParameterGroupList list = CommandParameterGroupList.Parse(BodyText);

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

            MessageId      = list.GetParameterValue <uint>("msgid");
            SenderUniqueId = list.GetParameterValue("cluid");
            Subject        = list.GetParameterValue("subject");
            Created        = new DateTime(1970, 1, 1).AddSeconds(list.GetParameterValue <ulong>("timestamp"));
            WasRead        = list.GetParameterValue("flag_read").ToBool();
        }
        protected override void FillFrom(string responseText, params object[] additionalStates)
        {
            CommandParameterGroupList list = CommandParameterGroupList.Parse(BodyText);

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

            ClientFileTransferId = list.GetParameterValue <uint?>("clientftfid");
            ServerFileTransferId = list.GetParameterValue <uint?>("serverftfid");
            FileTransferKey      = list.GetParameterValue("ftkey");
            FileTransferPort     = list.GetParameterValue <ushort?>("port");
            FileSize             = list.GetParameterValue <ulong?>("size");
        }
示例#18
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);
                }
            }
        }
示例#19
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;
            }
        }
示例#20
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;
            }
        }
示例#21
0
        protected override void FillFrom(string responseText, params object[] additionalStates)
        {
            base.FillFrom(responseText, additionalStates);

            CommandParameterGroupList list = CommandParameterGroupList.Parse(BodyText);

            LastIP = list.GetParameterValue("client_lastip");
        }
        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();
        }
        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();
        }
示例#24
0
        public ChannelDescriptionChangedEventArgs(CommandParameterGroupList commandParameterGroupList)
        {
            if (commandParameterGroupList == null)
            {
                throw new ArgumentNullException(nameof(commandParameterGroupList));
            }

            ChannelId = commandParameterGroupList.GetParameterValue <uint>("cid");
        }
示例#25
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 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);
        }
示例#27
0
        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");
        }
        public ChannelMovedEventArgs(CommandParameterGroupList commandParameterGroupList)
        {
            if (commandParameterGroupList == null)
            {
                throw new ArgumentNullException(nameof(commandParameterGroupList));
            }

            ChannelId       = commandParameterGroupList.GetParameterValue <uint>("cid");
            ParentChannelId = commandParameterGroupList.GetParameterValue <uint>("cpid");
            Order           = commandParameterGroupList.GetParameterValue <uint>("order");
            ReasonId        = commandParameterGroupList.GetParameterValue <uint>("reasonid");
            InvokerId       = commandParameterGroupList.GetParameterValue <uint>("invokerid");
            InvokerName     = commandParameterGroupList.GetParameterValue <string>("invokername");
            InvokerUniqueId = commandParameterGroupList.GetParameterValue <string>("invokeruid");
        }
        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);
        }
示例#30
0
        internal ClientKickEventArgs(CommandParameterGroupList commandParameterGroupList)
        {
            if (commandParameterGroupList == null)
            {
                throw new ArgumentNullException(nameof(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");
        }
示例#31
0
        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;
            }
        }
示例#32
0
        void INotificationHandler.HandleResponse(IQueryClient queryClient, string responseText)
        {
            CommandParameterGroupList parameterGroupList = CommandParameterGroupList.Parse(responseText);

            int?invokerId = parameterGroupList.GetParameterValue <int?>("invokerid");

            if (!invokerId.HasValue)
            {
                JoiningChannel?.Invoke(queryClient, new ClientMovedEventArgs(parameterGroupList));
                return;
            }

            if (invokerId == 0)
            {
                CreatingTemporaryChannel?.Invoke(queryClient, new ClientMovedEventArgs(parameterGroupList));
            }
            else
            {
                JoiningChannelForced?.Invoke(queryClient, new ClientMovedByClientEventArgs(parameterGroupList));
            }
        }
        void INotificationHandler.HandleResponse(IQueryClient queryClient, string responseText)
        {
            CommandParameterGroupList parameterGroupList = CommandParameterGroupList.Parse(responseText);

            MessageTarget messageTarget = (MessageTarget)parameterGroupList.GetParameterValue <uint>("targetmode");

            switch (messageTarget)
            {
            case MessageTarget.Client:
                ReceivedFromClient?.Invoke(queryClient, new MessageReceivedEventArgs(parameterGroupList));
                break;

            case MessageTarget.Channel:
                ReceivedFromChannel?.Invoke(queryClient, new MessageReceivedEventArgs(parameterGroupList));
                break;

            case MessageTarget.Server:
                ReceivedFromServer?.Invoke(queryClient, new MessageReceivedEventArgs(parameterGroupList));
                break;
            }
        }
示例#34
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;
            }
        }
        protected override void FillFrom(string responseText, params object[] additionalStates)
        {
            CommandParameterGroupList list = CommandParameterGroupList.Parse(BodyText);

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

            UniqueId             = list.GetParameterValue("client_unique_identifier");
            Nickname             = list.GetParameterValue("client_nickname");
            DatabaseId           = list.GetParameterValue <uint>("client_database_id");
            Created              = new DateTime(1970, 1, 1).AddSeconds(list.GetParameterValue <ulong>("client_created"));
            LastConnected        = new DateTime(1970, 1, 1).AddSeconds(list.GetParameterValue <ulong>("client_lastconnected"));
            TotalConnections     = list.GetParameterValue <uint>("client_totalconnections");
            Description          = list.GetParameterValue("client_description");
            MonthBytesUploaded   = list.GetParameterValue <ulong>("client_month_bytes_uploaded");
            MonthBytesDonwloaded = list.GetParameterValue <ulong>("client_month_bytes_downloaded");
            TotalBytesUploaded   = list.GetParameterValue <ulong>("client_total_bytes_uploaded");
            TotalBytesDownloaded = list.GetParameterValue <ulong>("client_total_bytes_downloaded");
            IconId         = list.GetParameterValue <uint?>("client_icon_id");
            HashedUniqueId = list.GetParameterValue("client_base64HashClientUID");
        }
 internal ClientMovedByClientEventArgs(CommandParameterGroupList commandParameterGroupList) : base(commandParameterGroupList)
 {
     InvokerClientId = commandParameterGroupList.GetParameterValue<uint>("invokerid");
     InvokerNickname = commandParameterGroupList.GetParameterValue("invokername");
     InvokerUniqueId = commandParameterGroupList.GetParameterValue("invokeruid");
 }
        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");
        }
 protected TalkStatusEventArgsBase(CommandParameterGroupList commandParameterGroupList)
 {
     ServerConnectionHandlerId = commandParameterGroupList.GetParameterValue <uint>("schandlerid");
     TalkStatus = (TalkStatus)commandParameterGroupList.GetParameterValue <byte>("status");
     ClientId   = commandParameterGroupList.GetParameterValue <uint>("clid");
 }
示例#39
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");
        }
 protected TalkStatusEventArgsBase(CommandParameterGroupList commandParameterGroupList)
 {
     ServerConnectionHandlerId = commandParameterGroupList.GetParameterValue<uint>("schandlerid");
     TalkStatus = (TalkStatus) commandParameterGroupList.GetParameterValue<byte>("status");
     ClientId = commandParameterGroupList.GetParameterValue<uint>("clid");
 }
示例#41
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);
            }
        }
示例#42
0
        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;
            }
        }