Пример #1
0
        public override void ChannelRead(IChannelHandlerContext ctx, object msg)
        {
            Client      client  = Engine.Locator.ClientController.GetClient(ctx.Channel);
            IByteBuffer message = msg as IByteBuffer;

            if (message.GetByte(0) == 60)
            {
                string policy =
                    "<?xml version=\"1.0\"?>\r\n<!DOCTYPE cross-domain-policy SYSTEM \"/xml/dtds/cross-domain-policy.dtd\">\r\n<cross-domain-policy>\r\n   <allow-access-from domain=\"*\" to-ports=\"1-65535\" />\r\n</cross-domain-policy>\0";
                ctx.Channel.WriteAndFlushAsync(Unpooled.CopiedBuffer(Encoding.GetEncoding(0).GetBytes(policy))).Wait();
            }
            else
            {
                while (message.ReadableBytes >= 5)
                {
                    int length = Base64Encoding.DecodeInt32(message.ReadBytes(3).ToArray());

                    if (length > 0)
                    {
                        IByteBuffer packet = message.ReadBytes(length);

                        Engine.Locator.PacketController.Handle(client, packet);
                    }
                }
            }

            base.ChannelRead(ctx, msg);
        }
Пример #2
0
        public void handlePacketData(byte[] data)
        {
            int pos = 0;

            while (pos < data.Length)
            {
                try
                {
                    int MessageLength = Base64Encoding.DecodeInt32(new byte[] { data[pos++], data[pos++], data[pos++] });
                    int MessageId     = Base64Encoding.DecodeInt32(new byte[] { data[pos++], data[pos++] });

                    byte[] Content = new byte[MessageLength - 2];

                    for (int i = 0; i < Content.Length && pos < data.Length; i++)
                    {
                        Content[i] = data[pos++];
                    }
                    if (onNewPacket != null)
                    {
                        using (ClientMessage message = ClientMessageFactory.GetClientMessage(MessageId, Content))
                        {
                            onNewPacket.Invoke(message);
                        }
                    }
                }
                catch (Exception e)
                {
                    Logging.HandleException(e, "packet handling");
                    con.Dispose();
                }
            }
        }
Пример #3
0
        private ClientMessage TryParseAsOldCrypto(byte[] packet)
        {
            try
            {
                int i = 0;
                while (i < packet.Length)
                {
                    int lenght = Base64Encoding.DecodeInt32(new byte[] { (byte)packet[i++], (byte)packet[i++], (byte)packet[i++] });
                    if (lenght > 0)
                    {
                        uint id = Base64Encoding.DecodeUInt32(new byte[] { (byte)packet[i++], (byte)packet[i++] });
                        if (id > 0)
                        {
                            byte[] bytes = new byte[lenght - 2];
                            for (int j = 0; j < bytes.Length; j++)
                            {
                                bytes[j] = packet[i++];
                            }

                            OldCryptoClientMessage crypto = new OldCryptoClientMessage();
                            crypto.Init(id, bytes);
                            return(crypto);
                        }
                    }
                }
            }
            catch
            {
                return(null);
            }

            return(null);
        }
Пример #4
0
        public static void HandleBytes(Session Session, ref byte[] Bytes)
        {
            if (Encoding.ASCII.GetString(Bytes) == "<policy-file-request/>\x0")
            {
                Session.Send(PolicyFileRequest);
                return;
            }

            var Pointer = new int();

            try
            {
                for (; Pointer < Bytes.Length;)
                {
                    var MessageLength = Base64Encoding.DecodeInt32(new byte[] { Bytes[Pointer++], Bytes[Pointer++], Bytes[Pointer++] });
                    var MessageId     = Base64Encoding.DecodeInt32(new byte[] { Bytes[Pointer++], Bytes[Pointer++] });

                    var ContextLength = (MessageLength - 2);
                    var Context       = new byte[ContextLength];

                    Array.Copy(Bytes, Pointer, Context, 0, ContextLength);

                    Pointer += ContextLength;

                    var InMessage = new InMessage(MessageId, Context);

                    HandleEvent(Session, InMessage);
                }
            }
            catch { }
        }
