Example #1
0
    public void Broadcast(string groupID, int broadcastType, byte[] broadcastContent, string tag, ActionTypeOnChannelIsBusy action)
    {
        BroadcastContract body       = new BroadcastContract(groupID, broadcastType, broadcastContent, tag, action);
        IMessageHandler   interface2 = this.interface9_0.imethod_4 <BroadcastContract>(this.string_0, this.contactsMessageTypeRoom_0.BroadcastByServer, body, groupID);

        this.interface31_0.imethod_0(interface2, true, action);
    }
    public void Broadcast(string groupID, int broadcastType, byte[] broadcastContent, string tag, ActionTypeOnChannelIsBusy action)
    {
        List <string> groupMemberList = this.icontactsManager_0.GetGroupMemberList(groupID);

        if ((groupMemberList != null) && (groupMemberList.Count > 0))
        {
            BroadcastContract body       = new BroadcastContract(groupID, broadcastType, broadcastContent, tag, action);
            IMessageHandler   interface2 = this.interface9_0.imethod_5 <BroadcastContract>("_0", this.object_0.BroadcastByServer, body);
            this.interface40_0.PostMessage(interface2, groupMemberList, action);
        }
    }
Example #3
0
        public void Broadcast(string groupID, int broadcastType, byte[] broadcastContent, ActionTypeOnChannelIsBusy action, BroadcastChannelMode broadcastChannelMode)
        {
            if (broadcastChannelMode == BroadcastChannelMode.AllTransferByServer)
            {
                this.BroadcastByServer(groupID, broadcastType, broadcastContent, action);
                return;
            }

            if (broadcastChannelMode == BroadcastChannelMode.AllByP2PChannel)
            {
                this.BroadcastByP2PChannel(groupID, broadcastType, broadcastContent, action);
                return;
            }

            BroadcastContract contract = new BroadcastContract(this.currentUserID, groupID, broadcastType, broadcastContent, action);

            byte[] info = CompactPropertySerializer.Default.Serialize(contract);
            SortedArray <string> passiveGroupmates = this.SafeGetGroupMembers(groupID);

            if (passiveGroupmates == null)
            {
                return;
            }
            bool allP2P = true;

            foreach (string memberID in passiveGroupmates.GetAll())
            {
                if (memberID == this.currentUserID)
                {
                    continue;
                }

                if (this.rapidPassiveEngine.P2PController.IsP2PChannelExist(memberID))
                {
                    this.rapidPassiveEngine.CustomizeOutter.SendByP2PChannel(memberID, this.groupInfoTypes.Broadcast, info, ActionTypeOnNoP2PChannel.Discard, true, action);
                }
                else
                {
                    allP2P = false;
                }
            }

            if (!allP2P) //如果有一个在线用户没有P2P,则经过服务器中转。
            {
                this.rapidPassiveEngine.CustomizeOutter.Send(null, this.groupInfoTypes.Broadcast, info, true, action);
            }
        }
Example #4
0
        private void BroadcastByP2PChannel(string groupID, int broadcastType, byte[] broadcastContent, ActionTypeOnChannelIsBusy action)
        {
            BroadcastContract contract = new BroadcastContract(this.currentUserID, groupID, broadcastType, broadcastContent, action);

            byte[] info = CompactPropertySerializer.Default.Serialize(contract);
            SortedArray <string> ary = this.SafeGetGroupMembers(groupID);

            foreach (string memberID in ary.GetAll())
            {
                if (memberID == this.currentUserID)
                {
                    continue;
                }

                if (this.rapidPassiveEngine.P2PController.IsP2PChannelExist(memberID))
                {
                    this.rapidPassiveEngine.CustomizeOutter.SendByP2PChannel(memberID, this.groupInfoTypes.Broadcast, info, ActionTypeOnNoP2PChannel.Discard, true, action);
                }
            }
        }
