Example #1
0
        /// <summary>
        ///     Gets the reversed bytes.
        /// </summary>
        /// <returns>System.Byte[].</returns>
        public byte[] GetReversedBytes()
        {
            byte[] bytes;

            using (MemoryStream finalBuffer = new MemoryStream())
            {
                byte[] length = BitConverter.GetBytes((int)CurrentMessage.Length);
                Array.Reverse(length);
                finalBuffer.Write(length, 0, length.Length);

                CurrentMessage.WriteTo(finalBuffer);

                bytes = finalBuffer.ToArray();
            }

            if (Yupi.PacketDebugMode)
            {
                Console.ForegroundColor = ConsoleColor.DarkBlue;
                Console.WriteLine();
                Console.Write("OUTGOING ");
                Console.ForegroundColor = ConsoleColor.DarkGreen;
                Console.Write("PREPARED ");
                Console.ForegroundColor = ConsoleColor.DarkGray;
                Console.Write(Id + Environment.NewLine +
                              HabboEncoding.GetCharFilter(Yupi.GetDefaultEncoding().GetString(bytes)));
                Console.WriteLine();
            }

            return(bytes);
        }
Example #2
0
 internal bool GetIntegerAsBool() => HabboEncoding.DecodeInt32(_body, ref _position) == 1;
Example #3
0
 /// <summary>
 ///     Gets the integer.
 /// </summary>
 /// <returns>System.Int32.</returns>
 internal int GetInteger() => HabboEncoding.DecodeInt32(_body, ref _position);
Example #4
0
 /// <summary>
 ///     Gets the integer16.
 /// </summary>
 /// <returns>System.Int16.</returns>
 internal short GetInteger16() => HabboEncoding.DecodeInt16(_body, ref _position);
Example #5
0
 /// <summary>
 ///     Returns a <see cref="System.String" /> that represents this instance.
 /// </summary>
 /// <returns>A <see cref="System.String" /> that represents this instance.</returns>
 public override string ToString()
 => HabboEncoding.GetCharFilter(Yupi.GetDefaultEncoding().GetString(GetReversedBytes()));