diff --git a/.vs/AmongUsCapture/DesignTimeBuild/.dtbcache.v2 b/.vs/AmongUsCapture/DesignTimeBuild/.dtbcache.v2 index d8dd94da..201af303 100644 Binary files a/.vs/AmongUsCapture/DesignTimeBuild/.dtbcache.v2 and b/.vs/AmongUsCapture/DesignTimeBuild/.dtbcache.v2 differ diff --git a/AmongUsCapture/AmongUsCapture - Backup.csproj b/AmongUsCapture/AmongUsCapture - Backup.csproj new file mode 100644 index 00000000..baedce15 --- /dev/null +++ b/AmongUsCapture/AmongUsCapture - Backup.csproj @@ -0,0 +1,28 @@ + + + + WinExe + netcoreapp3.1 + true + app.manifest + + + + true + + + + true + none + + + + + all + + + + + icon.ico + + \ No newline at end of file diff --git a/AmongUsCapture/ClientSocket.cs b/AmongUsCapture/ClientSocket.cs index 860263ac..5f5e5510 100644 --- a/AmongUsCapture/ClientSocket.cs +++ b/AmongUsCapture/ClientSocket.cs @@ -24,9 +24,11 @@ public void Connect(string url) GameMemReader.getInstance().PlayerChanged += PlayerChangedHandler; }; + socket.ConnectAsync(); } + public void SendConnectCode(string connectCode) { ConnectCode = connectCode; diff --git a/AmongUsCapture/Program.cs b/AmongUsCapture/Program.cs index a987412a..5aaf0685 100644 --- a/AmongUsCapture/Program.cs +++ b/AmongUsCapture/Program.cs @@ -11,7 +11,7 @@ namespace AmongUsCapture { static class Program { - private static bool debugGui = false; + private static bool doConsole = false; public static ConsoleInterface conInterface = null; /// /// The main entry point for the application. @@ -19,7 +19,7 @@ static class Program [STAThread] static void Main() { - if(!debugGui) + if(doConsole) { AllocConsole(); // needs to be the first call in the program to prevent weird bugs } diff --git a/AmongUsCapture/UserForm.Designer.cs b/AmongUsCapture/UserForm.Designer.cs index 23c7dfc6..f543924b 100644 --- a/AmongUsCapture/UserForm.Designer.cs +++ b/AmongUsCapture/UserForm.Designer.cs @@ -28,23 +28,30 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.UserSettings = new System.Windows.Forms.GroupBox(); this.ConnectCodeGB = new System.Windows.Forms.GroupBox(); - this.SubmitButton = new System.Windows.Forms.Button(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.ConnectCodeBox = new System.Windows.Forms.TextBox(); + this.SubmitButton = new System.Windows.Forms.Button(); this.CurrentStateGroupBox = new System.Windows.Forms.GroupBox(); this.CurrentState = new System.Windows.Forms.Label(); this.ConsoleGroupBox = new System.Windows.Forms.GroupBox(); this.ConsoleTextBox = new System.Windows.Forms.RichTextBox(); + this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.AutoScrollMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.checkBox1 = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); this.UserSettings.SuspendLayout(); this.ConnectCodeGB.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); this.CurrentStateGroupBox.SuspendLayout(); this.ConsoleGroupBox.SuspendLayout(); + this.contextMenuStrip1.SuspendLayout(); this.SuspendLayout(); // // splitContainer1 @@ -80,43 +87,69 @@ private void InitializeComponent() // // ConnectCodeGB // - this.ConnectCodeGB.Controls.Add(this.SubmitButton); - this.ConnectCodeGB.Controls.Add(this.ConnectCodeBox); + this.ConnectCodeGB.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.ConnectCodeGB.Controls.Add(this.tableLayoutPanel1); this.ConnectCodeGB.Dock = System.Windows.Forms.DockStyle.Top; + this.ConnectCodeGB.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.ConnectCodeGB.Location = new System.Drawing.Point(3, 19); this.ConnectCodeGB.Name = "ConnectCodeGB"; - this.ConnectCodeGB.Size = new System.Drawing.Size(268, 61); + this.ConnectCodeGB.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.ConnectCodeGB.Size = new System.Drawing.Size(268, 63); this.ConnectCodeGB.TabIndex = 4; this.ConnectCodeGB.TabStop = false; this.ConnectCodeGB.Text = "Connect Code"; // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.AutoSize = true; + this.tableLayoutPanel1.ColumnCount = 2; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.Controls.Add(this.ConnectCodeBox, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.SubmitButton, 1, 0); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 19); + this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(8); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(3); + this.tableLayoutPanel1.RowCount = 1; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(262, 41); + this.tableLayoutPanel1.TabIndex = 3; + // + // ConnectCodeBox + // + this.ConnectCodeBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.ConnectCodeBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.ConnectCodeBox.Location = new System.Drawing.Point(6, 6); + this.ConnectCodeBox.MaxLength = 6; + this.ConnectCodeBox.Name = "ConnectCodeBox"; + this.ConnectCodeBox.Size = new System.Drawing.Size(122, 23); + this.ConnectCodeBox.TabIndex = 0; + this.ConnectCodeBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + // // SubmitButton // + this.SubmitButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.SubmitButton.AutoSize = true; + this.SubmitButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.SubmitButton.BackColor = System.Drawing.SystemColors.Control; this.SubmitButton.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption; this.SubmitButton.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.SubmitButton.ForeColor = System.Drawing.SystemColors.ControlText; - this.SubmitButton.Location = new System.Drawing.Point(187, 22); + this.SubmitButton.Location = new System.Drawing.Point(134, 6); this.SubmitButton.Name = "SubmitButton"; - this.SubmitButton.Size = new System.Drawing.Size(75, 23); + this.SubmitButton.Size = new System.Drawing.Size(122, 25); this.SubmitButton.TabIndex = 2; this.SubmitButton.Text = "Submit"; this.SubmitButton.UseVisualStyleBackColor = true; this.SubmitButton.Click += new System.EventHandler(this.SubmitButton_Click); // - // ConnectCodeBox - // - this.ConnectCodeBox.Anchor = System.Windows.Forms.AnchorStyles.Top; - this.ConnectCodeBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.ConnectCodeBox.Location = new System.Drawing.Point(9, 22); - this.ConnectCodeBox.MaxLength = 6; - this.ConnectCodeBox.Name = "ConnectCodeBox"; - this.ConnectCodeBox.Size = new System.Drawing.Size(100, 23); - this.ConnectCodeBox.TabIndex = 0; - this.ConnectCodeBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // // CurrentStateGroupBox // + this.CurrentStateGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.CurrentStateGroupBox.Controls.Add(this.CurrentState); this.CurrentStateGroupBox.Location = new System.Drawing.Point(6, 414); this.CurrentStateGroupBox.Name = "CurrentStateGroupBox"; @@ -141,6 +174,7 @@ private void InitializeComponent() // ConsoleGroupBox // this.ConsoleGroupBox.Controls.Add(this.ConsoleTextBox); + this.ConsoleGroupBox.Controls.Add(this.checkBox1); this.ConsoleGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; this.ConsoleGroupBox.Location = new System.Drawing.Point(0, 0); this.ConsoleGroupBox.Name = "ConsoleGroupBox"; @@ -152,15 +186,45 @@ private void InitializeComponent() // ConsoleTextBox // this.ConsoleTextBox.AutoWordSelection = true; - this.ConsoleTextBox.BackColor = System.Drawing.SystemColors.Control; this.ConsoleTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.ConsoleTextBox.ContextMenuStrip = this.contextMenuStrip1; this.ConsoleTextBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.ConsoleTextBox.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.ConsoleTextBox.Location = new System.Drawing.Point(3, 19); this.ConsoleTextBox.Name = "ConsoleTextBox"; this.ConsoleTextBox.ReadOnly = true; this.ConsoleTextBox.Size = new System.Drawing.Size(540, 454); this.ConsoleTextBox.TabIndex = 0; this.ConsoleTextBox.Text = ""; + this.ConsoleTextBox.TextChanged += new System.EventHandler(this.ConsoleTextBox_TextChanged); + // + // contextMenuStrip1 + // + this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.AutoScrollMenuItem}); + this.contextMenuStrip1.Name = "contextMenuStrip1"; + this.contextMenuStrip1.Size = new System.Drawing.Size(130, 26); + // + // AutoScrollMenuItem + // + this.AutoScrollMenuItem.BackColor = System.Drawing.SystemColors.ControlDark; + this.AutoScrollMenuItem.Checked = true; + this.AutoScrollMenuItem.CheckOnClick = true; + this.AutoScrollMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; + this.AutoScrollMenuItem.ForeColor = System.Drawing.SystemColors.ControlLightLight; + this.AutoScrollMenuItem.Name = "AutoScrollMenuItem"; + this.AutoScrollMenuItem.Size = new System.Drawing.Size(129, 22); + this.AutoScrollMenuItem.Text = "AutoScroll"; + // + // checkBox1 + // + this.checkBox1.AutoSize = true; + this.checkBox1.Location = new System.Drawing.Point(250, 315); + this.checkBox1.Name = "checkBox1"; + this.checkBox1.Size = new System.Drawing.Size(83, 19); + this.checkBox1.TabIndex = 2; + this.checkBox1.Text = "checkBox1"; + this.checkBox1.UseVisualStyleBackColor = true; // // UserForm // @@ -170,6 +234,7 @@ private void InitializeComponent() this.Controls.Add(this.splitContainer1); this.Name = "UserForm"; this.Text = "Among Us Capture"; + this.Load += new System.EventHandler(this.OnLoad); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); @@ -177,9 +242,13 @@ private void InitializeComponent() this.UserSettings.ResumeLayout(false); this.ConnectCodeGB.ResumeLayout(false); this.ConnectCodeGB.PerformLayout(); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); this.CurrentStateGroupBox.ResumeLayout(false); this.CurrentStateGroupBox.PerformLayout(); this.ConsoleGroupBox.ResumeLayout(false); + this.ConsoleGroupBox.PerformLayout(); + this.contextMenuStrip1.ResumeLayout(false); this.ResumeLayout(false); } @@ -189,11 +258,15 @@ private void InitializeComponent() private System.Windows.Forms.SplitContainer splitContainer1; private System.Windows.Forms.GroupBox UserSettings; private System.Windows.Forms.GroupBox ConsoleGroupBox; - private System.Windows.Forms.RichTextBox ConsoleTextBox; private System.Windows.Forms.Button SubmitButton; private System.Windows.Forms.TextBox ConnectCodeBox; private System.Windows.Forms.GroupBox CurrentStateGroupBox; private System.Windows.Forms.Label CurrentState; private System.Windows.Forms.GroupBox ConnectCodeGB; + private System.Windows.Forms.RichTextBox ConsoleTextBox; + private System.Windows.Forms.CheckBox checkBox1; + private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; + private System.Windows.Forms.ToolStripMenuItem AutoScrollMenuItem; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; } } \ No newline at end of file diff --git a/AmongUsCapture/UserForm.cs b/AmongUsCapture/UserForm.cs index 43a95726..0ca944eb 100644 --- a/AmongUsCapture/UserForm.cs +++ b/AmongUsCapture/UserForm.cs @@ -27,6 +27,11 @@ public UserForm(ClientSocket sock) } + private void OnLoad(object sender, EventArgs e) + { + //TestFillConsole(100); + } + private void OnChatMessageAdded(object sender, ChatMessageEventArgs e) { WriteLineToConsole($"[CHAT] {e.Sender}: {e.Message}"); @@ -100,8 +105,25 @@ private void SubmitButton_Click(object sender, EventArgs e) if(ConnectCodeBox.TextLength == 6) { clientSocket.SendConnectCode(ConnectCodeBox.Text); - ConnectCodeBox.Enabled = false; - SubmitButton.Enabled = false; + //ConnectCodeBox.Enabled = false; + //SubmitButton.Enabled = false; + } + } + + private void ConsoleTextBox_TextChanged(object sender, EventArgs e) + { + if (AutoScrollMenuItem.Checked) + { + ConsoleTextBox.SelectionStart = ConsoleTextBox.Text.Length; + ConsoleTextBox.ScrollToCaret(); + } + } + + private void TestFillConsole(int entries) //Helper test method to see if filling console works. + { + for (int i = 0; i < entries; i++) + { + WriteLineToConsole(i.ToString()); } } @@ -115,5 +137,7 @@ public void WriteLineToConsole(String line) } } + + } } diff --git a/AmongUsCapture/UserForm.resx b/AmongUsCapture/UserForm.resx index 182bea4f..f298a7be 100644 --- a/AmongUsCapture/UserForm.resx +++ b/AmongUsCapture/UserForm.resx @@ -57,7 +57,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - \ No newline at end of file