update
This commit is contained in:
@@ -3,7 +3,6 @@ using System.IO;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
using ClientApp.Utils;
|
||||
using System.Diagnostics;
|
||||
using Util;
|
||||
|
||||
@@ -110,10 +109,10 @@ namespace Server
|
||||
}
|
||||
break;
|
||||
case DataParser.START_SESSION:
|
||||
this.saveData = new SaveData(Directory.GetCurrentDirectory() + "/" + this.username + "/" + sessionStart.ToString("yyyy-MM-dd HH-mm-ss"));
|
||||
this.communication.StartSessionUser(DataParser.getUsernameFromJson(payloadbytes));
|
||||
break;
|
||||
case DataParser.STOP_SESSION:
|
||||
this.saveData = null;
|
||||
this.communication.StopSessionUser(DataParser.getUsernameFromJson(payloadbytes));
|
||||
break;
|
||||
case DataParser.SET_RESISTANCE:
|
||||
bool worked = DataParser.getResistanceFromResponseJson(payloadbytes);
|
||||
@@ -242,5 +241,15 @@ namespace Server
|
||||
hex.AppendFormat("{0:x2}", b);
|
||||
return hex.ToString();
|
||||
}
|
||||
|
||||
public void StartSession()
|
||||
{
|
||||
this.saveData = new SaveData(Directory.GetCurrentDirectory() + "/" + this.username + "/" + sessionStart.ToString("yyyy-MM-dd HH-mm-ss"));
|
||||
}
|
||||
|
||||
public void StopSession()
|
||||
{
|
||||
this.saveData = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.IO.Pipes;
|
||||
using System.Linq;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using DoctorApp.Utils;
|
||||
using Util;
|
||||
|
||||
namespace Server
|
||||
@@ -56,5 +55,30 @@ namespace Server
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void StartSessionUser(string user)
|
||||
{
|
||||
foreach(Client client in clients)
|
||||
{
|
||||
if(client.username == user)
|
||||
{
|
||||
client.sendMessage(DataParser.getStartSessionJson(user));
|
||||
client.StartSession();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void StopSessionUser(string user)
|
||||
{
|
||||
foreach (Client client in clients)
|
||||
{
|
||||
if (client.username == user)
|
||||
{
|
||||
client.sendMessage(DataParser.getStopSessionJson(user));
|
||||
client.StopSession();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user