[ADD] add constant identifiers to JSONConvert and made serverclient and client use them

This commit is contained in:
Sem van der Hoeven
2020-10-20 15:50:26 +02:00
parent d9f2b97d3e
commit 5732f0b31d
3 changed files with 17 additions and 8 deletions

View File

@@ -7,6 +7,10 @@ namespace SharedClientServer
{
class JSONConvert
{
public const byte LOGIN = 0x01;
public const byte MESSAGE = 0x02;
public const byte LOBBY = 0x03;
public const byte CANVAS = 0x04;
public static (string,string) GetUsernameAndMessage(byte[] json)
{
string msg = Encoding.ASCII.GetString(json);
@@ -21,6 +25,11 @@ namespace SharedClientServer
return payload.username;
}
public static byte[] GetUsernameMessage(string username)
{
}
/// <summary>
/// constructs a message that can be sent to the clients or server
/// </summary>