Skip to content

Commit

Permalink
[Core] Fixed Sending for LightAppEntity.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Linwenxuan authored and Linwenxuan committed Feb 11, 2024
1 parent 6941e3a commit 6054789
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Lagrange.Core/Message/Entity/LightAppEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ IEnumerable<Elem> IMessageEntity.PackElement()
{
using var payload = new BinaryPacket()
.WriteByte(0x01)
.WriteBytes(ZCompression.ZDecompress(Encoding.UTF8.GetBytes(Payload)));
.WriteBytes(ZCompression.ZCompress(Encoding.UTF8.GetBytes(Payload)));

return new Elem[]
{
Expand Down
12 changes: 12 additions & 0 deletions Lagrange.Core/Message/MessageBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,18 @@ public MessageBuilder Poke(uint type = 1)

return this;
}

/// <summary>
/// Add a dedicated LightApp entity to message chain
/// </summary>
/// <param name="payload">Json Payload</param>
public MessageBuilder LightApp(string payload)
{
var pokeEntity = new LightAppEntity(payload);
_chain.Add(pokeEntity);

return this;
}

public MessageBuilder File(byte[] file, string fileName)
{
Expand Down

0 comments on commit 6054789

Please sign in to comment.