Пример #5
0
        /// <summary>
        /// Handles a given amount of data in a given byte array, by attempting to parse messages from the received data and process them in the message handler.
        /// </summary>
        /// <param name="Data">The byte array with the data to process.</param>
        /// <param name="numBytesToProcess">The actual amount of bytes in the byte array to process.</param>
        public void HandleConnectionData(ref byte[] data)
        {
            // Gameclient protocol or policyrequest?
            if (data[0] != 64)
            {
                IonEnvironment.GetLog().WriteInformation("Client " + mID + " sent non-gameclient message: " + IonEnvironment.GetDefaultTextEncoding().GetString(data));

                string xmlPolicy =
                    "<?xml version=\"1.0\"?>\r\n" +
                    "<!DOCTYPE cross-domain-policy SYSTEM \"/xml/dtds/cross-domain-policy.dtd\">\r\n" +
                    "<cross-domain-policy>\r\n" +
                    "<allow-access-from domain=\"*\" to-ports=\"1-31111\" />\r\n" +
                    "</cross-domain-policy>\x0";

                IonEnvironment.GetLog().WriteInformation("Client " + mID + ": sending XML cross domain policy file: " + xmlPolicy);
                mConnection.SendData(xmlPolicy);

                mMessageHandler.GetResponse().Initialize(ResponseOpcodes.SecretKey); // "@A"
                mMessageHandler.GetResponse().Append("ION/Deltar");
                mMessageHandler.SendResponse();
            }
            else
            {
                int pos = 0;
                while (pos < data.Length)
                {
                    try
                    {
                        // Total length of message (without this): 3 Base64 bytes
                        int messageLength = Base64Encoding.DecodeInt32(new byte[] { data[pos++], data[pos++], data[pos++] });

                        // ID of message: 2 Base64 bytes
                        uint messageID = Base64Encoding.DecodeUInt32(new byte[] { data[pos++], data[pos++] });

                        // Data of message: (messageLength - 2) bytes
                        byte[] Content = new byte[messageLength - 2];
                        for (int i = 0; i < Content.Length; i++)
                        {
                            Content[i] = data[pos++];
                        }

                        // Create message object
                        ClientMessage message = new ClientMessage(messageID, Content);

                        // Handle message object
                        mMessageHandler.HandleRequest(message);
                    }
                    catch (IndexOutOfRangeException) // Bad formatting!
                    {
                        IonEnvironment.GetHabboHotel().GetClients().StopClient(mID);
                    }
                    catch (Exception ex)
                    {
                        IonEnvironment.GetLog().WriteUnhandledExceptionError("GameClient.HandleConnectionData", ex);
                    }
                }
            }
        }
