public void SendMessage(string string_1)
 {
     this.SendData(HabboIM.GetDefaultEncoding().GetBytes(string_1));
 }
예제 #2
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(HabboIM.GetConfig().data["debug"]) == 1)
                                {
                                    Logging.WriteLine(string.Concat(new object[]
                                    {
                                        "[",
                                        this.ID,
                                        "] --> [",
                                        @class.Id,
                                        "] ",
                                        @class.Header,
                                        @class.GetBody()
                                    }));
                                }
                            }
                            catch
                            {
                            }
                            Interface @interface;
                            if (HabboIM.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)
                {
                    this.Connection.SendMessage(CrossdomainPolicy.GetXmlPolicy());
                    this.Message1_0.SendData(HabboIM.GetDefaultEncoding().GetBytes(CrossdomainPolicy.GetXmlPolicy()));
                    this.Connection.Close();
                }
            }
        }
예제 #3
0
 public string ToBodyString()
 {
     return(HabboIM.GetDefaultEncoding().GetString(this.Body.ToArray()));
 }
예제 #4
0
 public void AppendString(string s)
 {
     this.AppendString(s, HabboIM.GetDefaultEncoding());
 }
예제 #5
0
 public override string ToString()
 {
     return(this.Header + HabboIM.GetDefaultEncoding().GetString(this.Body.ToArray()));
 }