Fixed some errors in library.

This commit is contained in:
Aareschluchtje
2015-09-28 12:54:21 +02:00
parent 698748eefb
commit 659b481c43
+5 -4
View File
@@ -73,7 +73,8 @@ 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 = (string[]) com.Skip(2); string[] args = com;
Array.Clear(args, 0, 2);
switch (comType) switch (comType)
{ {
@@ -134,7 +135,7 @@ namespace ErgometerLibrary
private static NetCommand ParseLoginRequest(int session, string[] args) private static NetCommand ParseLoginRequest(int session, string[] args)
{ {
bool doctor = bool.Parse(args[1]); bool doctor = bool.Parse(args[3]);
if (doctor && args.Length != 5) if (doctor && args.Length != 5)
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 != 4)
@@ -142,9 +143,9 @@ namespace ErgometerLibrary
NetCommand temp = new NetCommand(CommandType.LOGIN, session); NetCommand temp = new NetCommand(CommandType.LOGIN, session);
temp.IsDoctor = doctor; temp.IsDoctor = doctor;
temp.DisplayName = args[0]; temp.DisplayName = args[2];
if (doctor) if (doctor)
temp.Password = args[2]; temp.Password = args[4];
return temp; return temp;
} }