214 lines
8.4 KiB
C#
214 lines
8.4 KiB
C#
// Decompiled with JetBrains decompiler
|
|||
|
|
// Type: Raton.Forms.ClientForms.Monitor.ratonDevice
|
||
|
|
// 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.Drawing;
|
||
|
|
using System.Windows.Forms;
|
||
|
|
|
||
|
|
#nullable disable
|
||
|
|
namespace Raton.Forms.ClientForms.Monitor;
|
||
|
|
|
||
|
|
public class ratonDevice : Form
|
||
|
|
{
|
||
|
|
internal TreeView treeDevices;
|
||
|
|
private IContainer components;
|
||
|
|
public TreeView treeView1;
|
||
|
|
private ContextMenuStrip contextMenuStrip1;
|
||
|
|
private ToolStripMenuItem enableDeviceToolStripMenuItem;
|
||
|
|
private ToolStripMenuItem disableDeviceToolStripMenuItem;
|
||
|
|
private ToolStripMenuItem updateControllerToolStripMenuItem;
|
||
|
|
private ToolStripMenuItem refreshToolStripMenuItem;
|
||
|
|
private Timer timer1;
|
||
|
|
|
||
|
|
public SillyClient SillyClient { get; set; }
|
||
|
|
|
||
|
|
public ratonDevice()
|
||
|
|
{
|
||
|
|
this.InitializeComponent();
|
||
|
|
DarkMode.Start((Form) this);
|
||
|
|
}
|
||
|
|
|
||
|
|
private void ratonDevice_Load(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
this.SetupTreeView();
|
||
|
|
this.InitializeDeviceCategories();
|
||
|
|
this.RequestRefresh();
|
||
|
|
this.timer1.Start();
|
||
|
|
}
|
||
|
|
|
||
|
|
private void SetupTreeView()
|
||
|
|
{
|
||
|
|
this.treeDevices = this.treeView1;
|
||
|
|
this.treeDevices.HideSelection = false;
|
||
|
|
this.treeDevices.ShowNodeToolTips = true;
|
||
|
|
this.treeDevices.AfterSelect -= new TreeViewEventHandler(this.TreeDevices_AfterSelect);
|
||
|
|
this.treeDevices.AfterSelect += new TreeViewEventHandler(this.TreeDevices_AfterSelect);
|
||
|
|
}
|
||
|
|
|
||
|
|
private void InitializeDeviceCategories()
|
||
|
|
{
|
||
|
|
this.treeDevices.Nodes.Clear();
|
||
|
|
string[] strArray = new string[13]
|
||
|
|
{
|
||
|
|
"Processors",
|
||
|
|
"Display adapters",
|
||
|
|
"Network adapters",
|
||
|
|
"Disk drives",
|
||
|
|
"USB controllers",
|
||
|
|
"Audio inputs and outputs",
|
||
|
|
"Keyboards",
|
||
|
|
"Mouse and other pointing devices",
|
||
|
|
"Bluetooth",
|
||
|
|
"Cameras",
|
||
|
|
"System devices",
|
||
|
|
"Sensors",
|
||
|
|
"Software devices"
|
||
|
|
};
|
||
|
|
foreach (string text in strArray)
|
||
|
|
this.treeDevices.Nodes.Add(new TreeNode(text)
|
||
|
|
{
|
||
|
|
Name = text
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
public void RequestRefresh()
|
||
|
|
{
|
||
|
|
Pack pack = new Pack();
|
||
|
|
pack.SetString("Packet", "DeviceRequest");
|
||
|
|
pack.SetString("Action", "GetDevices");
|
||
|
|
pack.SetString("DeviceId", "");
|
||
|
|
this.SillyClient.Send(pack.Pacc());
|
||
|
|
}
|
||
|
|
|
||
|
|
private void SendDeviceAction(string action)
|
||
|
|
{
|
||
|
|
if (this.treeDevices.SelectedNode == null || this.treeDevices.SelectedNode.Tag == null)
|
||
|
|
{
|
||
|
|
int num = (int) Messenger.MessageBox("Please select a device", "Error", icon: MessageBoxIcon.Exclamation);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
string str = this.treeDevices.SelectedNode.Tag.ToString().Split('^')[0];
|
||
|
|
Pack pack = new Pack();
|
||
|
|
pack.SetString("Packet", "DeviceRequest");
|
||
|
|
pack.SetString("Action", action);
|
||
|
|
pack.SetString("DeviceId", str);
|
||
|
|
this.SillyClient.Send(pack.Pacc());
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private void TreeDevices_AfterSelect(object sender, TreeViewEventArgs e)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
private void enableDeviceToolStripMenuItem_Click(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
this.SendDeviceAction("EnableDevice");
|
||
|
|
}
|
||
|
|
|
||
|
|
private void disableDeviceToolStripMenuItem_Click(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
this.SendDeviceAction("DisableDevice");
|
||
|
|
}
|
||
|
|
|
||
|
|
private void updateControllerToolStripMenuItem_Click(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
this.SendDeviceAction("UpdateDriver");
|
||
|
|
}
|
||
|
|
|
||
|
|
private void refreshToolStripMenuItem_Click(object sender, EventArgs e) => this.RequestRefresh();
|
||
|
|
|
||
|
|
private void timer1_Tick(object sender, EventArgs e)
|
||
|
|
{
|
||
|
|
if (this.SillyClient != null && this.SillyClient.isConnected())
|
||
|
|
return;
|
||
|
|
this.Close();
|
||
|
|
}
|
||
|
|
|
||
|
|
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 (ratonDevice));
|
||
|
|
this.treeView1 = new TreeView();
|
||
|
|
this.contextMenuStrip1 = new ContextMenuStrip(this.components);
|
||
|
|
this.enableDeviceToolStripMenuItem = new ToolStripMenuItem();
|
||
|
|
this.disableDeviceToolStripMenuItem = new ToolStripMenuItem();
|
||
|
|
this.updateControllerToolStripMenuItem = new ToolStripMenuItem();
|
||
|
|
this.refreshToolStripMenuItem = new ToolStripMenuItem();
|
||
|
|
this.timer1 = new Timer(this.components);
|
||
|
|
this.contextMenuStrip1.SuspendLayout();
|
||
|
|
this.SuspendLayout();
|
||
|
|
this.treeView1.BorderStyle = BorderStyle.None;
|
||
|
|
this.treeView1.ContextMenuStrip = this.contextMenuStrip1;
|
||
|
|
this.treeView1.Dock = DockStyle.Fill;
|
||
|
|
this.treeView1.Font = new Font("Microsoft JhengHei", 8.25f, FontStyle.Regular, GraphicsUnit.Point, (byte) 0);
|
||
|
|
this.treeView1.Location = new Point(0, 0);
|
||
|
|
this.treeView1.Name = "treeView1";
|
||
|
|
this.treeView1.Size = new Size(738, 521);
|
||
|
|
this.treeView1.TabIndex = 0;
|
||
|
|
this.contextMenuStrip1.Items.AddRange(new ToolStripItem[4]
|
||
|
|
{
|
||
|
|
(ToolStripItem) this.enableDeviceToolStripMenuItem,
|
||
|
|
(ToolStripItem) this.disableDeviceToolStripMenuItem,
|
||
|
|
(ToolStripItem) this.updateControllerToolStripMenuItem,
|
||
|
|
(ToolStripItem) this.refreshToolStripMenuItem
|
||
|
|
});
|
||
|
|
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||
|
|
this.contextMenuStrip1.Size = new Size(181, 114);
|
||
|
|
this.enableDeviceToolStripMenuItem.Font = new Font("Microsoft JhengHei", 9f, FontStyle.Regular, GraphicsUnit.Point, (byte) 0);
|
||
|
|
this.enableDeviceToolStripMenuItem.Image = (Image) Resources.RowUpdating_16x;
|
||
|
|
this.enableDeviceToolStripMenuItem.Name = "enableDeviceToolStripMenuItem";
|
||
|
|
this.enableDeviceToolStripMenuItem.Size = new Size(180, 22);
|
||
|
|
this.enableDeviceToolStripMenuItem.Text = "Enable device";
|
||
|
|
this.enableDeviceToolStripMenuItem.Click += new EventHandler(this.enableDeviceToolStripMenuItem_Click);
|
||
|
|
this.disableDeviceToolStripMenuItem.Font = new Font("Microsoft JhengHei", 9f, FontStyle.Regular, GraphicsUnit.Point, (byte) 0);
|
||
|
|
this.disableDeviceToolStripMenuItem.Image = (Image) Resources.DeleteAllRows_16x;
|
||
|
|
this.disableDeviceToolStripMenuItem.Name = "disableDeviceToolStripMenuItem";
|
||
|
|
this.disableDeviceToolStripMenuItem.Size = new Size(180, 22);
|
||
|
|
this.disableDeviceToolStripMenuItem.Text = "Disable device";
|
||
|
|
this.disableDeviceToolStripMenuItem.Click += new EventHandler(this.disableDeviceToolStripMenuItem_Click);
|
||
|
|
this.updateControllerToolStripMenuItem.Font = new Font("Microsoft JhengHei", 9f, FontStyle.Regular, GraphicsUnit.Point, (byte) 0);
|
||
|
|
this.updateControllerToolStripMenuItem.Image = (Image) Resources.UpdateLinkedTable_16x;
|
||
|
|
this.updateControllerToolStripMenuItem.Name = "updateControllerToolStripMenuItem";
|
||
|
|
this.updateControllerToolStripMenuItem.Size = new Size(180, 22);
|
||
|
|
this.updateControllerToolStripMenuItem.Text = "Update controller";
|
||
|
|
this.updateControllerToolStripMenuItem.Click += new EventHandler(this.updateControllerToolStripMenuItem_Click);
|
||
|
|
this.refreshToolStripMenuItem.Font = new Font("Microsoft JhengHei", 9f, FontStyle.Regular, GraphicsUnit.Point, (byte) 0);
|
||
|
|
this.refreshToolStripMenuItem.Image = (Image) Resources.Refresh_greyThin_16x;
|
||
|
|
this.refreshToolStripMenuItem.Name = "refreshToolStripMenuItem";
|
||
|
|
this.refreshToolStripMenuItem.Size = new Size(180, 22);
|
||
|
|
this.refreshToolStripMenuItem.Text = "Refresh";
|
||
|
|
this.refreshToolStripMenuItem.Click += new EventHandler(this.refreshToolStripMenuItem_Click);
|
||
|
|
this.timer1.Tick += new EventHandler(this.timer1_Tick);
|
||
|
|
this.AutoScaleDimensions = new SizeF(6f, 13f);
|
||
|
|
this.AutoScaleMode = AutoScaleMode.Font;
|
||
|
|
this.ClientSize = new Size(738, 521);
|
||
|
|
this.Controls.Add((Control) this.treeView1);
|
||
|
|
this.FormBorderStyle = FormBorderStyle.FixedSingle;
|
||
|
|
this.Icon = (Icon) componentResourceManager.GetObject("$this.Icon");
|
||
|
|
this.MaximizeBox = false;
|
||
|
|
this.Name = nameof (ratonDevice);
|
||
|
|
this.StartPosition = FormStartPosition.CenterScreen;
|
||
|
|
this.Text = nameof (ratonDevice);
|
||
|
|
this.Load += new EventHandler(this.ratonDevice_Load);
|
||
|
|
this.contextMenuStrip1.ResumeLayout(false);
|
||
|
|
this.ResumeLayout(false);
|
||
|
|
}
|
||
|
|
}
|