From 581b6bd5ee968a8646b744379144d12dd86387a8 Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Mon, 22 Jun 2020 22:36:43 +0200 Subject: [PATCH] Construct tristanable pakcet. --- source/tristanable/manager.d | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/source/tristanable/manager.d b/source/tristanable/manager.d index 29120ea..28039f0 100644 --- a/source/tristanable/manager.d +++ b/source/tristanable/manager.d @@ -36,7 +36,7 @@ public final class Manager { /* Set the socket */ socket = endpoint; - + /* TODO: Create the watcher */ watcher = new Watcher(this, endpoint); @@ -51,11 +51,22 @@ public final class Manager public void sendMessage(ulong tag, byte[] data) { - /* TODO: Implement me */ - /* Construct the message array */ byte[] messageData; + /* Add the `tag` bytes */ + messageData ~= *(cast(byte*)&tag); + messageData ~= *(cast(byte*)&tag+1); + messageData ~= *(cast(byte*)&tag+2); + messageData ~= *(cast(byte*)&tag+3); + messageData ~= *(cast(byte*)&tag+4); + messageData ~= *(cast(byte*)&tag+5); + messageData ~= *(cast(byte*)&tag+6); + messageData ~= *(cast(byte*)&tag+7); + + /* Add the `data` bytes (the actual message) */ + messageData ~= data; + /* Send the message */ bSendMessage(endpoint, messageData);