/// <summary> /// Wrap all contents into a byte array for sending /// </summary> public override byte[] Pack() { var buffer = new byte[SizeOf + 1]; base.Pack(ref buffer, buffer.Length); var packer = new SledNetworkBufferPacker(ref buffer, SizeOf); packer.PackByte(What); return buffer; }
/// <summary> /// Wrap all contents into a byte array for sending /// </summary> public override byte[] Pack() { var buffer = new byte[SizeOf + 1 + (2 + Encoding.UTF8.GetBytes(Filter).Length)]; base.Pack(ref buffer, buffer.Length); var packer = new SledNetworkBufferPacker(ref buffer, SizeOf); packer.PackByte(What); packer.PackString(Filter); return buffer; }
/// <summary> /// Wrap all contents into a byte array for sending /// </summary> public override byte[] Pack() { int size = SizeOf // Base + 1 // Byte - what + 1 // Byte - context + 2 // UInt16 - key value pairs count + 2 // Int16 - stack level + 4 // Int32 - index + 2 + Encoding.UTF32.GetBytes(Value).Length // string length + string + 2; // Int16 - value type foreach (var kv in LookUp.NamesAndTypes) { var bytes = Encoding.UTF8.GetBytes(kv.Name); size += 2; // UInt16 - length of string that follows size += bytes.Length; // UInt16 - string size += 2; // UInt16 - name lua_t<type> } var buffer = new byte[size]; base.Pack(ref buffer, buffer.Length); var packer = new SledNetworkBufferPacker(ref buffer, SizeOf); packer.PackByte((Byte)(int)LookUp.Scope); packer.PackByte((Byte)(int)LookUp.Context); packer.PackUInt16((UInt16)LookUp.NamesAndTypes.Count); packer.PackInt16((Int16)LookUp.StackLevel); packer.PackInt32(LookUp.Index); packer.PackString(Value); packer.PackInt16(ValueType); foreach (var kv in LookUp.NamesAndTypes) { packer.PackString(kv.Name); packer.PackUInt16((UInt16)kv.NameType); } return buffer; }
/// <summary> /// Wrap all contents into a byte array for sending /// </summary> public override byte[] Pack() { var buffer = new byte[SizeOf + (2 + Encoding.UTF8.GetBytes(FunctionName).Length) + 1 + 4 + (2 + Encoding.UTF8.GetBytes(RelScriptPath).Length)]; base.Pack(ref buffer, buffer.Length); var packer = new SledNetworkBufferPacker(ref buffer, SizeOf); packer.PackString(FunctionName); packer.PackByte(What); packer.PackInt32(Line); packer.PackString(RelScriptPath); return buffer; }
/// <summary> /// Wrap all contents into a byte array for sending /// </summary> /// <returns>Packed data</returns> public override byte[] Pack() { var buffer = new byte[SizeOf + (2 + Encoding.UTF8.GetBytes(RelFilePath).Length) + 4 + (2 + Encoding.UTF8.GetBytes(Condition).Length) + 1 + 1]; base.Pack(ref buffer, buffer.Length); var packer = new SledNetworkBufferPacker(ref buffer, SizeOf); packer.PackString(RelFilePath); packer.PackInt32(Line); packer.PackString(Condition); packer.PackByte(Result); packer.PackByte(UseFunctionEnvironment); return buffer; }