Example #5
0
    public IMessageHandler ProcessMessage(IMessageHandler interface37_0)
    {
        string       str;
        UserContract contract2;

        if (interface37_0.Header.MessageType == this.object_0.ContactsConnectedNotify)
        {
            contract2 = this.interface9_0.imethod_1 <UserContract>(interface37_0);
            this.ContactsOutter_0.OnContactsConnected(contract2.UserID);
            return(null);
        }
        if (interface37_0.Header.MessageType == this.object_0.ContactsOfflineNotify)
        {
            contract2 = this.interface9_0.imethod_1 <UserContract>(interface37_0);
            this.ContactsOutter_0.OnContactsOffline(contract2.UserID);
            return(null);
        }
        if (interface37_0.Header.MessageType == this.object_0.BroadcastByServer)
        {
            BroadcastContract contract = this.interface9_0.imethod_1 <BroadcastContract>(interface37_0);
            str = (interface37_0.Header.UserID == "_0") ? null : interface37_0.Header.UserID;
            this.ContactsOutter_0.OnBroadcastReceived(str, contract.GroupID, contract.InformationType, contract.Content, contract.Tag);
            return(null);
        }
        if (interface37_0.Header.MessageType == this.object_0.BroadcastBlob)
        {
            str = NetServer.IsServerUser(interface37_0.Header.UserID) ? null : interface37_0.Header.UserID;
            string destUserID = interface37_0.Header.DestUserID;
            BlobFragmentContract contract4   = this.interface9_0.imethod_1 <BlobFragmentContract>(interface37_0);
            Information          information = this.class76_0.method_1(interface37_0.Header.UserID, interface37_0.Header.DestUserID, contract4);
            if (information != null)
            {
                BlobAndTagContract contract3 = CompactPropertySerializer.Default.Deserialize <BlobAndTagContract>(information.Content, 0);
                this.ContactsOutter_0.OnBroadcastReceived(str, destUserID, information.InformationType, contract3.Message, contract3.Tag);
            }
            return(null);
        }
        return(null);
    }
Example #6
0
        public void HandleInformation(string sourceUserID, int informationType, byte[] information)
        {
            if (informationType == this.groupInfoTypes.SomeoneJoinGroupNotify)
            {
                GroupNotifyContract contract = CompactPropertySerializer.Default.Deserialize <GroupNotifyContract>(information, 0);
                this.groupOutter.SomeoneJoinGroupNotify(contract.GroupID, contract.MemberID);
                return;
            }
            if (informationType == this.groupInfoTypes.SomeoneQuitGroupNotify)
            {
                GroupNotifyContract contract = CompactPropertySerializer.Default.Deserialize <GroupNotifyContract>(information, 0);
                this.groupOutter.SomeoneQuitGroupNotify(contract.GroupID, contract.MemberID);
                return;
            }
            if (informationType == this.groupInfoTypes.GroupmateOfflineNotify)
            {
                UserContract contract = CompactPropertySerializer.Default.Deserialize <UserContract>(information, 0);
                this.groupOutter.GroupmateOfflineNotify(contract.UserID);
                return;
            }
            if (informationType == this.groupInfoTypes.Broadcast || informationType == this.groupInfoTypes.BroadcastByServer)
            {
                BroadcastContract contract      = CompactPropertySerializer.Default.Deserialize <BroadcastContract>(information, 0);
                string            broadcasterID = contract.BroadcasterID == NetServer.SystemUserID ? null : contract.BroadcasterID;
                this.groupOutter.OnBroadcast(broadcasterID, contract.GroupID, contract.InformationType, contract.Content);
                return;
            }

            if (informationType == this.groupInfoTypes.BroadcastBlob || informationType == this.groupInfoTypes.BroadcastBlobByServer)
            {
                BlobFragmentContract contract = CompactPropertySerializer.Default.Deserialize <BlobFragmentContract>(information, 0);
                Information          info     = this.blobReceiver.Receive(contract.SourceUserID, contract.DestUserID, contract);
                if (info != null)
                {
                    string broadcasterID = contract.SourceUserID == NetServer.SystemUserID ? null : contract.SourceUserID;
                    this.groupOutter.OnBroadcastBlob(broadcasterID, info.DestID, info.InformationType, info.Content);
                }
            }
        }
