first commit

This commit is contained in:
Digi
2025-02-23 20:09:12 +01:00
commit f3da4b9c3e
175 changed files with 2729 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace YapperServer.Net.IO
{
class PacketBuilder
{
MemoryStream _ms;
public PacketBuilder()
{
_ms = new MemoryStream();
}
public void WriteOpCode(byte opcode)
{
_ms.WriteByte(opcode);
}
public void WriteString(string msg)
{
var msgLength = msg.Length;
_ms.Write(BitConverter.GetBytes(msgLength));
_ms.Write(Encoding.ASCII.GetBytes(msg));
}
public byte[] GetPacketBytes()
{
return _ms.ToArray();
}
}
}