Ejemplo n.º 1
0
 public static bool append_int16_le(LuaBytes bytes, ushort value)
 {
     return bytes.SetLittleInt16(value, bytes.length);
 }
Ejemplo n.º 2
0
 public static int size(LuaBytes bytes)
 {
     return bytes.length;
 }
Ejemplo n.º 3
0
 public static bool append_byte(LuaBytes bytes, byte value)
 {
     return bytes.SetByte(value, bytes.length);
 }
Ejemplo n.º 4
0
 public static bool set_size(LuaBytes bytes, int capacity)
 {
     try
     {
         bytes.SetCapacity(capacity);
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }
Ejemplo n.º 5
0
 public static bool set_type(LuaBytes bytes, int type)
 {
     bytes.type = type;
     return true;
 }
Ejemplo n.º 6
0
 public static bool set_bytes(LuaBytes bytes, int offset, LuaBytes src, int length)
 {
     return bytes.SetBytes(src, offset - 1, length);
 }
Ejemplo n.º 7
0
 public static bool set_int32_le(LuaBytes bytes, int offset, uint value)
 {
     return bytes.SetLittleInt32(value, offset - 1);
 }
Ejemplo n.º 8
0
 public static LuaBytes get_bytes(LuaBytes bytes, int offset, int len)
 {
     byte[] b = bytes.GetBytes(offset - 1, len);
     return new LuaBytes(b);
 }
Ejemplo n.º 9
0
 public static int get_int16_be(LuaBytes bytes, int offset)
 {
     return bytes.GetShortBig(offset - 1);
 }
Ejemplo n.º 10
0
 public static int append_var_int(LuaBytes bytes, uint value)
 {
     return bytes.SetVarInt(value, bytes.length);
 }
Ejemplo n.º 11
0
 public static byte get_byte(LuaBytes bytes, int offset)
 {
     return bytes.GetByte(offset-1);
 }
Ejemplo n.º 12
0
 public static bool append_string(LuaBytes bytes, string value)
 {
     return bytes.SetString(value, bytes.length);
 }
Ejemplo n.º 13
0
 public static bool append_int64_le(LuaBytes bytes, ulong value)
 {
     return bytes.SetLittleInt64(value, bytes.length);
 }
Ejemplo n.º 14
0
        private object UnpackBlob(int count)
        {
            int type = buffer[offset++];
            count--;
            object val;

            switch (type)
            {
                case ParticleType.STRING:
                    val = ByteUtil.Utf8ToString(buffer, offset, count);
                    break;

                case ParticleType.CSHARP_BLOB:
                    val = ByteUtil.BytesToObject(buffer, offset, count);
                    break;

                default:
                    byte[] dest = new byte[count];
                    Array.Copy(buffer, offset, dest, 0, count);

                    if (lua)
                    {
                        val = new LuaBytes(dest);
                    }
                    else
                    {
                        val = dest;
                    }
                    break;
            }
            offset += count;
            return val;
        }
 public static int get_type(LuaBytes bytes)
 {
     return(bytes.type);
 }
Ejemplo n.º 16
0
 public static int get_int16_le(LuaBytes bytes, int offset)
 {
     return bytes.GetShortLittle(offset - 1);
 }
Ejemplo n.º 17
0
 public static bool set_byte(LuaBytes bytes, int offset, byte value)
 {
     return bytes.SetByte(value, offset - 1);
 }
Ejemplo n.º 18
0
 public static int get_int32_be(LuaBytes bytes, int offset)
 {
     return bytes.GetIntBig(offset - 1);
 }
Ejemplo n.º 19
0
 public static bool set_int16_le(LuaBytes bytes, int offset, ushort value)
 {
     return bytes.SetLittleInt16(value, offset - 1);
 }
Ejemplo n.º 20
0
 public static int get_int32_le(LuaBytes bytes, int offset)
 {
     return bytes.GetIntLittle(offset - 1);
 }
Ejemplo n.º 21
0
 public static bool set_int64_le(LuaBytes bytes, int offset, ulong value)
 {
     return bytes.SetLittleInt64(value, offset - 1);
 }
Ejemplo n.º 22
0
 public static long get_int64_be(LuaBytes bytes, int offset)
 {
     return bytes.GetLongBig(offset - 1);
 }
Ejemplo n.º 23
0
 public static bool set_string(LuaBytes bytes, int offset, string value)
 {
     return bytes.SetString(value, offset - 1);
 }
Ejemplo n.º 24
0
 public static long get_int64_le(LuaBytes bytes, int offset)
 {
     return bytes.GetLongLittle(offset - 1);
 }
Ejemplo n.º 25
0
 public static int set_var_int(LuaBytes bytes, int offset, uint value)
 {
     return bytes.SetVarInt(value, offset - 1);
 }
Ejemplo n.º 26
0
 public static string get_string(LuaBytes bytes, int offset, int len)
 {
     return bytes.GetString(offset - 1, len);
 }
Ejemplo n.º 27
0
 public bool SetBytes(LuaBytes value, int offset, int len)
 {
     try
     {
         if (len == 0 || len > value.length)
         {
             len = value.length;
         }
         int capacity = offset + len;
         EnsureCapacity(capacity);
         Array.Copy(value.bytes, 0, bytes, offset, len);
         ResetSize(capacity);
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }
Ejemplo n.º 28
0
 public static int get_type(LuaBytes bytes)
 {
     return bytes.type;
 }
Ejemplo n.º 29
0
 public static bool append_bytes(LuaBytes bytes, LuaBytes src, int length)
 {
     return bytes.SetBytes(src, bytes.length, length);
 }
Ejemplo n.º 30
0
        public static int get_var_int(LuaBytes bytes, int offset, out int size)
        {
            offset--;

            if (offset < 0 || offset > bytes.length)
            {
                size = 0;
                return 0;
            }
            return ByteUtil.VarBytesToInt(bytes.bytes, offset, out size);
        }
Ejemplo n.º 31
0
 public static bool append_int32_be(LuaBytes bytes, uint value)
 {
     return bytes.SetBigInt32(value, bytes.length);
 }
 public static int size(LuaBytes bytes)
 {
     return(bytes.length);
 }