Ejemplo n.º 1
0
        internal uint PopWiredUInt()
        {
            //int i = PopWiredInt32();

            //try
            //{
            //    return (uint)i;
            //}
            //catch (Exception e)
            //{
            //    Logging.LogException("OVerflow: I: " + i);
            //    thRow e;
            //}

            if (RemainingLength < 1)
            {
                return(0);
            }

            byte[] Data = PlainReadBytes(WireEncoding.MAX_INTEGER_BYTE_AMOUNT);

            Int32 TotalBytes = 0;
            uint  i          = WireEncoding.DecodeUInt32(Data, out TotalBytes);

            Pointer += TotalBytes;

            return(i);
        }
Ejemplo n.º 2
0
        public int ReadVL64()
        {
            int value = WireEncoding.DecodeInt32(GetBytes(buffer.ReadableBytes), out int totalBytes);

            ReadBytes(totalBytes);

            return(value);
        }
Ejemplo n.º 3
0
        public int PopWiredInt32()
        {
            if (this.RemainingLength < 1)
            {
                return(0);
            }
            byte[] bzData     = this.PlainReadBytes(6);
            int    totalBytes = 0;
            int    num2       = WireEncoding.DecodeInt32(bzData, out totalBytes);

            this.Pointer += totalBytes;
            return(num2);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///   Reads the next wire encoded 32 bit integer from the message content and advances the reader cursor.
        /// </summary>
        /// <returns>Int32</returns>
        public Int32 PopWiredInt32()
        {
            if (GetRemainingContent() == 0)
            {
                return(0);
            }

            byte[] bzData = ReadBytesFreezeCursor(WireEncoding.MaxIntegerByteAmount);
            int    totalBytes;
            int    i = WireEncoding.DecodeInt32(bzData, out totalBytes);

            _contentCursor += totalBytes;

            return(i);
        }
Ejemplo n.º 5
0
        public int GetInt32()
        {
            try
            {
                var Bytes  = GetBytes(WireEncoding.MAX_INTEGER_BYTE_AMOUNT);
                var Length = new int();

                var Result = WireEncoding.DecodeInt32(Bytes, out Length);

                PointerLength += Length;

                return(Result);
            }
            catch { return(0); }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Reads the next wire encoded 32 bit integer from the message content and advances the reader cursor.
        /// </summary>
        /// <returns>Int32</returns>
        internal Int32 PopWiredInt32()
        {
            if (this.remainingContent == 0)
            {
                return(0);
            }

            byte[] bzData     = this.ReadBytesFreezeCursor(WireEncoding.MAX_INTEGER_BYTE_AMOUNT);
            Int32  totalBytes = 0;
            Int32  i          = WireEncoding.DecodeInt32(bzData, out totalBytes);

            fContentCursor += totalBytes;

            return(i);
        }
Ejemplo n.º 7
0
        internal Int32 PopWiredInt32()
        {
            if (RemainingLength < 1)
            {
                return(0);
            }

            byte[] Data = PlainReadBytes(WireEncoding.MAX_INTEGER_BYTE_AMOUNT);

            Int32 TotalBytes = 0;
            Int32 i          = WireEncoding.DecodeInt32(Data, out TotalBytes);

            Pointer += TotalBytes;

            return(i);
        }
Ejemplo n.º 8
0
        public void Append(object Item)
        {
            var Type = Item.GetType();

            if (Type == typeof(int))
            {
                this.Content.AddRange(WireEncoding.EncodeInt32((int)Item));
            }
            else if (Type == typeof(string))
            {
                this.Content.AddRange(Encoding.ASCII.GetBytes(Item as string));
                this.Content.Add(STRING_CHARACTER);
            }
            else if (Type == typeof(bool))
            {
                this.Content.AddRange(WireEncoding.EncodeInt32((bool)Item ? 1 : 0));
            }
        }
Ejemplo n.º 9
0
        public int PopWiredInt32()
        {
            int i;

            if (this.RemainingLength < 1)
            {
                i = 0;
            }
            else
            {
                byte[] Data       = this.PlainReadBytes(6);
                int    TotalBytes = 0;
                int    num2       = WireEncoding.DecodeInt32(Data, out TotalBytes);
                this.Pointer += TotalBytes;
                i             = num2;
            }
            return(i);
        }
Ejemplo n.º 10
0
 internal void AppendInt32(Int32 i)
 {
     AppendBytes(WireEncoding.EncodeInt32(i));
 }
Ejemplo n.º 11
0
 public void AppendInt32(int i)
 {
     this.AppendBytes(WireEncoding.EncodeInt32(i));
 }
Ejemplo n.º 12
0
 public void AppendInt32(Int32 i)
 {
     AppendBytes(WireEncoding.EncodeInt32(i));
 }
Ejemplo n.º 13
0
 public void AppendInt32WithBreak(int i, byte BreakChar)
 {
     this.AppendBytes(WireEncoding.EncodeInt32(i));
     this.AppendByte(BreakChar);
 }
Ejemplo n.º 14
0
 public void AppendInt32WithBreak(int i)
 {
     this.AppendBytes(WireEncoding.EncodeInt32(i));
     this.AppendByte(2);
 }
Ejemplo n.º 15
0
        /// <summary>
        ///   Appends a wire encoded 32 bit integer to the message content.
        /// </summary>
        /// <param name = "i">The 32 bit integer to encode and append.</param>
        public IInternalOutgoingMessage AppendInt32(Int32 i)
        {
            Append(WireEncoding.EncodeInt32(i));

            return(this);
        }
Ejemplo n.º 16
0
 public void AppendVL64(int value)
 {
     buffer.AddRange(WireEncoding.EncodeInt32(value));
 }