From 5049bd3a38adc7cd457de03e56cd21bd22362495 Mon Sep 17 00:00:00 2001 From: Kenneth van Ewijk Date: Fri, 2 Oct 2015 12:47:22 +0200 Subject: [PATCH] Changed login procedure --- ErgometerLibrary/NetCommand.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ErgometerLibrary/NetCommand.cs b/ErgometerLibrary/NetCommand.cs index d32aa8b..1f2586d 100644 --- a/ErgometerLibrary/NetCommand.cs +++ b/ErgometerLibrary/NetCommand.cs @@ -139,16 +139,13 @@ namespace ErgometerLibrary private static NetCommand ParseLoginRequest(int session, string[] args) { bool doctor = bool.Parse(args[1]); - if (doctor && args.Length != 3) + if (args.Length != 3) throw new MissingFieldException("Error in NetCommand: Doctor login is missing arguments"); - else if (args.Length != 2) - throw new MissingFieldException("Error in NetCommand: Client login is missing arguments"); NetCommand temp = new NetCommand(CommandType.LOGIN, session); temp.IsDoctor = doctor; temp.DisplayName = args[0]; - if (doctor) - temp.Password = args[2]; + temp.Password = args[2]; return temp; } @@ -160,7 +157,7 @@ namespace ErgometerLibrary switch (Type) { case CommandType.LOGIN: - command += "1»ses" + Session + "»" + DisplayName + "»" + IsDoctor + (IsDoctor ? "»" + Password : ""); + command += "1»ses" + Session + "»" + DisplayName + "»" + IsDoctor + "»" + Password; break; case CommandType.DATA: command += "2»ses" + Session + "»" + Meting.ToCommand();