diff --git a/UI/Composer.Designer.cs b/UI/Composer.Designer.cs index 8e37cd6..b21e058 100644 --- a/UI/Composer.Designer.cs +++ b/UI/Composer.Designer.cs @@ -28,7 +28,6 @@ protected override void Dispose( bool disposing ) /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Composer)); this.label4 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); @@ -36,6 +35,9 @@ private void InitializeComponent() this.button3 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); + this.button5 = new System.Windows.Forms.Button(); + this.label8 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // label4 @@ -43,7 +45,7 @@ private void InitializeComponent() this.label4.AutoSize = true; this.label4.Font = new System.Drawing.Font("Microsoft YaHei", 16F, System.Drawing.FontStyle.Bold); this.label4.ForeColor = System.Drawing.SystemColors.Highlight; - this.label4.Location = new System.Drawing.Point(13, 221); + this.label4.Location = new System.Drawing.Point(13, 177); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(237, 30); this.label4.TabIndex = 3; @@ -66,7 +68,7 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.label5.Location = new System.Drawing.Point(19, 71); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(463, 57); + this.label5.Size = new System.Drawing.Size(330, 80); this.label5.TabIndex = 8; this.label5.Text = "The Composer version should match the version of your system.\r\n\r\nIt doesn\'t feel " + "right linking to Composer Pro downloads but they\'re quite easy to find if you kn" + @@ -76,19 +78,21 @@ private void InitializeComponent() // this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.label3.Location = new System.Drawing.Point(15, 265); + this.label3.Location = new System.Drawing.Point(15, 221); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(463, 78); + this.label3.Size = new System.Drawing.Size(463, 34); this.label3.TabIndex = 4; - this.label3.Text = resources.GetString("label3.Text"); + this.label3.Text = "We can stop Composer asking Control4 if you\'re a dealer. To do this we change the" + + " ComposerPro_LicensingService_Licensing setting in ComposerPro.exe.config. "; // // button3 // + this.button3.Anchor = System.Windows.Forms.AnchorStyles.None; this.button3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.button3.Image = global::Garry.Control4.Jailbreak.Properties.Resources.reddit; - this.button3.Location = new System.Drawing.Point(264, 149); + this.button3.Location = new System.Drawing.Point(355, 114); this.button3.Name = "button3"; - this.button3.Size = new System.Drawing.Size(93, 37); + this.button3.Size = new System.Drawing.Size(123, 37); this.button3.TabIndex = 10; this.button3.Text = " r/c4diy"; this.button3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -98,8 +102,9 @@ private void InitializeComponent() // // button1 // + this.button1.Anchor = System.Windows.Forms.AnchorStyles.None; this.button1.Image = global::Garry.Control4.Jailbreak.Properties.Resources.loupe; - this.button1.Location = new System.Drawing.Point(363, 149); + this.button1.Location = new System.Drawing.Point(355, 71); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(123, 37); this.button1.TabIndex = 9; @@ -111,11 +116,11 @@ private void InitializeComponent() // // button2 // - this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.button2.Anchor = System.Windows.Forms.AnchorStyles.None; this.button2.AutoSize = true; this.button2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.button2.Image = global::Garry.Control4.Jailbreak.Properties.Resources.patch; - this.button2.Location = new System.Drawing.Point(349, 346); + this.button2.Location = new System.Drawing.Point(349, 269); this.button2.Name = "button2"; this.button2.Padding = new System.Windows.Forms.Padding(8); this.button2.Size = new System.Drawing.Size(129, 39); @@ -125,11 +130,49 @@ private void InitializeComponent() this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.PatchComposer); // + // button5 + // + this.button5.Anchor = System.Windows.Forms.AnchorStyles.None; + this.button5.Image = global::Garry.Control4.Jailbreak.Properties.Resources.cup_cake; + this.button5.Location = new System.Drawing.Point(349, 420); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(129, 34); + this.button5.TabIndex = 24; + this.button5.Text = "Update Certificates"; + this.button5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.button5.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.button5.UseVisualStyleBackColor = true; + this.button5.Click += new System.EventHandler(this.UpdateCertificates); + // + // label8 + // + this.label8.Location = new System.Drawing.Point(15, 366); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(468, 40); + this.label8.TabIndex = 23; + this.label8.Text = "Your Composer needs to have a certificate matching the one on your Director in or" + + "der to connect. So lets copy the certificate we generated into your composer con" + + "fig folder so it does."; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Font = new System.Drawing.Font("Microsoft YaHei", 16F, System.Drawing.FontStyle.Bold); + this.label9.ForeColor = System.Drawing.SystemColors.Highlight; + this.label9.Location = new System.Drawing.Point(13, 322); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(291, 30); + this.label9.TabIndex = 22; + this.label9.Text = "COMPOSER CERTIFICATE"; + // // Composer // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.Window; + this.Controls.Add(this.button5); + this.Controls.Add(this.label8); + this.Controls.Add(this.label9); this.Controls.Add(this.button3); this.Controls.Add(this.button1); this.Controls.Add(this.label5); @@ -152,5 +195,8 @@ private void InitializeComponent() private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button3; private System.Windows.Forms.Label label3; - } + private System.Windows.Forms.Button button5; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label9; + } } diff --git a/UI/Composer.cs b/UI/Composer.cs index 60eaae8..08b1631 100644 --- a/UI/Composer.cs +++ b/UI/Composer.cs @@ -82,5 +82,39 @@ private void OpenControl4Reddit( object sender, EventArgs e ) { System.Diagnostics.Process.Start( $"https://www.reddit.com/r/C4diy/" ); } + + private void UpdateCertificates( object sender, EventArgs e ) + { + var log = new LogWindow( MainWindow ); + + log.WriteNormal( "Copying To Composer\n" ); + if ( !PatchComposer( log ) ) + { + return; + } + log.WriteNormal( "\n\n" ); + } + + + bool PatchComposer( LogWindow log ) + { + var configFolder = $"{Environment.GetFolderPath( Environment.SpecialFolder.ApplicationData )}\\Control4\\Composer"; + + CopyFile( log, $"Certs/{Constants.ComposerCertName}", $"{configFolder}\\{Constants.ComposerCertName}" ); + CopyFile( log, $"Certs/composer.p12", $"{configFolder}\\composer.p12" ); + + return true; + } + + private void CopyFile( LogWindow log, string a, string b ) + { + log.WriteNormal( $"Copying " ); + log.WriteHighlight( a ); + log.WriteNormal( $" to " ); + log.WriteHighlight( b ); + log.WriteNormal( $"\n" ); + + System.IO.File.Copy( a, b, true ); + } } } diff --git a/UI/Composer.resx b/UI/Composer.resx index ce75641..1af7de1 100644 --- a/UI/Composer.resx +++ b/UI/Composer.resx @@ -117,9 +117,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - We need to stop Composer asking Control4 if you're a dealer. To do this we change the ComposerPro_LicensingService_Licensing setting in ComposerPro.exe.config. - -You can do this yourself, or we can do it for you by pressing the button. We'll back up the old config file for you. - \ No newline at end of file diff --git a/UI/DirectorPatch.Designer.cs b/UI/DirectorPatch.Designer.cs index 872b545..40ae6ff 100644 --- a/UI/DirectorPatch.Designer.cs +++ b/UI/DirectorPatch.Designer.cs @@ -29,91 +29,47 @@ protected override void Dispose( bool disposing ) private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DirectorPatch)); - this.button1 = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); - this.button2 = new System.Windows.Forms.Button(); this.label6 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.button4 = new System.Windows.Forms.Button(); - this.button5 = new System.Windows.Forms.Button(); - this.label8 = new System.Windows.Forms.Label(); - this.label9 = new System.Windows.Forms.Label(); this.Password = new System.Windows.Forms.TextBox(); this.Username = new System.Windows.Forms.TextBox(); this.Address = new System.Windows.Forms.TextBox(); this.label10 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label(); - this.label15 = new System.Windows.Forms.Label(); - this.label16 = new System.Windows.Forms.Label(); - this.textBox2 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); this.SuspendLayout(); // - // button1 - // - this.button1.Image = global::Garry.Control4.Jailbreak.Properties.Resources.cup_cake; - this.button1.Location = new System.Drawing.Point(269, 136); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(105, 34); - this.button1.TabIndex = 9; - this.button1.Text = "Generate"; - this.button1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.button1.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this.button1.UseVisualStyleBackColor = true; - // - // label1 - // - this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label1.Location = new System.Drawing.Point(17, 72); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(469, 61); - this.label1.TabIndex = 10; - this.label1.Text = "Lets make some certificates so Composer Pro thinks we\'re a dealer. \r\n\r\nLater on w" + - "e\'ll add this certificate to our Director so we can connect to it using Composer" + - " too."; - // - // button2 - // - this.button2.Image = global::Garry.Control4.Jailbreak.Properties.Resources.folder; - this.button2.Location = new System.Drawing.Point(380, 136); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(105, 34); - this.button2.TabIndex = 11; - this.button2.Text = "View Files"; - this.button2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.button2.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this.button2.UseVisualStyleBackColor = true; - // // label6 // this.label6.AutoSize = true; - this.label6.Font = new System.Drawing.Font("Microsoft YaHei", 20.25F, System.Drawing.FontStyle.Bold); + this.label6.Font = new System.Drawing.Font("Microsoft YaHei", 16F, System.Drawing.FontStyle.Bold); this.label6.ForeColor = System.Drawing.SystemColors.Highlight; - this.label6.Location = new System.Drawing.Point(13, 436); + this.label6.Location = new System.Drawing.Point(12, 16); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(273, 36); + this.label6.Size = new System.Drawing.Size(276, 30); this.label6.TabIndex = 16; - this.label6.Text = "Director Certificate"; + this.label6.Text = "DIRECTOR CERTIFICATE"; // // label7 // this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.label7.Location = new System.Drawing.Point(17, 494); + this.label7.Location = new System.Drawing.Point(16, 74); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(466, 30); + this.label7.Size = new System.Drawing.Size(466, 63); this.label7.TabIndex = 17; this.label7.Text = "If you created a user we\'ll be able to patch the director with the new certificat" + - "e.\r\n"; + "e.\r\n\r\nWe can work out the password to your director, just make sure the Address " + + "is correct!\r\n"; // // button4 // this.button4.Image = global::Garry.Control4.Jailbreak.Properties.Resources.cup_cake; - this.button4.Location = new System.Drawing.Point(298, 599); + this.button4.Location = new System.Drawing.Point(297, 179); this.button4.Name = "button4"; this.button4.Size = new System.Drawing.Size(185, 34); this.button4.TabIndex = 18; @@ -123,61 +79,27 @@ private void InitializeComponent() this.button4.UseVisualStyleBackColor = true; this.button4.Click += new System.EventHandler(this.PatchDirectorCertificates); // - // button5 - // - this.button5.Image = global::Garry.Control4.Jailbreak.Properties.Resources.cup_cake; - this.button5.Location = new System.Drawing.Point(332, 365); - this.button5.Name = "button5"; - this.button5.Size = new System.Drawing.Size(154, 34); - this.button5.TabIndex = 21; - this.button5.Text = "Copy Composer Certs"; - this.button5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.button5.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this.button5.UseVisualStyleBackColor = true; - this.button5.Click += new System.EventHandler(this.CopyComposerCerts); - // - // label8 - // - this.label8.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label8.Location = new System.Drawing.Point(20, 282); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(468, 70); - this.label8.TabIndex = 20; - this.label8.Text = resources.GetString("label8.Text"); - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Font = new System.Drawing.Font("Microsoft YaHei", 20.25F, System.Drawing.FontStyle.Bold); - this.label9.ForeColor = System.Drawing.SystemColors.Highlight; - this.label9.Location = new System.Drawing.Point(17, 223); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(315, 36); - this.label9.TabIndex = 19; - this.label9.Text = "Composer Certificates"; - // // Password // - this.Password.Location = new System.Drawing.Point(350, 573); + this.Password.Location = new System.Drawing.Point(245, 153); this.Password.Name = "Password"; - this.Password.Size = new System.Drawing.Size(133, 20); + this.Password.Size = new System.Drawing.Size(237, 20); this.Password.TabIndex = 22; this.Password.Text = "jailbreak"; // // Username // - this.Username.Location = new System.Drawing.Point(211, 573); + this.Username.Location = new System.Drawing.Point(152, 153); this.Username.Name = "Username"; - this.Username.Size = new System.Drawing.Size(133, 20); + this.Username.Size = new System.Drawing.Size(87, 20); this.Username.TabIndex = 23; this.Username.Text = "root"; // // Address // - this.Address.Location = new System.Drawing.Point(17, 573); + this.Address.Location = new System.Drawing.Point(16, 153); this.Address.Name = "Address"; - this.Address.Size = new System.Drawing.Size(188, 20); + this.Address.Size = new System.Drawing.Size(130, 20); this.Address.TabIndex = 24; this.Address.Text = "127.0.0.1"; this.Address.TextChanged += new System.EventHandler(this.OnAddressChanged); @@ -185,7 +107,7 @@ private void InitializeComponent() // label10 // this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(18, 557); + this.label10.Location = new System.Drawing.Point(17, 137); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(45, 13); this.label10.TabIndex = 25; @@ -194,7 +116,7 @@ private void InitializeComponent() // label11 // this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(208, 557); + this.label11.Location = new System.Drawing.Point(149, 137); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(55, 13); this.label11.TabIndex = 26; @@ -203,86 +125,50 @@ private void InitializeComponent() // label12 // this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(347, 557); + this.label12.Location = new System.Drawing.Point(242, 137); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(53, 13); this.label12.TabIndex = 27; this.label12.Text = "Password"; // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft YaHei", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label2.ForeColor = System.Drawing.SystemColors.Highlight; - this.label2.Location = new System.Drawing.Point(13, 18); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(252, 36); - this.label2.TabIndex = 7; - this.label2.Text = "Make Certificates"; - // // label13 // this.label13.AutoSize = true; - this.label13.Font = new System.Drawing.Font("Microsoft YaHei", 20.25F, System.Drawing.FontStyle.Bold); + this.label13.Font = new System.Drawing.Font("Microsoft YaHei", 16F, System.Drawing.FontStyle.Bold); this.label13.ForeColor = System.Drawing.SystemColors.Highlight; - this.label13.Location = new System.Drawing.Point(18, 701); + this.label13.Location = new System.Drawing.Point(12, 243); this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(230, 36); + this.label13.Size = new System.Drawing.Size(235, 30); this.label13.TabIndex = 28; - this.label13.Text = "Restart Director"; + this.label13.Text = "RESTART DIRECTOR"; // // label14 // this.label14.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.label14.Location = new System.Drawing.Point(17, 757); + this.label14.Location = new System.Drawing.Point(17, 283); this.label14.Name = "label14"; - this.label14.Size = new System.Drawing.Size(466, 33); + this.label14.Size = new System.Drawing.Size(466, 71); this.label14.TabIndex = 29; - this.label14.Text = "You need to restart your director for the new certifcates to kick in. You can do " + - "this by right clicking in System Manager and going to Reboot.."; - // - // label15 - // - this.label15.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label15.Location = new System.Drawing.Point(17, 924); - this.label15.Name = "label15"; - this.label15.Size = new System.Drawing.Size(463, 33); - this.label15.TabIndex = 31; - this.label15.Text = "It\'s probably a good idea to create the jailbreak user. \r\n\r\nIt\'s probably no less" + - " secure than when the default password for everythign was t0talc0ntr0l4!, but to" + - " be safe, here\'s how:"; + this.label14.Text = resources.GetString("label14.Text"); // - // label16 - // - this.label16.AutoSize = true; - this.label16.Font = new System.Drawing.Font("Microsoft YaHei", 20.25F, System.Drawing.FontStyle.Bold); - this.label16.ForeColor = System.Drawing.SystemColors.Highlight; - this.label16.Location = new System.Drawing.Point(15, 868); - this.label16.Name = "label16"; - this.label16.Size = new System.Drawing.Size(172, 36); - this.label16.TabIndex = 30; - this.label16.Text = "Delete User"; - // - // textBox2 + // button1 // - this.textBox2.BackColor = System.Drawing.SystemColors.ControlLightLight; - this.textBox2.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.textBox2.Location = new System.Drawing.Point(17, 960); - this.textBox2.Name = "textBox2"; - this.textBox2.ReadOnly = true; - this.textBox2.Size = new System.Drawing.Size(467, 22); - this.textBox2.TabIndex = 32; - this.textBox2.Text = "deluser jailbreak"; + this.button1.Location = new System.Drawing.Point(297, 380); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(185, 34); + this.button1.TabIndex = 30; + this.button1.Text = "Reboot Director"; + this.button1.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.RebootDirector); // // DirectorPatch // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.textBox2); - this.Controls.Add(this.label15); - this.Controls.Add(this.label16); + this.BackColor = System.Drawing.SystemColors.Window; + this.Controls.Add(this.button1); this.Controls.Add(this.label14); this.Controls.Add(this.label13); this.Controls.Add(this.label12); @@ -291,44 +177,28 @@ private void InitializeComponent() this.Controls.Add(this.Address); this.Controls.Add(this.Username); this.Controls.Add(this.Password); - this.Controls.Add(this.button5); - this.Controls.Add(this.label8); - this.Controls.Add(this.label9); this.Controls.Add(this.button4); this.Controls.Add(this.label7); this.Controls.Add(this.label6); - this.Controls.Add(this.button2); - this.Controls.Add(this.label1); - this.Controls.Add(this.button1); - this.Controls.Add(this.label2); this.Name = "DirectorPatch"; - this.Size = new System.Drawing.Size(500, 1394); + this.Size = new System.Drawing.Size(500, 443); this.ResumeLayout(false); this.PerformLayout(); } #endregion - private System.Windows.Forms.Button button1; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Button button2; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label7; private System.Windows.Forms.Button button4; - private System.Windows.Forms.Button button5; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.Label label9; private System.Windows.Forms.TextBox Password; private System.Windows.Forms.TextBox Username; private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label11; private System.Windows.Forms.Label label12; - private System.Windows.Forms.Label label2; public System.Windows.Forms.TextBox Address; private System.Windows.Forms.Label label13; private System.Windows.Forms.Label label14; - private System.Windows.Forms.Label label15; - private System.Windows.Forms.Label label16; - private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Button button1; } } diff --git a/UI/DirectorPatch.cs b/UI/DirectorPatch.cs index e386dc4..944a3a3 100644 --- a/UI/DirectorPatch.cs +++ b/UI/DirectorPatch.cs @@ -29,15 +29,6 @@ public DirectorPatch( MainWindow MainWindow ) } - bool PatchComposer( LogWindow log ) - { - var configFolder = $"{Environment.GetFolderPath( Environment.SpecialFolder.ApplicationData )}\\Control4\\Composer"; - - CopyFile( log, $"Certs/{Constants.ComposerCertName}", $"{configFolder}\\{Constants.ComposerCertName}" ); - CopyFile( log, $"Certs/composer.p12", $"{configFolder}\\composer.p12" ); - - return true; - } bool PatchDirector( LogWindow log ) { @@ -136,31 +127,9 @@ bool PatchDirector( LogWindow log ) return true; } - private void CopyFile( LogWindow log, string a, string b ) - { - log.WriteNormal( $"Copying " ); - log.WriteHighlight( a ); - log.WriteNormal( $" to " ); - log.WriteHighlight( b ); - log.WriteNormal( $"\n" ); - - System.IO.File.Copy( a, b, true ); - } - private void CopyComposerCerts( object sender, EventArgs e ) - { - var log = new LogWindow( MainWindow ); - - log.WriteNormal( "Copying To Composer\n" ); - if ( !PatchComposer( log ) ) - { - return; - } - log.WriteNormal( "\n\n" ); - } - private void OpenSystemManager( object sender, EventArgs e ) { Process.Start( @"C:\Program Files (x86)\Control4\Composer\Pro\Sysman.exe" ); @@ -237,5 +206,35 @@ private static string GetDirectorRootPassword( string address ) } } - } + private void RebootDirector( object sender, EventArgs e ) + { + var log = new LogWindow( MainWindow ); + + try + { + var SshConnectionInfo = new ConnectionInfo( Address.Text.ToString(), Username.Text, new PasswordAuthenticationMethod( Username.Text, Password.Text ) ); + SshConnectionInfo.RetryAttempts = 1; + SshConnectionInfo.Timeout = TimeSpan.FromSeconds( 5 ); + + log.WriteTrace( "Connecting To Director..\n" ); + + using ( var ssh = new SshClient( SshConnectionInfo ) ) + { + ssh.Connect(); + + log.WriteTrace( "Connected!\n" ); + + log.WriteTrace( "Running Reboot Command..\n" ); + var r = ssh.RunCommand( "reboot" ); + log.WriteTrace( $"Response Was: {r.Result}\n" ); + + log.WriteSuccess( $"Your system is rebooting - it can take a while - don't panic, give it 10 minutes!" ); + } + } + catch ( System.Exception ex ) + { + log.WriteError( ex ); + } + } + } } diff --git a/UI/DirectorPatch.resx b/UI/DirectorPatch.resx index 8be34cc..b6c9b37 100644 --- a/UI/DirectorPatch.resx +++ b/UI/DirectorPatch.resx @@ -117,9 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - We can copy the new certificates to the composer user settings folder. + + You need to restart your director for the new certifcates to kick in. You can also do this by right clicking in System Manager and going to Reboot.. -This will mean Composer will think you're a dealer. It will also mean that System Manager will let you use Terminal to connect to your director. +It can take a few minutes for your director to come back online. It's a scary time but it'll come back. Don't do this while your wife is home because she'll be going fucking mad. \ No newline at end of file diff --git a/UI/MainWindow.Designer.cs b/UI/MainWindow.Designer.cs index 721f536..77ec24a 100644 --- a/UI/MainWindow.Designer.cs +++ b/UI/MainWindow.Designer.cs @@ -60,7 +60,7 @@ private void InitializeComponent() this.helpToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(534, 24); + this.menuStrip1.Size = new System.Drawing.Size(504, 24); this.menuStrip1.TabIndex = 1; this.menuStrip1.Text = "menuStrip1"; // @@ -146,7 +146,7 @@ private void InitializeComponent() this.splitContainer3.Panel2.Controls.Add(this.StatusTextRight); this.splitContainer3.Panel2.Padding = new System.Windows.Forms.Padding(4); this.splitContainer3.Panel2MinSize = 20; - this.splitContainer3.Size = new System.Drawing.Size(534, 537); + this.splitContainer3.Size = new System.Drawing.Size(504, 537); this.splitContainer3.SplitterDistance = 511; this.splitContainer3.SplitterWidth = 1; this.splitContainer3.TabIndex = 2; @@ -161,7 +161,7 @@ private void InitializeComponent() this.TabControl.Location = new System.Drawing.Point(0, 0); this.TabControl.Name = "TabControl"; this.TabControl.SelectedIndex = 0; - this.TabControl.Size = new System.Drawing.Size(534, 516); + this.TabControl.Size = new System.Drawing.Size(504, 519); this.TabControl.TabIndex = 0; // // tabPage1 @@ -169,7 +169,7 @@ private void InitializeComponent() this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(526, 490); + this.tabPage1.Size = new System.Drawing.Size(496, 493); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "tabPage1"; this.tabPage1.UseVisualStyleBackColor = true; @@ -179,7 +179,7 @@ private void InitializeComponent() this.tabPage2.Location = new System.Drawing.Point(4, 22); this.tabPage2.Name = "tabPage2"; this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(526, 487); + this.tabPage2.Size = new System.Drawing.Size(526, 490); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "tabPage2"; this.tabPage2.UseVisualStyleBackColor = true; @@ -200,7 +200,7 @@ private void InitializeComponent() this.StatusTextRight.AutoSize = true; this.StatusTextRight.BackColor = System.Drawing.Color.Transparent; this.StatusTextRight.Dock = System.Windows.Forms.DockStyle.Right; - this.StatusTextRight.Location = new System.Drawing.Point(530, 4); + this.StatusTextRight.Location = new System.Drawing.Point(500, 4); this.StatusTextRight.Name = "StatusTextRight"; this.StatusTextRight.Size = new System.Drawing.Size(0, 13); this.StatusTextRight.TabIndex = 1; @@ -210,14 +210,14 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(534, 561); + this.ClientSize = new System.Drawing.Size(504, 561); this.Controls.Add(this.splitContainer3); this.Controls.Add(this.menuStrip1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.menuStrip1; - this.MaximumSize = new System.Drawing.Size(550, 600); - this.MinimumSize = new System.Drawing.Size(550, 600); + this.MaximumSize = new System.Drawing.Size(520, 600); + this.MinimumSize = new System.Drawing.Size(520, 600); this.Name = "MainWindow"; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.Text = "Garry\'s Control4 Jailbreak";