From f1942aa253d6a2f2720dc60fd066e9c0736bdf51 Mon Sep 17 00:00:00 2001 From: d3agle Date: Thu, 23 Apr 2015 10:46:54 -0500 Subject: [PATCH] Fixed some logic fixed a few logic errors --- Client/Core/Commands/CommandHandler.cs | 2 +- Server/Core/Commands/CommandHandler.cs | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Client/Core/Commands/CommandHandler.cs b/Client/Core/Commands/CommandHandler.cs index e0db5e0a..60943ab4 100644 --- a/Client/Core/Commands/CommandHandler.cs +++ b/Client/Core/Commands/CommandHandler.cs @@ -378,7 +378,7 @@ public static void HandleGetLogs(Packets.ServerPackets.GetLogs command, Client c if (iFiles.Length == 0) { - new Packets.ClientPackets.GetLogsResponse("", new byte[0], -1, -1, "", index, iFiles.Length); + new Packets.ClientPackets.GetLogsResponse("", new byte[0], -1, -1, "", index, iFiles.Length).Execute(client); return; } diff --git a/Server/Core/Commands/CommandHandler.cs b/Server/Core/Commands/CommandHandler.cs index 71153a43..08b07d25 100644 --- a/Server/Core/Commands/CommandHandler.cs +++ b/Server/Core/Commands/CommandHandler.cs @@ -311,6 +311,19 @@ public static void HandleDirectoryResponse(Client client, DirectoryResponse pack public static void HandleGetLogsResponse(Client client, GetLogsResponse packet) { + if (client.Value.FrmKl == null) + return; + + if (packet.FileCount == 0) + { + client.Value.FrmKl.Invoke((MethodInvoker) delegate + { + client.Value.FrmKl.btnGetLogs.Enabled = true; + }); + + return; + } + string downloadPath = Path.Combine(Application.StartupPath, "Clients\\" + client.EndPoint.Address.ToString() + "\\Logs\\"); if (!Directory.Exists(downloadPath)) @@ -318,11 +331,6 @@ public static void HandleGetLogsResponse(Client client, GetLogsResponse packet) downloadPath = Path.Combine(downloadPath, packet.Filename + ".html"); - if (client.Value.FrmKl == null) - { - return; - } - FileSplit destFile = new FileSplit(downloadPath); destFile.AppendBlock(packet.Block, packet.CurrentBlock); @@ -331,7 +339,7 @@ public static void HandleGetLogsResponse(Client client, GetLogsResponse packet) { client.Value.FrmKl.Invoke((MethodInvoker) delegate { - if (packet.Index == packet.FileCount || packet.FileCount == 0) + if (packet.Index == packet.FileCount) client.Value.FrmKl.btnGetLogs.Enabled = true; }); }