diff --git a/Client/Client.cs b/Client/Client.cs index e6727d3..f40e671 100644 --- a/Client/Client.cs +++ b/Client/Client.cs @@ -85,6 +85,7 @@ namespace Client bool isJson = DataParser.getJsonIdentifier(this.buffer, out identifier); if (isJson) { + throw new NotImplementedException(); } else if (DataParser.isRawData(this.buffer)) diff --git a/Client/DataParser.cs b/Client/DataParser.cs index 55ce704..4dc71e9 100644 --- a/Client/DataParser.cs +++ b/Client/DataParser.cs @@ -76,7 +76,7 @@ namespace Client /// /// /// the message ready for sending - private static byte[] getMessage(byte[] payload, byte messageId, byte clientId) + public static byte[] getMessage(byte[] payload, byte messageId, byte clientId) { byte[] res = new byte[payload.Length + 6]; diff --git a/Server/Client.cs b/Server/Client.cs index e57b4d7..c4e9d2a 100644 --- a/Server/Client.cs +++ b/Server/Client.cs @@ -129,7 +129,8 @@ namespace Server { Console.WriteLine("Data " + packet); dynamic json = JsonConvert.DeserializeObject(packet); - if (json.data.name == json.data.password) + Console.WriteLine("Name: "+json.data.username + "Password: "+json.data.password); + if (json.data.username == json.data.password) { dynamic payload = new { @@ -145,9 +146,10 @@ namespace Server private void Write(string data) { - byte[] bytes = DataParser.getMessage(Encoding.ASCII.GetBytes(data), 0x01); + byte[] bytes = DataParser.getMessage(Encoding.ASCII.GetBytes(data), 0x01, 0x01); stream.Write(bytes, 0, bytes.Length); stream.Flush(); + Console.WriteLine("Wrote message"); } } }