From 659b481c4325d79cd48bd3453a3a66adb8aac3d6 Mon Sep 17 00:00:00 2001 From: Aareschluchtje Date: Mon, 28 Sep 2015 12:54:21 +0200 Subject: [PATCH] Fixed some errors in library. --- ErgometerLibrary/NetCommand.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ErgometerLibrary/NetCommand.cs b/ErgometerLibrary/NetCommand.cs index 1334c8f..ace8cce 100644 --- a/ErgometerLibrary/NetCommand.cs +++ b/ErgometerLibrary/NetCommand.cs @@ -73,7 +73,8 @@ namespace ErgometerLibrary else 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) { @@ -134,7 +135,7 @@ namespace ErgometerLibrary 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) throw new MissingFieldException("Error in NetCommand: Doctor login is missing arguments"); else if(args.Length != 4) @@ -142,9 +143,9 @@ namespace ErgometerLibrary NetCommand temp = new NetCommand(CommandType.LOGIN, session); temp.IsDoctor = doctor; - temp.DisplayName = args[0]; + temp.DisplayName = args[2]; if (doctor) - temp.Password = args[2]; + temp.Password = args[4]; return temp; }