Example #7
0
    public IMessageHandler ProcessMessage(IMessageHandler interface37_0)
    {
        string       str;
        UserContract contract3;

        if (interface37_0.Header.MessageType == this.object_0.GroupmateConnectedNotify)
        {
            contract3 = this.interface9_0.imethod_1 <UserContract>(interface37_0);
            this.class19_0.GroupmateConnectedNotify(contract3.UserID);
            return(null);
        }
        if (interface37_0.Header.MessageType == this.object_0.GroupmateOfflineNotify)
        {
            contract3 = this.interface9_0.imethod_1 <UserContract>(interface37_0);
            this.class19_0.GroupmateOfflineNotify(contract3.UserID);
            return(null);
        }
        if (interface37_0.Header.MessageType == this.object_0.BroadcastByServer)
        {
            BroadcastContract contract2 = this.interface9_0.imethod_1 <BroadcastContract>(interface37_0);
            str = (interface37_0.Header.UserID == "_0") ? null : interface37_0.Header.UserID;
            this.class19_0.method_6(str, contract2.GroupID, contract2.InformationType, contract2.Content);
            return(null);
        }
        if (interface37_0.Header.MessageType == this.object_0.BroadcastBlob)
        {
            str = NetServer.IsServerUser(interface37_0.Header.UserID) ? null : interface37_0.Header.UserID;
            string destUserID                = interface37_0.Header.DestUserID;
            BlobFragmentContract contract    = this.interface9_0.imethod_1 <BlobFragmentContract>(interface37_0);
            Information          information = this.class76_0.method_1(interface37_0.Header.UserID, interface37_0.Header.DestUserID, contract);
            if (information != null)
            {
                this.class19_0.method_6(str, destUserID, information.InformationType, information.Content);
            }
            return(null);
        }
        return(null);
    }
    public IMessageHandler ProcessMessage(IMessageHandler interface37_0)
    {
        string        destUserID;
        List <string> groupMemberList;
        IHeader       interface3;

        if (interface37_0.Header.MessageType == this.object_0.GetContracts)
        {
            ReqContactsContract contract4 = this.interface9_0.imethod_1 <ReqContactsContract>(interface37_0);
            List <string>       users     = new List <string>();
            if (this.icontactsManager_0 != null)
            {
                users = this.icontactsManager_0.GetContacts(interface37_0.Header.UserID);
                if (contract4.JustOnline)
                {
                    users = this.ginterface8_0.SelectOnlineUserFrom(users);
                }
            }
            ResContactsContract body = new ResContactsContract(users);
            interface3 = this.interface9_0.imethod_7(interface37_0.Header);
            return(this.interface9_0.imethod_2 <ResContactsContract>(interface3, body));
        }
        if (interface37_0.Header.MessageType == this.object_0.GetGroupMembers)
        {
            GroupContract contract7 = this.interface9_0.imethod_1 <GroupContract>(interface37_0);
            groupMemberList = this.icontactsManager_0.GetGroupMemberList(contract7.GroupID);
            GroupmatesContract contract = null;
            if (groupMemberList != null)
            {
                List <string> online  = new List <string>();
                List <string> offline = new List <string>();
                foreach (string str2 in groupMemberList)
                {
                    if (this.iuserManager_0.IsUserOnLine(str2))
                    {
                        online.Add(str2);
                    }
                    else
                    {
                        offline.Add(str2);
                    }
                }
                contract = new GroupmatesContract(online, offline);
            }
            interface3 = this.interface9_0.imethod_7(interface37_0.Header);
            return(this.interface9_0.imethod_2 <GroupmatesContract>(interface3, contract));
        }
        if (interface37_0.Header.MessageType == this.object_0.BroadcastByServer)
        {
            bool flag1 = interface37_0.Header.MessageType == this.object_0.BroadcastByServer;
            destUserID = interface37_0.Header.DestUserID;
            BroadcastContract contract2 = this.interface9_0.imethod_1 <BroadcastContract>(interface37_0);
            if (this.BroadcastReceived != null)
            {
                this.BroadcastReceived(interface37_0.Header.UserID, destUserID, contract2.InformationType, contract2.Content, contract2.Tag);
            }
            groupMemberList = this.icontactsManager_0.GetGroupMemberList(destUserID);
            if (groupMemberList != null)
            {
                BroadcastInformation information = new BroadcastInformation(interface37_0.Header.UserID, destUserID, contract2.InformationType, contract2.Content, contract2.Tag);
                foreach (string str3 in groupMemberList)
                {
                    if (str3 != interface37_0.Header.UserID)
                    {
                        if (this.ginterface8_0.IsUserOnLine(str3))
                        {
                            this.interface40_0.PostMessage(interface37_0, str3, contract2.ActionTypeOnChannelIsBusy);
                        }
                        else if (this.BroadcastFailed != null)
                        {
                            this.BroadcastFailed(str3, information);
                        }
                    }
                }
            }
            return(null);
        }
        if (interface37_0.Header.MessageType == this.object_0.BroadcastBlob)
        {
            destUserID = interface37_0.Header.DestUserID;
            if (this.bool_4 && (this.BroadcastReceived != null))
            {
                BlobFragmentContract contract5    = this.interface9_0.imethod_1 <BlobFragmentContract>(interface37_0);
                Information          information2 = this.class76_0.method_1(interface37_0.Header.UserID, destUserID, contract5);
                if (information2 != null)
                {
                    BlobAndTagContract contract6 = CompactPropertySerializer.Default.Deserialize <BlobAndTagContract>(information2.Content, 0);
                    this.BroadcastReceived(interface37_0.Header.UserID, destUserID, contract5.InformationType, contract6.Message, contract6.Tag);
                }
            }
            groupMemberList = this.icontactsManager_0.GetGroupMemberList(destUserID);
            if (groupMemberList != null)
            {
                foreach (string str3 in groupMemberList)
                {
                    if (str3 != interface37_0.Header.UserID)
                    {
                        this.interface40_0.PostMessage(interface37_0, str3, ActionTypeOnChannelIsBusy.Continue);
                    }
                }
            }
            return(null);
        }
        return(null);
    }
