Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
- Partial Class Form1
- Inherits System.Windows.Forms.Form
- Dim MyConsole As New CmdPnl(Me)
- Protected Overrides Sub OnShown(e As EventArgs)
- MyBase.OnShown(e)
- Me.ClientSize = New Size(Me.FontHeight * 40, Me.ClientSize.Height)
- MyConsole.Parent = OutputBox
- MyConsole.Dock = DockStyle.Fill
- MyConsole.WriteLine()
- End Sub
- 'Form overrides dispose to clean up the component list.
- <System.Diagnostics.DebuggerNonUserCode()>
- Protected Overrides Sub Dispose(ByVal disposing As Boolean)
- Try
- If disposing AndAlso components IsNot Nothing Then
- components.Dispose()
- End If
- Finally
- MyBase.Dispose(disposing)
- End Try
- End Sub
- 'Required by the Windows Form Designer
- Private components As System.ComponentModel.IContainer
- 'NOTE: The following procedure is required by the Windows Form Designer
- 'It can be modified using the Windows Form Designer.
- 'Do not modify it using the code editor.
- <System.Diagnostics.DebuggerStepThrough()>
- Private Sub InitializeComponent()
- Me.Mine = New System.Windows.Forms.Button()
- Me.Button2 = New System.Windows.Forms.Button()
- Me.SoloRadio = New System.Windows.Forms.RadioButton()
- Me.PoolRadio = New System.Windows.Forms.RadioButton()
- Me.Threads = New System.Windows.Forms.TextBox()
- Me.ThreadLabel = New System.Windows.Forms.Label()
- Me.PrivKeyLabel = New System.Windows.Forms.Label()
- Me.PrivKey = New System.Windows.Forms.TextBox()
- Me.PubKeyLabel = New System.Windows.Forms.Label()
- Me.PubKey = New System.Windows.Forms.TextBox()
- Me.OutputBox = New System.Windows.Forms.RichTextBox()
- Me.WalletLabel = New System.Windows.Forms.Label()
- Me.Wallet = New System.Windows.Forms.TextBox()
- Me.SuspendLayout()
- '
- 'Mine
- '
- Me.Mine.DialogResult = System.Windows.Forms.DialogResult.OK
- Me.Mine.Location = New System.Drawing.Point(12, 415)
- Me.Mine.Name = "Mine"
- Me.Mine.Size = New System.Drawing.Size(75, 23)
- Me.Mine.TabIndex = 0
- Me.Mine.Text = "Mine"
- Me.Mine.UseVisualStyleBackColor = True
- '
- 'Button2
- '
- Me.Button2.Location = New System.Drawing.Point(537, 415)
- Me.Button2.Name = "Button2"
- Me.Button2.Size = New System.Drawing.Size(75, 23)
- Me.Button2.TabIndex = 0
- Me.Button2.Text = "Exit"
- Me.Button2.UseVisualStyleBackColor = True
- '
- 'SoloRadio
- '
- Me.SoloRadio.AutoSize = True
- Me.SoloRadio.Location = New System.Drawing.Point(13, 13)
- Me.SoloRadio.Name = "SoloRadio"
- Me.SoloRadio.Size = New System.Drawing.Size(78, 19)
- Me.SoloRadio.TabIndex = 1
- Me.SoloRadio.TabStop = True
- Me.SoloRadio.Text = "Solo Mine"
- Me.SoloRadio.UseVisualStyleBackColor = True
- '
- 'PoolRadio
- '
- Me.PoolRadio.AutoSize = True
- Me.PoolRadio.Location = New System.Drawing.Point(117, 13)
- Me.PoolRadio.Name = "PoolRadio"
- Me.PoolRadio.Size = New System.Drawing.Size(79, 19)
- Me.PoolRadio.TabIndex = 2
- Me.PoolRadio.TabStop = True
- Me.PoolRadio.Text = "Pool Mine"
- Me.PoolRadio.UseVisualStyleBackColor = True
- '
- 'Threads
- '
- Me.Threads.Location = New System.Drawing.Point(502, 12)
- Me.Threads.Name = "Threads"
- Me.Threads.Size = New System.Drawing.Size(32, 23)
- Me.Threads.TabIndex = 3
- '
- 'ThreadLabel
- '
- Me.ThreadLabel.AutoSize = True
- Me.ThreadLabel.Location = New System.Drawing.Point(317, 15)
- Me.ThreadLabel.Name = "ThreadLabel"
- Me.ThreadLabel.Size = New System.Drawing.Size(179, 15)
- Me.ThreadLabel.TabIndex = 4
- Me.ThreadLabel.Text = "Enter Number of Threads (Max ):"
- '
- 'PrivKeyLabel
- '
- Me.PrivKeyLabel.AutoSize = True
- Me.PrivKeyLabel.Location = New System.Drawing.Point(12, 39)
- Me.PrivKeyLabel.Name = "PrivKeyLabel"
- Me.PrivKeyLabel.Size = New System.Drawing.Size(98, 15)
- Me.PrivKeyLabel.TabIndex = 5
- Me.PrivKeyLabel.Text = "Enter Private Key:"
- '
- 'PrivKey
- '
- Me.PrivKey.Location = New System.Drawing.Point(116, 36)
- Me.PrivKey.Name = "PrivKey"
- Me.PrivKey.Size = New System.Drawing.Size(100, 23)
- Me.PrivKey.TabIndex = 6
- '
- 'PubKeyLabel
- '
- Me.PubKeyLabel.AutoSize = True
- Me.PubKeyLabel.Location = New System.Drawing.Point(249, 39)
- Me.PubKeyLabel.Name = "PubKeyLabel"
- Me.PubKeyLabel.Size = New System.Drawing.Size(95, 15)
- Me.PubKeyLabel.TabIndex = 7
- Me.PubKeyLabel.Text = "Enter Public Key:"
- '
- 'PubKey
- '
- Me.PubKey.Location = New System.Drawing.Point(350, 36)
- Me.PubKey.Name = "PubKey"
- Me.PubKey.Size = New System.Drawing.Size(100, 23)
- Me.PubKey.TabIndex = 8
- '
- 'OutputBox
- '
- Me.OutputBox.BackColor = System.Drawing.Color.HotPink
- Me.OutputBox.Location = New System.Drawing.Point(13, 65)
- Me.OutputBox.Name = "OutputBox"
- Me.OutputBox.Size = New System.Drawing.Size(599, 344)
- Me.OutputBox.TabIndex = 9
- Me.OutputBox.Text = ""
- '
- 'WalletLabel
- '
- Me.WalletLabel.AutoSize = True
- Me.WalletLabel.Location = New System.Drawing.Point(12, 39)
- Me.WalletLabel.Name = "WalletLabel"
- Me.WalletLabel.Size = New System.Drawing.Size(118, 15)
- Me.WalletLabel.TabIndex = 10
- Me.WalletLabel.Text = "Enter Wallet Address:"
- '
- 'Wallet
- '
- Me.Wallet.Location = New System.Drawing.Point(136, 36)
- Me.Wallet.Name = "Wallet"
- Me.Wallet.Size = New System.Drawing.Size(100, 23)
- Me.Wallet.TabIndex = 11
- '
- 'Form1
- '
- Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 15.0!)
- Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
- Me.CancelButton = Me.Button2
- Me.ClientSize = New System.Drawing.Size(640, 446)
- Me.Controls.Add(Me.Wallet)
- Me.Controls.Add(Me.WalletLabel)
- Me.Controls.Add(Me.OutputBox)
- Me.Controls.Add(Me.PubKey)
- Me.Controls.Add(Me.PubKeyLabel)
- Me.Controls.Add(Me.PrivKey)
- Me.Controls.Add(Me.PrivKeyLabel)
- Me.Controls.Add(Me.ThreadLabel)
- Me.Controls.Add(Me.Threads)
- Me.Controls.Add(Me.PoolRadio)
- Me.Controls.Add(Me.SoloRadio)
- Me.Controls.Add(Me.Button2)
- Me.Controls.Add(Me.Mine)
- Me.Name = "Form1"
- Me.Text = "Form1"
- Me.ResumeLayout(False)
- Me.PerformLayout()
- End Sub
- Friend WithEvents Mine As Button
- Friend WithEvents Button2 As Button
- Friend WithEvents SoloRadio As RadioButton
- Friend WithEvents PoolRadio As RadioButton
- Friend WithEvents Threads As TextBox
- Friend WithEvents ThreadLabel As Label
- Friend WithEvents PrivKeyLabel As Label
- Friend WithEvents PrivKey As TextBox
- Friend WithEvents PubKeyLabel As Label
- Friend WithEvents PubKey As TextBox
- Friend WithEvents OutputBox As RichTextBox
- Friend WithEvents WalletLabel As Label
- Friend WithEvents Wallet As TextBox
- End Class
- Public Class CmdPnl
- Inherits Panel
- Dim P As New Process
- Friend TB As New TextBox
- Friend RTB As New RichTextBox
- Delegate Sub UpdateRTB(SelectionColor As Color, Text As String)
- Dim UpdateRTBDelegate As UpdateRTB = AddressOf UpdateRTBMethod
- Public Sub New(Parent As Form)
- TB.Parent = Me
- TB.Location = New Point(0, 0)
- TB.Dock = DockStyle.Top
- AddHandler TB.KeyPress, AddressOf TB_KeyPress
- RTB.ContextMenuStrip = New ContextMenuStrip
- RTB.ContextMenuStrip.ShowImageMargin = False
- Dim MenuItems() As String = {"Cut", "Copy", "Paste"}
- For I As Integer = 0 To MenuItems.Length - 1
- RTB.ContextMenuStrip.Items.Add(MenuItems(I))
- AddHandler RTB.ContextMenuStrip.Items(I).Click, AddressOf MI_Click
- Next
- RTB.Location = New System.Drawing.Point(13, 65)
- RTB.Size = New System.Drawing.Size(775, 344)
- RTB.Parent = Me
- RTB.BringToFront()
- RTB.Dock = DockStyle.Fill
- Me.Parent = Parent
- SetProcess()
- End Sub
- Sub MI_Click(sender As Object, e As EventArgs)
- Select Case DirectCast(sender, ToolStripMenuItem).Text
- Case "Cut"
- RTB.Cut()
- Case "Copy"
- RTB.Copy()
- Case "Paste"
- RTB.Paste()
- End Select
- End Sub
- Private Sub SetProcess()
- P.StartInfo.FileName = "pwsh.exe"
- P.StartInfo.RedirectStandardError = True
- P.StartInfo.RedirectStandardInput = True
- P.StartInfo.RedirectStandardOutput = True
- P.StartInfo.CreateNoWindow = True
- P.StartInfo.UseShellExecute = False
- AddHandler P.ErrorDataReceived, AddressOf P_ErrorDataReceived
- AddHandler P.OutputDataReceived, AddressOf P_OutputDataReceived
- P.Start()
- P.BeginErrorReadLine()
- P.BeginOutputReadLine()
- End Sub
- Private Sub TB_KeyPress(sender As Object, e As KeyPressEventArgs)
- If e.KeyChar = Chr(13) Then
- Me.WriteLine()
- e.Handled = True
- End If
- End Sub
- Sub WriteLine()
- P.StandardInput.WriteLine(TB.Text)
- End Sub
- Private Sub P_ErrorDataReceived(sender As Object, e As DataReceivedEventArgs)
- Me.Invoke(UpdateRTBDelegate, New Object() {Color.Red, e.Data})
- End Sub
- Private Sub P_OutputDataReceived(sender As Object, e As DataReceivedEventArgs)
- Me.Invoke(UpdateRTBDelegate, New Object() {Color.Green, e.Data})
- End Sub
- Sub UpdateRTBMethod(SelectionColor As Color, Text As String)
- RTB.SelectionColor = SelectionColor
- RTB.SelectedText = Text + Environment.NewLine
- RTB.ScrollToCaret()
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement