Exemplo n.º 1
0
 public BroadcastContract(string _broadcasterID, string _groupID, int infoType ,byte[] info ,ActionTypeOnChannelIsBusy action)
 {
     this.broadcasterID = _broadcasterID;
     this.groupID = _groupID;
     this.content = info;
     this.informationType = infoType;
     this.actionTypeOnChannelIsBusy = action;
 }
Exemplo n.º 2
0
    public bool Send(string userID, int informationType, byte[] info, bool post, ActionTypeOnChannelIsBusy action)
    {
        int             num        = post ? this.object_0.InformationByPost : this.object_0.InformationBySend;
        IMessageHandler interface2 = this.interface9_0.imethod_4 <BinaryInformationContract>("_0", num, new BinaryInformationContract(informationType, info), userID);

        if (post)
        {
            return(this.interface40_0.PostMessage(interface2, userID, action));
        }
        return(this.interface40_0.SendMessage(interface2, userID, action));
    }
Exemplo n.º 3
0
 public bool CommitMessageToServer(IMessageHandler interface37_0, bool bool_3, ActionTypeOnChannelIsBusy actionTypeOnChannelIsBusy_0)
 {
     if (this.ChannelIsBusy && (actionTypeOnChannelIsBusy_0 == ActionTypeOnChannelIsBusy.Discard))
     {
         return(false);
     }
     if (bool_3)
     {
         base.SendMessage(interface37_0, this.agileIPE_0.IPEndPoint_0);
     }
     else
     {
         base.SendMessage(interface37_0, this.agileIPE_0.IPEndPoint_0);
     }
     return(true);
 }
Exemplo n.º 4
0
 public bool PostMessage(IMessageHandler interface37_0, IPEndPoint ipendPoint_0, ActionTypeOnChannelIsBusy actionTypeOnChannelIsBusy_0)
 {
     try
     {
         IMessageHandler interface2 = this.interface39_0.imethod_3(interface37_0);
         if (interface2 == null)
         {
             return(false);
         }
         return(this.interface6_0.PostMessageToClient(ipendPoint_0, interface2, actionTypeOnChannelIsBusy_0));
     }
     catch (Exception exception)
     {
         this.emptyAgileLogger_0.Log(exception, "CJFramework.Server.RegularSender.PostMessage", ErrorLevel.Standard);
         return(false);
     }
 }
Exemplo n.º 5
0
 public bool PostMessage(IMessageHandler interface37_0, string string_0, ActionTypeOnChannelIsBusy actionTypeOnChannelIsBusy_0)
 {
     try
     {
         IMessageHandler interface2 = this.interface39_0.imethod_3(interface37_0);
         if (interface2 == null)
         {
             return(false);
         }
         IPEndPoint userAddress = this.iuserManager_0.GetUserAddress(string_0);
         if (userAddress == null)
         {
             return(this.vmethod_1(interface37_0, string_0, true, actionTypeOnChannelIsBusy_0));
         }
         return(this.interface6_0.PostMessageToClient(userAddress, interface2, actionTypeOnChannelIsBusy_0));
     }
     catch (Exception exception)
     {
         this.emptyAgileLogger_0.Log(exception, "CJFramework.Server.RegularSender.PostMessage", ErrorLevel.Standard);
         return(false);
     }
 }
Exemplo n.º 6
0
 public bool CommitMessageToServer(IMessageHandler interface37_0, bool bool_5, ActionTypeOnChannelIsBusy actionTypeOnChannelIsBusy_0)
 {
     if (((interface37_0 == null) ? 0 : this.isConnected) == null)
     {
         return(false);
     }
     if (this.ChannelIsBusy && (actionTypeOnChannelIsBusy_0 == ActionTypeOnChannelIsBusy.Discard))
     {
         return(false);
     }
     byte[] buffer = interface37_0.ToStream();
     if (buffer.Length > this.int_2)
     {
         string msg = string.Format("Size of message to be sent overflow! Message type is {0}.", interface37_0.Header.MessageType);
         this.emptyAgileLogger_0.Log("MessageSizeOverFlow", msg, "CJFramework.Engine.Tcp.Passive.TcpEngine.CommitMessageToServer", ErrorLevel.High);
         return(false);
     }
     if (bool_5)
     {
         return(this.PostMessageToServer(buffer, interface37_0));
     }
     return(this.SendMessageToServer(buffer, interface37_0));
 }
