Fixed skip/clear bug

This commit is contained in:
Aareschluchtje
2015-10-02 10:57:35 +02:00
parent 62901bc6ec
commit 3c9450462e
+10 -7
View File
@@ -73,8 +73,11 @@ namespace ErgometerLibrary
else else
throw new FormatException("Error in NetCommend: " + com[1] + " is not a valid session."); throw new FormatException("Error in NetCommend: " + com[1] + " is not a valid session.");
string[] args = com; string[] args = new string[9];
Array.Clear(args, 0, 2); for (int i = 2; i < com.Length; i++)
{
args[i - 2] = com[i];
}
switch (comType) switch (comType)
{ {
@@ -135,17 +138,17 @@ namespace ErgometerLibrary
private static NetCommand ParseLoginRequest(int session, string[] args) private static NetCommand ParseLoginRequest(int session, string[] args)
{ {
bool doctor = bool.Parse(args[3]); bool doctor = bool.Parse(args[1]);
if (doctor && args.Length != 5) if (doctor && args.Length != 3)
throw new MissingFieldException("Error in NetCommand: Doctor login is missing arguments"); throw new MissingFieldException("Error in NetCommand: Doctor login is missing arguments");
else if(args.Length != 4) else if (args.Length != 2)
throw new MissingFieldException("Error in NetCommand: Client login is missing arguments"); throw new MissingFieldException("Error in NetCommand: Client login is missing arguments");
NetCommand temp = new NetCommand(CommandType.LOGIN, session); NetCommand temp = new NetCommand(CommandType.LOGIN, session);
temp.IsDoctor = doctor; temp.IsDoctor = doctor;
temp.DisplayName = args[2]; temp.DisplayName = args[0];
if (doctor) if (doctor)
temp.Password = args[4]; temp.Password = args[2];
return temp; return temp;
} }