From 96deb8b9bbde3c81cbff8e2652aaf6d7e448652d Mon Sep 17 00:00:00 2001 From: Kenneth van Ewijk Date: Wed, 21 Oct 2015 09:33:13 +0200 Subject: [PATCH] Possible encrypt fix --- ErgometerLibrary/NetHelper.cs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/ErgometerLibrary/NetHelper.cs b/ErgometerLibrary/NetHelper.cs index 00fbf04..d344b6b 100644 --- a/ErgometerLibrary/NetHelper.cs +++ b/ErgometerLibrary/NetHelper.cs @@ -57,24 +57,27 @@ namespace ErgometerLibrary string str; NetCommand net; - - try { - str = AESEncrypt.DecryptString(ReadString(client)); - } - catch (Exception e) - { - str = ""; - net = new NetCommand(NetCommand.CommandType.ERROR, 0); - } + str = ReadString(client); if (str != "") + { + try + { + str = AESEncrypt.DecryptString(str); + } + catch (Exception e) + { + str = ""; + net = new NetCommand(NetCommand.CommandType.ERROR, 0); + } try { net = NetCommand.Parse(str); } - catch(Exception e) + catch (Exception e) { net = new NetCommand(NetCommand.CommandType.ERROR, 0); } + } else net = new NetCommand(NetCommand.CommandType.ERROR, 0); return net;