Develop #10
@@ -100,9 +100,14 @@ namespace Server
|
|||||||
handleLogin(payloadbytes);
|
handleLogin(payloadbytes);
|
||||||
break;
|
break;
|
||||||
case DataParser.LOGIN_DOCTOR:
|
case DataParser.LOGIN_DOCTOR:
|
||||||
handleLogin(payloadbytes);
|
if (communication.doctor != null)
|
||||||
communication.doctor = this;
|
return;
|
||||||
Console.WriteLine("Set doctor to " + communication.doctor + " , this is " + this);
|
|
||||||
|
if (handleLogin(payloadbytes))
|
||||||
|
{
|
||||||
|
communication.doctor = this;
|
||||||
|
Console.WriteLine("Set doctor to " + communication.doctor + " , this is " + this);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case DataParser.START_SESSION:
|
case DataParser.START_SESSION:
|
||||||
this.saveData = new SaveData(Directory.GetCurrentDirectory() + "/" + this.username + "/" + sessionStart.ToString("yyyy-MM-dd HH-mm-ss"));
|
this.saveData = new SaveData(Directory.GetCurrentDirectory() + "/" + this.username + "/" + sessionStart.ToString("yyyy-MM-dd HH-mm-ss"));
|
||||||
@@ -150,7 +155,7 @@ namespace Server
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleLogin(byte[] payloadbytes)
|
private bool handleLogin(byte[] payloadbytes)
|
||||||
{
|
{
|
||||||
string username;
|
string username;
|
||||||
string password;
|
string password;
|
||||||
@@ -164,6 +169,7 @@ namespace Server
|
|||||||
sendMessage(DataParser.getLoginResponse("OK"));
|
sendMessage(DataParser.getLoginResponse("OK"));
|
||||||
sendMessage(DataParser.getStartSessionJson());
|
sendMessage(DataParser.getStartSessionJson());
|
||||||
communication.NewLogin(this);
|
communication.NewLogin(this);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -174,6 +180,7 @@ namespace Server
|
|||||||
{
|
{
|
||||||
sendMessage(DataParser.getLoginResponse("invalid json"));
|
sendMessage(DataParser.getLoginResponse("invalid json"));
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendMessage(byte[] message)
|
public void sendMessage(byte[] message)
|
||||||
|
|||||||
Reference in New Issue
Block a user