Exemplo n.º 7
0
 private void HandleMessage(IMessageHandler interface37_0, bool bool_0, ActionTypeOnChannelIsBusy actionTypeOnChannelIsBusy_0)
 {
     if (this.ginterface8_0.IsUserOnLine(interface37_0.Header.DestUserID))
     {
         if (bool_0)
         {
             this.interface40_0.PostMessage(interface37_0, interface37_0.Header.DestUserID, actionTypeOnChannelIsBusy_0);
         }
         else
         {
             this.interface40_0.SendMessage(interface37_0, interface37_0.Header.DestUserID, actionTypeOnChannelIsBusy_0);
         }
     }
     else if ((interface37_0.Header.MessageType != this.object_0.BlobByRapidEngine) && (interface37_0.Header.MessageType != this.object_0.BlobInformation))
     {
         BinaryInformationContract contract = this.interface9_0.imethod_1 <BinaryInformationContract>(interface37_0);
         Information information            = new Information(interface37_0.Header.UserID, interface37_0.Header.DestUserID, contract.InformationType, contract.Content);
         if (this.TransmitFailed != null)
         {
             this.TransmitFailed(information);
         }
     }
 }
Exemplo n.º 8
0
    public bool SendMessage(string string_2, IMessageHandler interface37_0, bool bool_3, ActionTypeOnChannelIsBusy actionTypeOnChannelIsBusy_0)
    {
        if (this.class83_0 == null)
        {
            return(false);
        }
        P2PChannelState state = this.safeDictionary_0.Get(string_2);

        if (!((state != null) && state.Enabled))
        {
            return(false);
        }
        try
        {
            if (bool_3)
            {
                this.class83_0.PostMessageToClient(state.DestIPE.IPEndPoint_0, interface37_0, actionTypeOnChannelIsBusy_0);
            }
            else
            {
                this.class83_0.SendMessageToClient(state.DestIPE.IPEndPoint_0, interface37_0, actionTypeOnChannelIsBusy_0);
            }
            state.MessageSent();
            return(true);
        }
        catch (Exception exception)
        {
            this.emptyAgileLogger_0.Log(exception, "CJPlus.Application.P2PSession.Passive.Udp.UdpChannelManager.SendMessage", ErrorLevel.High);
            return(false);
        }
    }
Exemplo n.º 9
0
 public BroadcastContract(string _broadcasterID, string _groupID, int infoType, byte[] info, ActionTypeOnChannelIsBusy action)
 {
     this.broadcasterID             = _broadcasterID;
     this.groupID                   = _groupID;
     this.content                   = info;
     this.informationType           = infoType;
     this.actionTypeOnChannelIsBusy = action;
 }
Exemplo n.º 10
0
    public bool PostMessageToClient(IPEndPoint ipendPoint_0, IMessageHandler interface37_0, ActionTypeOnChannelIsBusy actionTypeOnChannelIsBusy_0)
    {
        if ((interface37_0 == null) || this.bool_0)
        {
            return(false);
        }
        Interface5 interface2 = this.class142_0.method_9(ipendPoint_0);

        if (interface2 == null)
        {
            return(false);
        }
        byte[] buffer = interface37_0.ToStream();
        if (buffer.Length > this.int_1)
        {
            throw new Exception(string.Format("Size of message to be post overflow! Message type is {0}.", interface37_0.Header.MessageType));
        }
        if (interface2.ChannelIsBusy && (actionTypeOnChannelIsBusy_0 == ActionTypeOnChannelIsBusy.Discard))
        {
            return(false);
        }
        try
        {
            interface2.imethod_14();
            interface2.imethod_11(ref buffer);
            interface2.GetStream().BeginWrite(buffer, 0, buffer.Length, new AsyncCallback(this.OnPostMessageCallback), new Class37(interface2, interface37_0));
            return(true);
        }
        catch (Exception exception)
        {
            interface2.imethod_15();
            if (((exception is IOException) || (exception is ObjectDisposedException)) || (exception is InvalidOperationException))
            {
                this.OnSomeOneDisconnected(interface2, DisconnectedType.NetworkInterrupted);
            }
            else
            {
                this.emptyAgileLogger_0.Log(exception, "CJFramework.Engine.Tcp.Server.BaseTcpEngine.PostMessageToClient", ErrorLevel.Standard);
            }
            return(false);
        }
    }
Exemplo n.º 11
0
    public void method_10(string string_0, IMessageHandler interface37_0, bool bool_1, ActionTypeOnChannelIsBusy actionTypeOnChannelIsBusy_0)
    {
        IPEndPoint userAddress = this.class98_0.GetUserAddress(string_0);

        if (userAddress != null)
        {
            if (bool_1)
            {
                this.object_1.PostMessageToClient(userAddress, interface37_0, actionTypeOnChannelIsBusy_0);
            }
            else
            {
                this.object_1.SendMessageToClient(userAddress, interface37_0, actionTypeOnChannelIsBusy_0);
            }
        }
    }