Пример #6
0
        public void HandleConnectionData(ref byte[] data)
        {
            if (data[0] == 64)
            {
                int pos = 0;
                while (pos < data.Length)
                {
                    try
                    {
                        int  MessageLength = Base64Encoding.DecodeInt32(new byte[] { data[pos++], data[pos++], data[pos++] });
                        uint MessageId     = Base64Encoding.DecodeUInt32(new byte[] { data[pos++], data[pos++] });

                        byte[] Content = new byte[MessageLength - 2];
                        for (int j = 0; j < Content.Length; j++)
                        {
                            Content[j] = data[pos++];
                        }
                        if (this.MessageHandler == null)
                        {
                            this.InitHandler();
                        }
                        ClientMessage Message = new ClientMessage(MessageId, Content);
                        if (Message != null)
                        {
                            try
                            {
                                if (int.Parse(PhoenixEnvironment.GetConfig().data["debug"]) == 1)
                                {
                                    Logging.WriteLine(string.Concat(new object[] { "[", ClientId, "] --> [", Message.Id, "] ", Message.Header, Message.GetBody() }));
                                }
                            }
                            catch
                            {
                            }
                            MessageEvent MessageHandler;
                            if (PhoenixEnvironment.GetPacketManager().Get(Message.Id, out MessageHandler))
                            {
                                MessageHandler.parse(this, Message);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Logging.LogException("Error: " + ex.ToString());
                        this.Disconnect();
                    }
                }
            }
            else
            {
                if (true)
                {
                    this.Connection.SendData(CrossdomainPolicy.GetXmlPolicy());
                    this.Connection.Dispose();
                }
            }
        }
        public bool ReadByte(byte byte_) //returns if packet is fully readed
        {
            if (this.Lenght != null)
            {
                if (this.Packet == null)
                {
                    this.Packet = new byte[(int)this.Lenght];
                }

                this.Packet[this.Pointer++] = byte_;
            }
            else
            {
                if (this.LenghtBytes == null)
                {
                    if (this.RC4 == null)
                    {
                        this.LenghtBytes = new byte?[3] {
                            null, null, null
                        };
                    }
                    else
                    {
                        this.LenghtBytes = new byte?[6] {
                            null, null, null, null, null, null
                        };
                    }
                }

                int i = 0;
                for (; i < this.LenghtBytes.Length; i++)
                {
                    if (this.LenghtBytes[i] == null)
                    {
                        this.LenghtBytes[i] = byte_;
                        break;
                    }
                }

                if (i == this.LenghtBytes.Length - 1)
                {
                    if (this.RC4 == null)
                    {
                        this.Lenght = Base64Encoding.DecodeInt32(this.LenghtBytes.Select(j => (byte)j).ToArray());
                    }
                    else
                    {
                        this.Lenght = Base64Encoding.DecodeInt32(this.RC4.Decipher(this.LenghtBytes.Select(j => (byte)j).ToArray(), false)) * 2;
                    }
                }

                return(false);
            }

            return(this.Pointer == this.Packet.Length);
        }
Пример #8
0
        internal void HandleConnectionData(ref byte[] data)
        {
            if (data[0] == 64)
            {
                int pos = 0;

                while (pos < data.Length)
                {
                    try
                    {
                        int MessageLength = Base64Encoding.DecodeInt32(new byte[] { data[pos++], data[pos++], data[pos++] });
                        int MessageId     = Base64Encoding.DecodeInt32(new byte[] { data[pos++], data[pos++] });

                        byte[] Content = new byte[MessageLength - 2];

                        for (int i = 0; i < Content.Length; i++)
                        {
                            Content[i] = data[pos++];
                        }

                        ClientMessage Message = new ClientMessage(MessageId, Content);

                        Console.WriteLine("[Request] >> [" + MessageId + "] " + Message.ToString());

                        if (MessageHandler == null)
                        {
                            InitHandler();
                        }

                        //DateTime PacketMsgStart = DateTime.Now;
                    }
                    catch (Exception e)
                    {
                        Logging.HandleException(e, "packet handling");
                        Disconnect();
                    }
                }
            }
            else
            {
                Connection.SendData(PiciEnvironment.GetDefaultEncoding().GetBytes(CrossdomainPolicy.GetXmlPolicy()));
            }
        }
Пример #9
0
        internal void HandleConnectionData(ref byte[] data)
        {
            if (data[0] == 64)
            {
                int pos = 0;

                while (pos < data.Length)
                {
                    try
                    {
                        int MessageLength = Base64Encoding.DecodeInt32(new byte[] { data[pos++], data[pos++], data[pos++] });
                        int MessageId     = Base64Encoding.DecodeInt32(new byte[] { data[pos++], data[pos++] });

                        byte[] Content = new byte[MessageLength - 2];

                        for (int i = 0; i < Content.Length; i++)
                        {
                            Content[i] = data[pos++];
                        }

                        ClientMessage Message = new ClientMessage(MessageId, Content);

                        if (MessageHandler == null)
                        {
                            InitHandler(); //Never ever register the packets BEFORE you receive any data.
                        }

                        //DateTime PacketMsgStart = DateTime.Now;
                    }
                    catch (Exception e)
                    {
                        Logging.HandleException(e, "packet handling");
                        Disconnect();
                    }
                }
            }
            else
            {
                Connection.SendData(ButterflyEnvironment.GetDefaultEncoding().GetBytes(CrossdomainPolicy.GetXmlPolicy()));
            }
        }
Пример #10
0
        public override IncomingMessage ParseMessage(byte[] data)
        {
            try
            {
                byte[] headerBytes = new [] { data[0], data[1] };
                int    headerId    = Base64Encoding.DecodeInt32(headerBytes);

                byte[] contentBytes = new byte[data.Length - 2];
                for (int i = 0; i < data.Length - 2; i++)
                {
                    contentBytes[i] = data[i + 2];
                }

                return(new ClassicIncomingMessage(headerId, contentBytes));
            }
            catch (Exception e)
            {
                throw new FormatException(
                          "Invalid packet data. Are you sure you are using the correct GameSocketReader?", e);
            }
        }
Пример #11
0
        public string GetString()
        {
            try
            {
                var Length = Base64Encoding.DecodeInt32(GetBytes(2));

                if (Length > 0)
                {
                    PointerLength += 2;

                    var Result = Encoding.ASCII.GetString(GetBytes(Length)).Replace((char)1, ' ');

                    PointerLength += Length;

                    return(Result);
                }
                else
                {
                    return(string.Empty);
                }
            }
            catch { return(string.Empty); }
        }
Пример #12
0
 public int PopInt32()
 {
     return(Base64Encoding.DecodeInt32(this.ReadBytes(2)));
 }
Пример #13
0
        public byte[] ReadFixedValue()
        {
            int len = Base64Encoding.DecodeInt32(this.ReadBytes(2));

            return(this.ReadBytes(len));
        }
Пример #14
0
 public override int PopBase64Int32()
 {
     return(Base64Encoding.DecodeInt32(this.ReadBytes(2)));
 }
Пример #15
0
 public override int ParseLength(byte[] data)
 {
     return(Base64Encoding.DecodeInt32(data));
 }
Пример #16
0
        private void ProcessData(byte[] Data)
        {
            if (Data.Length == 0)
            {
                return;
            }

            if (Data[0] == 64)
            {
                int Pos = 0;

                while (Pos < Data.Length)
                {
                    ClientMessage Message = null;

                    try
                    {
                        int  MessageLength = Base64Encoding.DecodeInt32(new byte[] { Data[Pos++], Data[Pos++], Data[Pos++] });
                        uint MessageId     = Base64Encoding.DecodeUInt32(new byte[] { Data[Pos++], Data[Pos++] });

                        byte[] Content = new byte[MessageLength - 2];

                        for (int i = 0; i < Content.Length; i++)
                        {
                            Content[i] = Data[Pos++];
                        }

                        Message = new ClientMessage(MessageId, Content);
                    }
                    catch (Exception)
                    {
                        SessionManager.StopSession(mId); // packet formatting exception
                        return;
                    }

                    if (Message != null)
                    {
                        Output.WriteLine("[RCV][" + mId + "]: " + Message.ToString(), OutputLevel.DebugInformation);

                        try
                        {
                            DataRouter.HandleData(this, Message);
                        }
                        catch (Exception e)
                        {
                            Output.WriteLine("Critical error in HandleData stack: " + e.Message + "\n\n" + e.StackTrace,
                                             OutputLevel.CriticalError);
                            SessionManager.StopSession(mId);
                            return;
                        }
                    }
                }
            }
            else if (Data[0] == 60)
            {
                Output.WriteLine("Sent crossdomain policy to client " + mId + ".", OutputLevel.DebugInformation);
                SendData(CrossdomainPolicy.GetBytes());
                SessionManager.StopSession(mId);
            }
            else
            {
                SessionManager.StopSession(mId);
            }
        }
Пример #17
0
        /// <summary>
        /// Reads a length-prefixed (Base64) value from the message and returns it as a byte array.
        /// </summary>
        private byte[] PopPrefixedValue()
        {
            int length = Base64Encoding.DecodeInt32(ReadBytes(2));

            return(ReadBytes(length));
        }
Пример #18
0
        public void ParsePacket(ref byte[] bytes)
        {
            if (bytes[0] == 64)
            {
                int i = 0;

                while (i < bytes.Length)
                {
                    try
                    {
                        int num = Base64Encoding.DecodeInt32(new byte[]
                        {
                            bytes[i++],
                            bytes[i++],
                            bytes[i++]
                        });

                        uint uint_ = Base64Encoding.DecodeUInt32(new byte[]
                        {
                            bytes[i++],
                            bytes[i++]
                        });

                        byte[] array = new byte[num - 2];
                        for (int j = 0; j < array.Length; j++)
                        {
                            array[j] = bytes[i++];
                        }

                        if (this.ClientMessageHandler == null)
                        {
                            this.CreateClientMessageHandler();
                        }
                        ClientMessage @class = new ClientMessage(uint_, array);
                        if (@class != null)
                        {
                            try
                            {
                                if (int.Parse(GoldTree.GetConfig().data["debug"]) == 1)
                                {
                                    Logging.WriteLine(string.Concat(new object[]
                                    {
                                        "[",
                                        this.ID,
                                        "] --> [",
                                        @class.Id,
                                        "] ",
                                        @class.Header,
                                        @class.GetBody()
                                    }));
                                }
                            }
                            catch
                            {
                            }
                            Interface @interface;
                            if (GoldTree.GetPacketManager().Handle(@class.Id, out @interface))
                            {
                                try
                                {
                                    @interface.Handle(this, @class);
                                }
                                catch (Exception ex)
                                {
                                    Logging.LogException("Error: " + ex.ToString());
                                    this.method_12();
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        if (ex.GetType() == typeof(IndexOutOfRangeException))
                        {
                            return;
                        }
                        Logging.LogException("Error: " + ex.ToString());
                        this.method_12();
                    }
                }
            }
            else
            {
                if (true)                //Class13.Boolean_7)
                {
                    this.Connection.SendMessage(CrossdomainPolicy.GetXmlPolicy());
                    //this.Message1_0.SendData(GoldTree.GetDefaultEncoding().GetBytes(CrossdomainPolicy.GetXmlPolicy()));
                    this.Connection.Close();
                }
            }
        }
Пример #19
0
 public int ReadB64()
 {
     return(Base64Encoding.DecodeInt32(ReadBytes(2)));
 }
Пример #20
0
        /// <summary>
        /// Reads a length-prefixed (Base64) value from the message and returns it as a byte array.
        /// </summary>
        /// <returns>byte[]</returns>
        private byte[] ReadPrefixedValue()
        {
            Int32 Length = Base64Encoding.DecodeInt32(this.ReadBytes(2));

            return(this.ReadBytes(Length));
        }
Пример #21
0
        /// <summary>
        ///   Reads a length-prefixed (Base64) value from the message and returns it as a byte array.
        /// </summary>
        /// <returns>byte[]</returns>
        public byte[] ReadPrefixedValue()
        {
            int length = Base64Encoding.DecodeInt32(ReadBytes(2));

            return(ReadBytes(length));
        }
Пример #22
0
 internal Int32 PopInt32()
 {
     return(Base64Encoding.DecodeInt32(this.ReadBytes(2)));
 }
Пример #23
0
        private void HandleConnectionData(ref byte[] data)
        {
            int pos = 0;

            while (pos < data.Length)
            {
                try
                {
                    // Total length of message (without this): 3 Base64 bytes
                    int messageLength = Base64Encoding.DecodeInt32(new byte[] { data[pos++], data[pos++], data[pos++] });

                    // ID of message: 2 Base64 bytes
                    uint messageID = Base64Encoding.DecodeUInt32(new byte[] { data[pos++], data[pos++] });

                    // Data of message: (messageLength - 2) bytes
                    byte[] Content = new byte[messageLength - 2];
                    for (int i = 0; i < Content.Length; i++)
                    {
                        Content[i] = data[pos++];
                    }

                    // Create message object
                    IncomingMessage message = new IncomingMessage(messageID, Content);

                    if (this.mUser.IsLoggedIn())
                    {
                        Core.GetStandardOut().PrintDebug("[" + this.mUser.GetUsername() + "] -- > " + message.Header + message.GetContentString());
                    }
                    else
                    {
                        Core.GetStandardOut().PrintDebug("[No Name] -> " + message.Header + message.GetContentString());
                    }


                    // Handle message object
                    this.mPacketHandlers[messageID, 3].Invoke(message); // Execute High Priority

                    if (message.IsCancelled())
                    {
                        return;
                    }

                    this.mPacketHandlers[messageID, 2].Invoke(message); // Execute Low Priority

                    if (message.IsCancelled())
                    {
                        return;
                    }

                    this.mPacketHandlers[messageID, 1].Invoke(message); // Execute Default Action
                    this.mPacketHandlers[messageID, 0].Invoke(message); // Execute Watchers
                }
                catch (IndexOutOfRangeException)                        // Bad formatting!
                {
                    // TODO: Move this to IHI
                    //IonEnvironment.GetHabboHotel().GetClients().StopClient(mID, 0);
                }
                catch (Exception ex)
                {
                    Core.GetStandardOut().PrintError(ex.Message);
                }
            }
        }
Пример #24
0
        private void HandleConnectionData(ref byte[] data)
        {
            int pos = 0;
            while (pos < data.Length)
            {
                try
                {
                    if (data[0] == 60)
                    {
                        CoreManager.ServerCore.GetStandardOut().PrintDebug("[" + _id + "] --> Policy Request");
                        SendData(PolicyReplyData);
                        CoreManager.ServerCore.GetStandardOut().PrintDebug("[" + _id + "] <-- Policy Sent");
                        Close();
                        return;
                    }

                    // Total length of message (without this): 3 Base64 bytes                    
                    int messageLength = Base64Encoding.DecodeInt32(new[] {data[pos++], data[pos++], data[pos++]});

                    // ID of message: 2 Base64 bytes
                    uint messageID = Base64Encoding.DecodeUInt32(new[] {data[pos++], data[pos++]});

                    // Data of message: (messageLength - 2) bytes
                    byte[] content = new byte[messageLength - 2];
                    for (int i = 0; i < content.Length; i++)
                    {
                        content[i] = data[pos++];
                    }

                    // Create message object
                    IncomingMessage message = new IncomingMessage(messageID, content);

                    if (Habbo.IsLoggedIn())
                        CoreManager.ServerCore.GetStandardOut().PrintDebug("[" + Habbo.GetUsername() + "] --> " +
                                                                           message.GetHeader() +
                                                                           message.GetContentString());
                    else
                        CoreManager.ServerCore.GetStandardOut().PrintDebug("[" + _id + "] --> " +
                                                                           message.GetHeader() +
                                                                           message.GetContentString());


                    // Handle message object
                    bool unknown = true;

                    if (_packetHandlers.GetLength(0) > messageID)
                    {
                        if (_packetHandlers[messageID, 3] != null)
                        {
                            lock (_packetHandlers[messageID, 3])
                            {
                                _packetHandlers[messageID, 3].Invoke(Habbo, message); // Execute High Priority
                                unknown = false;
                            }
                        }

                        if (message.IsCancelled())
                            return;

                        if (_packetHandlers[messageID, 2] != null)
                        {
                            lock (_packetHandlers[messageID, 2])
                            {
                                _packetHandlers[messageID, 2].Invoke(Habbo, message); // Execute Low Priority
                                unknown = false;
                            }
                        }

                        if (message.IsCancelled())
                            return;

                        if (_packetHandlers[messageID, 1] != null)
                        {
                            lock (_packetHandlers[messageID, 1])
                            {
                                _packetHandlers[messageID, 1].Invoke(Habbo, message); // Execute Default Action
                                unknown = false;
                            }
                        }

                        if (_packetHandlers[messageID, 0] != null)
                        {
                            lock (_packetHandlers[messageID, 0])
                            {
                                _packetHandlers[messageID, 0].Invoke(Habbo, message); // Execute Watchers
                                unknown = false;
                            }
                        }
                    }

                    if (unknown)
                    {
                        CoreManager.ServerCore.GetStandardOut().PrintWarning("Packet " + messageID + " ('" +
                                                                             message.GetHeader() + "') unhandled!");
                    }
                }
                catch (IndexOutOfRangeException) // Bad formatting!
                {
                    // TODO: Move this to IHI
                    //IonEnvironment.GetHabboHotel().GetClients().StopClient(_id, 0);
                }
                catch (Exception ex)
                {
                    CoreManager.ServerCore.GetStandardOut().PrintException(ex);
                }
            }
        }
Пример #25
0
        internal byte[] ReadFixedValue()
        {
            int len = Base64Encoding.DecodeInt32(ReadBytes(2));

            return(ReadBytes(len));
        }
Пример #26
0
 internal int PopBase64Int32()
 {
     return(Base64Encoding.DecodeInt32(ReadBytes(2)));
 }
Пример #27
0
 public Int32 PopInt32()
 {
     return(Base64Encoding.DecodeInt32(ReadBytes(2)));
 }
Пример #28
0
 public void method_13(ref byte[] byte_0)
 {
     if (byte_0[0] == 64)
     {
         int i = 0;
         while (i < byte_0.Length)
         {
             try
             {
                 int num = Base64Encoding.DecodeInt32(new byte[]
                 {
                     byte_0[i++],
                     byte_0[i++],
                     byte_0[i++]
                 });
                 uint uint_ = Base64Encoding.DecodeUInt32(new byte[]
                 {
                     byte_0[i++],
                     byte_0[i++]
                 });
                 byte[] array = new byte[num - 2];
                 for (int j = 0; j < array.Length; j++)
                 {
                     array[j] = byte_0[i++];
                 }
                 if (this.class17_0 == null)
                 {
                     this.method_4();
                 }
                 ClientMessage @class = new ClientMessage(uint_, array);
                 if (@class != null)
                 {
                     try
                     {
                         if (int.Parse(GoldTree.GetConfig().data["debug"]) == 1)
                         {
                             Logging.WriteLine(string.Concat(new object[]
                             {
                                 "[",
                                 this.UInt32_0,
                                 "] --> [",
                                 @class.Id,
                                 "] ",
                                 @class.Header,
                                 @class.GetBody()
                             }));
                         }
                     }
                     catch
                     {
                     }
                     Interface @interface;
                     if (GoldTree.smethod_10().Handle(@class.Id, out @interface))
                     {
                         @interface.Handle(this, @class);
                     }
                 }
             }
             catch (Exception ex)
             {
                 Logging.LogException("Error: " + ex.ToString());
                 this.method_12();
             }
         }
     }
     else
     {
         if (true)                //Class13.Boolean_7)
         {
             this.Message1_0.method_4(CrossdomainPolicy.GetXmlPolicy());
             this.Message1_0.Dispose();
         }
     }
 }