From 7356d26b00c4d05ff7c4c4b176877f9835a6cce9 Mon Sep 17 00:00:00 2001 From: Gerezd <36887090+MrazGergo@users.noreply.github.com> Date: Fri, 4 Oct 2019 19:34:35 +0200 Subject: [PATCH 01/10] Clicker class added: simple interface to create button clicks periodically or to hold a button. UserInput user control: to unify user inputs for each button --- AutoClicker/AutoClicker.csproj | 10 +++ AutoClicker/Clicker.cs | 66 ++++++++++++++++ AutoClicker/Main.Designer.cs | 47 +++++++----- AutoClicker/UserInput.Designer.cs | 114 ++++++++++++++++++++++++++++ AutoClicker/UserInput.cs | 54 ++++++++++++++ AutoClicker/UserInput.resx | 120 ++++++++++++++++++++++++++++++ 6 files changed, 393 insertions(+), 18 deletions(-) create mode 100644 AutoClicker/Clicker.cs create mode 100644 AutoClicker/UserInput.Designer.cs create mode 100644 AutoClicker/UserInput.cs create mode 100644 AutoClicker/UserInput.resx diff --git a/AutoClicker/AutoClicker.csproj b/AutoClicker/AutoClicker.csproj index b57c9ef..754b23a 100644 --- a/AutoClicker/AutoClicker.csproj +++ b/AutoClicker/AutoClicker.csproj @@ -44,6 +44,7 @@ + Component @@ -62,6 +63,12 @@ + + UserControl + + + UserInput.cs + Main.cs @@ -78,6 +85,9 @@ True Resources.resx + + UserInput.cs + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/AutoClicker/Clicker.cs b/AutoClicker/Clicker.cs new file mode 100644 index 0000000..1981bbb --- /dev/null +++ b/AutoClicker/Clicker.cs @@ -0,0 +1,66 @@ +using System; +using System.Windows.Forms; + +namespace AutoClicker +{ + internal class Clicker : IDisposable + { + private readonly uint buttonPressCode; + private readonly uint buttonReleaseCode; + private readonly IntPtr handle; + private readonly Timer timer; + + private bool hold = false; + + public Clicker(uint buttonPressCode, uint buttonReleaseCode, IntPtr handle) + { + this.buttonPressCode = buttonPressCode; + this.buttonReleaseCode = buttonReleaseCode; + this.handle = handle; + + timer = new Timer(); + timer.Tick += Timer_Tick; + } + + private void Timer_Tick(object sender, EventArgs e) + { + Win32Api.PostMessage(handle, buttonPressCode, IntPtr.Zero, IntPtr.Zero); + Win32Api.PostMessage(handle, buttonReleaseCode, IntPtr.Zero, IntPtr.Zero); + } + + public void Start(int delay) + { + timer.Stop(); + + if (delay == 0) + { + hold = true; + Win32Api.PostMessage(handle, buttonPressCode, IntPtr.Zero, IntPtr.Zero); + } + else + { + hold = false; + timer.Interval = delay; + timer.Start(); + } + } + + public void Stop() + { + if (hold) + { + Win32Api.PostMessage(handle, buttonReleaseCode, IntPtr.Zero, IntPtr.Zero); + } + else + { + timer.Stop(); + } + } + + public void Dispose() + { + timer.Stop(); + timer.Dispose(); + } + } +} diff --git a/AutoClicker/Main.Designer.cs b/AutoClicker/Main.Designer.cs index 4736c93..fdd77f3 100644 --- a/AutoClicker/Main.Designer.cs +++ b/AutoClicker/Main.Designer.cs @@ -34,9 +34,10 @@ private void InitializeComponent() this.btn_stop = new System.Windows.Forms.Button(); this.lbl_delay = new System.Windows.Forms.Label(); this.txtDelay = new System.Windows.Forms.TextBox(); - this.rdio_RightClick = new System.Windows.Forms.RadioButton(); this.rdio_LeftClick = new System.Windows.Forms.RadioButton(); + this.rdio_RightClick = new System.Windows.Forms.RadioButton(); this.chkHold = new System.Windows.Forms.CheckBox(); + this.userInput1 = new AutoClicker.UserInput(); this.SuspendLayout(); // // btn_start @@ -54,7 +55,7 @@ private void InitializeComponent() this.lbl_startText.AutoSize = true; this.lbl_startText.Location = new System.Drawing.Point(11, 18); this.lbl_startText.Name = "lbl_startText"; - this.lbl_startText.Size = new System.Drawing.Size(85, 15); + this.lbl_startText.Size = new System.Drawing.Size(77, 13); this.lbl_startText.TabIndex = 1; this.lbl_startText.Text = "Started Action:"; // @@ -63,7 +64,7 @@ private void InitializeComponent() this.lblstart_time.AutoSize = true; this.lblstart_time.Location = new System.Drawing.Point(103, 18); this.lblstart_time.Name = "lblstart_time"; - this.lblstart_time.Size = new System.Drawing.Size(0, 15); + this.lblstart_time.Size = new System.Drawing.Size(0, 13); this.lblstart_time.TabIndex = 2; // // btn_stop @@ -82,7 +83,7 @@ private void InitializeComponent() this.lbl_delay.AutoSize = true; this.lbl_delay.Location = new System.Drawing.Point(31, 46); this.lbl_delay.Name = "lbl_delay"; - this.lbl_delay.Size = new System.Drawing.Size(72, 15); + this.lbl_delay.Size = new System.Drawing.Size(62, 13); this.lbl_delay.TabIndex = 4; this.lbl_delay.Text = "Delay (ms): "; // @@ -94,43 +95,52 @@ private void InitializeComponent() this.txtDelay.TabIndex = 5; this.txtDelay.Text = "300"; // + // rdio_LeftClick + // + this.rdio_LeftClick.AutoSize = true; + this.rdio_LeftClick.Location = new System.Drawing.Point(138, 76); + this.rdio_LeftClick.Name = "rdio_LeftClick"; + this.rdio_LeftClick.Size = new System.Drawing.Size(69, 17); + this.rdio_LeftClick.TabIndex = 7; + this.rdio_LeftClick.Text = "Left Click"; + this.rdio_LeftClick.UseVisualStyleBackColor = true; + // // rdio_RightClick // this.rdio_RightClick.AutoSize = true; this.rdio_RightClick.Checked = true; this.rdio_RightClick.Location = new System.Drawing.Point(49, 76); this.rdio_RightClick.Name = "rdio_RightClick"; - this.rdio_RightClick.Size = new System.Drawing.Size(83, 19); + this.rdio_RightClick.Size = new System.Drawing.Size(76, 17); this.rdio_RightClick.TabIndex = 6; this.rdio_RightClick.TabStop = true; this.rdio_RightClick.Text = "Right Click"; this.rdio_RightClick.UseVisualStyleBackColor = true; // - // rdio_LeftClick - // - this.rdio_LeftClick.AutoSize = true; - this.rdio_LeftClick.Location = new System.Drawing.Point(138, 76); - this.rdio_LeftClick.Name = "rdio_LeftClick"; - this.rdio_LeftClick.Size = new System.Drawing.Size(74, 19); - this.rdio_LeftClick.TabIndex = 7; - this.rdio_LeftClick.Text = "Left Click"; - this.rdio_LeftClick.UseVisualStyleBackColor = true; - // // chkHold // this.chkHold.AutoSize = true; this.chkHold.Location = new System.Drawing.Point(27, 104); this.chkHold.Name = "chkHold"; - this.chkHold.Size = new System.Drawing.Size(224, 19); + this.chkHold.Size = new System.Drawing.Size(197, 17); this.chkHold.TabIndex = 8; this.chkHold.Text = "Hold Click Button Down (For Mining)"; this.chkHold.UseVisualStyleBackColor = true; // + // userInput1 + // + this.userInput1.ButtonName = "Button name"; + this.userInput1.Location = new System.Drawing.Point(296, 32); + this.userInput1.Name = "userInput1"; + this.userInput1.Size = new System.Drawing.Size(317, 161); + this.userInput1.TabIndex = 9; + // // Main // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(263, 196); + this.ClientSize = new System.Drawing.Size(664, 403); + this.Controls.Add(this.userInput1); this.Controls.Add(this.chkHold); this.Controls.Add(this.rdio_LeftClick); this.Controls.Add(this.rdio_RightClick); @@ -158,9 +168,10 @@ private void InitializeComponent() private System.Windows.Forms.Button btn_stop; private System.Windows.Forms.Label lbl_delay; private System.Windows.Forms.TextBox txtDelay; - private System.Windows.Forms.RadioButton rdio_RightClick; private System.Windows.Forms.RadioButton rdio_LeftClick; + private System.Windows.Forms.RadioButton rdio_RightClick; private System.Windows.Forms.CheckBox chkHold; + private UserInput userInput1; } } diff --git a/AutoClicker/UserInput.Designer.cs b/AutoClicker/UserInput.Designer.cs new file mode 100644 index 0000000..3ffb6fb --- /dev/null +++ b/AutoClicker/UserInput.Designer.cs @@ -0,0 +1,114 @@ +namespace AutoClicker +{ + partial class UserInput + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.cbButtonEnable = new System.Windows.Forms.CheckBox(); + this.cbHold = new System.Windows.Forms.CheckBox(); + this.lblDelay = new System.Windows.Forms.Label(); + this.numDelay = new System.Windows.Forms.NumericUpDown(); + ((System.ComponentModel.ISupportInitialize)(this.numDelay)).BeginInit(); + this.SuspendLayout(); + // + // cbButtonEnable + // + this.cbButtonEnable.AutoSize = true; + this.cbButtonEnable.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.cbButtonEnable.Location = new System.Drawing.Point(55, 29); + this.cbButtonEnable.Name = "cbButtonEnable"; + this.cbButtonEnable.Size = new System.Drawing.Size(107, 21); + this.cbButtonEnable.TabIndex = 1; + this.cbButtonEnable.Text = "Button name"; + this.cbButtonEnable.UseVisualStyleBackColor = true; + this.cbButtonEnable.Click += new System.EventHandler(this.CbButtonEnable_Click); + // + // cbHold + // + this.cbHold.AutoSize = true; + this.cbHold.Enabled = false; + this.cbHold.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.cbHold.Location = new System.Drawing.Point(55, 65); + this.cbHold.Name = "cbHold"; + this.cbHold.Size = new System.Drawing.Size(100, 21); + this.cbHold.TabIndex = 2; + this.cbHold.Text = "Hold button"; + this.cbHold.UseVisualStyleBackColor = true; + this.cbHold.Click += new System.EventHandler(this.CbHold_Click); + // + // lblDelay + // + this.lblDelay.AutoSize = true; + this.lblDelay.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.lblDelay.Location = new System.Drawing.Point(56, 100); + this.lblDelay.Name = "lblDelay"; + this.lblDelay.Size = new System.Drawing.Size(80, 17); + this.lblDelay.TabIndex = 3; + this.lblDelay.Text = "Delay (ms):"; + // + // numDelay + // + this.numDelay.Enabled = false; + this.numDelay.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.numDelay.Location = new System.Drawing.Point(142, 100); + this.numDelay.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numDelay.Name = "numDelay"; + this.numDelay.Size = new System.Drawing.Size(120, 23); + this.numDelay.TabIndex = 4; + this.numDelay.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // + // UserInput + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.numDelay); + this.Controls.Add(this.lblDelay); + this.Controls.Add(this.cbHold); + this.Controls.Add(this.cbButtonEnable); + this.Name = "UserInput"; + this.Size = new System.Drawing.Size(317, 161); + ((System.ComponentModel.ISupportInitialize)(this.numDelay)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.CheckBox cbButtonEnable; + private System.Windows.Forms.CheckBox cbHold; + private System.Windows.Forms.Label lblDelay; + private System.Windows.Forms.NumericUpDown numDelay; + } +} diff --git a/AutoClicker/UserInput.cs b/AutoClicker/UserInput.cs new file mode 100644 index 0000000..6cf319a --- /dev/null +++ b/AutoClicker/UserInput.cs @@ -0,0 +1,54 @@ +using System; +using System.Windows.Forms; + +namespace AutoClicker +{ + public partial class UserInput : UserControl + { + public UserInput() + { + InitializeComponent(); + numDelay.Minimum = 1; + numDelay.Maximum = int.MaxValue; + } + + public string ButtonName + { + get { return cbButtonEnable.Text; } + set { cbButtonEnable.Text = value; } + } + + public uint Delay => cbHold.Checked ? 0 : (uint)numDelay.Value; + + private void CbButtonEnable_Click(object sender, EventArgs e) + { + if (cbButtonEnable.Checked) + { + cbHold.Enabled = true; + HoldCheckBoxClicked(); + } + else + { + cbHold.Enabled = false; + numDelay.Enabled = false; + } + } + + private void CbHold_Click(object sender, EventArgs e) + { + HoldCheckBoxClicked(); + } + + private void HoldCheckBoxClicked() + { + if (cbHold.Checked) + { + numDelay.Enabled = false; + } + else + { + numDelay.Enabled = true; + } + } + } +} diff --git a/AutoClicker/UserInput.resx b/AutoClicker/UserInput.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/AutoClicker/UserInput.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file From 7ec224b0e9146cc7f3efa5035bfb157309173adb Mon Sep 17 00:00:00 2001 From: Gerezd <36887090+MrazGergo@users.noreply.github.com> Date: Fri, 4 Oct 2019 23:42:44 +0200 Subject: [PATCH 02/10] UserInput renamed to ButtonInputs. Clicker now can handle multiple handles. Main: new UI finished, Win32Api: button codes are now returned as uint instead of int. --- AutoClicker/AutoClicker.csproj | 10 +- ...t.Designer.cs => ButtonInputs.Designer.cs} | 16 ++- AutoClicker/ButtonInputs.cs | 83 ++++++++++++++ .../{UserInput.resx => ButtonInputs.resx} | 0 AutoClicker/Clicker.cs | 53 ++++++--- AutoClicker/Main.Designer.cs | 105 ++++-------------- AutoClicker/Main.cs | 19 +--- AutoClicker/UserInput.cs | 54 --------- AutoClicker/Win32Api.cs | 4 +- 9 files changed, 159 insertions(+), 185 deletions(-) rename AutoClicker/{UserInput.Designer.cs => ButtonInputs.Designer.cs} (88%) create mode 100644 AutoClicker/ButtonInputs.cs rename AutoClicker/{UserInput.resx => ButtonInputs.resx} (100%) delete mode 100644 AutoClicker/UserInput.cs diff --git a/AutoClicker/AutoClicker.csproj b/AutoClicker/AutoClicker.csproj index 754b23a..2c4e967 100644 --- a/AutoClicker/AutoClicker.csproj +++ b/AutoClicker/AutoClicker.csproj @@ -63,11 +63,11 @@ - + UserControl - - UserInput.cs + + ButtonInputs.cs @@ -85,8 +85,8 @@ True Resources.resx - - UserInput.cs + + ButtonInputs.cs SettingsSingleFileGenerator diff --git a/AutoClicker/UserInput.Designer.cs b/AutoClicker/ButtonInputs.Designer.cs similarity index 88% rename from AutoClicker/UserInput.Designer.cs rename to AutoClicker/ButtonInputs.Designer.cs index 3ffb6fb..5b31985 100644 --- a/AutoClicker/UserInput.Designer.cs +++ b/AutoClicker/ButtonInputs.Designer.cs @@ -1,6 +1,6 @@ namespace AutoClicker { - partial class UserInput + partial class ButtonInputs { /// /// Required designer variable. @@ -37,9 +37,10 @@ private void InitializeComponent() // // cbButtonEnable // + this.cbButtonEnable.Anchor = System.Windows.Forms.AnchorStyles.None; this.cbButtonEnable.AutoSize = true; this.cbButtonEnable.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.cbButtonEnable.Location = new System.Drawing.Point(55, 29); + this.cbButtonEnable.Location = new System.Drawing.Point(18, 12); this.cbButtonEnable.Name = "cbButtonEnable"; this.cbButtonEnable.Size = new System.Drawing.Size(107, 21); this.cbButtonEnable.TabIndex = 1; @@ -49,10 +50,11 @@ private void InitializeComponent() // // cbHold // + this.cbHold.Anchor = System.Windows.Forms.AnchorStyles.None; this.cbHold.AutoSize = true; this.cbHold.Enabled = false; this.cbHold.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.cbHold.Location = new System.Drawing.Point(55, 65); + this.cbHold.Location = new System.Drawing.Point(18, 48); this.cbHold.Name = "cbHold"; this.cbHold.Size = new System.Drawing.Size(100, 21); this.cbHold.TabIndex = 2; @@ -62,9 +64,10 @@ private void InitializeComponent() // // lblDelay // + this.lblDelay.Anchor = System.Windows.Forms.AnchorStyles.None; this.lblDelay.AutoSize = true; this.lblDelay.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.lblDelay.Location = new System.Drawing.Point(56, 100); + this.lblDelay.Location = new System.Drawing.Point(19, 83); this.lblDelay.Name = "lblDelay"; this.lblDelay.Size = new System.Drawing.Size(80, 17); this.lblDelay.TabIndex = 3; @@ -72,9 +75,10 @@ private void InitializeComponent() // // numDelay // + this.numDelay.Anchor = System.Windows.Forms.AnchorStyles.None; this.numDelay.Enabled = false; this.numDelay.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.numDelay.Location = new System.Drawing.Point(142, 100); + this.numDelay.Location = new System.Drawing.Point(105, 83); this.numDelay.Minimum = new decimal(new int[] { 1, 0, @@ -98,7 +102,7 @@ private void InitializeComponent() this.Controls.Add(this.cbHold); this.Controls.Add(this.cbButtonEnable); this.Name = "UserInput"; - this.Size = new System.Drawing.Size(317, 161); + this.Size = new System.Drawing.Size(240, 130); ((System.ComponentModel.ISupportInitialize)(this.numDelay)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); diff --git a/AutoClicker/ButtonInputs.cs b/AutoClicker/ButtonInputs.cs new file mode 100644 index 0000000..2ed7837 --- /dev/null +++ b/AutoClicker/ButtonInputs.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; + +namespace AutoClicker +{ + public partial class ButtonInputs : UserControl + { + private bool initialized = false; + private Clicker clicker = null; + + public ButtonInputs() + { + InitializeComponent(); + numDelay.Maximum = int.MaxValue; + } + + public void Init(string buttonName, uint buttonDownCode, uint buttonUpCode) + { + //if(initialized) + //{ + // throw new Exception($"{nameof(ButtonInputs)}.{cbButtonEnable.Text} is already initialized!"); + //} + + cbButtonEnable.Text = buttonName; + clicker = new Clicker(buttonDownCode, buttonUpCode); + initialized = true; + } + + public void Start(ICollection minecraftHandles) + { + if (!initialized) + { + throw new Exception($"{nameof(ButtonInputs)}.{cbButtonEnable.Text} is not initialized!"); + } + + int delay = cbHold.Checked ? 0 : (int)numDelay.Value; + clicker.Start(delay, minecraftHandles); + } + + public void Stop() + { + clicker.Stop(); + } + + private void CbButtonEnable_Click(object sender, EventArgs e) + { + if (cbButtonEnable.Checked) + { + cbHold.Enabled = true; + HoldCheckBoxClicked(); + } + else + { + cbHold.Enabled = false; + numDelay.Enabled = false; + } + } + + private void CbHold_Click(object sender, EventArgs e) + { + HoldCheckBoxClicked(); + } + + private void HoldCheckBoxClicked() + { + if (cbHold.Checked) + { + numDelay.Enabled = false; + } + else + { + numDelay.Enabled = true; + } + } + + public new void Dispose() + { + clicker?.Dispose(); + base.Dispose(); + } + } +} diff --git a/AutoClicker/UserInput.resx b/AutoClicker/ButtonInputs.resx similarity index 100% rename from AutoClicker/UserInput.resx rename to AutoClicker/ButtonInputs.resx diff --git a/AutoClicker/Clicker.cs b/AutoClicker/Clicker.cs index 1981bbb..8f3174c 100644 --- a/AutoClicker/Clicker.cs +++ b/AutoClicker/Clicker.cs @@ -1,45 +1,54 @@ using System; +using System.Collections.Generic; using System.Windows.Forms; namespace AutoClicker { internal class Clicker : IDisposable { - private readonly uint buttonPressCode; - private readonly uint buttonReleaseCode; - private readonly IntPtr handle; + private readonly uint buttonDownCode; + private readonly uint buttonUpCode; + private ICollection minecraftHandles = null; private readonly Timer timer; private bool hold = false; - public Clicker(uint buttonPressCode, uint buttonReleaseCode, IntPtr handle) + public Clicker(uint buttonDownCode, uint buttonUpCode) { - this.buttonPressCode = buttonPressCode; - this.buttonReleaseCode = buttonReleaseCode; - this.handle = handle; + this.buttonDownCode = buttonDownCode; + this.buttonUpCode = buttonUpCode; timer = new Timer(); timer.Tick += Timer_Tick; } - + private void Timer_Tick(object sender, EventArgs e) { - Win32Api.PostMessage(handle, buttonPressCode, IntPtr.Zero, IntPtr.Zero); - Win32Api.PostMessage(handle, buttonReleaseCode, IntPtr.Zero, IntPtr.Zero); + ToAllHandle((IntPtr handle) => + { + Win32Api.PostMessage(handle, buttonDownCode, IntPtr.Zero, IntPtr.Zero); + Win32Api.PostMessage(handle, buttonUpCode, IntPtr.Zero, IntPtr.Zero); + }); } - public void Start(int delay) + public void Start(int delay, ICollection minecraftHandles) { - timer.Stop(); + Stop(); + + if (!(minecraftHandles != null && minecraftHandles.Count != 0)) + { + return; + } + this.minecraftHandles = minecraftHandles; + + hold = (delay == 0); - if (delay == 0) + if (hold) { - hold = true; - Win32Api.PostMessage(handle, buttonPressCode, IntPtr.Zero, IntPtr.Zero); + ToAllHandle((IntPtr handle) => Win32Api.PostMessage(handle, buttonDownCode, (IntPtr)0x0001, IntPtr.Zero)); } else { - hold = false; timer.Interval = delay; timer.Start(); } @@ -49,18 +58,26 @@ public void Stop() { if (hold) { - Win32Api.PostMessage(handle, buttonReleaseCode, IntPtr.Zero, IntPtr.Zero); + ToAllHandle((IntPtr handle) => Win32Api.PostMessage(handle, buttonUpCode, IntPtr.Zero, IntPtr.Zero)); } else { timer.Stop(); } } - + public void Dispose() { timer.Stop(); timer.Dispose(); } + + private void ToAllHandle(Action todo) + { + foreach(var handle in minecraftHandles) + { + todo(handle); + } + } } } diff --git a/AutoClicker/Main.Designer.cs b/AutoClicker/Main.Designer.cs index fdd77f3..f44bf75 100644 --- a/AutoClicker/Main.Designer.cs +++ b/AutoClicker/Main.Designer.cs @@ -29,20 +29,15 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.btn_start = new System.Windows.Forms.Button(); - this.lbl_startText = new System.Windows.Forms.Label(); this.lblstart_time = new System.Windows.Forms.Label(); this.btn_stop = new System.Windows.Forms.Button(); - this.lbl_delay = new System.Windows.Forms.Label(); - this.txtDelay = new System.Windows.Forms.TextBox(); - this.rdio_LeftClick = new System.Windows.Forms.RadioButton(); - this.rdio_RightClick = new System.Windows.Forms.RadioButton(); - this.chkHold = new System.Windows.Forms.CheckBox(); - this.userInput1 = new AutoClicker.UserInput(); + this.biLeftMouse = new AutoClicker.ButtonInputs(); + this.biRightMouse = new AutoClicker.ButtonInputs(); this.SuspendLayout(); // // btn_start // - this.btn_start.Location = new System.Drawing.Point(143, 133); + this.btn_start.Location = new System.Drawing.Point(269, 160); this.btn_start.Name = "btn_start"; this.btn_start.Size = new System.Drawing.Size(88, 51); this.btn_start.TabIndex = 0; @@ -50,15 +45,6 @@ private void InitializeComponent() this.btn_start.UseVisualStyleBackColor = true; this.btn_start.Click += new System.EventHandler(this.Btn_action_Click); // - // lbl_startText - // - this.lbl_startText.AutoSize = true; - this.lbl_startText.Location = new System.Drawing.Point(11, 18); - this.lbl_startText.Name = "lbl_startText"; - this.lbl_startText.Size = new System.Drawing.Size(77, 13); - this.lbl_startText.TabIndex = 1; - this.lbl_startText.Text = "Started Action:"; - // // lblstart_time // this.lblstart_time.AutoSize = true; @@ -70,7 +56,7 @@ private void InitializeComponent() // btn_stop // this.btn_stop.Enabled = false; - this.btn_stop.Location = new System.Drawing.Point(44, 133); + this.btn_stop.Location = new System.Drawing.Point(165, 160); this.btn_stop.Name = "btn_stop"; this.btn_stop.Size = new System.Drawing.Size(88, 51); this.btn_stop.TabIndex = 3; @@ -78,77 +64,29 @@ private void InitializeComponent() this.btn_stop.UseVisualStyleBackColor = true; this.btn_stop.Click += new System.EventHandler(this.Btn_stop_Click); // - // lbl_delay - // - this.lbl_delay.AutoSize = true; - this.lbl_delay.Location = new System.Drawing.Point(31, 46); - this.lbl_delay.Name = "lbl_delay"; - this.lbl_delay.Size = new System.Drawing.Size(62, 13); - this.lbl_delay.TabIndex = 4; - this.lbl_delay.Text = "Delay (ms): "; - // - // txtDelay - // - this.txtDelay.Location = new System.Drawing.Point(109, 43); - this.txtDelay.Name = "txtDelay"; - this.txtDelay.Size = new System.Drawing.Size(70, 20); - this.txtDelay.TabIndex = 5; - this.txtDelay.Text = "300"; - // - // rdio_LeftClick - // - this.rdio_LeftClick.AutoSize = true; - this.rdio_LeftClick.Location = new System.Drawing.Point(138, 76); - this.rdio_LeftClick.Name = "rdio_LeftClick"; - this.rdio_LeftClick.Size = new System.Drawing.Size(69, 17); - this.rdio_LeftClick.TabIndex = 7; - this.rdio_LeftClick.Text = "Left Click"; - this.rdio_LeftClick.UseVisualStyleBackColor = true; - // - // rdio_RightClick - // - this.rdio_RightClick.AutoSize = true; - this.rdio_RightClick.Checked = true; - this.rdio_RightClick.Location = new System.Drawing.Point(49, 76); - this.rdio_RightClick.Name = "rdio_RightClick"; - this.rdio_RightClick.Size = new System.Drawing.Size(76, 17); - this.rdio_RightClick.TabIndex = 6; - this.rdio_RightClick.TabStop = true; - this.rdio_RightClick.Text = "Right Click"; - this.rdio_RightClick.UseVisualStyleBackColor = true; - // - // chkHold + // biLeftMouse // - this.chkHold.AutoSize = true; - this.chkHold.Location = new System.Drawing.Point(27, 104); - this.chkHold.Name = "chkHold"; - this.chkHold.Size = new System.Drawing.Size(197, 17); - this.chkHold.TabIndex = 8; - this.chkHold.Text = "Hold Click Button Down (For Mining)"; - this.chkHold.UseVisualStyleBackColor = true; + this.biLeftMouse.Location = new System.Drawing.Point(12, 18); + this.biLeftMouse.Name = "biLeftMouse"; + this.biLeftMouse.Size = new System.Drawing.Size(240, 130); + this.biLeftMouse.TabIndex = 4; // - // userInput1 + // biRightMouse // - this.userInput1.ButtonName = "Button name"; - this.userInput1.Location = new System.Drawing.Point(296, 32); - this.userInput1.Name = "userInput1"; - this.userInput1.Size = new System.Drawing.Size(317, 161); - this.userInput1.TabIndex = 9; + this.biRightMouse.Location = new System.Drawing.Point(258, 18); + this.biRightMouse.Name = "biRightMouse"; + this.biRightMouse.Size = new System.Drawing.Size(240, 130); + this.biRightMouse.TabIndex = 5; // // Main // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(664, 403); - this.Controls.Add(this.userInput1); - this.Controls.Add(this.chkHold); - this.Controls.Add(this.rdio_LeftClick); - this.Controls.Add(this.rdio_RightClick); - this.Controls.Add(this.txtDelay); - this.Controls.Add(this.lbl_delay); + this.ClientSize = new System.Drawing.Size(518, 223); + this.Controls.Add(this.biRightMouse); + this.Controls.Add(this.biLeftMouse); this.Controls.Add(this.btn_stop); this.Controls.Add(this.lblstart_time); - this.Controls.Add(this.lbl_startText); this.Controls.Add(this.btn_start); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; @@ -163,15 +101,10 @@ private void InitializeComponent() #endregion private System.Windows.Forms.Button btn_start; - private System.Windows.Forms.Label lbl_startText; private System.Windows.Forms.Label lblstart_time; private System.Windows.Forms.Button btn_stop; - private System.Windows.Forms.Label lbl_delay; - private System.Windows.Forms.TextBox txtDelay; - private System.Windows.Forms.RadioButton rdio_LeftClick; - private System.Windows.Forms.RadioButton rdio_RightClick; - private System.Windows.Forms.CheckBox chkHold; - private UserInput userInput1; + private ButtonInputs biLeftMouse; + private ButtonInputs biRightMouse; } } diff --git a/AutoClicker/Main.cs b/AutoClicker/Main.cs index 75043bc..6906846 100644 --- a/AutoClicker/Main.cs +++ b/AutoClicker/Main.cs @@ -15,24 +15,18 @@ public partial class Main : Form public Main() { InitializeComponent(); + biLeftMouse.Init("Left mouse button", Win32Api.WmLbuttonDown, Win32Api.WmLbuttonDown + 1); + biRightMouse.Init("Right mouse button", Win32Api.WmRbuttonDown, Win32Api.WmRbuttonDown + 1); } private void Btn_action_Click(object sender, EventArgs e) { var mcProcesses = Process.GetProcessesByName("javaw").Where(b => b.MainWindowTitle.Contains("Minecraft")).ToList(); - var mainHandle = this.Handle; - if (!int.TryParse(this.txtDelay.Text, out int delay)) - { - MessageBox.Show(@"The delay must be an integer! Resetting to default.", @"Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); - this.txtDelay.Text = @"300"; - return; - } - if (!mcProcesses.Any()) { - MessageBox.Show(@"Minecraft not running!", @"Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(@"Minecraft is not running!", @"Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } @@ -45,17 +39,14 @@ private void Btn_action_Click(object sender, EventArgs e) mcProcesses = instancesForm.SelectedInstances.Select(Process.GetProcessById).ToList(); } - - var buttonCode = rdio_RightClick.Checked ? Win32Api.WmRbuttonDown : Win32Api.WmLbuttonDown; + // ------------------------------------------------------------------------- this._stop = false; this.lblstart_time.Text = DateTime.Now.ToString("MMMM dd HH:mm tt"); foreach (var mcProcess in mcProcesses) { - var thread = new BackgroundWorker(); - thread.DoWork += delegate { StartClick(mcProcess, mainHandle, (uint)buttonCode, delay, this.chkHold.Checked); }; - thread.RunWorkerAsync(); + Thread.Sleep(200); FocusToggle(mcProcess.MainWindowHandle); diff --git a/AutoClicker/UserInput.cs b/AutoClicker/UserInput.cs deleted file mode 100644 index 6cf319a..0000000 --- a/AutoClicker/UserInput.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Windows.Forms; - -namespace AutoClicker -{ - public partial class UserInput : UserControl - { - public UserInput() - { - InitializeComponent(); - numDelay.Minimum = 1; - numDelay.Maximum = int.MaxValue; - } - - public string ButtonName - { - get { return cbButtonEnable.Text; } - set { cbButtonEnable.Text = value; } - } - - public uint Delay => cbHold.Checked ? 0 : (uint)numDelay.Value; - - private void CbButtonEnable_Click(object sender, EventArgs e) - { - if (cbButtonEnable.Checked) - { - cbHold.Enabled = true; - HoldCheckBoxClicked(); - } - else - { - cbHold.Enabled = false; - numDelay.Enabled = false; - } - } - - private void CbHold_Click(object sender, EventArgs e) - { - HoldCheckBoxClicked(); - } - - private void HoldCheckBoxClicked() - { - if (cbHold.Checked) - { - numDelay.Enabled = false; - } - else - { - numDelay.Enabled = true; - } - } - } -} diff --git a/AutoClicker/Win32Api.cs b/AutoClicker/Win32Api.cs index 1d60418..f0db78b 100644 --- a/AutoClicker/Win32Api.cs +++ b/AutoClicker/Win32Api.cs @@ -14,7 +14,7 @@ public class Win32Api [DllImport("user32.dll")] internal static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); //ShowWindow needs an IntPtr - public static int WmRbuttonDown => 0x0204; - public static int WmLbuttonDown => 0x201; + public static uint WmRbuttonDown => 0x0204; + public static uint WmLbuttonDown => 0x201; } } From 123e3cb7cec818ff53adb97093c4f5ea47c482dd Mon Sep 17 00:00:00 2001 From: Gerezd <36887090+MrazGergo@users.noreply.github.com> Date: Sat, 5 Oct 2019 00:39:02 +0200 Subject: [PATCH 03/10] ButtonInputs: saves the button codes, Needed property to get wheter the user needs that button, Start function returns a Clicker object. Clicker: reverted to handle only one handle. Main: modified to use the new ButtonInputs. --- AutoClicker/ButtonInputs.cs | 26 ++++----- AutoClicker/Clicker.cs | 37 +++++-------- AutoClicker/Main.cs | 107 ++++++++++++++++++++---------------- 3 files changed, 83 insertions(+), 87 deletions(-) diff --git a/AutoClicker/ButtonInputs.cs b/AutoClicker/ButtonInputs.cs index 2ed7837..5786253 100644 --- a/AutoClicker/ButtonInputs.cs +++ b/AutoClicker/ButtonInputs.cs @@ -6,8 +6,11 @@ namespace AutoClicker { public partial class ButtonInputs : UserControl { + private uint buttonDownCode; + private uint buttonUpCode; private bool initialized = false; - private Clicker clicker = null; + + public bool Needed => cbButtonEnable.Checked; public ButtonInputs() { @@ -22,25 +25,24 @@ public void Init(string buttonName, uint buttonDownCode, uint buttonUpCode) // throw new Exception($"{nameof(ButtonInputs)}.{cbButtonEnable.Text} is already initialized!"); //} + this.buttonDownCode = buttonDownCode; + this.buttonUpCode = buttonUpCode; cbButtonEnable.Text = buttonName; - clicker = new Clicker(buttonDownCode, buttonUpCode); initialized = true; } - public void Start(ICollection minecraftHandles) + internal Clicker StartClicking(IntPtr minecraftHandle) { if (!initialized) { throw new Exception($"{nameof(ButtonInputs)}.{cbButtonEnable.Text} is not initialized!"); } - int delay = cbHold.Checked ? 0 : (int)numDelay.Value; - clicker.Start(delay, minecraftHandles); - } - public void Stop() - { - clicker.Stop(); + var clicker = new Clicker(buttonDownCode, buttonUpCode, minecraftHandle); + clicker.Start(delay); + + return clicker; } private void CbButtonEnable_Click(object sender, EventArgs e) @@ -73,11 +75,5 @@ private void HoldCheckBoxClicked() numDelay.Enabled = true; } } - - public new void Dispose() - { - clicker?.Dispose(); - base.Dispose(); - } } } diff --git a/AutoClicker/Clicker.cs b/AutoClicker/Clicker.cs index 8f3174c..63c7f64 100644 --- a/AutoClicker/Clicker.cs +++ b/AutoClicker/Clicker.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Windows.Forms; namespace AutoClicker @@ -8,47 +7,38 @@ internal class Clicker : IDisposable { private readonly uint buttonDownCode; private readonly uint buttonUpCode; - private ICollection minecraftHandles = null; + private readonly IntPtr minecraftHandle; private readonly Timer timer; private bool hold = false; - public Clicker(uint buttonDownCode, uint buttonUpCode) + public Clicker(uint buttonDownCode, uint buttonUpCode, IntPtr minecraftHandle) { this.buttonDownCode = buttonDownCode; this.buttonUpCode = buttonUpCode; + this.minecraftHandle = minecraftHandle; timer = new Timer(); timer.Tick += Timer_Tick; } - + private void Timer_Tick(object sender, EventArgs e) { - ToAllHandle((IntPtr handle) => - { - Win32Api.PostMessage(handle, buttonDownCode, IntPtr.Zero, IntPtr.Zero); - Win32Api.PostMessage(handle, buttonUpCode, IntPtr.Zero, IntPtr.Zero); - }); + Click(); } - public void Start(int delay, ICollection minecraftHandles) + public void Start(int delay) { Stop(); - - if (!(minecraftHandles != null && minecraftHandles.Count != 0)) - { - return; - } - this.minecraftHandles = minecraftHandles; - hold = (delay == 0); if (hold) { - ToAllHandle((IntPtr handle) => Win32Api.PostMessage(handle, buttonDownCode, (IntPtr)0x0001, IntPtr.Zero)); + Win32Api.PostMessage(minecraftHandle, buttonDownCode, (IntPtr)0x0001, IntPtr.Zero); } else { + Click(); timer.Interval = delay; timer.Start(); } @@ -58,11 +48,12 @@ public void Stop() { if (hold) { - ToAllHandle((IntPtr handle) => Win32Api.PostMessage(handle, buttonUpCode, IntPtr.Zero, IntPtr.Zero)); + Win32Api.PostMessage(minecraftHandle, buttonUpCode, IntPtr.Zero, IntPtr.Zero); } else { timer.Stop(); + Click(); } } @@ -72,12 +63,10 @@ public void Dispose() timer.Dispose(); } - private void ToAllHandle(Action todo) + private void Click() { - foreach(var handle in minecraftHandles) - { - todo(handle); - } + Win32Api.PostMessage(minecraftHandle, buttonDownCode, IntPtr.Zero, IntPtr.Zero); + Win32Api.PostMessage(minecraftHandle, buttonUpCode, IntPtr.Zero, IntPtr.Zero); } } } diff --git a/AutoClicker/Main.cs b/AutoClicker/Main.cs index 6906846..101786a 100644 --- a/AutoClicker/Main.cs +++ b/AutoClicker/Main.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Linq; @@ -10,7 +11,7 @@ namespace AutoClicker { public partial class Main : Form { - private bool _stop; + private Dictionary> instanceClickers = new Dictionary>(); public Main() { @@ -21,12 +22,14 @@ public Main() private void Btn_action_Click(object sender, EventArgs e) { + EnableElements(false); var mcProcesses = Process.GetProcessesByName("javaw").Where(b => b.MainWindowTitle.Contains("Minecraft")).ToList(); - var mainHandle = this.Handle; + var mainHandle = Handle; if (!mcProcesses.Any()) { MessageBox.Show(@"Minecraft is not running!", @"Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); + EnableElements(true); return; } @@ -39,75 +42,83 @@ private void Btn_action_Click(object sender, EventArgs e) mcProcesses = instancesForm.SelectedInstances.Select(Process.GetProcessById).ToList(); } - // ------------------------------------------------------------------------- - this._stop = false; this.lblstart_time.Text = DateTime.Now.ToString("MMMM dd HH:mm tt"); foreach (var mcProcess in mcProcesses) { - + SetControlPropertyThreadSafe(this.btn_start, "Enabled", false); + SetControlPropertyThreadSafe(this.btn_stop, "Enabled", true); + + var minecraftHandle = mcProcess.MainWindowHandle; + FocusToggle(minecraftHandle); + + SetControlPropertyThreadSafe(this.btn_start, "Text", @"Starting in: "); + Thread.Sleep(500); + + for (var i = 5; i > 0; i--) + { + SetControlPropertyThreadSafe(this.btn_start, "Text", i.ToString()); + Thread.Sleep(500); + } + + FocusToggle(mainHandle); + SetControlPropertyThreadSafe(this.btn_start, "Text", @"Running..."); + Thread.Sleep(500); + + if(biLeftMouse.Needed) + { + var clicker = biLeftMouse.StartClicking(minecraftHandle); + AddToInstanceClickers(mcProcess, clicker); + } + + if(biRightMouse.Needed) + { + var clicker = biRightMouse.StartClicking(minecraftHandle); + AddToInstanceClickers(mcProcess, clicker); + } Thread.Sleep(200); - FocusToggle(mcProcess.MainWindowHandle); - FocusToggle(this.Handle); + FocusToggle(minecraftHandle); + FocusToggle(mainHandle); } } - private void StartClick(Process mcProcess, IntPtr mainWindowHandle, uint buttonCode, int delay, bool miningMode) + private void AddToInstanceClickers(Process mcProcess, Clicker clicker) { - SetControlPropertyThreadSafe(this.btn_start, "Enabled", false); - SetControlPropertyThreadSafe(this.btn_stop, "Enabled", true); - - var handle = mcProcess.MainWindowHandle; - FocusToggle(mcProcess.MainWindowHandle); - - SetControlPropertyThreadSafe(this.btn_start, "Text", @"Starting in: "); - Thread.Sleep(500); - - for (var i = 5; i > 0; i--) + if(instanceClickers.ContainsKey(mcProcess)) { - SetControlPropertyThreadSafe(this.btn_start, "Text", i.ToString()); - Thread.Sleep(500); + instanceClickers[mcProcess].Add(clicker); } + else + { + instanceClickers.Add(mcProcess, new List() { clicker }); + } + } - FocusToggle(mainWindowHandle); - SetControlPropertyThreadSafe(this.btn_start, "Text", @"Running..."); - Thread.Sleep(500); - - var millisecondsPassed = -1; - if (miningMode) - Win32Api.PostMessage(handle, (uint)buttonCode, (IntPtr)0x0001, IntPtr.Zero); // send left button down + private void Btn_stop_Click(object sender, EventArgs e) + { + this.btn_stop.Enabled = false; - while (!this._stop) + foreach(var clickers in instanceClickers.Values) { - if (millisecondsPassed == -1 || millisecondsPassed >= delay) + foreach(var clicker in clickers) { - millisecondsPassed = 0; - if (!miningMode) - { - Win32Api.PostMessage(handle, buttonCode, IntPtr.Zero, IntPtr.Zero); - Win32Api.PostMessage(handle, buttonCode + 1, IntPtr.Zero, IntPtr.Zero); - } + clicker.Dispose(); } - - // sleep only 25 ms and do the check above so if the user clicks - // "STOP" with a like 60 second delay, they don't have to wait 60 seconds - Thread.Sleep(5); - millisecondsPassed += 5; } + instanceClickers.Clear(); - Win32Api.PostMessage(handle, buttonCode, IntPtr.Zero, IntPtr.Zero); - Win32Api.PostMessage(handle, buttonCode + 1, IntPtr.Zero, IntPtr.Zero); - - SetControlPropertyThreadSafe(this.btn_start, "Text", @"START!"); - SetControlPropertyThreadSafe(this.btn_start, "Enabled", true); + btn_start.Text = "START"; + EnableElements(true); } - private void Btn_stop_Click(object sender, EventArgs e) + private void EnableElements(bool enable) { - this._stop = true; - this.btn_stop.Enabled = false; + btn_start.Enabled = enable; + biLeftMouse.Enabled = enable; + biRightMouse.Enabled = enable; + btn_stop.Enabled = !enable; } private static void FocusToggle(IntPtr hwnd) From 6702b473fe0a28d6c9cb68e8fe252a57cffd1226 Mon Sep 17 00:00:00 2001 From: Gerezd <36887090+MrazGergo@users.noreply.github.com> Date: Sat, 5 Oct 2019 10:43:03 +0200 Subject: [PATCH 04/10] Clicker: Stop and Dispose will stop holding button down too (bug fix). Main: whole start function is in try-catch, if an error happens, then it shows the error message and stops running clickers, Right click is ahead of left click, there is a delay between them. --- AutoClicker/Clicker.cs | 12 ++-- AutoClicker/Main.cs | 125 ++++++++++++++++++++++++----------------- 2 files changed, 78 insertions(+), 59 deletions(-) diff --git a/AutoClicker/Clicker.cs b/AutoClicker/Clicker.cs index 63c7f64..eaf634d 100644 --- a/AutoClicker/Clicker.cs +++ b/AutoClicker/Clicker.cs @@ -34,6 +34,7 @@ public void Start(int delay) if (hold) { + //Select the minecraft handle with Alt+Tab to not stop holding (when using the program) Win32Api.PostMessage(minecraftHandle, buttonDownCode, (IntPtr)0x0001, IntPtr.Zero); } else @@ -46,20 +47,17 @@ public void Start(int delay) public void Stop() { - if (hold) - { - Win32Api.PostMessage(minecraftHandle, buttonUpCode, IntPtr.Zero, IntPtr.Zero); - } - else + if (!hold) { timer.Stop(); - Click(); } + + Click(); } public void Dispose() { - timer.Stop(); + Stop(); timer.Dispose(); } diff --git a/AutoClicker/Main.cs b/AutoClicker/Main.cs index 101786a..36a4876 100644 --- a/AutoClicker/Main.cs +++ b/AutoClicker/Main.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Diagnostics; using System.Linq; using System.Reflection; @@ -11,7 +10,7 @@ namespace AutoClicker { public partial class Main : Form { - private Dictionary> instanceClickers = new Dictionary>(); + private readonly Dictionary> instanceClickers = new Dictionary>(); public Main() { @@ -22,71 +21,84 @@ public Main() private void Btn_action_Click(object sender, EventArgs e) { - EnableElements(false); - var mcProcesses = Process.GetProcessesByName("javaw").Where(b => b.MainWindowTitle.Contains("Minecraft")).ToList(); - var mainHandle = Handle; - - if (!mcProcesses.Any()) - { - MessageBox.Show(@"Minecraft is not running!", @"Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); - EnableElements(true); - return; - } - - if (mcProcesses.Count > 1) + try { - var instancesForm = new MultipleInstances(mcProcesses); + EnableElements(false); + var mcProcesses = Process.GetProcessesByName("javaw").Where(b => b.MainWindowTitle.Contains("Minecraft")).ToList(); + var mainHandle = Handle; - if (instancesForm.ShowDialog() != DialogResult.OK) + if (!mcProcesses.Any()) + { + MessageBox.Show(@"Minecraft is not running!", @"Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); + EnableElements(true); return; + } - mcProcesses = instancesForm.SelectedInstances.Select(Process.GetProcessById).ToList(); - } - - this.lblstart_time.Text = DateTime.Now.ToString("MMMM dd HH:mm tt"); + if (mcProcesses.Count > 1) + { + var instancesForm = new MultipleInstances(mcProcesses); - foreach (var mcProcess in mcProcesses) - { - SetControlPropertyThreadSafe(this.btn_start, "Enabled", false); - SetControlPropertyThreadSafe(this.btn_stop, "Enabled", true); + if (instancesForm.ShowDialog() != DialogResult.OK) + { + return; + } - var minecraftHandle = mcProcess.MainWindowHandle; - FocusToggle(minecraftHandle); + mcProcesses = instancesForm.SelectedInstances.Select(Process.GetProcessById).ToList(); + } - SetControlPropertyThreadSafe(this.btn_start, "Text", @"Starting in: "); - Thread.Sleep(500); + lblstart_time.Text = DateTime.Now.ToString("MMMM dd HH:mm tt"); - for (var i = 5; i > 0; i--) + foreach (var mcProcess in mcProcesses) { - SetControlPropertyThreadSafe(this.btn_start, "Text", i.ToString()); + SetControlPropertyThreadSafe(btn_start, "Enabled", false); + SetControlPropertyThreadSafe(btn_stop, "Enabled", true); + + var minecraftHandle = mcProcess.MainWindowHandle; + FocusToggle(minecraftHandle); + + SetControlPropertyThreadSafe(btn_start, "Text", @"Starting in: "); Thread.Sleep(500); - } - FocusToggle(mainHandle); - SetControlPropertyThreadSafe(this.btn_start, "Text", @"Running..."); - Thread.Sleep(500); + for (var i = 5; i > 0; i--) + { + SetControlPropertyThreadSafe(btn_start, "Text", i.ToString()); + Thread.Sleep(500); + } - if(biLeftMouse.Needed) - { - var clicker = biLeftMouse.StartClicking(minecraftHandle); - AddToInstanceClickers(mcProcess, clicker); - } + FocusToggle(mainHandle); + SetControlPropertyThreadSafe(btn_start, "Text", @"Running..."); + Thread.Sleep(500); - if(biRightMouse.Needed) - { - var clicker = biRightMouse.StartClicking(minecraftHandle); - AddToInstanceClickers(mcProcess, clicker); + //Right click needs to be ahead of left click for concrete mining + if (biRightMouse.Needed) + { + var clicker = biRightMouse.StartClicking(minecraftHandle); + AddToInstanceClickers(mcProcess, clicker); + } + + /* + * This sleep is needed, because if you want to mine concrete, then Minecraft starts to hold left click first + * and it won't place the block in your second hand for some reason... + */ + Thread.Sleep(100); + + if (biLeftMouse.Needed) + { + var clicker = biLeftMouse.StartClicking(minecraftHandle); + AddToInstanceClickers(mcProcess, clicker); + } } - - Thread.Sleep(200); - FocusToggle(minecraftHandle); - FocusToggle(mainHandle); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "An error occured", MessageBoxButtons.OK, MessageBoxIcon.Error); + Stop(); } } private void AddToInstanceClickers(Process mcProcess, Clicker clicker) { - if(instanceClickers.ContainsKey(mcProcess)) + if (instanceClickers.ContainsKey(mcProcess)) { instanceClickers[mcProcess].Add(clicker); } @@ -98,13 +110,18 @@ private void AddToInstanceClickers(Process mcProcess, Clicker clicker) private void Btn_stop_Click(object sender, EventArgs e) { - this.btn_stop.Enabled = false; + Stop(); + } + + private void Stop() + { + btn_stop.Enabled = false; - foreach(var clickers in instanceClickers.Values) + foreach (var clickers in instanceClickers.Values) { - foreach(var clicker in clickers) + foreach (var clicker in clickers) { - clicker.Dispose(); + clicker?.Dispose(); } } instanceClickers.Clear(); @@ -131,9 +148,13 @@ private static void FocusToggle(IntPtr hwnd) public static void SetControlPropertyThreadSafe(Control control, string propertyName, object propertyValue) { if (control.InvokeRequired) + { control.Invoke(new SetControlPropertyThreadSafeDelegate(SetControlPropertyThreadSafe), control, propertyName, propertyValue); + } else + { control.GetType().InvokeMember(propertyName, BindingFlags.SetProperty, null, control, new[] { propertyValue }); + } }//end SetControlPropertyThreadSafe } } From fb63fd41d0988cb48be536ca0a1947043c7854b1 Mon Sep 17 00:00:00 2001 From: Gerezd <36887090+MrazGergo@users.noreply.github.com> Date: Sun, 20 Oct 2019 10:37:20 +0200 Subject: [PATCH 05/10] Clicker: Dispose pattern fully implemented. Main.Designer.cs: Started at label readded at the bottom. Main.cs: MultipleInstancesForm gets disposed, Started at labels get showed at start and hide at stop. Autoclicker.exe: updated with the latest release build. --- AutoClicker.exe | Bin 19456 -> 22528 bytes AutoClicker/Clicker.cs | 36 +++++++++++++++++++++++++++++----- AutoClicker/Main.Designer.cs | 37 +++++++++++++++++++++++++---------- AutoClicker/Main.cs | 20 ++++++++++++------- 4 files changed, 71 insertions(+), 22 deletions(-) diff --git a/AutoClicker.exe b/AutoClicker.exe index c91104333bb0a3fad48c8fee6c27594c585184b9..f3fb16f179d7676ae4dbd8f88f9ea0bfc38c01e9 100644 GIT binary patch literal 22528 zcmeHvd3YSvmG7zQRjsvK*5XxV*&=OiNR|QH*v7IX8-ZnvC7aERXmyw6wp(3tRm-*z z0x1v(2_z5_9!{JDNXR@gArlhvf|+5G37JetLbl2B_yT+oCV7yJkZlqI=KapORoyMw zc;@~0-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icker/Clicker.cs @@ -11,6 +11,7 @@ internal class Clicker : IDisposable private readonly Timer timer; private bool hold = false; + private bool disposed; public Clicker(uint buttonDownCode, uint buttonUpCode, IntPtr minecraftHandle) { @@ -55,16 +56,41 @@ public void Stop() Click(); } + private void Click() + { + Win32Api.PostMessage(minecraftHandle, buttonDownCode, IntPtr.Zero, IntPtr.Zero); + Win32Api.PostMessage(minecraftHandle, buttonUpCode, IntPtr.Zero, IntPtr.Zero); + } + + #region Dispose public void Dispose() { - Stop(); - timer.Dispose(); + // Dispose of unmanaged resources. + Dispose(true); + // Suppress finalization. + GC.SuppressFinalize(this); } - private void Click() + protected void Dispose(bool disposing) { - Win32Api.PostMessage(minecraftHandle, buttonDownCode, IntPtr.Zero, IntPtr.Zero); - Win32Api.PostMessage(minecraftHandle, buttonUpCode, IntPtr.Zero, IntPtr.Zero); + if (disposed) + { + return; + } + + if (disposing) + { + Stop(); + timer.Dispose(); + } + + disposed = true; + } + + ~Clicker() + { + Dispose(false); } + #endregion } } diff --git a/AutoClicker/Main.Designer.cs b/AutoClicker/Main.Designer.cs index f44bf75..c8ff221 100644 --- a/AutoClicker/Main.Designer.cs +++ b/AutoClicker/Main.Designer.cs @@ -29,10 +29,11 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.btn_start = new System.Windows.Forms.Button(); - this.lblstart_time = new System.Windows.Forms.Label(); + this.lblStartTime = new System.Windows.Forms.Label(); this.btn_stop = new System.Windows.Forms.Button(); this.biLeftMouse = new AutoClicker.ButtonInputs(); this.biRightMouse = new AutoClicker.ButtonInputs(); + this.lblStarted = new System.Windows.Forms.Label(); this.SuspendLayout(); // // btn_start @@ -45,13 +46,16 @@ private void InitializeComponent() this.btn_start.UseVisualStyleBackColor = true; this.btn_start.Click += new System.EventHandler(this.Btn_action_Click); // - // lblstart_time + // lblStartTime // - this.lblstart_time.AutoSize = true; - this.lblstart_time.Location = new System.Drawing.Point(103, 18); - this.lblstart_time.Name = "lblstart_time"; - this.lblstart_time.Size = new System.Drawing.Size(0, 13); - this.lblstart_time.TabIndex = 2; + this.lblStartTime.AutoSize = true; + this.lblStartTime.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.lblStartTime.Location = new System.Drawing.Point(233, 222); + this.lblStartTime.Name = "lblStartTime"; + this.lblStartTime.Size = new System.Drawing.Size(34, 17); + this.lblStartTime.TabIndex = 2; + this.lblStartTime.Text = "time"; + this.lblStartTime.Visible = false; // // btn_stop // @@ -78,15 +82,27 @@ private void InitializeComponent() this.biRightMouse.Size = new System.Drawing.Size(240, 130); this.biRightMouse.TabIndex = 5; // + // lblStarted + // + this.lblStarted.AutoSize = true; + this.lblStarted.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.lblStarted.Location = new System.Drawing.Point(162, 222); + this.lblStarted.Name = "lblStarted"; + this.lblStarted.Size = new System.Drawing.Size(74, 17); + this.lblStarted.TabIndex = 6; + this.lblStarted.Text = "Started at:"; + this.lblStarted.Visible = false; + // // Main // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(518, 223); + this.ClientSize = new System.Drawing.Size(518, 250); + this.Controls.Add(this.lblStarted); this.Controls.Add(this.biRightMouse); this.Controls.Add(this.biLeftMouse); this.Controls.Add(this.btn_stop); - this.Controls.Add(this.lblstart_time); + this.Controls.Add(this.lblStartTime); this.Controls.Add(this.btn_start); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; @@ -101,10 +117,11 @@ private void InitializeComponent() #endregion private System.Windows.Forms.Button btn_start; - private System.Windows.Forms.Label lblstart_time; + private System.Windows.Forms.Label lblStartTime; private System.Windows.Forms.Button btn_stop; private ButtonInputs biLeftMouse; private ButtonInputs biRightMouse; + private System.Windows.Forms.Label lblStarted; } } diff --git a/AutoClicker/Main.cs b/AutoClicker/Main.cs index 36a4876..4340180 100644 --- a/AutoClicker/Main.cs +++ b/AutoClicker/Main.cs @@ -36,17 +36,20 @@ private void Btn_action_Click(object sender, EventArgs e) if (mcProcesses.Count > 1) { - var instancesForm = new MultipleInstances(mcProcesses); - - if (instancesForm.ShowDialog() != DialogResult.OK) + using (var instancesForm = new MultipleInstances(mcProcesses)) { - return; - } + if (instancesForm.ShowDialog() != DialogResult.OK) + { + return; + } - mcProcesses = instancesForm.SelectedInstances.Select(Process.GetProcessById).ToList(); + mcProcesses = instancesForm.SelectedInstances.Select(Process.GetProcessById).ToList(); + } } - lblstart_time.Text = DateTime.Now.ToString("MMMM dd HH:mm tt"); + lblStartTime.Text = DateTime.Now.ToString("MMMM dd HH:mm tt"); + lblStarted.Visible = true; + lblStartTime.Visible = true; foreach (var mcProcess in mcProcesses) { @@ -126,6 +129,9 @@ private void Stop() } instanceClickers.Clear(); + lblStarted.Visible = false; + lblStartTime.Visible = false; + btn_start.Text = "START"; EnableElements(true); } From e698dcdefdab31b4c98e0663dcc051bedeefe573 Mon Sep 17 00:00:00 2001 From: Travis Smith Date: Sun, 15 Dec 2019 21:47:03 -0500 Subject: [PATCH 06/10] minor code tweaking --- AutoClicker/ButtonInputs.cs | 33 ++++++--------------------------- AutoClicker/Clicker.cs | 6 ------ AutoClicker/Main.Designer.cs | 4 ++-- AutoClicker/Main.cs | 15 ++------------- 4 files changed, 10 insertions(+), 48 deletions(-) diff --git a/AutoClicker/ButtonInputs.cs b/AutoClicker/ButtonInputs.cs index 5786253..f40a48f 100644 --- a/AutoClicker/ButtonInputs.cs +++ b/AutoClicker/ButtonInputs.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Windows.Forms; namespace AutoClicker @@ -8,38 +7,25 @@ public partial class ButtonInputs : UserControl { private uint buttonDownCode; private uint buttonUpCode; - private bool initialized = false; public bool Needed => cbButtonEnable.Checked; - public ButtonInputs() + public ButtonInputs(string buttonName, uint buttonDownCode, uint buttonUpCode) { InitializeComponent(); - numDelay.Maximum = int.MaxValue; - } - - public void Init(string buttonName, uint buttonDownCode, uint buttonUpCode) - { - //if(initialized) - //{ - // throw new Exception($"{nameof(ButtonInputs)}.{cbButtonEnable.Text} is already initialized!"); - //} this.buttonDownCode = buttonDownCode; this.buttonUpCode = buttonUpCode; cbButtonEnable.Text = buttonName; - initialized = true; + numDelay.Maximum = int.MaxValue; + numDelay.Value = 200; } internal Clicker StartClicking(IntPtr minecraftHandle) { - if (!initialized) - { - throw new Exception($"{nameof(ButtonInputs)}.{cbButtonEnable.Text} is not initialized!"); - } - int delay = cbHold.Checked ? 0 : (int)numDelay.Value; - + var delay = cbHold.Checked ? 0 : (int)numDelay.Value; var clicker = new Clicker(buttonDownCode, buttonUpCode, minecraftHandle); + clicker.Start(delay); return clicker; @@ -66,14 +52,7 @@ private void CbHold_Click(object sender, EventArgs e) private void HoldCheckBoxClicked() { - if (cbHold.Checked) - { - numDelay.Enabled = false; - } - else - { - numDelay.Enabled = true; - } + numDelay.Enabled = !cbHold.Checked; } } } diff --git a/AutoClicker/Clicker.cs b/AutoClicker/Clicker.cs index b046037..7ce0ba4 100644 --- a/AutoClicker/Clicker.cs +++ b/AutoClicker/Clicker.cs @@ -34,10 +34,8 @@ public void Start(int delay) hold = (delay == 0); if (hold) - { //Select the minecraft handle with Alt+Tab to not stop holding (when using the program) Win32Api.PostMessage(minecraftHandle, buttonDownCode, (IntPtr)0x0001, IntPtr.Zero); - } else { Click(); @@ -49,9 +47,7 @@ public void Start(int delay) public void Stop() { if (!hold) - { timer.Stop(); - } Click(); } @@ -74,9 +70,7 @@ public void Dispose() protected void Dispose(bool disposing) { if (disposed) - { return; - } if (disposing) { diff --git a/AutoClicker/Main.Designer.cs b/AutoClicker/Main.Designer.cs index c8ff221..2a35bc1 100644 --- a/AutoClicker/Main.Designer.cs +++ b/AutoClicker/Main.Designer.cs @@ -31,8 +31,8 @@ private void InitializeComponent() this.btn_start = new System.Windows.Forms.Button(); this.lblStartTime = new System.Windows.Forms.Label(); this.btn_stop = new System.Windows.Forms.Button(); - this.biLeftMouse = new AutoClicker.ButtonInputs(); - this.biRightMouse = new AutoClicker.ButtonInputs(); + this.biLeftMouse = new AutoClicker.ButtonInputs("Left mouse button", Win32Api.WmLbuttonDown, Win32Api.WmLbuttonDown + 1); + this.biRightMouse = new AutoClicker.ButtonInputs("Right mouse button", Win32Api.WmRbuttonDown, Win32Api.WmRbuttonDown + 1); this.lblStarted = new System.Windows.Forms.Label(); this.SuspendLayout(); // diff --git a/AutoClicker/Main.cs b/AutoClicker/Main.cs index 4340180..11ae892 100644 --- a/AutoClicker/Main.cs +++ b/AutoClicker/Main.cs @@ -15,8 +15,6 @@ public partial class Main : Form public Main() { InitializeComponent(); - biLeftMouse.Init("Left mouse button", Win32Api.WmLbuttonDown, Win32Api.WmLbuttonDown + 1); - biRightMouse.Init("Right mouse button", Win32Api.WmRbuttonDown, Win32Api.WmRbuttonDown + 1); } private void Btn_action_Click(object sender, EventArgs e) @@ -39,9 +37,7 @@ private void Btn_action_Click(object sender, EventArgs e) using (var instancesForm = new MultipleInstances(mcProcesses)) { if (instancesForm.ShowDialog() != DialogResult.OK) - { return; - } mcProcesses = instancesForm.SelectedInstances.Select(Process.GetProcessById).ToList(); } @@ -102,13 +98,9 @@ private void Btn_action_Click(object sender, EventArgs e) private void AddToInstanceClickers(Process mcProcess, Clicker clicker) { if (instanceClickers.ContainsKey(mcProcess)) - { instanceClickers[mcProcess].Add(clicker); - } else - { - instanceClickers.Add(mcProcess, new List() { clicker }); - } + instanceClickers.Add(mcProcess, new List { clicker }); } private void Btn_stop_Click(object sender, EventArgs e) @@ -127,6 +119,7 @@ private void Stop() clicker?.Dispose(); } } + instanceClickers.Clear(); lblStarted.Visible = false; @@ -154,13 +147,9 @@ private static void FocusToggle(IntPtr hwnd) public static void SetControlPropertyThreadSafe(Control control, string propertyName, object propertyValue) { if (control.InvokeRequired) - { control.Invoke(new SetControlPropertyThreadSafeDelegate(SetControlPropertyThreadSafe), control, propertyName, propertyValue); - } else - { control.GetType().InvokeMember(propertyName, BindingFlags.SetProperty, null, control, new[] { propertyValue }); - } }//end SetControlPropertyThreadSafe } } From a4d4b52a8961f4396a8b30d155fb468347d10609 Mon Sep 17 00:00:00 2001 From: Travis Smith Date: Sun, 15 Dec 2019 22:01:56 -0500 Subject: [PATCH 07/10] formatting --- AutoClicker/ButtonInputs.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/AutoClicker/ButtonInputs.cs b/AutoClicker/ButtonInputs.cs index f40a48f..91acd37 100644 --- a/AutoClicker/ButtonInputs.cs +++ b/AutoClicker/ButtonInputs.cs @@ -5,8 +5,8 @@ namespace AutoClicker { public partial class ButtonInputs : UserControl { - private uint buttonDownCode; - private uint buttonUpCode; + private readonly uint _buttonDownCode; + private readonly uint _buttonUpCode; public bool Needed => cbButtonEnable.Checked; @@ -14,8 +14,8 @@ public ButtonInputs(string buttonName, uint buttonDownCode, uint buttonUpCode) { InitializeComponent(); - this.buttonDownCode = buttonDownCode; - this.buttonUpCode = buttonUpCode; + this._buttonDownCode = buttonDownCode; + this._buttonUpCode = buttonUpCode; cbButtonEnable.Text = buttonName; numDelay.Maximum = int.MaxValue; numDelay.Value = 200; @@ -24,7 +24,7 @@ public ButtonInputs(string buttonName, uint buttonDownCode, uint buttonUpCode) internal Clicker StartClicking(IntPtr minecraftHandle) { var delay = cbHold.Checked ? 0 : (int)numDelay.Value; - var clicker = new Clicker(buttonDownCode, buttonUpCode, minecraftHandle); + var clicker = new Clicker(this._buttonDownCode, this._buttonUpCode, minecraftHandle); clicker.Start(delay); From e0fcb57c61afb851c55e7ee7c2d670b45fa7de19 Mon Sep 17 00:00:00 2001 From: Travis Smith Date: Sun, 15 Dec 2019 22:06:00 -0500 Subject: [PATCH 08/10] fix stop button when cancelling multiple-instances window --- AutoClicker/Main.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/AutoClicker/Main.cs b/AutoClicker/Main.cs index 11ae892..f7f50d2 100644 --- a/AutoClicker/Main.cs +++ b/AutoClicker/Main.cs @@ -36,8 +36,11 @@ private void Btn_action_Click(object sender, EventArgs e) { using (var instancesForm = new MultipleInstances(mcProcesses)) { - if (instancesForm.ShowDialog() != DialogResult.OK) - return; + if (instancesForm.ShowDialog() != DialogResult.OK) + { + EnableElements(true); + return; + } mcProcesses = instancesForm.SelectedInstances.Select(Process.GetProcessById).ToList(); } From 701310337cde86d7208fbc19dd2c1cdaee4425c0 Mon Sep 17 00:00:00 2001 From: Travis Smith Date: Sun, 15 Dec 2019 22:10:25 -0500 Subject: [PATCH 09/10] check processes that start with java and not only javaw --- AutoClicker/Main.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AutoClicker/Main.cs b/AutoClicker/Main.cs index f7f50d2..3de603e 100644 --- a/AutoClicker/Main.cs +++ b/AutoClicker/Main.cs @@ -22,7 +22,7 @@ private void Btn_action_Click(object sender, EventArgs e) try { EnableElements(false); - var mcProcesses = Process.GetProcessesByName("javaw").Where(b => b.MainWindowTitle.Contains("Minecraft")).ToList(); + var mcProcesses = Process.GetProcesses().Where(b => b.ProcessName.StartsWith("java") && b.MainWindowTitle.Contains("Minecraft")).ToList(); var mainHandle = Handle; if (!mcProcesses.Any()) From 62e609e3ea9739cdc9540c6b63a6c8096dd8c5b8 Mon Sep 17 00:00:00 2001 From: Travis Smith Date: Sun, 15 Dec 2019 22:11:22 -0500 Subject: [PATCH 10/10] updated exe --- AutoClicker.exe | Bin 22528 -> 22016 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/AutoClicker.exe b/AutoClicker.exe index f3fb16f179d7676ae4dbd8f88f9ea0bfc38c01e9..1bdb40edde63248e563c806e1de96f514ebb2def 100644 GIT binary patch delta 7196 zcmZ`;349gRx&O|Yx!c@5I{}g#mT#JJDr78t^TJb?KqOCl(_y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