Example #9
0
        public void HandleInformation(string sourceUserID, int informationType, byte[] information)
        {
            if (informationType == this.groupInfoTypes.P2PChannelOpen)
            {
                P2PChannelReportContract contract = CompactPropertySerializer.Default.Deserialize <P2PChannelReportContract>(information, 0);
                this.p2PChannelManager.Register(sourceUserID, contract.DestUserID);
                return;
            }

            if (informationType == this.groupInfoTypes.P2PChannelClose)
            {
                P2PChannelReportContract contract = CompactPropertySerializer.Default.Deserialize <P2PChannelReportContract>(information, 0);
                this.p2PChannelManager.Unregister(sourceUserID, contract.DestUserID);
                return;
            }

            if (informationType == this.groupInfoTypes.Join)
            {
                GroupContract contract = CompactPropertySerializer.Default.Deserialize <GroupContract>(information, 0);
                this.dynamicGroupManager.JoinGroup(contract.GroupID, sourceUserID);
                return;
            }

            if (informationType == this.groupInfoTypes.DestroyGroup)
            {
                GroupContract contract = CompactPropertySerializer.Default.Deserialize <GroupContract>(information, 0);
                this.dynamicGroupManager.DestroyGroup(sourceUserID, contract.GroupID);
                return;
            }

            if (informationType == this.groupInfoTypes.QuitGroup)
            {
                GroupContract contract = CompactPropertySerializer.Default.Deserialize <GroupContract>(information, 0);
                this.dynamicGroupManager.QuitGroup(contract.GroupID, sourceUserID);
                return;
            }

            if (informationType == this.groupInfoTypes.Fire)
            {
                RecruitOrFireContract contract = CompactPropertySerializer.Default.Deserialize <RecruitOrFireContract>(information, 0);
                this.dynamicGroupManager.QuitGroup(contract.GroupID, contract.MemberID);
                return;
            }

            if (informationType == this.groupInfoTypes.Broadcast || informationType == this.groupInfoTypes.BroadcastByServer)
            {
                bool transfer = informationType == this.groupInfoTypes.BroadcastByServer;
                BroadcastContract contract = CompactPropertySerializer.Default.Deserialize <BroadcastContract>(information, 0);
                string            groupID  = contract.GroupID;
                if (this.BroadcastReceived != null)
                {
                    this.BroadcastReceived(sourceUserID, groupID, contract.InformationType, contract.Content);
                }

                List <string> members = this.dynamicGroupManager.GetGroupMembers(groupID);
                if (members != null)
                {
                    foreach (string memberID in members)
                    {
                        bool useP2PChannel = transfer ? false : this.p2PChannelManager.IsP2PChannelExist(sourceUserID, memberID);
                        if (memberID != sourceUserID && !useP2PChannel)
                        {
                            this.customizeController.Send(memberID, informationType, information, true, contract.ActionTypeOnChannelIsBusy);
                        }
                    }
                }
                return;
            }
            if (informationType == this.groupInfoTypes.BroadcastBlob || informationType == this.groupInfoTypes.BroadcastBlobByServer)
            {
                BlobFragmentContract contract = CompactPropertySerializer.Default.Deserialize <BlobFragmentContract>(information, 0);
                if (this.BroadcastReceived != null)
                {
                    Information info = this.blobReceiver.Receive(sourceUserID, contract.DestUserID, contract);
                    if (info != null)
                    {
                        this.BroadcastReceived(sourceUserID, contract.DestUserID, info.InformationType, info.Content);
                    }
                }

                bool          transfer = informationType == this.groupInfoTypes.BroadcastBlobByServer;
                List <string> members  = this.dynamicGroupManager.GetGroupMembers(contract.DestUserID);
                if (members != null)
                {
                    foreach (string memberID in members)
                    {
                        bool useP2PChannel = transfer ? false : this.p2PChannelManager.IsP2PChannelExist(sourceUserID, memberID);
                        if (memberID != sourceUserID && !useP2PChannel)
                        {
                            this.customizeController.Send(memberID, informationType, information, true, ActionTypeOnChannelIsBusy.Continue);
                        }
                    }
                }
                return;
            }
        }