Exemplo n.º 12
0
    public bool Send(string targetUserID, int informationType, byte[] info, bool post, ActionTypeOnChannelIsBusy action, ChannelMode mode)
    {
        if (targetUserID == null)
        {
            targetUserID = "_0";
        }
        int             num        = post ? this.customizeMessageTypeRoom_0.InformationByPost : this.customizeMessageTypeRoom_0.InformationBySend;
        IMessageHandler interface2 = this.interface9_0.imethod_4 <BinaryInformationContract>(this.string_0, num, new BinaryInformationContract(informationType, info), targetUserID);

        if ((targetUserID == "_0") || (mode == ChannelMode.TransferByServer))
        {
            return(this.interface31_0.imethod_0(interface2, post, action));
        }
        if (mode == ChannelMode.P2PChannelFirst)
        {
            return(this.interface31_0.Send(interface2, post, action));
        }
        return(this.interface31_0.SendByP2PChannel(interface2, ActionTypeOnNoP2PChannel.Discard, post, targetUserID, action));
    }
Exemplo n.º 13
0
 public void Broadcast(string groupID, int broadcastType, byte[] broadcastContent , ActionTypeOnChannelIsBusy action)
 {
     List<string> members = this.dynamicGroupManager.GetGroupMembers(groupID);
     if (members != null)
     {
         byte[] info = CompactPropertySerializer.Default.Serialize(new BroadcastContract(NetServer.SystemUserID , groupID, broadcastType, broadcastContent ,action));
         foreach (string memberID in members)
         {
             this.customizeController.Send(memberID, this.groupInfoTypes.BroadcastByServer, info, true, action);
         }
     }
 }
Exemplo n.º 14
0
 public void PostMessage(IMessageHandler interface37_0, IEnumerable <string> ienumerable_0, ActionTypeOnChannelIsBusy actionTypeOnChannelIsBusy_0)
 {
     if ((interface37_0 != null) && (ienumerable_0 != null))
     {
         IMessageHandler interface2 = this.interface39_0.imethod_3(interface37_0);
         if (interface2 != null)
         {
             List <string> foreigners = null;
             foreach (string str in ienumerable_0)
             {
                 try
                 {
                     IPEndPoint userAddress = this.iuserManager_0.GetUserAddress(str);
                     if (userAddress == null)
                     {
                         if (foreigners == null)
                         {
                             foreigners = new List <string>();
                         }
                         foreigners.Add(str);
                     }
                     else
                     {
                         this.interface6_0.PostMessageToClient(userAddress, interface2, actionTypeOnChannelIsBusy_0);
                     }
                 }
                 catch (Exception exception)
                 {
                     this.emptyAgileLogger_0.Log(exception, "CJFramework.Server.RegularSender.PostMessage", ErrorLevel.Standard);
                 }
             }
             if (foreigners != null)
             {
                 this.vmethod_0(interface37_0, foreigners, true, actionTypeOnChannelIsBusy_0);
             }
         }
     }
 }
Exemplo n.º 15
0
 protected virtual void vmethod_0(IMessageHandler interface37_0, IEnumerable <string> foreigners, bool bool_0, ActionTypeOnChannelIsBusy actionTypeOnChannelIsBusy_0)
 {
 }
Exemplo n.º 16
0
    public void CoNbnqugPr(string string_1, IMessageHandler interface37, bool bool_0, ActionTypeOnChannelIsBusy actionTypeOnChannelIsBusy)
    {
        Interface26 interface2 = this.safeDictionary_0.Get(string_1);

        if (interface2 != null)
        {
            interface2.CommitMessageToServer(interface37, bool_0, actionTypeOnChannelIsBusy);
        }
    }
Exemplo n.º 17
0
 public bool SendMessage(string string_0, IMessageHandler interface37_0, bool bool_0, ActionTypeOnChannelIsBusy actionTypeOnChannelIsBusy_0)
 {
     return(false);
 }
Exemplo n.º 18
0
 public bool Send(IMessageHandler interface37_0, bool bool_0, ActionTypeOnChannelIsBusy actionTypeOnChannelIsBusy_0)
 {
     return(this.interface36_0.SendMessage(interface37_0, false, bool_0, actionTypeOnChannelIsBusy_0));
 }
Exemplo n.º 19
0
 public bool imethod_0(IMessageHandler interface37_0, ActionTypeOnChannelIsBusy actionTypeOnChannelIsBusy_0)
 {
     return(this.PostMessage(interface37_0, interface37_0.Header.DestUserID, actionTypeOnChannelIsBusy_0));
 }
Exemplo n.º 20
0
    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);
        }
    }
Exemplo n.º 21
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));
        }
Exemplo n.º 22
0
 public bool SendByP2PChannel(IMessageHandler interface37_0, ActionTypeOnNoP2PChannel actionTypeOnNoP2PChannel_0, bool bool_0, string string_0, ActionTypeOnChannelIsBusy actionTypeOnChannelIsBusy_0)
 {
     return(this.interface36_0.SendByP2PChannel(interface37_0, actionTypeOnNoP2PChannel_0, bool_0, string_0, actionTypeOnChannelIsBusy_0));
 }
