Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -57,13 +57,20 @@ namespace ErgometerServer
|
|||||||
sendToDoctor(new NetCommand(user.Key, user.Value, input.Session));
|
sendToDoctor(new NetCommand(user.Key, user.Value, input.Session));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case NetCommand.RequestType.CHAT:
|
||||||
|
List<ChatMessage> chat = FileHandler.ReadChat(input.Session);
|
||||||
|
foreach (ChatMessage msg in chat)
|
||||||
|
{
|
||||||
|
Thread.Sleep(10);
|
||||||
|
sendToDoctor(new NetCommand(msg.Message, msg.IsDoctor, input.Session));
|
||||||
|
}
|
||||||
|
break;
|
||||||
case NetCommand.RequestType.OLDDATA:
|
case NetCommand.RequestType.OLDDATA:
|
||||||
List<Meting> metingen = FileHandler.ReadMetingen(input.Session);
|
List<Meting> metingen = FileHandler.ReadMetingen(input.Session);
|
||||||
foreach (Meting meting in metingen)
|
foreach (Meting meting in metingen)
|
||||||
{
|
{
|
||||||
Thread.Sleep(10);
|
Thread.Sleep(10);
|
||||||
sendToDoctor(new NetCommand(meting, input.Session));
|
sendToDoctor(new NetCommand(meting, input.Session));
|
||||||
Console.WriteLine(new NetCommand(meting, input.Session));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NetCommand.RequestType.ALLSESSIONS:
|
case NetCommand.RequestType.ALLSESSIONS:
|
||||||
|
|||||||
@@ -33,9 +33,9 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="ErgometerLibrary, Version=1.0.3.1, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="ErgometerLibrary, Version=1.0.3.5, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\ErgometerLibrary\ErgometerLibrary\bin\Debug\ErgometerLibrary.dll</HintPath>
|
<HintPath>..\..\..\ErgometerLibrary\ErgometerLibrary\ErgometerLibrary\bin\Debug\ErgometerLibrary.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ namespace ErgometerServer
|
|||||||
File.WriteAllText(GetSessionMetingen(session), json);
|
File.WriteAllText(GetSessionMetingen(session), json);
|
||||||
Console.WriteLine("Writing metingen: " + GetSessionMetingen(session));
|
Console.WriteLine("Writing metingen: " + GetSessionMetingen(session));
|
||||||
}
|
}
|
||||||
|
File.WriteAllText(GetSessionFile(session), File.ReadAllText(GetSessionFile(session)) + Environment.NewLine + Helper.Now);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Meting> ReadMetingen(int session)
|
public static List<Meting> ReadMetingen(int session)
|
||||||
@@ -102,6 +103,7 @@ namespace ErgometerServer
|
|||||||
{
|
{
|
||||||
if (Directory.Exists(GetSessionFolder(session)))
|
if (Directory.Exists(GetSessionFolder(session)))
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
string write = "";
|
string write = "";
|
||||||
foreach (ChatMessage c in chat)
|
foreach (ChatMessage c in chat)
|
||||||
{
|
{
|
||||||
@@ -110,9 +112,21 @@ namespace ErgometerServer
|
|||||||
|
|
||||||
File.WriteAllText(GetSessionChat(session), write);
|
File.WriteAllText(GetSessionChat(session), write);
|
||||||
Console.WriteLine("Writing chat: " + GetSessionChat(session));
|
Console.WriteLine("Writing chat: " + GetSessionChat(session));
|
||||||
|
*/
|
||||||
|
string json = Newtonsoft.Json.JsonConvert.SerializeObject(chat.ToArray());
|
||||||
|
File.WriteAllText(GetSessionChat(session), json);
|
||||||
|
Console.WriteLine("Writing chat: " + GetSessionChat(session));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<ChatMessage> ReadChat(int session)
|
||||||
|
{
|
||||||
|
string json = File.ReadAllText(GetSessionChat(session));
|
||||||
|
|
||||||
|
List<ChatMessage> chat = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ChatMessage>>(json);
|
||||||
|
return chat;
|
||||||
|
}
|
||||||
|
|
||||||
private static string GetSessionFolder(int session)
|
private static string GetSessionFolder(int session)
|
||||||
{
|
{
|
||||||
return Path.Combine(DataFolder, session.ToString());
|
return Path.Combine(DataFolder, session.ToString());
|
||||||
@@ -127,7 +141,7 @@ namespace ErgometerServer
|
|||||||
}
|
}
|
||||||
private static string GetSessionChat(int session)
|
private static string GetSessionChat(int session)
|
||||||
{
|
{
|
||||||
return Path.Combine(DataFolder, session.ToString(), "chat.log");
|
return Path.Combine(DataFolder, session.ToString(), "chat.ergo");
|
||||||
}
|
}
|
||||||
|
|
||||||
//USER MANAGEMENT
|
//USER MANAGEMENT
|
||||||
|
|||||||
Reference in New Issue
Block a user