Develop #10

Merged
SemvdH merged 229 commits from develop into master 2020-10-29 22:50:49 +00:00
Showing only changes of commit 5bacfdc8ce - Show all commits

View File

@@ -100,9 +100,14 @@ namespace Server
handleLogin(payloadbytes);
break;
case DataParser.LOGIN_DOCTOR:
handleLogin(payloadbytes);
communication.doctor = this;
Console.WriteLine("Set doctor to " + communication.doctor + " , this is " + this);
if (communication.doctor != null)
return;
if (handleLogin(payloadbytes))
{
communication.doctor = this;
Console.WriteLine("Set doctor to " + communication.doctor + " , this is " + this);
}
break;
case DataParser.START_SESSION:
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 password;
@@ -164,6 +169,7 @@ namespace Server
sendMessage(DataParser.getLoginResponse("OK"));
sendMessage(DataParser.getStartSessionJson());
communication.NewLogin(this);
return true;
}
else
{
@@ -174,6 +180,7 @@ namespace Server
{
sendMessage(DataParser.getLoginResponse("invalid json"));
}
return false;
}
public void sendMessage(byte[] message)