Exemplo n.º 23
0
 protected virtual bool vmethod_1(IMessageHandler interface37_0, string string_0, bool bool_0, ActionTypeOnChannelIsBusy actionTypeOnChannelIsBusy_0)
 {
     return(false);
 }
Exemplo n.º 24
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);
                }
            }
        }
Exemplo n.º 25
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);
            }
        }
Exemplo n.º 26
0
 public void Broadcast(string groupID, int broadcastType, byte[] broadcastContent, ActionTypeOnChannelIsBusy action)
 {
     this.Broadcast(groupID, broadcastType, broadcastContent, action, BroadcastChannelMode.AllTransferByServer);
 }
Exemplo n.º 27
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);
    }
Exemplo n.º 28
0
        public void Broadcast(string groupID, int broadcastType, byte[] broadcastContent, ActionTypeOnChannelIsBusy action)
        {
            List <string> members = this.dynamicGroupManager.GetGroupMembers(groupID);

            if (members != null)
            {
                byte[] info = CompactPropertySerializer.Default.Serialize(new BroadcastContract(NetServer.SystemUserID, groupID, broadcastType, broadcastContent, action));
                foreach (string memberID in members)
                {
                    this.customizeController.Send(memberID, this.groupInfoTypes.BroadcastByServer, info, true, action);
                }
            }
        }
Exemplo n.º 29
0
 public bool Send(string targetUserID, int informationType, byte[] info, bool post, ActionTypeOnChannelIsBusy action)
 {
     return(this.Send(targetUserID, informationType, info, post, action, ChannelMode.P2PChannelFirst));
 }
Exemplo n.º 30
0
    public bool SendMessageToClient(IPEndPoint ipendPoint_0, IMessageHandler interface37_0, ActionTypeOnChannelIsBusy actionTypeOnChannelIsBusy_0)
    {
        if ((interface37_0 == null) || this.bool_0)
        {
            return(false);
        }
        Interface5 interface2 = this.class142_0.method_9(ipendPoint_0);

        if (interface2 == null)
        {
            return(false);
        }
        byte[] buffer = interface37_0.ToStream();
        if (buffer.Length > this.int_1)
        {
            throw new Exception(string.Format("Size of message to be sent overflow! Message type is {0}.", interface37_0.Header.MessageType));
        }
        if (interface2.ChannelIsBusy && (actionTypeOnChannelIsBusy_0 == ActionTypeOnChannelIsBusy.Discard))
        {
            return(false);
        }
        if ((this.int_5 > 0) && (interface2.imethod_19() >= this.int_5))
        {
            this.OnSomeOneDisconnected(interface2, DisconnectedType.ChannelCacheOverflow);
            return(false);
        }
        bool flag2 = false;

        try
        {
            interface2.imethod_16();
            interface2.imethod_11(ref buffer);
            interface2.GetStream().Write(buffer, 0, buffer.Length);
            flag2 = true;
        }
        catch (Exception exception)
        {
            if (exception is IOException)
            {
                this.OnSomeOneDisconnected(interface2, DisconnectedType.NetworkInterrupted);
            }
            else
            {
                this.emptyAgileLogger_0.Log(exception, "CJFramework.Engine.Tcp.Server.BaseTcpEngine.SendMessageToClient", ErrorLevel.High);
            }
        }
        finally
        {
            interface2.imethod_17();
        }
        if (flag2)
        {
            this.eventSafeTrigger_0.Action <IPEndPoint, IMessageHandler>("MessageSent", this.MessageReceived, interface2.GetIPEndPoint(), interface37_0);
        }
        return(flag2);
    }
Exemplo n.º 31
0
    public bool SendByP2PChannel(string targetUserID, int informationType, byte[] info, ActionTypeOnNoP2PChannel actionType, bool post, ActionTypeOnChannelIsBusy action)
    {
        int             num        = post ? this.customizeMessageTypeRoom_0.InformationByPost : this.customizeMessageTypeRoom_0.InformationBySend;
        IMessageHandler interface2 = this.interface9_0.imethod_4 <BinaryInformationContract>(this.string_0, num, new BinaryInformationContract(informationType, info), targetUserID);

        return(this.interface31_0.SendByP2PChannel(interface2, actionType, post, targetUserID, action));
    }
Exemplo n.º 32
0
 public bool SendMessage(string string_1, IMessageHandler interface37_0, bool bool_0, ActionTypeOnChannelIsBusy actionTypeOnChannelIsBusy_0)
 {
     return(this.class42_0.SendMessage(string_1, interface37_0, bool_0, actionTypeOnChannelIsBusy_0) || this.class57_0.SendMessage(string_1, interface37_0, bool_0, actionTypeOnChannelIsBusy_0));
 }