Changed old sessions
This commit is contained in:
@@ -74,11 +74,11 @@ namespace ErgometerServer
|
||||
}
|
||||
break;
|
||||
case NetCommand.RequestType.ALLSESSIONS:
|
||||
int[] sessions = FileHandler.GetAllSessions();
|
||||
sendToDoctor(new NetCommand(NetCommand.LengthType.SESSIONS, sessions.Length, input.Session));
|
||||
for (int i = 0; i < sessions.Length; i++)
|
||||
List<Tuple<int, string, double>> sessions = FileHandler.GetAllSessions();
|
||||
sendToDoctor(new NetCommand(NetCommand.LengthType.SESSIONS, sessions.Count, input.Session));
|
||||
foreach(Tuple<int,string,double> session in sessions)
|
||||
{
|
||||
sendToDoctor(new NetCommand(NetCommand.CommandType.SESSION, sessions[i]));
|
||||
sendToDoctor(new NetCommand(session.Item2, session.Item3, session.Item1));
|
||||
}
|
||||
break;
|
||||
case NetCommand.RequestType.SESSIONDATA:
|
||||
@@ -86,7 +86,7 @@ namespace ErgometerServer
|
||||
sendToDoctor(new NetCommand(NetCommand.LengthType.SESSIONDATA, currentsessionsdata.Count, input.Session));
|
||||
foreach (Tuple<int, string> ses in currentsessionsdata)
|
||||
{
|
||||
sendToDoctor(new NetCommand(ses.Item2, false, ses.Item1));
|
||||
sendToDoctor(new NetCommand(ses.Item2, Helper.Now, ses.Item1));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -33,9 +33,9 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ErgometerLibrary, Version=1.0.2.8, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Include="ErgometerLibrary, Version=1.0.3.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\ErgometerLibrary\ErgometerLibrary\ErgometerLibrary\bin\Debug\ErgometerLibrary.dll</HintPath>
|
||||
<HintPath>..\..\ErgometerLibrary\ErgometerLibrary\bin\Debug\ErgometerLibrary.dll</HintPath>
|
||||
</Reference>
|
||||
<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>
|
||||
|
||||
@@ -82,15 +82,19 @@ namespace ErgometerServer
|
||||
return metingen;
|
||||
}
|
||||
|
||||
public static int[] GetAllSessions()
|
||||
public static List<Tuple<int, string, double>> GetAllSessions()
|
||||
{
|
||||
string[] directories = Directory.GetDirectories(DataFolder);
|
||||
int[] sessions = new int[directories.Length];
|
||||
List<Tuple<int,string,double>> sessiondata = new List<Tuple<int, string, double>>();
|
||||
for (int i = 0; i < directories.Length; i++)
|
||||
{
|
||||
sessions[i] = int.Parse(directories[i]);
|
||||
string props = File.ReadAllText(GetSessionFile(int.Parse(directories[i])));
|
||||
string[] properties = props.Split('\n');
|
||||
string name = properties[0];
|
||||
double date = double.Parse(properties[1]);
|
||||
sessiondata.Add(new Tuple<int, string, double>(int.Parse(directories[i]), name, date));
|
||||
}
|
||||
return sessions;
|
||||
return sessiondata;
|
||||
}
|
||||
|
||||
public static void WriteChat(int session, List<ChatMessage> chat)
|
||||
|
||||
Reference in New Issue
Block a user