shit
This commit is contained in:
@@ -85,6 +85,7 @@ namespace Client
|
|||||||
bool isJson = DataParser.getJsonIdentifier(this.buffer, out identifier);
|
bool isJson = DataParser.getJsonIdentifier(this.buffer, out identifier);
|
||||||
if (isJson)
|
if (isJson)
|
||||||
{
|
{
|
||||||
|
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
else if (DataParser.isRawData(this.buffer))
|
else if (DataParser.isRawData(this.buffer))
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ namespace Client
|
|||||||
/// <param name="messageId"></param>
|
/// <param name="messageId"></param>
|
||||||
/// <param name="clientId"></param>
|
/// <param name="clientId"></param>
|
||||||
/// <returns>the message ready for sending</returns>
|
/// <returns>the message ready for sending</returns>
|
||||||
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];
|
byte[] res = new byte[payload.Length + 6];
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,8 @@ namespace Server
|
|||||||
{
|
{
|
||||||
Console.WriteLine("Data " + packet);
|
Console.WriteLine("Data " + packet);
|
||||||
dynamic json = JsonConvert.DeserializeObject(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
|
dynamic payload = new
|
||||||
{
|
{
|
||||||
@@ -145,9 +146,10 @@ namespace Server
|
|||||||
|
|
||||||
private void Write(string data)
|
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.Write(bytes, 0, bytes.Length);
|
||||||
stream.Flush();
|
stream.Flush();
|
||||||
|
Console.WriteLine("Wrote message");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user