doctor can see patients who logged on before

This commit is contained in:
shinichi
2020-10-16 15:02:19 +02:00
parent 6fb9d0efaa
commit fd9b321292
4 changed files with 15 additions and 90 deletions

View File

@@ -6,6 +6,7 @@ using Newtonsoft.Json;
using ClientApp.Utils;
using System.Diagnostics;
using Util;
using System.Linq;
namespace Server
{
@@ -168,7 +169,7 @@ namespace Server
Console.WriteLine("Log in");
this.username = username;
sendMessage(DataParser.getLoginResponse("OK"));
sendMessage(DataParser.getStartSessionJson());
//sendMessage(DataParser.getStartSessionJson());
return true;
}
else
@@ -185,6 +186,7 @@ namespace Server
public void sendMessage(byte[] message)
{
Debug.WriteLine("serverclient " + Encoding.ASCII.GetString(message.Skip(5).ToArray()));
stream.BeginWrite(message, 0, message.Length, new AsyncCallback(OnWrite), null);
}

View File

@@ -26,8 +26,9 @@ namespace Server
this.mDoctor = value;
this.clients.ForEach((client) =>
{
var dinges = DataParser.getNewConnectionJson(client.username);
Debug.WriteLine("foreach " + Encoding.ASCII.GetString(dinges));
Debug.WriteLine("foreach called for " + client.username);
byte[] dinges = DataParser.getNewConnectionJson(client.username);
Debug.WriteLine("foreach " + Encoding.ASCII.GetString(dinges.Skip(5).ToArray()));
this.mDoctor.sendMessage(dinges);
});
}
@@ -63,7 +64,8 @@ namespace Server
public void NewLogin(Client client)
{
clients.Add(client);
this.clients.Add(client);
Debug.WriteLine("amount of clients is now " + this.clients.Count);
var dinges = DataParser.getNewConnectionJson(client.username);
Debug.WriteLine("new login" + Encoding.ASCII.GetString(dinges));
Doctor?.sendMessage(dinges);