Example #10
0
        private void BroadcastByServer(string groupID, int broadcastType, byte[] broadcastContent, ActionTypeOnChannelIsBusy action)
        {
            BroadcastContract contract = new BroadcastContract(this.currentUserID, groupID, broadcastType, broadcastContent, action);

            this.rapidPassiveEngine.CustomizeOutter.Send(this.groupInfoTypes.BroadcastByServer, CompactPropertySerializer.Default.Serialize(contract));
        }
Example #11
0
    public IMessageHandler ProcessMessage(IMessageHandler interface37_0)
    {
        List <string> groupMembers;
        string        destUserID;

        if (interface37_0.Header.MessageType == this.object_0.GetGroupMembers)
        {
            GroupContract contract4 = this.interface9_0.imethod_1 <GroupContract>(interface37_0);
            groupMembers = this.igroupManager_0.GetGroupMembers(contract4.GroupID);
            GroupmatesContract body = null;
            if (groupMembers != null)
            {
                List <string> online  = new List <string>();
                List <string> offline = new List <string>();
                foreach (string str in groupMembers)
                {
                    if (this.iuserManager_0.IsUserOnLine(str))
                    {
                        online.Add(str);
                    }
                    else
                    {
                        offline.Add(str);
                    }
                }
                body = new GroupmatesContract(online, offline);
            }
            IHeader interface3 = this.interface9_0.imethod_7(interface37_0.Header);
            return(this.interface9_0.imethod_2 <GroupmatesContract>(interface3, body));
        }
        if (interface37_0.Header.MessageType == this.object_0.BroadcastByServer)
        {
            bool flag1 = interface37_0.Header.MessageType == this.object_0.BroadcastByServer;
            destUserID = interface37_0.Header.DestUserID;
            BroadcastContract contract2 = this.interface9_0.imethod_1 <BroadcastContract>(interface37_0);
            if (this.BroadcastReceived != null)
            {
                this.BroadcastReceived(interface37_0.Header.UserID, destUserID, contract2.InformationType, contract2.Content);
            }
            groupMembers = this.igroupManager_0.GetGroupMembers(destUserID);
            if (groupMembers != null)
            {
                foreach (string str2 in groupMembers)
                {
                    if (str2 != interface37_0.Header.UserID)
                    {
                        this.interface40_0.PostMessage(interface37_0, str2, contract2.ActionTypeOnChannelIsBusy);
                    }
                }
            }
            return(null);
        }
        if (interface37_0.Header.MessageType == this.object_0.BroadcastBlob)
        {
            destUserID = interface37_0.Header.DestUserID;
            if (this.bool_4 && (this.BroadcastReceived != null))
            {
                BlobFragmentContract contract3   = this.interface9_0.imethod_1 <BlobFragmentContract>(interface37_0);
                Information          information = this.class76_0.method_1(interface37_0.Header.UserID, destUserID, contract3);
                if (information != null)
                {
                    this.BroadcastReceived(interface37_0.Header.UserID, destUserID, contract3.InformationType, information.Content);
                }
            }
            groupMembers = this.igroupManager_0.GetGroupMembers(destUserID);
            if (groupMembers != null)
            {
                foreach (string str2 in groupMembers)
                {
                    if (str2 != interface37_0.Header.UserID)
                    {
                        this.interface40_0.PostMessage(interface37_0, str2, ActionTypeOnChannelIsBusy.Continue);
                    }
                }
            }
            return(null);
        }
        return(null);
    }