├── .gitignore
├── BandagedBD.sln
├── BandagedBD
├── App.config
├── BBD_small64.ico
├── BandagedBD.csproj
├── Controls
│ ├── Button.cs
│ ├── DiscordLocator.Designer.cs
│ ├── DiscordLocator.cs
│ ├── DiscordLocator.resx
│ ├── FlatCheckBox.cs
│ └── FlatProgressBar.cs
├── FormMain.Designer.cs
├── FormMain.cs
├── FormMain.resx
├── Panels
│ ├── ActionPanel.Designer.cs
│ ├── ActionPanel.cs
│ ├── ActionPanel.resx
│ ├── IPanel.cs
│ ├── InstallConfigPanel.Designer.cs
│ ├── InstallConfigPanel.cs
│ ├── InstallConfigPanel.resx
│ ├── InstallPanel.Designer.cs
│ ├── InstallPanel.cs
│ ├── InstallPanel.resx
│ ├── LicensePanel.Designer.cs
│ ├── LicensePanel.cs
│ ├── LicensePanel.resx
│ ├── RepairConfigPanel.Designer.cs
│ ├── RepairConfigPanel.cs
│ ├── RepairConfigPanel.resx
│ ├── RepairPanel.Designer.cs
│ ├── RepairPanel.cs
│ ├── RepairPanel.resx
│ ├── UninstallConfigPanel.Designer.cs
│ ├── UninstallConfigPanel.cs
│ ├── UninstallConfigPanel.resx
│ ├── UninstallPanel.Designer.cs
│ ├── UninstallPanel.cs
│ └── UninstallPanel.resx
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Resources
│ ├── BBDVS.png
│ ├── archive_small.png
│ ├── build_small.png
│ └── delete_small.png
├── Utilities.cs
└── app.manifest
├── LICENSE
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | .vs/
2 | bin/
3 | obj/
4 |
5 | *.user
6 |
--------------------------------------------------------------------------------
/BandagedBD.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27130.2010
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BandagedBD", "BandagedBD\BandagedBD.csproj", "{390615F1-CE33-4173-9E8C-4E4F3EB1758D}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {390615F1-CE33-4173-9E8C-4E4F3EB1758D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {390615F1-CE33-4173-9E8C-4E4F3EB1758D}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {390615F1-CE33-4173-9E8C-4E4F3EB1758D}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {390615F1-CE33-4173-9E8C-4E4F3EB1758D}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {C4B9CD4A-4904-43C7-BE3F-B72A35C86ADF}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/BandagedBD/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | False
18 |
19 |
20 |
21 |
22 |
23 |
24 | 28, 28, 28
25 |
26 |
27 | 42, 42, 42
28 |
29 |
30 | 62, 130, 229
31 |
32 |
33 | White
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/BandagedBD/BBD_small64.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zerebos/BBDInstaller/67a2a9132f34e90ac079efe8047984c4bebe77fc/BandagedBD/BBD_small64.ico
--------------------------------------------------------------------------------
/BandagedBD/BandagedBD.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {390615F1-CE33-4173-9E8C-4E4F3EB1758D}
8 | WinExe
9 | BandagedBD
10 | BandagedBD
11 | v4.5.2
12 | 512
13 | true
14 |
15 |
16 |
17 | false
18 | publish\
19 | true
20 | Disk
21 | false
22 | Foreground
23 | 7
24 | Days
25 | false
26 | false
27 | true
28 | 0
29 | 1.0.0.%2a
30 | false
31 | true
32 |
33 |
34 | AnyCPU
35 | true
36 | full
37 | false
38 | bin\Debug\
39 | DEBUG;TRACE
40 | prompt
41 | 4
42 |
43 |
44 | AnyCPU
45 | pdbonly
46 | true
47 | bin\Release\
48 | TRACE
49 | prompt
50 | 4
51 |
52 |
53 | BBD_small64.ico
54 |
55 |
56 |
57 | false
58 |
59 |
60 | false
61 |
62 |
63 | app.manifest
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 | Component
83 |
84 |
85 | Component
86 |
87 |
88 | Component
89 |
90 |
91 | Form
92 |
93 |
94 | FormMain.cs
95 |
96 |
97 | UserControl
98 |
99 |
100 | ActionPanel.cs
101 |
102 |
103 | UserControl
104 |
105 |
106 | DiscordLocator.cs
107 |
108 |
109 | UserControl
110 |
111 |
112 | InstallConfigPanel.cs
113 |
114 |
115 | UserControl
116 |
117 |
118 | RepairConfigPanel.cs
119 |
120 |
121 | UserControl
122 |
123 |
124 | RepairPanel.cs
125 |
126 |
127 | UserControl
128 |
129 |
130 | UninstallPanel.cs
131 |
132 |
133 | UserControl
134 |
135 |
136 | UninstallConfigPanel.cs
137 |
138 |
139 | UserControl
140 |
141 |
142 | InstallPanel.cs
143 |
144 |
145 |
146 | UserControl
147 |
148 |
149 | LicensePanel.cs
150 |
151 |
152 |
153 |
154 |
155 | FormMain.cs
156 |
157 |
158 | ActionPanel.cs
159 |
160 |
161 | DiscordLocator.cs
162 |
163 |
164 | InstallConfigPanel.cs
165 |
166 |
167 | RepairConfigPanel.cs
168 |
169 |
170 | RepairPanel.cs
171 |
172 |
173 | UninstallPanel.cs
174 |
175 |
176 | UninstallConfigPanel.cs
177 |
178 |
179 | InstallPanel.cs
180 |
181 |
182 | LicensePanel.cs
183 |
184 |
185 | ResXFileCodeGenerator
186 | Designer
187 | Resources.Designer.cs
188 |
189 |
190 | Designer
191 |
192 |
193 | SettingsSingleFileGenerator
194 | Settings.Designer.cs
195 |
196 |
197 | True
198 | True
199 | Resources.resx
200 |
201 |
202 | True
203 | Settings.settings
204 | True
205 |
206 |
207 |
208 |
209 | Designer
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 | False
222 | Microsoft .NET Framework 4.5.2 %28x86 and x64%29
223 | true
224 |
225 |
226 | False
227 | .NET Framework 3.5 SP1
228 | false
229 |
230 |
231 |
232 |
--------------------------------------------------------------------------------
/BandagedBD/Controls/Button.cs:
--------------------------------------------------------------------------------
1 | namespace BandagedBD.Controls {
2 | public partial class Button : System.Windows.Forms.Button {
3 |
4 | public Button HideDisable(string newText = null) {
5 | if (newText != null) Text = newText;
6 | Hide();
7 | Enabled = false;
8 | return this;
9 | }
10 |
11 | public Button HideEnable(string newText = null) {
12 | if (newText != null) Text = newText;
13 | Hide();
14 | Enabled = true;
15 | return this;
16 | }
17 |
18 | public Button ShowDisable(string newText = null) {
19 | if (newText != null) Text = newText;
20 | Show();
21 | Enabled = false;
22 | return this;
23 | }
24 |
25 | public Button ShowEnable(string newText = null) {
26 | if (newText != null) Text = newText;
27 | Show();
28 | Enabled = true;
29 | return this;
30 | }
31 |
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/BandagedBD/Controls/DiscordLocator.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace BandagedBD.Controls {
2 | partial class DiscordLocator {
3 | ///
4 | /// Required designer variable.
5 | ///
6 | private System.ComponentModel.IContainer components = null;
7 |
8 | ///
9 | /// Clean up any resources being used.
10 | ///
11 | /// true if managed resources should be disposed; otherwise, false.
12 | protected override void Dispose(bool disposing) {
13 | if (disposing && (components != null)) {
14 | components.Dispose();
15 | }
16 | base.Dispose(disposing);
17 | }
18 |
19 | #region Component Designer generated code
20 |
21 | ///
22 | /// Required method for Designer support - do not modify
23 | /// the contents of this method with the code editor.
24 | ///
25 | private void InitializeComponent() {
26 | this.titleLabel = new System.Windows.Forms.Label();
27 | this.browsePTB = new BandagedBD.Controls.Button();
28 | this.tbPTB = new System.Windows.Forms.TextBox();
29 | this.panel3 = new System.Windows.Forms.Panel();
30 | this.browseCanary = new BandagedBD.Controls.Button();
31 | this.tbCanary = new System.Windows.Forms.TextBox();
32 | this.panel1 = new System.Windows.Forms.Panel();
33 | this.browseStable = new BandagedBD.Controls.Button();
34 | this.tbStable = new System.Windows.Forms.TextBox();
35 | this.panel2 = new System.Windows.Forms.Panel();
36 | this.discordPTB = new BandagedBD.Controls.FlatCheckBox();
37 | this.discordCanary = new BandagedBD.Controls.FlatCheckBox();
38 | this.discordStable = new BandagedBD.Controls.FlatCheckBox();
39 | this.SuspendLayout();
40 | //
41 | // titleLabel
42 | //
43 | this.titleLabel.AutoSize = true;
44 | this.titleLabel.BackColor = System.Drawing.Color.Transparent;
45 | this.titleLabel.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
46 | this.titleLabel.Location = new System.Drawing.Point(7, 10);
47 | this.titleLabel.Name = "titleLabel";
48 | this.titleLabel.Size = new System.Drawing.Size(533, 13);
49 | this.titleLabel.TabIndex = 37;
50 | this.titleLabel.Text = "BandagedBD can attempt to fix several common problems. First we need to locate al" +
51 | "l BandagedBD installations:";
52 | //
53 | // browsePTB
54 | //
55 | this.browsePTB.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
56 | this.browsePTB.BackColor = global::BandagedBD.Properties.Settings.Default.Accent;
57 | this.browsePTB.Cursor = System.Windows.Forms.Cursors.Hand;
58 | this.browsePTB.FlatAppearance.BorderSize = 0;
59 | this.browsePTB.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
60 | this.browsePTB.ForeColor = System.Drawing.Color.White;
61 | this.browsePTB.Location = new System.Drawing.Point(657, 138);
62 | this.browsePTB.Name = "browsePTB";
63 | this.browsePTB.Size = new System.Drawing.Size(86, 26);
64 | this.browsePTB.TabIndex = 36;
65 | this.browsePTB.Text = "Browse";
66 | this.browsePTB.UseVisualStyleBackColor = false;
67 | this.browsePTB.Click += new System.EventHandler(this.browsePTB_Click);
68 | //
69 | // tbPTB
70 | //
71 | this.tbPTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
72 | | System.Windows.Forms.AnchorStyles.Right)));
73 | this.tbPTB.BackColor = global::BandagedBD.Properties.Settings.Default.SecondaryBackground;
74 | this.tbPTB.BorderStyle = System.Windows.Forms.BorderStyle.None;
75 | this.tbPTB.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
76 | this.tbPTB.ForeColor = System.Drawing.Color.White;
77 | this.tbPTB.Location = new System.Drawing.Point(194, 143);
78 | this.tbPTB.Name = "tbPTB";
79 | this.tbPTB.ReadOnly = true;
80 | this.tbPTB.Size = new System.Drawing.Size(441, 15);
81 | this.tbPTB.TabIndex = 34;
82 | //
83 | // panel3
84 | //
85 | this.panel3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
86 | | System.Windows.Forms.AnchorStyles.Right)));
87 | this.panel3.BackColor = global::BandagedBD.Properties.Settings.Default.SecondaryBackground;
88 | this.panel3.Location = new System.Drawing.Point(179, 138);
89 | this.panel3.Name = "panel3";
90 | this.panel3.Size = new System.Drawing.Size(471, 26);
91 | this.panel3.TabIndex = 35;
92 | //
93 | // browseCanary
94 | //
95 | this.browseCanary.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
96 | this.browseCanary.BackColor = global::BandagedBD.Properties.Settings.Default.Accent;
97 | this.browseCanary.Cursor = System.Windows.Forms.Cursors.Hand;
98 | this.browseCanary.FlatAppearance.BorderSize = 0;
99 | this.browseCanary.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
100 | this.browseCanary.ForeColor = System.Drawing.Color.White;
101 | this.browseCanary.Location = new System.Drawing.Point(657, 89);
102 | this.browseCanary.Name = "browseCanary";
103 | this.browseCanary.Size = new System.Drawing.Size(86, 26);
104 | this.browseCanary.TabIndex = 33;
105 | this.browseCanary.Text = "Browse";
106 | this.browseCanary.UseVisualStyleBackColor = false;
107 | this.browseCanary.Click += new System.EventHandler(this.browseCanary_Click);
108 | //
109 | // tbCanary
110 | //
111 | this.tbCanary.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
112 | | System.Windows.Forms.AnchorStyles.Right)));
113 | this.tbCanary.BackColor = global::BandagedBD.Properties.Settings.Default.SecondaryBackground;
114 | this.tbCanary.BorderStyle = System.Windows.Forms.BorderStyle.None;
115 | this.tbCanary.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
116 | this.tbCanary.ForeColor = System.Drawing.Color.White;
117 | this.tbCanary.Location = new System.Drawing.Point(194, 95);
118 | this.tbCanary.Name = "tbCanary";
119 | this.tbCanary.ReadOnly = true;
120 | this.tbCanary.Size = new System.Drawing.Size(441, 15);
121 | this.tbCanary.TabIndex = 31;
122 | //
123 | // panel1
124 | //
125 | this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
126 | | System.Windows.Forms.AnchorStyles.Right)));
127 | this.panel1.BackColor = global::BandagedBD.Properties.Settings.Default.SecondaryBackground;
128 | this.panel1.Location = new System.Drawing.Point(179, 89);
129 | this.panel1.Name = "panel1";
130 | this.panel1.Size = new System.Drawing.Size(471, 26);
131 | this.panel1.TabIndex = 32;
132 | //
133 | // browseStable
134 | //
135 | this.browseStable.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
136 | this.browseStable.BackColor = global::BandagedBD.Properties.Settings.Default.Accent;
137 | this.browseStable.Cursor = System.Windows.Forms.Cursors.Hand;
138 | this.browseStable.FlatAppearance.BorderSize = 0;
139 | this.browseStable.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
140 | this.browseStable.ForeColor = System.Drawing.Color.White;
141 | this.browseStable.Location = new System.Drawing.Point(657, 42);
142 | this.browseStable.Name = "browseStable";
143 | this.browseStable.Size = new System.Drawing.Size(86, 26);
144 | this.browseStable.TabIndex = 30;
145 | this.browseStable.Text = "Browse";
146 | this.browseStable.UseVisualStyleBackColor = false;
147 | this.browseStable.Click += new System.EventHandler(this.browseStable_Click);
148 | //
149 | // tbStable
150 | //
151 | this.tbStable.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
152 | | System.Windows.Forms.AnchorStyles.Right)));
153 | this.tbStable.BackColor = global::BandagedBD.Properties.Settings.Default.SecondaryBackground;
154 | this.tbStable.BorderStyle = System.Windows.Forms.BorderStyle.None;
155 | this.tbStable.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
156 | this.tbStable.ForeColor = System.Drawing.Color.White;
157 | this.tbStable.Location = new System.Drawing.Point(194, 48);
158 | this.tbStable.Name = "tbStable";
159 | this.tbStable.ReadOnly = true;
160 | this.tbStable.Size = new System.Drawing.Size(441, 15);
161 | this.tbStable.TabIndex = 28;
162 | //
163 | // panel2
164 | //
165 | this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
166 | | System.Windows.Forms.AnchorStyles.Right)));
167 | this.panel2.BackColor = global::BandagedBD.Properties.Settings.Default.SecondaryBackground;
168 | this.panel2.Location = new System.Drawing.Point(179, 42);
169 | this.panel2.Name = "panel2";
170 | this.panel2.Size = new System.Drawing.Size(471, 26);
171 | this.panel2.TabIndex = 29;
172 | //
173 | // discordPTB
174 | //
175 | this.discordPTB.AutoSize = true;
176 | this.discordPTB.BoxBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
177 | this.discordPTB.BoxForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(62)))), ((int)(((byte)(130)))), ((int)(((byte)(229)))));
178 | this.discordPTB.Cursor = System.Windows.Forms.Cursors.Hand;
179 | this.discordPTB.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
180 | this.discordPTB.Location = new System.Drawing.Point(10, 142);
181 | this.discordPTB.Name = "discordPTB";
182 | this.discordPTB.Size = new System.Drawing.Size(98, 17);
183 | this.discordPTB.TabIndex = 27;
184 | this.discordPTB.Text = "Repair On PTB";
185 | this.discordPTB.UseVisualStyleBackColor = true;
186 | this.discordPTB.CheckedChanged += new System.EventHandler(this.discordPTB_CheckedChanged);
187 | //
188 | // discordCanary
189 | //
190 | this.discordCanary.AutoSize = true;
191 | this.discordCanary.BoxBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
192 | this.discordCanary.BoxForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(62)))), ((int)(((byte)(130)))), ((int)(((byte)(229)))));
193 | this.discordCanary.Cursor = System.Windows.Forms.Cursors.Hand;
194 | this.discordCanary.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
195 | this.discordCanary.Location = new System.Drawing.Point(10, 94);
196 | this.discordCanary.Name = "discordCanary";
197 | this.discordCanary.Size = new System.Drawing.Size(110, 17);
198 | this.discordCanary.TabIndex = 26;
199 | this.discordCanary.Text = "Repair On Canary";
200 | this.discordCanary.UseVisualStyleBackColor = true;
201 | this.discordCanary.CheckedChanged += new System.EventHandler(this.discordCanary_CheckedChanged);
202 | //
203 | // discordStable
204 | //
205 | this.discordStable.AutoSize = true;
206 | this.discordStable.BoxBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
207 | this.discordStable.BoxForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(62)))), ((int)(((byte)(130)))), ((int)(((byte)(229)))));
208 | this.discordStable.Cursor = System.Windows.Forms.Cursors.Hand;
209 | this.discordStable.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
210 | this.discordStable.Location = new System.Drawing.Point(10, 47);
211 | this.discordStable.Name = "discordStable";
212 | this.discordStable.Size = new System.Drawing.Size(107, 17);
213 | this.discordStable.TabIndex = 25;
214 | this.discordStable.Text = "Repair On Stable";
215 | this.discordStable.UseVisualStyleBackColor = true;
216 | this.discordStable.CheckedChanged += new System.EventHandler(this.discordStable_CheckedChanged);
217 | //
218 | // DiscordLocator
219 | //
220 | this.AutoScaleDimensions = new System.Drawing.SizeF(110F, 110F);
221 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
222 | this.BackColor = System.Drawing.Color.Transparent;
223 | this.Controls.Add(this.titleLabel);
224 | this.Controls.Add(this.browsePTB);
225 | this.Controls.Add(this.tbPTB);
226 | this.Controls.Add(this.panel3);
227 | this.Controls.Add(this.browseCanary);
228 | this.Controls.Add(this.tbCanary);
229 | this.Controls.Add(this.panel1);
230 | this.Controls.Add(this.browseStable);
231 | this.Controls.Add(this.tbStable);
232 | this.Controls.Add(this.panel2);
233 | this.Controls.Add(this.discordPTB);
234 | this.Controls.Add(this.discordCanary);
235 | this.Controls.Add(this.discordStable);
236 | this.Name = "DiscordLocator";
237 | this.Size = new System.Drawing.Size(759, 184);
238 | this.ResumeLayout(false);
239 | this.PerformLayout();
240 |
241 | }
242 |
243 | #endregion
244 |
245 | private Controls.Button browsePTB;
246 | private System.Windows.Forms.TextBox tbPTB;
247 | private System.Windows.Forms.Panel panel3;
248 | private Controls.Button browseCanary;
249 | private System.Windows.Forms.TextBox tbCanary;
250 | private System.Windows.Forms.Panel panel1;
251 | private Controls.Button browseStable;
252 | private System.Windows.Forms.TextBox tbStable;
253 | private System.Windows.Forms.Panel panel2;
254 | private BandagedBD.Controls.FlatCheckBox discordPTB;
255 | private BandagedBD.Controls.FlatCheckBox discordCanary;
256 | private BandagedBD.Controls.FlatCheckBox discordStable;
257 | private System.Windows.Forms.Label titleLabel;
258 | }
259 | }
260 |
--------------------------------------------------------------------------------
/BandagedBD/Controls/DiscordLocator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace BandagedBD.Controls {
5 | public partial class DiscordLocator : UserControl {
6 |
7 | public bool stable => discordStable.Checked;
8 | public bool canary => discordCanary.Checked;
9 | public bool ptb => discordPTB.Checked;
10 | public EventHandler OnCheckedChange;
11 |
12 | public DiscordLocator() {
13 | InitializeComponent();
14 | if (Utilities.CurrentStablePath != null) tbStable.Text = Utilities.CurrentStablePath;
15 | if (Utilities.CurrentCanaryPath != null) tbCanary.Text = Utilities.CurrentCanaryPath;
16 | if (Utilities.CurrentPtbPath != null) tbPTB.Text = Utilities.CurrentPtbPath;
17 | Utilities.EnsureDiscord(tbStable, discordStable, Discord.Stable);
18 | Utilities.EnsureDiscord(tbCanary, discordCanary, Discord.Canary);
19 | Utilities.EnsureDiscord(tbPTB, discordPTB, Discord.PTB);
20 | }
21 |
22 | public void setLabel(string label) {
23 | titleLabel.Text = label;
24 | }
25 |
26 | public void setCheckboxLabel(Discord which, string label) {
27 | if (which == Discord.Stable) discordStable.Text = label;
28 | if (which == Discord.Canary) discordCanary.Text = label;
29 | if (which == Discord.PTB) discordPTB.Text = label;
30 | }
31 |
32 | private void browseStable_Click(object sender, EventArgs e) {
33 | var fbd = new FolderBrowserDialog { SelectedPath = tbStable.Text };
34 | fbd.ShowDialog();
35 | tbStable.Text = fbd.SelectedPath;
36 | Utilities.EnsureDiscord(tbStable, discordStable, Discord.Stable);
37 | }
38 |
39 | private void browseCanary_Click(object sender, EventArgs e) {
40 | var fbd = new FolderBrowserDialog { SelectedPath = tbCanary.Text };
41 | fbd.ShowDialog();
42 | tbCanary.Text = fbd.SelectedPath;
43 | Utilities.EnsureDiscord(tbCanary, discordCanary, Discord.Canary);
44 | }
45 |
46 | private void browsePTB_Click(object sender, EventArgs e) {
47 | var fbd = new FolderBrowserDialog { SelectedPath = tbPTB.Text };
48 | fbd.ShowDialog();
49 | tbPTB.Text = fbd.SelectedPath;
50 | Utilities.EnsureDiscord(tbPTB, discordPTB, Discord.PTB);
51 | }
52 |
53 | private void discordStable_CheckedChanged(object sender, EventArgs e) {
54 | if (discordStable.Checked) Utilities.EnsureDiscord(tbStable, discordStable, Discord.Stable);
55 | OnCheckedChange?.Invoke(sender, e);
56 | }
57 |
58 | private void discordCanary_CheckedChanged(object sender, EventArgs e) {
59 | if (discordCanary.Checked) Utilities.EnsureDiscord(tbCanary, discordCanary, Discord.Canary);
60 | OnCheckedChange?.Invoke(sender, e);
61 | }
62 |
63 | private void discordPTB_CheckedChanged(object sender, EventArgs e) {
64 | if (discordPTB.Checked) Utilities.EnsureDiscord(tbPTB, discordPTB, Discord.PTB);
65 | OnCheckedChange?.Invoke(sender, e);
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/BandagedBD/Controls/DiscordLocator.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/BandagedBD/Controls/FlatCheckBox.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using System.Drawing;
3 | using System.Drawing.Text;
4 | using System.Windows.Forms;
5 |
6 | namespace BandagedBD.Controls {
7 | class FlatCheckBox : CheckBox {
8 |
9 | [Description("Background color for the CheckBox"), Category("Flatpak")]
10 | public Color BoxBackColor { get; set; } = Color.FromArgb(60, 60, 60);
11 |
12 | [Description("Foreground color for the CheckBox"), Category("Flatpak")]
13 | public Color BoxForeColor { get; set; } = Properties.Settings.Default.Accent;
14 |
15 | public FlatCheckBox() {
16 | SetStyle(ControlStyles.UserPaint, true);
17 | SetStyle(ControlStyles.AllPaintingInWmPaint, true);
18 | }
19 |
20 | protected override void OnPaint(PaintEventArgs e) {
21 | base.OnPaint(e);
22 | e.Graphics.FillRectangle(new SolidBrush(BoxBackColor), new Rectangle(0, 0, 13, 14));
23 | if (Checked) {
24 | e.Graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
25 | e.Graphics.DrawString("\u2714", this.Font, new SolidBrush(BoxForeColor), -1, 1);
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/BandagedBD/Controls/FlatProgressBar.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Windows.Forms;
3 |
4 | namespace BandagedBD.Controls {
5 | public class FlatProgressBar : ProgressBar {
6 | public FlatProgressBar() {
7 | SetStyle(ControlStyles.UserPaint, true);
8 | }
9 |
10 | protected override void OnPaintBackground(PaintEventArgs pevent) {
11 | // None... Helps control the flicker.
12 | // No seriously, it works.
13 | }
14 |
15 | protected override void OnPaint(PaintEventArgs e) {
16 | using (Image offscreenImage = new Bitmap(Width, Height)) {
17 | using (Graphics offscreen = Graphics.FromImage(offscreenImage)) {
18 | Rectangle rect = new Rectangle(0, 0, Width, Height);
19 | offscreen.FillRectangle(new SolidBrush(BackColor), rect);
20 | rect.Width = (int) (rect.Width * ((double) (Value - Minimum) / (Maximum - Minimum)));
21 | if (rect.Width > 0) offscreen.FillRectangle(new SolidBrush(ForeColor), 0, 0, rect.Width, rect.Height);
22 | e.Graphics.DrawImage(offscreenImage, 0, 0);
23 | offscreenImage.Dispose();
24 | }
25 | }
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/BandagedBD/FormMain.Designer.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 |
3 | namespace BandagedBD {
4 | partial class FormMain {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 | private readonly Pen headerPen = new Pen(Color.FromArgb(32, 32, 32));
10 | private readonly SolidBrush headerBrush = new SolidBrush(Properties.Settings.Default.SecondaryBackground);
11 | private Rectangle headerShape => new Rectangle(0, 0, Width, 85);
12 |
13 | ///
14 | /// Clean up any resources being used.
15 | ///
16 | /// true if managed resources should be disposed; otherwise, false.
17 | protected override void Dispose(bool disposing) {
18 | if (disposing) {
19 | headerBrush.Dispose();
20 | headerPen.Dispose();
21 | if (components != null) components.Dispose();
22 | }
23 | base.Dispose(disposing);
24 | }
25 |
26 | #region Windows Form Designer generated code
27 |
28 | ///
29 | /// Required method for Designer support - do not modify
30 | /// the contents of this method with the code editor.
31 | ///
32 | private void InitializeComponent() {
33 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
34 | this.panelDock = new System.Windows.Forms.Panel();
35 | this.lblTitle = new System.Windows.Forms.Label();
36 | this.logo = new System.Windows.Forms.Panel();
37 | this.linkLabel1 = new System.Windows.Forms.LinkLabel();
38 | this.label1 = new System.Windows.Forms.Label();
39 | this.btnCancel = new BandagedBD.Controls.Button();
40 | this.btnNext = new BandagedBD.Controls.Button();
41 | this.btnBack = new BandagedBD.Controls.Button();
42 | this.SuspendLayout();
43 | //
44 | // panelDock
45 | //
46 | this.panelDock.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
47 | | System.Windows.Forms.AnchorStyles.Left)
48 | | System.Windows.Forms.AnchorStyles.Right)));
49 | this.panelDock.AutoScroll = true;
50 | this.panelDock.AutoScrollMinSize = new System.Drawing.Size(700, 300);
51 | this.panelDock.BackColor = System.Drawing.Color.Transparent;
52 | this.panelDock.Location = new System.Drawing.Point(12, 96);
53 | this.panelDock.Name = "panelDock";
54 | this.panelDock.Size = new System.Drawing.Size(752, 339);
55 | this.panelDock.TabIndex = 0;
56 | //
57 | // lblTitle
58 | //
59 | this.lblTitle.AutoSize = true;
60 | this.lblTitle.BackColor = System.Drawing.Color.Transparent;
61 | this.lblTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold);
62 | this.lblTitle.ForeColor = System.Drawing.Color.White;
63 | this.lblTitle.Location = new System.Drawing.Point(82, 37);
64 | this.lblTitle.Name = "lblTitle";
65 | this.lblTitle.Size = new System.Drawing.Size(145, 16);
66 | this.lblTitle.TabIndex = 5;
67 | this.lblTitle.Text = "BandagedBD Setup";
68 | //
69 | // logo
70 | //
71 | this.logo.BackColor = System.Drawing.Color.Transparent;
72 | this.logo.BackgroundImage = global::BandagedBD.Properties.Resources.BBDVS;
73 | this.logo.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
74 | this.logo.Cursor = System.Windows.Forms.Cursors.Hand;
75 | this.logo.Location = new System.Drawing.Point(12, 12);
76 | this.logo.Name = "logo";
77 | this.logo.Size = new System.Drawing.Size(64, 64);
78 | this.logo.TabIndex = 4;
79 | //
80 | // linkLabel1
81 | //
82 | this.linkLabel1.ActiveLinkColor = global::BandagedBD.Properties.Settings.Default.Accent;
83 | this.linkLabel1.Anchor = System.Windows.Forms.AnchorStyles.Top;
84 | this.linkLabel1.AutoSize = true;
85 | this.linkLabel1.Cursor = System.Windows.Forms.Cursors.Hand;
86 | this.linkLabel1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
87 | this.linkLabel1.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline;
88 | this.linkLabel1.LinkColor = global::BandagedBD.Properties.Settings.Default.Accent;
89 | this.linkLabel1.Location = new System.Drawing.Point(172, 471);
90 | this.linkLabel1.Name = "linkLabel1";
91 | this.linkLabel1.Size = new System.Drawing.Size(95, 13);
92 | this.linkLabel1.TabIndex = 34;
93 | this.linkLabel1.TabStop = true;
94 | this.linkLabel1.Text = "Consider donating.";
95 | this.linkLabel1.VisitedLinkColor = global::BandagedBD.Properties.Settings.Default.Accent;
96 | this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
97 | //
98 | // label1
99 | //
100 | this.label1.Anchor = System.Windows.Forms.AnchorStyles.Top;
101 | this.label1.AutoSize = true;
102 | this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
103 | this.label1.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
104 | this.label1.Location = new System.Drawing.Point(13, 471);
105 | this.label1.Name = "label1";
106 | this.label1.Size = new System.Drawing.Size(120, 13);
107 | this.label1.TabIndex = 33;
108 | this.label1.Text = "Enjoying BandagedBD?";
109 | //
110 | // btnCancel
111 | //
112 | this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
113 | this.btnCancel.BackColor = global::BandagedBD.Properties.Settings.Default.Accent;
114 | this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
115 | this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
116 | this.btnCancel.FlatAppearance.BorderSize = 0;
117 | this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
118 | this.btnCancel.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
119 | this.btnCancel.Location = new System.Drawing.Point(689, 466);
120 | this.btnCancel.Name = "btnCancel";
121 | this.btnCancel.Size = new System.Drawing.Size(75, 23);
122 | this.btnCancel.TabIndex = 8;
123 | this.btnCancel.Text = "Cancel";
124 | this.btnCancel.UseVisualStyleBackColor = false;
125 | this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
126 | //
127 | // btnNext
128 | //
129 | this.btnNext.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
130 | this.btnNext.BackColor = global::BandagedBD.Properties.Settings.Default.Accent;
131 | this.btnNext.Cursor = System.Windows.Forms.Cursors.Hand;
132 | this.btnNext.FlatAppearance.BorderSize = 0;
133 | this.btnNext.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
134 | this.btnNext.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
135 | this.btnNext.Location = new System.Drawing.Point(608, 466);
136 | this.btnNext.Name = "btnNext";
137 | this.btnNext.Size = new System.Drawing.Size(75, 23);
138 | this.btnNext.TabIndex = 7;
139 | this.btnNext.Text = "Next >";
140 | this.btnNext.UseVisualStyleBackColor = false;
141 | this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
142 | //
143 | // btnBack
144 | //
145 | this.btnBack.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
146 | this.btnBack.BackColor = global::BandagedBD.Properties.Settings.Default.Accent;
147 | this.btnBack.Cursor = System.Windows.Forms.Cursors.Hand;
148 | this.btnBack.FlatAppearance.BorderSize = 0;
149 | this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
150 | this.btnBack.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
151 | this.btnBack.Location = new System.Drawing.Point(527, 466);
152 | this.btnBack.Name = "btnBack";
153 | this.btnBack.Size = new System.Drawing.Size(75, 23);
154 | this.btnBack.TabIndex = 6;
155 | this.btnBack.Text = "< Back";
156 | this.btnBack.UseVisualStyleBackColor = false;
157 | this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
158 | //
159 | // FormMain
160 | //
161 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
162 | this.BackColor = global::BandagedBD.Properties.Settings.Default.PrimaryBackground;
163 | this.ClientSize = new System.Drawing.Size(776, 501);
164 | this.Controls.Add(this.linkLabel1);
165 | this.Controls.Add(this.btnCancel);
166 | this.Controls.Add(this.label1);
167 | this.Controls.Add(this.btnNext);
168 | this.Controls.Add(this.btnBack);
169 | this.Controls.Add(this.lblTitle);
170 | this.Controls.Add(this.logo);
171 | this.Controls.Add(this.panelDock);
172 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
173 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
174 | this.MaximizeBox = false;
175 | this.Name = "FormMain";
176 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
177 | this.Text = "BandagedBD Installer v0.3.2";
178 | this.Load += new System.EventHandler(this.FormMain_Load);
179 | this.ResumeLayout(false);
180 | this.PerformLayout();
181 |
182 | }
183 |
184 | #endregion
185 |
186 | private System.Windows.Forms.Panel panelDock;
187 | private System.Windows.Forms.Panel logo;
188 | private System.Windows.Forms.Label lblTitle;
189 | public Controls.Button btnNext;
190 | public Controls.Button btnCancel;
191 | public Controls.Button btnBack;
192 | private System.Windows.Forms.LinkLabel linkLabel1;
193 | private System.Windows.Forms.Label label1;
194 | }
195 | }
196 |
197 |
--------------------------------------------------------------------------------
/BandagedBD/FormMain.cs:
--------------------------------------------------------------------------------
1 | using BandagedBD.Panels;
2 | using System;
3 | using System.Net;
4 | using System.Collections.Generic;
5 | using System.Windows.Forms;
6 | using System.Threading.Tasks;
7 |
8 | namespace BandagedBD {
9 |
10 | public enum PanelTypes { License, Action, InstallConfig, RepairConfig, UninstallConfig, Install, Repair, Uninstall, NONE };
11 |
12 | public partial class FormMain : Form {
13 |
14 | private PanelTypes CurrentPanel = PanelTypes.NONE;
15 | public PanelTypes Action = PanelTypes.NONE;
16 |
17 | private string currentTag = "v" + Properties.Resources.Version;
18 | private string remoteTag = "v";
19 |
20 | private Dictionary panelMap = new Dictionary();
21 |
22 |
23 | public FormMain() {
24 | InitializeComponent();
25 | this.Text = "BandagedBD Installer v" + Properties.Resources.Version;
26 | logo.Click += Logo_Click;
27 |
28 | panelMap[PanelTypes.License] = new LicensePanel();
29 | panelMap[PanelTypes.Action] = new ActionPanel();
30 | panelMap[PanelTypes.InstallConfig] = new InstallConfigPanel();
31 | panelMap[PanelTypes.UninstallConfig] = new UninstallConfigPanel();
32 | panelMap[PanelTypes.RepairConfig] = new RepairConfigPanel();
33 | panelMap[PanelTypes.Install] = new InstallPanel();
34 | panelMap[PanelTypes.Uninstall] = new UninstallPanel();
35 | panelMap[PanelTypes.Repair] = new RepairPanel();
36 |
37 | foreach (KeyValuePair entry in panelMap) {
38 | entry.Value.SetWindow(this);
39 | entry.Value.Control.Dock = DockStyle.Fill;
40 | }
41 |
42 | if (!Properties.Settings.Default.AgreedToTerms) SwitchPanel(PanelTypes.License);
43 | else SwitchPanel(PanelTypes.Action);
44 |
45 | Task.Run(checkForUpdate).ContinueWith(result => {
46 | if (result.Result) showUpdateNotice();
47 | });
48 | }
49 |
50 | public void SetTitle(string title) => lblTitle.Text = title;
51 |
52 | public IPanel GetPanel(PanelTypes which) {
53 | return panelMap[which];
54 | }
55 |
56 | public void SwitchPanel(PanelTypes which) {
57 | if (CurrentPanel != PanelTypes.NONE) panelDock.Controls.Remove(panelMap[CurrentPanel].Control);
58 |
59 | CurrentPanel = which;
60 | panelDock.Controls.Add(panelMap[which].Control);
61 | SetTitle($"BandagedBD — {panelMap[which].Title}");
62 | panelMap[which].OnShow();
63 |
64 | if (panelMap[CurrentPanel].PreviousPanel == PanelTypes.NONE) btnBack.HideDisable();
65 | if (panelMap[CurrentPanel].NextPanel == PanelTypes.NONE) {
66 | btnBack.HideDisable();
67 | btnNext.HideDisable();
68 | btnCancel.ShowEnable("Exit");
69 | }
70 | }
71 |
72 | protected override void OnPaint(PaintEventArgs e) {
73 | base.OnPaint(e);
74 | var g = e.Graphics;
75 | g.FillRectangle(headerBrush, headerShape);
76 | g.DrawLine(headerPen, 0, 85, Width, 85);
77 | }
78 |
79 | private void btnNext_Click(object sender, EventArgs e) {
80 | if (CurrentPanel == PanelTypes.License) {
81 | Properties.Settings.Default.AgreedToTerms = true;
82 | Properties.Settings.Default.Save();
83 | }
84 | SwitchPanel(panelMap[CurrentPanel].NextPanel);
85 | }
86 |
87 | private void btnCancel_Click(object sender, EventArgs e) {
88 | Application.Exit();
89 | }
90 |
91 | private void btnBack_Click(object sender, EventArgs e) {
92 | SwitchPanel(panelMap[CurrentPanel].PreviousPanel);
93 | }
94 |
95 | public void Fail() {
96 | btnCancel.ShowEnable();
97 | btnNext.ShowDisable();
98 | btnBack.ShowEnable();
99 | }
100 |
101 | private void Logo_Click(object sender, EventArgs e) {
102 | Utilities.OpenProcess("https://github.com/rauenzi/BetterDiscordApp");
103 | }
104 |
105 | private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
106 | Utilities.OpenProcess("https://paypal.me/ZackRauen");
107 | }
108 |
109 | private async Task checkForUpdate()
110 | {
111 | string endpoint = "https://api.github.com/repos/rauenzi/BBDInstaller/releases/latest";
112 |
113 | ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;
114 |
115 | string tagNameKey = "\"tag_name\":";
116 | using (var wc = new TimedWebClient())
117 | {
118 |
119 | try
120 | {
121 | wc.Headers.Set("User-Agent", "BBDInstaller");
122 | string json = wc.DownloadString(endpoint);
123 | int tagNameIndex = json.IndexOf(tagNameKey);
124 | int versionStart = tagNameIndex + tagNameKey.Length + 1;
125 | int versionEnd = json.IndexOf("\"", versionStart);
126 | remoteTag = json.Substring(versionStart, versionEnd - versionStart);
127 | return string.CompareOrdinal(remoteTag, currentTag) > 0;
128 | }
129 | catch
130 | {
131 | return false;
132 | }
133 |
134 | }
135 | }
136 |
137 | private void showUpdateNotice()
138 | {
139 | DialogResult confirmResult = MessageBox.Show($"There is a newer version of the installer available ({remoteTag}). Would you like to download it now?", "Update Available!", MessageBoxButtons.YesNo);
140 | if (confirmResult == DialogResult.Yes)
141 | {
142 | Utilities.OpenProcess($"https://github.com/rauenzi/BBDInstaller/releases/download/{remoteTag}/BandagedBD.exe");
143 | Application.Exit();
144 | }
145 | else
146 | {
147 | Application.Exit();
148 | }
149 | }
150 |
151 | private void FormMain_Load(object sender, EventArgs e)
152 | {
153 |
154 | }
155 | }
156 | }
157 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/ActionPanel.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace BandagedBD.Panels
2 | {
3 | partial class ActionPanel
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.installButton = new System.Windows.Forms.Button();
32 | this.repairButton = new System.Windows.Forms.Button();
33 | this.uninstallButton = new System.Windows.Forms.Button();
34 | this.label1 = new System.Windows.Forms.Label();
35 | this.label2 = new System.Windows.Forms.Label();
36 | this.label3 = new System.Windows.Forms.Label();
37 | this.label4 = new System.Windows.Forms.Label();
38 | this.label5 = new System.Windows.Forms.Label();
39 | this.label6 = new System.Windows.Forms.Label();
40 | this.SuspendLayout();
41 | //
42 | // installButton
43 | //
44 | this.installButton.Anchor = System.Windows.Forms.AnchorStyles.Top;
45 | this.installButton.BackColor = global::BandagedBD.Properties.Settings.Default.Accent;
46 | this.installButton.BackgroundImage = global::BandagedBD.Properties.Resources.archive_small;
47 | this.installButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
48 | this.installButton.Cursor = System.Windows.Forms.Cursors.Hand;
49 | this.installButton.FlatAppearance.BorderSize = 0;
50 | this.installButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
51 | this.installButton.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
52 | this.installButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
53 | this.installButton.Location = new System.Drawing.Point(29, 17);
54 | this.installButton.Name = "installButton";
55 | this.installButton.Size = new System.Drawing.Size(56, 56);
56 | this.installButton.TabIndex = 0;
57 | this.installButton.UseVisualStyleBackColor = false;
58 | this.installButton.Click += new System.EventHandler(this.installButton_Click);
59 | //
60 | // repairButton
61 | //
62 | this.repairButton.Anchor = System.Windows.Forms.AnchorStyles.Top;
63 | this.repairButton.BackColor = global::BandagedBD.Properties.Settings.Default.Accent;
64 | this.repairButton.BackgroundImage = global::BandagedBD.Properties.Resources.build_small;
65 | this.repairButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
66 | this.repairButton.Cursor = System.Windows.Forms.Cursors.Hand;
67 | this.repairButton.FlatAppearance.BorderSize = 0;
68 | this.repairButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
69 | this.repairButton.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
70 | this.repairButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
71 | this.repairButton.Location = new System.Drawing.Point(29, 123);
72 | this.repairButton.Name = "repairButton";
73 | this.repairButton.Size = new System.Drawing.Size(56, 56);
74 | this.repairButton.TabIndex = 1;
75 | this.repairButton.UseVisualStyleBackColor = false;
76 | this.repairButton.Click += new System.EventHandler(this.repairButton_Click);
77 | //
78 | // uninstallButton
79 | //
80 | this.uninstallButton.Anchor = System.Windows.Forms.AnchorStyles.Top;
81 | this.uninstallButton.BackColor = global::BandagedBD.Properties.Settings.Default.Accent;
82 | this.uninstallButton.BackgroundImage = global::BandagedBD.Properties.Resources.delete_small;
83 | this.uninstallButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
84 | this.uninstallButton.Cursor = System.Windows.Forms.Cursors.Hand;
85 | this.uninstallButton.FlatAppearance.BorderSize = 0;
86 | this.uninstallButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
87 | this.uninstallButton.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
88 | this.uninstallButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
89 | this.uninstallButton.Location = new System.Drawing.Point(29, 231);
90 | this.uninstallButton.Name = "uninstallButton";
91 | this.uninstallButton.Size = new System.Drawing.Size(56, 56);
92 | this.uninstallButton.TabIndex = 2;
93 | this.uninstallButton.UseVisualStyleBackColor = false;
94 | this.uninstallButton.Click += new System.EventHandler(this.uninstallButton_Click);
95 | //
96 | // label1
97 | //
98 | this.label1.Anchor = System.Windows.Forms.AnchorStyles.Top;
99 | this.label1.AutoSize = true;
100 | this.label1.BackColor = System.Drawing.Color.Transparent;
101 | this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
102 | this.label1.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
103 | this.label1.Location = new System.Drawing.Point(102, 17);
104 | this.label1.Name = "label1";
105 | this.label1.Size = new System.Drawing.Size(119, 13);
106 | this.label1.TabIndex = 3;
107 | this.label1.Text = "Install BandagedBD";
108 | //
109 | // label2
110 | //
111 | this.label2.Anchor = System.Windows.Forms.AnchorStyles.Top;
112 | this.label2.AutoSize = true;
113 | this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
114 | this.label2.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
115 | this.label2.Location = new System.Drawing.Point(102, 123);
116 | this.label2.Name = "label2";
117 | this.label2.Size = new System.Drawing.Size(122, 13);
118 | this.label2.TabIndex = 4;
119 | this.label2.Text = "Repair BandagedBD";
120 | //
121 | // label3
122 | //
123 | this.label3.Anchor = System.Windows.Forms.AnchorStyles.Top;
124 | this.label3.AutoSize = true;
125 | this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
126 | this.label3.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
127 | this.label3.Location = new System.Drawing.Point(102, 231);
128 | this.label3.Name = "label3";
129 | this.label3.Size = new System.Drawing.Size(134, 13);
130 | this.label3.TabIndex = 5;
131 | this.label3.Text = "Uninstall BandagedBD";
132 | //
133 | // label4
134 | //
135 | this.label4.Anchor = System.Windows.Forms.AnchorStyles.Top;
136 | this.label4.AutoSize = true;
137 | this.label4.BackColor = System.Drawing.Color.Transparent;
138 | this.label4.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
139 | this.label4.Location = new System.Drawing.Point(102, 39);
140 | this.label4.MaximumSize = new System.Drawing.Size(450, 0);
141 | this.label4.Name = "label4";
142 | this.label4.Size = new System.Drawing.Size(434, 26);
143 | this.label4.TabIndex = 6;
144 | this.label4.Text = "This allows you to install BandagedBD to your existing Discord installation. Band" +
145 | "agedBD is able to install to Discord Stable, Discord Canary, and Discord PTB sep" +
146 | "arately.";
147 | //
148 | // label5
149 | //
150 | this.label5.Anchor = System.Windows.Forms.AnchorStyles.Top;
151 | this.label5.AutoSize = true;
152 | this.label5.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
153 | this.label5.Location = new System.Drawing.Point(102, 145);
154 | this.label5.MaximumSize = new System.Drawing.Size(450, 0);
155 | this.label5.Name = "label5";
156 | this.label5.Size = new System.Drawing.Size(447, 26);
157 | this.label5.TabIndex = 7;
158 | this.label5.Text = "This repairs an existing BandagedBD installation fixing multiple issues. This inc" +
159 | "ludes but is not limited to a broken injection, corrupt data files, and Discord " +
160 | "update loops.";
161 | //
162 | // label6
163 | //
164 | this.label6.Anchor = System.Windows.Forms.AnchorStyles.Top;
165 | this.label6.AutoSize = true;
166 | this.label6.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
167 | this.label6.Location = new System.Drawing.Point(102, 253);
168 | this.label6.MaximumSize = new System.Drawing.Size(450, 0);
169 | this.label6.Name = "label6";
170 | this.label6.Size = new System.Drawing.Size(450, 26);
171 | this.label6.TabIndex = 8;
172 | this.label6.Text = "This option fully removes BandagedBD from a Discord installation and optionally c" +
173 | "leans up any user data related to BandagedBD.";
174 | //
175 | // ActionPanel
176 | //
177 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
178 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
179 | this.BackColor = global::BandagedBD.Properties.Settings.Default.PrimaryBackground;
180 | this.Controls.Add(this.label6);
181 | this.Controls.Add(this.label5);
182 | this.Controls.Add(this.label4);
183 | this.Controls.Add(this.label3);
184 | this.Controls.Add(this.label2);
185 | this.Controls.Add(this.label1);
186 | this.Controls.Add(this.uninstallButton);
187 | this.Controls.Add(this.repairButton);
188 | this.Controls.Add(this.installButton);
189 | this.Name = "ActionPanel";
190 | this.Size = new System.Drawing.Size(580, 350);
191 | this.ResumeLayout(false);
192 | this.PerformLayout();
193 |
194 | }
195 |
196 | #endregion
197 |
198 | private System.Windows.Forms.Button installButton;
199 | private System.Windows.Forms.Button repairButton;
200 | private System.Windows.Forms.Button uninstallButton;
201 | private System.Windows.Forms.Label label1;
202 | private System.Windows.Forms.Label label2;
203 | private System.Windows.Forms.Label label3;
204 | private System.Windows.Forms.Label label4;
205 | private System.Windows.Forms.Label label5;
206 | private System.Windows.Forms.Label label6;
207 | }
208 | }
209 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/ActionPanel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace BandagedBD.Panels {
5 | public partial class ActionPanel : UserControl, IPanel {
6 | private FormMain Window;
7 | public void SetWindow(FormMain window) => Window = window;
8 |
9 | public string Title => "Choose an Action";
10 | public UserControl Control => this;
11 |
12 | public PanelTypes PreviousPanel => PanelTypes.License;
13 | public PanelTypes NextPanel => _nextPanel;
14 | private PanelTypes _nextPanel = PanelTypes.Install;
15 |
16 | public ActionPanel() {
17 | InitializeComponent();
18 | }
19 |
20 | public void OnShow() {
21 | Window.btnBack.ShowEnable();
22 | Window.btnCancel.ShowEnable("Cancel");
23 | Window.btnNext.HideDisable();
24 | Show();
25 | }
26 |
27 | private void GoToNext(PanelTypes next) {
28 | _nextPanel = next;
29 | Window.btnNext.ShowEnable("");
30 | Window.btnNext.PerformClick();
31 | }
32 |
33 | private void installButton_Click(object sender, EventArgs e) {
34 | GoToNext(PanelTypes.InstallConfig);
35 | }
36 |
37 | private void repairButton_Click(object sender, EventArgs e) {
38 | GoToNext(PanelTypes.RepairConfig);
39 | }
40 |
41 | private void uninstallButton_Click(object sender, EventArgs e) {
42 | GoToNext(PanelTypes.UninstallConfig);
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/ActionPanel.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/IPanel.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 |
3 | namespace BandagedBD.Panels {
4 | public interface IPanel {
5 | void OnShow();
6 | void SetWindow(FormMain window);
7 | string Title { get; }
8 | UserControl Control { get; }
9 | PanelTypes PreviousPanel { get; }
10 | PanelTypes NextPanel { get; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/InstallConfigPanel.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace BandagedBD.Panels
2 | {
3 | partial class InstallConfigPanel
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.cbShouldRestart = new BandagedBD.Controls.FlatCheckBox();
32 | this.discordLocator = new BandagedBD.Controls.DiscordLocator();
33 | this.label1 = new System.Windows.Forms.Label();
34 | this.SuspendLayout();
35 | //
36 | // cbShouldRestart
37 | //
38 | this.cbShouldRestart.Anchor = System.Windows.Forms.AnchorStyles.Top;
39 | this.cbShouldRestart.AutoSize = true;
40 | this.cbShouldRestart.BoxBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
41 | this.cbShouldRestart.BoxForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(62)))), ((int)(((byte)(130)))), ((int)(((byte)(229)))));
42 | this.cbShouldRestart.Checked = true;
43 | this.cbShouldRestart.CheckState = System.Windows.Forms.CheckState.Checked;
44 | this.cbShouldRestart.Cursor = System.Windows.Forms.Cursors.Hand;
45 | this.cbShouldRestart.FlatAppearance.CheckedBackColor = System.Drawing.Color.Transparent;
46 | this.cbShouldRestart.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
47 | this.cbShouldRestart.Location = new System.Drawing.Point(10, 212);
48 | this.cbShouldRestart.Name = "cbShouldRestart";
49 | this.cbShouldRestart.Size = new System.Drawing.Size(162, 17);
50 | this.cbShouldRestart.TabIndex = 5;
51 | this.cbShouldRestart.Text = "Restart All Discord Instances";
52 | this.cbShouldRestart.UseVisualStyleBackColor = true;
53 | //
54 | // discordLocator
55 | //
56 | this.discordLocator.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
57 | | System.Windows.Forms.AnchorStyles.Left)
58 | | System.Windows.Forms.AnchorStyles.Right)));
59 | this.discordLocator.BackColor = System.Drawing.Color.Transparent;
60 | this.discordLocator.Location = new System.Drawing.Point(0, 3);
61 | this.discordLocator.Name = "discordLocator";
62 | this.discordLocator.Size = new System.Drawing.Size(662, 176);
63 | this.discordLocator.TabIndex = 6;
64 | //
65 | // label1
66 | //
67 | this.label1.Anchor = System.Windows.Forms.AnchorStyles.Top;
68 | this.label1.AutoSize = true;
69 | this.label1.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
70 | this.label1.Location = new System.Drawing.Point(7, 186);
71 | this.label1.Name = "label1";
72 | this.label1.Size = new System.Drawing.Size(95, 13);
73 | this.label1.TabIndex = 8;
74 | this.label1.Text = "Additional Options:";
75 | //
76 | // InstallConfigPanel
77 | //
78 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
79 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
80 | this.AutoSize = true;
81 | this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
82 | this.BackColor = System.Drawing.Color.Transparent;
83 | this.Controls.Add(this.label1);
84 | this.Controls.Add(this.cbShouldRestart);
85 | this.Controls.Add(this.discordLocator);
86 | this.Name = "InstallConfigPanel";
87 | this.Size = new System.Drawing.Size(665, 284);
88 | this.Load += new System.EventHandler(this.InstallConfigPanel_Load);
89 | this.ResumeLayout(false);
90 | this.PerformLayout();
91 |
92 | }
93 |
94 | #endregion
95 | private BandagedBD.Controls.FlatCheckBox cbShouldRestart;
96 | private BandagedBD.Controls.DiscordLocator discordLocator;
97 | private System.Windows.Forms.Label label1;
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/InstallConfigPanel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace BandagedBD.Panels {
5 | public partial class InstallConfigPanel : UserControl, IPanel {
6 |
7 | private FormMain Window;
8 | public void SetWindow(FormMain formMain) => Window = formMain;
9 |
10 | public string Title => "Installation Setup";
11 | public UserControl Control => this;
12 |
13 | public PanelTypes PreviousPanel => PanelTypes.Action;
14 | public PanelTypes NextPanel => PanelTypes.Install;
15 |
16 | public bool shouldRestart => cbShouldRestart.Checked;
17 | public string[] paths => Utilities.GetLocalPaths(discordLocator.stable, discordLocator.canary, discordLocator.ptb);
18 | public string[] executables => Utilities.GetExecutables(discordLocator.stable, discordLocator.canary, discordLocator.ptb);
19 | public string[] roamings => Utilities.GetRoamingPaths(discordLocator.stable, discordLocator.canary, discordLocator.ptb);
20 |
21 | public InstallConfigPanel() {
22 | InitializeComponent();
23 | discordLocator.setLabel("BandagedBD will be installed to the locations below. Click browse if the locations are incorrect.");
24 | discordLocator.setCheckboxLabel(Discord.Stable, "Install To Stable");
25 | discordLocator.setCheckboxLabel(Discord.Canary, "Install To Canary");
26 | discordLocator.setCheckboxLabel(Discord.PTB, "Install To PTB");
27 | discordLocator.OnCheckedChange += OnCheckedChange;
28 | }
29 |
30 | public void OnShow() {
31 | Window.btnBack.ShowEnable();
32 | Window.btnCancel.ShowEnable("Cancel");
33 | Window.btnNext.ShowDisable("Install");
34 | }
35 |
36 | private void OnCheckedChange(object sender, EventArgs e) {
37 | if (discordLocator.stable || discordLocator.canary || discordLocator.ptb) Window.btnNext.ShowEnable("Install");
38 | else Window.btnNext.ShowDisable("Install");
39 | }
40 |
41 | private void InstallConfigPanel_Load(object sender, EventArgs e) {
42 |
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/InstallConfigPanel.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/InstallPanel.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace BandagedBD.Panels {
2 | partial class InstallPanel {
3 | ///
4 | /// Required designer variable.
5 | ///
6 | private System.ComponentModel.IContainer components = null;
7 |
8 | ///
9 | /// Clean up any resources being used.
10 | ///
11 | /// true if managed resources should be disposed; otherwise, false.
12 | protected override void Dispose(bool disposing) {
13 | if (disposing && (components != null)) {
14 | components.Dispose();
15 | }
16 | base.Dispose(disposing);
17 | }
18 |
19 | #region Component Designer generated code
20 |
21 | ///
22 | /// Required method for Designer support - do not modify
23 | /// the contents of this method with the code editor.
24 | ///
25 | private void InitializeComponent() {
26 | this.rtbStatus = new System.Windows.Forms.RichTextBox();
27 | this.cbDetailed = new BandagedBD.Controls.FlatCheckBox();
28 | this.rtbDetailed = new System.Windows.Forms.RichTextBox();
29 | this.panel1 = new System.Windows.Forms.Panel();
30 | this.pbStatus = new BandagedBD.Controls.FlatProgressBar();
31 | this.SuspendLayout();
32 | //
33 | // rtbStatus
34 | //
35 | this.rtbStatus.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
36 | | System.Windows.Forms.AnchorStyles.Left)
37 | | System.Windows.Forms.AnchorStyles.Right)));
38 | this.rtbStatus.BackColor = global::BandagedBD.Properties.Settings.Default.SecondaryBackground;
39 | this.rtbStatus.BorderStyle = System.Windows.Forms.BorderStyle.None;
40 | this.rtbStatus.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
41 | this.rtbStatus.Location = new System.Drawing.Point(13, 8);
42 | this.rtbStatus.Name = "rtbStatus";
43 | this.rtbStatus.ReadOnly = true;
44 | this.rtbStatus.Size = new System.Drawing.Size(474, 113);
45 | this.rtbStatus.TabIndex = 0;
46 | this.rtbStatus.Text = "";
47 | //
48 | // cbDetailed
49 | //
50 | this.cbDetailed.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
51 | this.cbDetailed.AutoSize = true;
52 | this.cbDetailed.Cursor = System.Windows.Forms.Cursors.Hand;
53 | this.cbDetailed.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
54 | this.cbDetailed.Location = new System.Drawing.Point(4, 138);
55 | this.cbDetailed.Name = "cbDetailed";
56 | this.cbDetailed.Size = new System.Drawing.Size(58, 17);
57 | this.cbDetailed.TabIndex = 2;
58 | this.cbDetailed.Text = "Details";
59 | this.cbDetailed.UseVisualStyleBackColor = true;
60 | this.cbDetailed.CheckedChanged += new System.EventHandler(this.cbDetailed_CheckedChanged);
61 | //
62 | // rtbDetailed
63 | //
64 | this.rtbDetailed.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
65 | | System.Windows.Forms.AnchorStyles.Left)
66 | | System.Windows.Forms.AnchorStyles.Right)));
67 | this.rtbDetailed.BackColor = global::BandagedBD.Properties.Settings.Default.SecondaryBackground;
68 | this.rtbDetailed.BorderStyle = System.Windows.Forms.BorderStyle.None;
69 | this.rtbDetailed.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
70 | this.rtbDetailed.Location = new System.Drawing.Point(13, 8);
71 | this.rtbDetailed.Name = "rtbDetailed";
72 | this.rtbDetailed.ReadOnly = true;
73 | this.rtbDetailed.Size = new System.Drawing.Size(474, 113);
74 | this.rtbDetailed.TabIndex = 3;
75 | this.rtbDetailed.Text = "";
76 | this.rtbDetailed.Visible = false;
77 | //
78 | // panel1
79 | //
80 | this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
81 | | System.Windows.Forms.AnchorStyles.Left)
82 | | System.Windows.Forms.AnchorStyles.Right)));
83 | this.panel1.BackColor = global::BandagedBD.Properties.Settings.Default.SecondaryBackground;
84 | this.panel1.Location = new System.Drawing.Point(4, 0);
85 | this.panel1.Name = "panel1";
86 | this.panel1.Size = new System.Drawing.Size(491, 129);
87 | this.panel1.TabIndex = 4;
88 | //
89 | // pbStatus
90 | //
91 | this.pbStatus.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
92 | | System.Windows.Forms.AnchorStyles.Right)));
93 | this.pbStatus.BackColor = global::BandagedBD.Properties.Settings.Default.SecondaryBackground;
94 | this.pbStatus.ForeColor = global::BandagedBD.Properties.Settings.Default.Accent;
95 | this.pbStatus.Location = new System.Drawing.Point(67, 135);
96 | this.pbStatus.Name = "pbStatus";
97 | this.pbStatus.Size = new System.Drawing.Size(428, 23);
98 | this.pbStatus.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
99 | this.pbStatus.TabIndex = 7;
100 | //
101 | // InstallPanel
102 | //
103 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
104 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
105 | this.BackColor = System.Drawing.Color.Transparent;
106 | this.Controls.Add(this.pbStatus);
107 | this.Controls.Add(this.cbDetailed);
108 | this.Controls.Add(this.rtbStatus);
109 | this.Controls.Add(this.rtbDetailed);
110 | this.Controls.Add(this.panel1);
111 | this.Name = "InstallPanel";
112 | this.Size = new System.Drawing.Size(501, 166);
113 | this.ResumeLayout(false);
114 | this.PerformLayout();
115 |
116 | }
117 |
118 | #endregion
119 |
120 | private System.Windows.Forms.RichTextBox rtbStatus;
121 | private BandagedBD.Controls.FlatCheckBox cbDetailed;
122 | private System.Windows.Forms.RichTextBox rtbDetailed;
123 | private System.Windows.Forms.Panel panel1;
124 | private Controls.FlatProgressBar pbStatus;
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/InstallPanel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.IO.Compression;
4 | using System.Net;
5 | using System.Threading;
6 | using System.Threading.Tasks;
7 | using System.Windows.Forms;
8 |
9 | namespace BandagedBD.Panels {
10 | public partial class InstallPanel : UserControl, IPanel {
11 | private FormMain Window;
12 | public void SetWindow(FormMain formMain) => Window = formMain;
13 |
14 | public string Title => "Installing";
15 | public UserControl Control => this;
16 |
17 | public PanelTypes PreviousPanel => PanelTypes.InstallConfig;
18 | public PanelTypes NextPanel => PanelTypes.NONE;
19 |
20 | private InstallConfigPanel config => (InstallConfigPanel) Window.GetPanel(PanelTypes.InstallConfig);
21 |
22 | private readonly SynchronizationContext _synchronizationContext;
23 | private int progressChunk => 100 / config.paths.Length;
24 | private int iteration = 0;
25 |
26 | private string repo = "rauenzi";
27 | private string branch = "injector";
28 |
29 | public InstallPanel() {
30 | InitializeComponent();
31 | _synchronizationContext = SynchronizationContext.Current;
32 | }
33 |
34 | private void setProgress(int baseAmount) {
35 | _synchronizationContext.Post(_ => {
36 | pbStatus.Value = ((baseAmount * progressChunk) / 100) + (progressChunk * iteration);
37 | }, 100);
38 | }
39 |
40 | private async Task InstallTask() {
41 | string[] processNames = config.executables;
42 | string[] paths = config.paths;
43 | for (int i = 0; i < paths.Length; i++) {
44 | iteration = i;
45 | Append($"Starting installation for {processNames[i]}");
46 | Append($"Killing {processNames[i]} Processes");
47 | string currentExecutable = Utilities.KillProcess(processNames[i], Append);
48 |
49 | if (await DownloadBd(paths[i]) != 1) {
50 | setProgress(0);
51 | Append("Download seems to have failed, will try once more.");
52 | if (await DownloadBd(paths[i]) != 1) return 0;
53 | }
54 |
55 | setProgress(75);
56 | if (Verify(paths[i]) != 1) return 0;
57 | setProgress(90);
58 | if (config.shouldRestart && currentExecutable != string.Empty) {
59 | Append($"Restarting {processNames[i]}");
60 | Utilities.OpenProcess(currentExecutable);
61 | }
62 | setProgress(100);
63 | Append($"Finished installing BandagedBD for {processNames[i]}!");
64 | Append("---------------------------------------------------------------------------------");
65 | }
66 | return 1;
67 | }
68 |
69 | private async Task DownloadBd(string installationPath) {
70 | var channel = $"https://github.com/{repo}/BetterDiscordApp/archive/{branch}.zip";
71 | var dest = $"{installationPath}\\resources\\BetterDiscord.zip";
72 |
73 | Append("Downloading BandagedBD package");
74 |
75 | ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;
76 |
77 |
78 | using (var wc = new TimedWebClient()) {
79 | wc.DownloadProgressChanged += (sender, args) => {
80 | setProgress(args.ProgressPercentage / 2);
81 | };
82 |
83 | Append($"Using channel: {channel}", true);
84 | Append($"Downloading to: {dest}", true);
85 |
86 | try {
87 | await wc.DownloadFileTaskAsync(channel, dest);
88 | }
89 | catch (WebException e) {
90 | Append("Download error: " + e.Message, true);
91 | return 0;
92 | }
93 |
94 | }
95 |
96 | Append("Finished downloading BandagedBD package");
97 |
98 | return ExtractBd(dest, $"{installationPath}\\resources");
99 | }
100 |
101 | private int ExtractBd(string path, string dest) {
102 |
103 | if (Directory.Exists($"{dest}\\app")) {
104 | Append("Deleting old BetterDiscord");
105 | Directory.Delete($"{dest}\\app", true);
106 | }
107 |
108 | if (Directory.Exists($"{dest}\\BetterDiscordApp-{branch}")) {
109 | Append($"Deleting old BetterDiscordApp-{branch}");
110 | Directory.Delete($"{dest}\\BetterDiscordApp-{branch}", true);
111 | }
112 |
113 | Append("Extracting BandagedBD package");
114 |
115 | if (!File.Exists(path)) {
116 | Append($"BandagedBD package does not exist in: {path}. Cannot continue.");
117 | return 0;
118 | }
119 |
120 | var zar = ZipFile.OpenRead(path);
121 |
122 | if (!Directory.Exists(dest)) {
123 | Directory.CreateDirectory(dest);
124 | }
125 |
126 | zar.ExtractToDirectory(dest);
127 | zar.Dispose();
128 | if (!Directory.Exists($"{dest}\\BetterDiscordApp-{branch}")) {
129 | Append($"BandagedBD package does not exist in: {dest}\\BetterDiscordApp-{branch}. Cannot continue.");
130 | return 0;
131 | }
132 |
133 | Append("Renaming package dir");
134 |
135 | Directory.Move($"{dest}\\BetterDiscordApp-{branch}", $"{dest}\\app");
136 |
137 | if (File.Exists(path)) {
138 | Append($"Deleting temp file {path}");
139 | File.Delete(path);
140 | }
141 |
142 | return 1;
143 | }
144 |
145 | private int Verify(string installationPath) {
146 |
147 | Append("Verifying installation");
148 | Append("Checking for old style injection");
149 | foreach (var roaming in config.roamings) {
150 | var core = $"{roaming}\\modules\\discord_desktop_core\\core";
151 | Append($"Checking for old injection {roaming}", true);
152 | if (!Directory.Exists(core)) continue;
153 | Append($"Deleting old injection {roaming}", true);
154 | try {
155 | Directory.Delete(roaming, true);
156 | }
157 | catch {
158 | Append($"Please delete this folder: {roaming}");
159 | }
160 | }
161 |
162 | var appFolder = $"{installationPath}\\resources\\app";
163 | if (!Directory.Exists(appFolder)) {
164 | Append($"{appFolder} does not exist! Verification failed!");
165 | Window.Fail();
166 | return 0;
167 | }
168 |
169 | var injectorFiles = new[] { "index.js", "package.json", "betterdiscord\\index.js", "betterdiscord\\preload.js", "betterdiscord\\config.json", "betterdiscord\\logger.js" };
170 |
171 | foreach (var bdFile in injectorFiles) {
172 | if (File.Exists($"{appFolder}\\{bdFile}")) {
173 | Append($"Verifying {appFolder}\\{bdFile}", true);
174 | continue;
175 | }
176 | Append($"{appFolder}\\{bdFile} does not exist! Verification failed!");
177 | Window.Fail();
178 | return 0;
179 | }
180 |
181 | Append("Verification successful");
182 |
183 | return 1;
184 | }
185 |
186 | public void OnShow() {
187 | rtbStatus.Text = "";
188 | Task.Run(InstallTask).ContinueWith(result => {
189 | if (result.Result == 0) Window.Fail();
190 | _synchronizationContext.Post(o => {
191 | Window.btnCancel.ShowEnable("Exit");
192 | }, result);
193 | });
194 |
195 | }
196 |
197 | private void Append(string text, bool detailed = false) {
198 | _synchronizationContext.Post(o => {
199 | if (!detailed) {
200 | rtbStatus.AppendText((string) o);
201 | rtbStatus.AppendText(Environment.NewLine);
202 | }
203 | rtbDetailed.AppendText((string) o);
204 | rtbDetailed.AppendText(Environment.NewLine);
205 | rtbStatus.ScrollToCaret();
206 | rtbDetailed.ScrollToCaret();
207 | }, text);
208 | }
209 |
210 | private void cbDetailed_CheckedChanged(object sender, EventArgs e) {
211 | rtbDetailed.Visible = cbDetailed.Checked;
212 | rtbStatus.Visible = !cbDetailed.Checked;
213 | }
214 | }
215 | }
--------------------------------------------------------------------------------
/BandagedBD/Panels/InstallPanel.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/LicensePanel.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace BandagedBD.Panels {
2 | partial class LicensePanel {
3 | ///
4 | /// Required designer variable.
5 | ///
6 | private System.ComponentModel.IContainer components = null;
7 |
8 | ///
9 | /// Clean up any resources being used.
10 | ///
11 | /// true if managed resources should be disposed; otherwise, false.
12 | protected override void Dispose(bool disposing) {
13 | if (disposing && (components != null)) {
14 | components.Dispose();
15 | }
16 | base.Dispose(disposing);
17 | }
18 |
19 | #region Component Designer generated code
20 |
21 | ///
22 | /// Required method for Designer support - do not modify
23 | /// the contents of this method with the code editor.
24 | ///
25 | private void InitializeComponent() {
26 | this.label1 = new System.Windows.Forms.Label();
27 | this.richTextBox1 = new System.Windows.Forms.RichTextBox();
28 | this.panel1 = new System.Windows.Forms.Panel();
29 | this.SuspendLayout();
30 | //
31 | // label1
32 | //
33 | this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
34 | | System.Windows.Forms.AnchorStyles.Right)));
35 | this.label1.ForeColor = System.Drawing.Color.White;
36 | this.label1.Location = new System.Drawing.Point(3, 5);
37 | this.label1.Name = "label1";
38 | this.label1.Size = new System.Drawing.Size(480, 13);
39 | this.label1.TabIndex = 2;
40 | this.label1.Text = "Please read the following License Agreement and accept the terms before continuin" +
41 | "g the installation.";
42 | //
43 | // richTextBox1
44 | //
45 | this.richTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
46 | | System.Windows.Forms.AnchorStyles.Left)
47 | | System.Windows.Forms.AnchorStyles.Right)));
48 | this.richTextBox1.BackColor = global::BandagedBD.Properties.Settings.Default.SecondaryBackground;
49 | this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
50 | this.richTextBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
51 | this.richTextBox1.ForeColor = System.Drawing.Color.White;
52 | this.richTextBox1.Location = new System.Drawing.Point(11, 29);
53 | this.richTextBox1.Name = "richTextBox1";
54 | this.richTextBox1.ReadOnly = true;
55 | this.richTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
56 | this.richTextBox1.Size = new System.Drawing.Size(521, 248);
57 | this.richTextBox1.TabIndex = 3;
58 | this.richTextBox1.Text = "";
59 | //
60 | // panel1
61 | //
62 | this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
63 | | System.Windows.Forms.AnchorStyles.Left)
64 | | System.Windows.Forms.AnchorStyles.Right)));
65 | this.panel1.BackColor = global::BandagedBD.Properties.Settings.Default.SecondaryBackground;
66 | this.panel1.Location = new System.Drawing.Point(3, 21);
67 | this.panel1.Name = "panel1";
68 | this.panel1.Size = new System.Drawing.Size(536, 264);
69 | this.panel1.TabIndex = 4;
70 | //
71 | // LicensePanel
72 | //
73 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
74 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
75 | this.BackColor = System.Drawing.Color.Transparent;
76 | this.Controls.Add(this.richTextBox1);
77 | this.Controls.Add(this.label1);
78 | this.Controls.Add(this.panel1);
79 | this.Name = "LicensePanel";
80 | this.Size = new System.Drawing.Size(542, 306);
81 | this.ResumeLayout(false);
82 |
83 | }
84 |
85 | #endregion
86 | private System.Windows.Forms.Label label1;
87 | private System.Windows.Forms.RichTextBox richTextBox1;
88 | private System.Windows.Forms.Panel panel1;
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/LicensePanel.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 |
3 | namespace BandagedBD.Panels {
4 |
5 | public partial class LicensePanel : UserControl, IPanel {
6 |
7 | private FormMain Window;
8 | public void SetWindow(FormMain formMain) => Window = formMain;
9 |
10 | public string Title => "License Agreement";
11 | public UserControl Control => this;
12 |
13 | public PanelTypes PreviousPanel => PanelTypes.NONE;
14 | public PanelTypes NextPanel => PanelTypes.Action;
15 |
16 | public LicensePanel() {
17 | InitializeComponent();
18 | richTextBox1.Text += Properties.Resources.License;
19 | }
20 |
21 | public void OnShow() {
22 | Window.btnBack.HideDisable();
23 | Window.btnNext.ShowEnable("Agree");
24 | Window.btnCancel.ShowEnable("Decline");
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/LicensePanel.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/RepairConfigPanel.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace BandagedBD.Panels
2 | {
3 | partial class RepairConfigPanel
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.label2 = new System.Windows.Forms.Label();
32 | this.cbBootLoop = new BandagedBD.Controls.FlatCheckBox();
33 | this.cbInfinite = new BandagedBD.Controls.FlatCheckBox();
34 | this.cbError = new BandagedBD.Controls.FlatCheckBox();
35 | this.cbUninjected = new BandagedBD.Controls.FlatCheckBox();
36 | this.discordLocator = new BandagedBD.Controls.DiscordLocator();
37 | this.label1 = new System.Windows.Forms.Label();
38 | this.linkLabel1 = new System.Windows.Forms.LinkLabel();
39 | this.label3 = new System.Windows.Forms.Label();
40 | this.cbShouldRestart = new BandagedBD.Controls.FlatCheckBox();
41 | this.SuspendLayout();
42 | //
43 | // label2
44 | //
45 | this.label2.Anchor = System.Windows.Forms.AnchorStyles.Top;
46 | this.label2.AutoSize = true;
47 | this.label2.BackColor = System.Drawing.Color.Transparent;
48 | this.label2.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
49 | this.label2.Location = new System.Drawing.Point(6, 212);
50 | this.label2.Name = "label2";
51 | this.label2.Size = new System.Drawing.Size(292, 13);
52 | this.label2.TabIndex = 25;
53 | this.label2.Text = "Which of the following problems are affecting BandagedBD?";
54 | //
55 | // cbBootLoop
56 | //
57 | this.cbBootLoop.Anchor = System.Windows.Forms.AnchorStyles.Top;
58 | this.cbBootLoop.AutoSize = true;
59 | this.cbBootLoop.BoxBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
60 | this.cbBootLoop.BoxForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(62)))), ((int)(((byte)(130)))), ((int)(((byte)(229)))));
61 | this.cbBootLoop.Cursor = System.Windows.Forms.Cursors.Hand;
62 | this.cbBootLoop.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
63 | this.cbBootLoop.Location = new System.Drawing.Point(120, 238);
64 | this.cbBootLoop.Name = "cbBootLoop";
65 | this.cbBootLoop.Size = new System.Drawing.Size(121, 17);
66 | this.cbBootLoop.TabIndex = 26;
67 | this.cbBootLoop.Text = "Discord update loop";
68 | this.cbBootLoop.UseVisualStyleBackColor = true;
69 | //
70 | // cbInfinite
71 | //
72 | this.cbInfinite.Anchor = System.Windows.Forms.AnchorStyles.Top;
73 | this.cbInfinite.AutoSize = true;
74 | this.cbInfinite.BoxBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
75 | this.cbInfinite.BoxForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(62)))), ((int)(((byte)(130)))), ((int)(((byte)(229)))));
76 | this.cbInfinite.Cursor = System.Windows.Forms.Cursors.Hand;
77 | this.cbInfinite.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
78 | this.cbInfinite.Location = new System.Drawing.Point(120, 272);
79 | this.cbInfinite.Name = "cbInfinite";
80 | this.cbInfinite.Size = new System.Drawing.Size(167, 17);
81 | this.cbInfinite.TabIndex = 27;
82 | this.cbInfinite.Text = "BandagedBD loading infinitely";
83 | this.cbInfinite.UseVisualStyleBackColor = true;
84 | //
85 | // cbError
86 | //
87 | this.cbError.Anchor = System.Windows.Forms.AnchorStyles.Top;
88 | this.cbError.AutoSize = true;
89 | this.cbError.BoxBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
90 | this.cbError.BoxForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(62)))), ((int)(((byte)(130)))), ((int)(((byte)(229)))));
91 | this.cbError.Cursor = System.Windows.Forms.Cursors.Hand;
92 | this.cbError.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
93 | this.cbError.Location = new System.Drawing.Point(358, 272);
94 | this.cbError.Name = "cbError";
95 | this.cbError.Size = new System.Drawing.Size(176, 17);
96 | this.cbError.TabIndex = 28;
97 | this.cbError.Text = "Fatal JavaScript error on launch";
98 | this.cbError.UseVisualStyleBackColor = true;
99 | //
100 | // cbUninjected
101 | //
102 | this.cbUninjected.Anchor = System.Windows.Forms.AnchorStyles.Top;
103 | this.cbUninjected.AutoSize = true;
104 | this.cbUninjected.BoxBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
105 | this.cbUninjected.BoxForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(62)))), ((int)(((byte)(130)))), ((int)(((byte)(229)))));
106 | this.cbUninjected.Cursor = System.Windows.Forms.Cursors.Hand;
107 | this.cbUninjected.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
108 | this.cbUninjected.Location = new System.Drawing.Point(358, 238);
109 | this.cbUninjected.Name = "cbUninjected";
110 | this.cbUninjected.Size = new System.Drawing.Size(218, 17);
111 | this.cbUninjected.TabIndex = 29;
112 | this.cbUninjected.Text = "BandagedBD not launching with Discord";
113 | this.cbUninjected.UseVisualStyleBackColor = true;
114 | //
115 | // discordLocator
116 | //
117 | this.discordLocator.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
118 | | System.Windows.Forms.AnchorStyles.Left)
119 | | System.Windows.Forms.AnchorStyles.Right)));
120 | this.discordLocator.BackColor = System.Drawing.Color.Transparent;
121 | this.discordLocator.Location = new System.Drawing.Point(0, 2);
122 | this.discordLocator.Name = "discordLocator";
123 | this.discordLocator.Size = new System.Drawing.Size(662, 175);
124 | this.discordLocator.TabIndex = 30;
125 | //
126 | // label1
127 | //
128 | this.label1.Anchor = System.Windows.Forms.AnchorStyles.Top;
129 | this.label1.AutoSize = true;
130 | this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
131 | this.label1.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
132 | this.label1.Location = new System.Drawing.Point(141, 307);
133 | this.label1.Name = "label1";
134 | this.label1.Size = new System.Drawing.Size(144, 13);
135 | this.label1.TabIndex = 31;
136 | this.label1.Text = "Can\'t find your problem here?";
137 | //
138 | // linkLabel1
139 | //
140 | this.linkLabel1.ActiveLinkColor = global::BandagedBD.Properties.Settings.Default.Accent;
141 | this.linkLabel1.Anchor = System.Windows.Forms.AnchorStyles.Top;
142 | this.linkLabel1.AutoSize = true;
143 | this.linkLabel1.Cursor = System.Windows.Forms.Cursors.Hand;
144 | this.linkLabel1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
145 | this.linkLabel1.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline;
146 | this.linkLabel1.LinkColor = global::BandagedBD.Properties.Settings.Default.Accent;
147 | this.linkLabel1.Location = new System.Drawing.Point(328, 307);
148 | this.linkLabel1.Name = "linkLabel1";
149 | this.linkLabel1.Size = new System.Drawing.Size(114, 13);
150 | this.linkLabel1.TabIndex = 32;
151 | this.linkLabel1.TabStop = true;
152 | this.linkLabel1.Text = "Try this troubleshooter.";
153 | this.linkLabel1.VisitedLinkColor = global::BandagedBD.Properties.Settings.Default.Accent;
154 | this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
155 | //
156 | // label3
157 | //
158 | this.label3.Anchor = System.Windows.Forms.AnchorStyles.Top;
159 | this.label3.AutoSize = true;
160 | this.label3.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
161 | this.label3.Location = new System.Drawing.Point(6, 184);
162 | this.label3.Name = "label3";
163 | this.label3.Size = new System.Drawing.Size(95, 13);
164 | this.label3.TabIndex = 34;
165 | this.label3.Text = "Additional Options:";
166 | //
167 | // cbShouldRestart
168 | //
169 | this.cbShouldRestart.Anchor = System.Windows.Forms.AnchorStyles.Top;
170 | this.cbShouldRestart.AutoSize = true;
171 | this.cbShouldRestart.BoxBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
172 | this.cbShouldRestart.BoxForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(62)))), ((int)(((byte)(130)))), ((int)(((byte)(229)))));
173 | this.cbShouldRestart.Checked = true;
174 | this.cbShouldRestart.CheckState = System.Windows.Forms.CheckState.Checked;
175 | this.cbShouldRestart.Cursor = System.Windows.Forms.Cursors.Hand;
176 | this.cbShouldRestart.FlatAppearance.CheckedBackColor = System.Drawing.Color.Transparent;
177 | this.cbShouldRestart.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
178 | this.cbShouldRestart.Location = new System.Drawing.Point(120, 183);
179 | this.cbShouldRestart.Name = "cbShouldRestart";
180 | this.cbShouldRestart.Size = new System.Drawing.Size(162, 17);
181 | this.cbShouldRestart.TabIndex = 33;
182 | this.cbShouldRestart.Text = "Restart All Discord Instances";
183 | this.cbShouldRestart.UseVisualStyleBackColor = true;
184 | //
185 | // RepairConfigPanel
186 | //
187 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
188 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
189 | this.BackColor = System.Drawing.Color.Transparent;
190 | this.Controls.Add(this.label3);
191 | this.Controls.Add(this.cbShouldRestart);
192 | this.Controls.Add(this.linkLabel1);
193 | this.Controls.Add(this.label1);
194 | this.Controls.Add(this.discordLocator);
195 | this.Controls.Add(this.cbUninjected);
196 | this.Controls.Add(this.cbError);
197 | this.Controls.Add(this.cbInfinite);
198 | this.Controls.Add(this.cbBootLoop);
199 | this.Controls.Add(this.label2);
200 | this.Name = "RepairConfigPanel";
201 | this.Size = new System.Drawing.Size(662, 335);
202 | this.ResumeLayout(false);
203 | this.PerformLayout();
204 |
205 | }
206 |
207 | #endregion
208 | private System.Windows.Forms.Label label2;
209 | private BandagedBD.Controls.FlatCheckBox cbBootLoop;
210 | private BandagedBD.Controls.FlatCheckBox cbInfinite;
211 | private BandagedBD.Controls.FlatCheckBox cbError;
212 | private BandagedBD.Controls.FlatCheckBox cbUninjected;
213 | private BandagedBD.Controls.DiscordLocator discordLocator;
214 | private System.Windows.Forms.Label label1;
215 | private System.Windows.Forms.LinkLabel linkLabel1;
216 | private System.Windows.Forms.Label label3;
217 | private BandagedBD.Controls.FlatCheckBox cbShouldRestart;
218 | }
219 | }
220 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/RepairConfigPanel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace BandagedBD.Panels {
5 | public partial class RepairConfigPanel : UserControl, IPanel {
6 |
7 | private FormMain Window;
8 | public void SetWindow(FormMain formMain) => Window = formMain;
9 |
10 | public PanelTypes PreviousPanel => PanelTypes.Action;
11 | public PanelTypes NextPanel => PanelTypes.Repair;
12 |
13 | public string Title => "Repair Setup";
14 | public UserControl Control => this;
15 |
16 | public string[] localPaths => Utilities.GetLocalPaths(discordLocator.stable, discordLocator.canary, discordLocator.ptb, "resources\\app");
17 | public string[] roamingPaths => Utilities.GetRoamingPaths(discordLocator.stable, discordLocator.canary, discordLocator.ptb);
18 | public string[] executables => Utilities.GetExecutables(discordLocator.stable, discordLocator.canary, discordLocator.ptb);
19 |
20 | public bool shouldDeleteRoaming => cbError.Checked || cbBootLoop.Checked;
21 | public bool shouldDeleteLocal => cbBootLoop.Checked;
22 | public bool shouldDeleteStorage => cbInfinite.Checked;
23 | public bool shouldReinstall => cbUninjected.Checked || cbBootLoop.Checked;
24 | public bool shouldRestart => cbShouldRestart.Checked;
25 |
26 | public RepairConfigPanel() {
27 | InitializeComponent();
28 | discordLocator.setLabel("BandagedBD can attempt to fix several common problems. First we need to locate all BandagedBD installations:");
29 | discordLocator.setCheckboxLabel(Discord.Stable, "Repair On Stable");
30 | discordLocator.setCheckboxLabel(Discord.Canary, "Repair On Canary");
31 | discordLocator.setCheckboxLabel(Discord.PTB, "Repair On PTB");
32 | discordLocator.OnCheckedChange += OnCheckedChange;
33 | cbError.CheckedChanged += OnCheckedChange;
34 | cbBootLoop.CheckedChanged += OnCheckedChange;
35 | cbUninjected.CheckedChanged += OnCheckedChange;
36 | cbInfinite.CheckedChanged += OnCheckedChange;
37 | }
38 |
39 | public void OnShow() {
40 | Window.btnBack.ShowEnable();
41 | Window.btnCancel.ShowEnable("Cancel");
42 | Window.btnNext.ShowDisable("Repair");
43 | }
44 |
45 | private void OnCheckedChange(object sender, EventArgs e) {
46 | bool location = discordLocator.stable || discordLocator.canary || discordLocator.ptb;
47 | bool problem = cbError.Checked || cbBootLoop.Checked || cbUninjected.Checked || cbInfinite.Checked;
48 | if (location && problem) Window.btnNext.ShowEnable("Repair");
49 | else Window.btnNext.ShowDisable("Repair");
50 | }
51 |
52 | private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
53 | Utilities.OpenProcess("https://0x71.cc/bd/troubleshoot/");
54 | }
55 |
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/RepairConfigPanel.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/RepairPanel.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace BandagedBD.Panels
2 | {
3 | partial class RepairPanel
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.richText = new System.Windows.Forms.RichTextBox();
32 | this.panel1 = new System.Windows.Forms.Panel();
33 | this.pbStatus = new BandagedBD.Controls.FlatProgressBar();
34 | this.SuspendLayout();
35 | //
36 | // richText
37 | //
38 | this.richText.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
39 | | System.Windows.Forms.AnchorStyles.Left)
40 | | System.Windows.Forms.AnchorStyles.Right)));
41 | this.richText.BackColor = global::BandagedBD.Properties.Settings.Default.SecondaryBackground;
42 | this.richText.BorderStyle = System.Windows.Forms.BorderStyle.None;
43 | this.richText.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
44 | this.richText.Location = new System.Drawing.Point(13, 8);
45 | this.richText.Name = "richText";
46 | this.richText.ReadOnly = true;
47 | this.richText.Size = new System.Drawing.Size(474, 113);
48 | this.richText.TabIndex = 0;
49 | this.richText.Text = "";
50 | //
51 | // panel1
52 | //
53 | this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
54 | | System.Windows.Forms.AnchorStyles.Left)
55 | | System.Windows.Forms.AnchorStyles.Right)));
56 | this.panel1.BackColor = global::BandagedBD.Properties.Settings.Default.SecondaryBackground;
57 | this.panel1.Location = new System.Drawing.Point(4, 0);
58 | this.panel1.Name = "panel1";
59 | this.panel1.Size = new System.Drawing.Size(491, 129);
60 | this.panel1.TabIndex = 4;
61 | //
62 | // pbStatus
63 | //
64 | this.pbStatus.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
65 | | System.Windows.Forms.AnchorStyles.Right)));
66 | this.pbStatus.BackColor = global::BandagedBD.Properties.Settings.Default.SecondaryBackground;
67 | this.pbStatus.ForeColor = global::BandagedBD.Properties.Settings.Default.Accent;
68 | this.pbStatus.Location = new System.Drawing.Point(4, 135);
69 | this.pbStatus.Name = "pbStatus";
70 | this.pbStatus.Size = new System.Drawing.Size(491, 23);
71 | this.pbStatus.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
72 | this.pbStatus.TabIndex = 5;
73 | //
74 | // RepairPanel
75 | //
76 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
77 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
78 | this.BackColor = System.Drawing.Color.Transparent;
79 | this.Controls.Add(this.pbStatus);
80 | this.Controls.Add(this.richText);
81 | this.Controls.Add(this.panel1);
82 | this.Name = "RepairPanel";
83 | this.Size = new System.Drawing.Size(501, 166);
84 | this.ResumeLayout(false);
85 |
86 | }
87 |
88 | #endregion
89 |
90 | private System.Windows.Forms.RichTextBox richText;
91 | private System.Windows.Forms.Panel panel1;
92 | private Controls.FlatProgressBar pbStatus;
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/RepairPanel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Windows.Forms;
5 |
6 | namespace BandagedBD.Panels {
7 | public partial class RepairPanel : UserControl, IPanel {
8 |
9 | private FormMain Window;
10 | public void SetWindow(FormMain formMain) => Window = formMain;
11 |
12 | public string Title => "Repairing";
13 | public UserControl Control => this;
14 |
15 | public PanelTypes PreviousPanel => PanelTypes.InstallConfig;
16 | public PanelTypes NextPanel => Config.shouldReinstall ? PanelTypes.InstallConfig : PanelTypes.NONE;
17 |
18 | private RepairConfigPanel Config => (RepairConfigPanel) Window.GetPanel(PanelTypes.RepairConfig);
19 |
20 | public RepairPanel() {
21 | InitializeComponent();
22 | }
23 |
24 | private void Repair() {
25 | List exes = new List();
26 | foreach (var process in Config.executables) exes.Add(Utilities.KillProcess(process, Append));
27 | pbStatus.Value = 25;
28 | if (Config.shouldDeleteRoaming) Utilities.DeleteFolders(Config.roamingPaths, Append);
29 | pbStatus.Value = 50;
30 | if (Config.shouldDeleteLocal) Utilities.DeleteFolders(Config.localPaths, Append);
31 | pbStatus.Value = 75;
32 | if (Config.shouldDeleteStorage) Utilities.DeleteFiles(new string[] { $"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}\\BetterDiscord\\bdstorage.json" }, Append);
33 | pbStatus.Value = 100;
34 | if (Config.shouldReinstall) {
35 | Append("In order to complete repairs, BandagedBD needs to be reinstalled. Click Install to continue.");
36 | Window.btnNext.ShowEnable("Install");
37 | var confirmResult = MessageBox.Show("In order to complete repairs, BandagedBD needs to be reinstalled. Reinstall now?", "Reinstall needed!", MessageBoxButtons.YesNo);
38 | if (confirmResult == DialogResult.Yes) Window.btnNext.PerformClick();
39 | else {
40 | Window.btnNext.HideDisable();
41 | Window.btnBack.HideDisable();
42 | Window.btnCancel.ShowEnable("Exit");
43 | }
44 | }
45 | else {
46 | foreach (var exe in exes) {
47 | if (exe != string.Empty && Config.shouldRestart) Utilities.OpenProcess(exe);
48 | }
49 | Append("Repairs completed!");
50 | }
51 |
52 | }
53 |
54 | public void OnShow() {
55 | richText.Text = "";
56 | if (Config.shouldReinstall) Window.btnNext.HideDisable("Install");
57 | Repair();
58 | }
59 |
60 | private void Append(string text) {
61 | Debug.WriteLine(text);
62 | richText.AppendText(text);
63 | richText.AppendText(Environment.NewLine);
64 | richText.ScrollToCaret();
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/RepairPanel.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/UninstallConfigPanel.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace BandagedBD.Panels
2 | {
3 | partial class UninstallConfigPanel
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.userData = new BandagedBD.Controls.FlatCheckBox();
32 | this.label1 = new System.Windows.Forms.Label();
33 | this.cbShouldRestart = new BandagedBD.Controls.FlatCheckBox();
34 | this.discordLocator = new BandagedBD.Controls.DiscordLocator();
35 | this.SuspendLayout();
36 | //
37 | // userData
38 | //
39 | this.userData.Anchor = System.Windows.Forms.AnchorStyles.Top;
40 | this.userData.AutoSize = true;
41 | this.userData.BoxBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
42 | this.userData.BoxForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(62)))), ((int)(((byte)(130)))), ((int)(((byte)(229)))));
43 | this.userData.Cursor = System.Windows.Forms.Cursors.Hand;
44 | this.userData.FlatAppearance.CheckedBackColor = System.Drawing.Color.Transparent;
45 | this.userData.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
46 | this.userData.Location = new System.Drawing.Point(9, 209);
47 | this.userData.Name = "userData";
48 | this.userData.Size = new System.Drawing.Size(170, 17);
49 | this.userData.TabIndex = 5;
50 | this.userData.Text = "Remove all BandagedBD data";
51 | this.userData.UseVisualStyleBackColor = true;
52 | //
53 | // label1
54 | //
55 | this.label1.Anchor = System.Windows.Forms.AnchorStyles.Top;
56 | this.label1.AutoSize = true;
57 | this.label1.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
58 | this.label1.Location = new System.Drawing.Point(6, 183);
59 | this.label1.Name = "label1";
60 | this.label1.Size = new System.Drawing.Size(95, 13);
61 | this.label1.TabIndex = 7;
62 | this.label1.Text = "Additional Options:";
63 | //
64 | // cbShouldRestart
65 | //
66 | this.cbShouldRestart.Anchor = System.Windows.Forms.AnchorStyles.Top;
67 | this.cbShouldRestart.AutoSize = true;
68 | this.cbShouldRestart.BoxBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
69 | this.cbShouldRestart.BoxForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(62)))), ((int)(((byte)(130)))), ((int)(((byte)(229)))));
70 | this.cbShouldRestart.Checked = true;
71 | this.cbShouldRestart.CheckState = System.Windows.Forms.CheckState.Checked;
72 | this.cbShouldRestart.Cursor = System.Windows.Forms.Cursors.Hand;
73 | this.cbShouldRestart.FlatAppearance.CheckedBackColor = System.Drawing.Color.Transparent;
74 | this.cbShouldRestart.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
75 | this.cbShouldRestart.Location = new System.Drawing.Point(9, 232);
76 | this.cbShouldRestart.Name = "cbShouldRestart";
77 | this.cbShouldRestart.Size = new System.Drawing.Size(162, 17);
78 | this.cbShouldRestart.TabIndex = 34;
79 | this.cbShouldRestart.Text = "Restart All Discord Instances";
80 | this.cbShouldRestart.UseVisualStyleBackColor = true;
81 | //
82 | // discordLocator
83 | //
84 | this.discordLocator.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
85 | | System.Windows.Forms.AnchorStyles.Left)
86 | | System.Windows.Forms.AnchorStyles.Right)));
87 | this.discordLocator.BackColor = System.Drawing.Color.Transparent;
88 | this.discordLocator.Location = new System.Drawing.Point(0, 3);
89 | this.discordLocator.Name = "discordLocator";
90 | this.discordLocator.Size = new System.Drawing.Size(662, 177);
91 | this.discordLocator.TabIndex = 6;
92 | //
93 | // UninstallConfigPanel
94 | //
95 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
96 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
97 | this.BackColor = System.Drawing.Color.Transparent;
98 | this.Controls.Add(this.cbShouldRestart);
99 | this.Controls.Add(this.label1);
100 | this.Controls.Add(this.userData);
101 | this.Controls.Add(this.discordLocator);
102 | this.Name = "UninstallConfigPanel";
103 | this.Size = new System.Drawing.Size(662, 284);
104 | this.ResumeLayout(false);
105 | this.PerformLayout();
106 |
107 | }
108 |
109 | #endregion
110 | private BandagedBD.Controls.FlatCheckBox userData;
111 | private BandagedBD.Controls.DiscordLocator discordLocator;
112 | private System.Windows.Forms.Label label1;
113 | private BandagedBD.Controls.FlatCheckBox cbShouldRestart;
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/UninstallConfigPanel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Windows.Forms;
4 |
5 | namespace BandagedBD.Panels {
6 | public partial class UninstallConfigPanel : UserControl, IPanel {
7 |
8 | private FormMain Window;
9 | public void SetWindow(FormMain formMain) => Window = formMain;
10 |
11 | public string Title => "Uninstall Setup";
12 | public UserControl Control => this;
13 |
14 | public PanelTypes PreviousPanel => PanelTypes.Action;
15 | public PanelTypes NextPanel => PanelTypes.Uninstall;
16 |
17 | public string[] pathsToDelete {
18 | get {
19 | List paths = new List(Utilities.GetLocalPaths(discordLocator.stable, discordLocator.canary, discordLocator.ptb, "resources\\app"));
20 | if (userData.Checked) paths.Add($"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}\\BetterDiscord");
21 | return paths.ToArray();
22 | }
23 | }
24 | public string[] executables => Utilities.GetExecutables(discordLocator.stable, discordLocator.canary, discordLocator.ptb);
25 | public bool shouldRestart => cbShouldRestart.Checked;
26 |
27 | public UninstallConfigPanel() {
28 | InitializeComponent();
29 | discordLocator.setLabel("BandagedBD will be removed from the locations below. Click browse if the locations are incorrect.");
30 | discordLocator.setCheckboxLabel(Discord.Stable, "Remove from Stable");
31 | discordLocator.setCheckboxLabel(Discord.Canary, "Remove from Canary");
32 | discordLocator.setCheckboxLabel(Discord.PTB, "Remove from PTB");
33 | discordLocator.OnCheckedChange += OnCheckedChange;
34 | }
35 |
36 | public void OnShow() {
37 | Window.btnBack.ShowEnable();
38 | Window.btnCancel.ShowEnable("Cancel");
39 | Window.btnNext.ShowDisable("Uninstall");
40 | }
41 |
42 | private void OnCheckedChange(object sender, EventArgs e) {
43 | if (discordLocator.stable || discordLocator.canary || discordLocator.ptb) Window.btnNext.ShowEnable("Uninstall");
44 | else Window.btnNext.ShowDisable("Uninstall");
45 | }
46 |
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/UninstallConfigPanel.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/UninstallPanel.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace BandagedBD.Panels
2 | {
3 | partial class UninstallPanel
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.richText = new System.Windows.Forms.RichTextBox();
32 | this.panel1 = new System.Windows.Forms.Panel();
33 | this.pbStatus = new BandagedBD.Controls.FlatProgressBar();
34 | this.SuspendLayout();
35 | //
36 | // richText
37 | //
38 | this.richText.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
39 | | System.Windows.Forms.AnchorStyles.Left)
40 | | System.Windows.Forms.AnchorStyles.Right)));
41 | this.richText.BackColor = global::BandagedBD.Properties.Settings.Default.SecondaryBackground;
42 | this.richText.BorderStyle = System.Windows.Forms.BorderStyle.None;
43 | this.richText.ForeColor = global::BandagedBD.Properties.Settings.Default.TextColor;
44 | this.richText.Location = new System.Drawing.Point(13, 8);
45 | this.richText.Name = "richText";
46 | this.richText.ReadOnly = true;
47 | this.richText.Size = new System.Drawing.Size(474, 113);
48 | this.richText.TabIndex = 0;
49 | this.richText.Text = "";
50 | //
51 | // panel1
52 | //
53 | this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
54 | | System.Windows.Forms.AnchorStyles.Left)
55 | | System.Windows.Forms.AnchorStyles.Right)));
56 | this.panel1.BackColor = global::BandagedBD.Properties.Settings.Default.SecondaryBackground;
57 | this.panel1.Location = new System.Drawing.Point(4, 0);
58 | this.panel1.Name = "panel1";
59 | this.panel1.Size = new System.Drawing.Size(491, 129);
60 | this.panel1.TabIndex = 4;
61 | //
62 | // pbStatus
63 | //
64 | this.pbStatus.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
65 | | System.Windows.Forms.AnchorStyles.Right)));
66 | this.pbStatus.BackColor = global::BandagedBD.Properties.Settings.Default.SecondaryBackground;
67 | this.pbStatus.ForeColor = global::BandagedBD.Properties.Settings.Default.Accent;
68 | this.pbStatus.Location = new System.Drawing.Point(4, 135);
69 | this.pbStatus.Name = "pbStatus";
70 | this.pbStatus.Size = new System.Drawing.Size(491, 23);
71 | this.pbStatus.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
72 | this.pbStatus.TabIndex = 6;
73 | //
74 | // UninstallPanel
75 | //
76 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
77 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
78 | this.BackColor = System.Drawing.Color.Transparent;
79 | this.Controls.Add(this.pbStatus);
80 | this.Controls.Add(this.richText);
81 | this.Controls.Add(this.panel1);
82 | this.Name = "UninstallPanel";
83 | this.Size = new System.Drawing.Size(501, 166);
84 | this.ResumeLayout(false);
85 |
86 | }
87 |
88 | #endregion
89 |
90 | private System.Windows.Forms.RichTextBox richText;
91 | private System.Windows.Forms.Panel panel1;
92 | private Controls.FlatProgressBar pbStatus;
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/UninstallPanel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Windows.Forms;
4 |
5 | namespace BandagedBD.Panels {
6 | public partial class UninstallPanel : UserControl, IPanel {
7 |
8 | private FormMain Window;
9 | public void SetWindow(FormMain formMain) => Window = formMain;
10 |
11 | public string Title => "Uninstalling";
12 | public UserControl Control => this;
13 |
14 | public PanelTypes PreviousPanel => PanelTypes.InstallConfig;
15 | public PanelTypes NextPanel => PanelTypes.NONE;
16 |
17 | private UninstallConfigPanel Config => (UninstallConfigPanel) Window.GetPanel(PanelTypes.UninstallConfig);
18 |
19 | public UninstallPanel() {
20 | InitializeComponent();
21 | }
22 |
23 | private void Uninstall() {
24 | List exes = new List();
25 | foreach (var process in Config.executables) exes.Add(Utilities.KillProcess(process, Append));
26 | pbStatus.Value = 20;
27 | string[] paths = Config.pathsToDelete;
28 | int chunk = 80 / paths.Length;
29 | int i = 0;
30 | int newValue = 20;
31 | Utilities.DeleteFolders(paths, (message) => {
32 | Append(message);
33 | newValue = (chunk * i + chunk) + 20;
34 | if (newValue <= 100) pbStatus.Value = newValue;
35 | else pbStatus.Value = 100;
36 | i++;
37 | });
38 | foreach (var exe in exes) {
39 | if (exe != string.Empty && Config.shouldRestart) Utilities.OpenProcess(exe);
40 | }
41 | Append("Uninstalling Complete!");
42 | }
43 |
44 | public void OnShow() {
45 | richText.Text = "";
46 | Uninstall();
47 | Window.btnCancel.ShowEnable("Exit");
48 | }
49 |
50 | private void Append(string text) {
51 | richText.AppendText(text);
52 | richText.AppendText(Environment.NewLine);
53 | richText.ScrollToCaret();
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/BandagedBD/Panels/UninstallPanel.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/BandagedBD/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace BandagedBD {
5 | static class Program {
6 | ///
7 | /// The main entry point for the application.
8 | ///
9 | [STAThread]
10 | static void Main() {
11 | Application.EnableVisualStyles();
12 | Application.SetCompatibleTextRenderingDefault(false);
13 | Application.Run(new FormMain());
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/BandagedBD/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("BandagedBD")]
8 | [assembly: AssemblyDescription("BandagedBD Windows Installer")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("Zerebos")]
11 | [assembly: AssemblyProduct("BandagedBD")]
12 | [assembly: AssemblyCopyright("Copyright © 2017-present")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("390615f1-ce33-4173-9e8c-4e4f3eb1758d")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.2")]
35 | [assembly: AssemblyFileVersion("1.0.2")]
36 |
--------------------------------------------------------------------------------
/BandagedBD/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace BandagedBD.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BandagedBD.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Looks up a localized resource of type System.Drawing.Bitmap.
65 | ///
66 | internal static System.Drawing.Bitmap archive_small {
67 | get {
68 | object obj = ResourceManager.GetObject("archive_small", resourceCulture);
69 | return ((System.Drawing.Bitmap)(obj));
70 | }
71 | }
72 |
73 | ///
74 | /// Looks up a localized resource of type System.Drawing.Bitmap.
75 | ///
76 | internal static System.Drawing.Bitmap BBDVS {
77 | get {
78 | object obj = ResourceManager.GetObject("BBDVS", resourceCulture);
79 | return ((System.Drawing.Bitmap)(obj));
80 | }
81 | }
82 |
83 | ///
84 | /// Looks up a localized resource of type System.Drawing.Bitmap.
85 | ///
86 | internal static System.Drawing.Bitmap build_small {
87 | get {
88 | object obj = ResourceManager.GetObject("build_small", resourceCulture);
89 | return ((System.Drawing.Bitmap)(obj));
90 | }
91 | }
92 |
93 | ///
94 | /// Looks up a localized resource of type System.Drawing.Bitmap.
95 | ///
96 | internal static System.Drawing.Bitmap delete_small {
97 | get {
98 | object obj = ResourceManager.GetObject("delete_small", resourceCulture);
99 | return ((System.Drawing.Bitmap)(obj));
100 | }
101 | }
102 |
103 | ///
104 | /// Looks up a localized string similar to Copyright (c) 2017 - Present Zerebos
105 | ///
106 | ///Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
107 | ///
108 | ///The above copyright notice and this [rest of string was truncated]";.
109 | ///
110 | internal static string License {
111 | get {
112 | return ResourceManager.GetString("License", resourceCulture);
113 | }
114 | }
115 |
116 | ///
117 | /// Looks up a localized string similar to 1.0.5.
118 | ///
119 | internal static string Version {
120 | get {
121 | return ResourceManager.GetString("Version", resourceCulture);
122 | }
123 | }
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/BandagedBD/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace BandagedBD.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.5.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 |
26 | [global::System.Configuration.UserScopedSettingAttribute()]
27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28 | [global::System.Configuration.DefaultSettingValueAttribute("False")]
29 | public bool AgreedToTerms {
30 | get {
31 | return ((bool)(this["AgreedToTerms"]));
32 | }
33 | set {
34 | this["AgreedToTerms"] = value;
35 | }
36 | }
37 |
38 | [global::System.Configuration.ApplicationScopedSettingAttribute()]
39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
40 | [global::System.Configuration.DefaultSettingValueAttribute("28, 28, 28")]
41 | public global::System.Drawing.Color PrimaryBackground {
42 | get {
43 | return ((global::System.Drawing.Color)(this["PrimaryBackground"]));
44 | }
45 | }
46 |
47 | [global::System.Configuration.ApplicationScopedSettingAttribute()]
48 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
49 | [global::System.Configuration.DefaultSettingValueAttribute("42, 42, 42")]
50 | public global::System.Drawing.Color SecondaryBackground {
51 | get {
52 | return ((global::System.Drawing.Color)(this["SecondaryBackground"]));
53 | }
54 | }
55 |
56 | [global::System.Configuration.ApplicationScopedSettingAttribute()]
57 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
58 | [global::System.Configuration.DefaultSettingValueAttribute("62, 130, 229")]
59 | public global::System.Drawing.Color Accent {
60 | get {
61 | return ((global::System.Drawing.Color)(this["Accent"]));
62 | }
63 | }
64 |
65 | [global::System.Configuration.ApplicationScopedSettingAttribute()]
66 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
67 | [global::System.Configuration.DefaultSettingValueAttribute("White")]
68 | public global::System.Drawing.Color TextColor {
69 | get {
70 | return ((global::System.Drawing.Color)(this["TextColor"]));
71 | }
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/BandagedBD/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | False
7 |
8 |
9 | 28, 28, 28
10 |
11 |
12 | 42, 42, 42
13 |
14 |
15 | 62, 130, 229
16 |
17 |
18 | White
19 |
20 |
21 |
--------------------------------------------------------------------------------
/BandagedBD/Resources/BBDVS.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zerebos/BBDInstaller/67a2a9132f34e90ac079efe8047984c4bebe77fc/BandagedBD/Resources/BBDVS.png
--------------------------------------------------------------------------------
/BandagedBD/Resources/archive_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zerebos/BBDInstaller/67a2a9132f34e90ac079efe8047984c4bebe77fc/BandagedBD/Resources/archive_small.png
--------------------------------------------------------------------------------
/BandagedBD/Resources/build_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zerebos/BBDInstaller/67a2a9132f34e90ac079efe8047984c4bebe77fc/BandagedBD/Resources/build_small.png
--------------------------------------------------------------------------------
/BandagedBD/Resources/delete_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zerebos/BBDInstaller/67a2a9132f34e90ac079efe8047984c4bebe77fc/BandagedBD/Resources/delete_small.png
--------------------------------------------------------------------------------
/BandagedBD/Utilities.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Drawing;
5 | using System.IO;
6 | using System.Net;
7 | using System.Text.RegularExpressions;
8 | using System.Windows.Forms;
9 |
10 | namespace BandagedBD {
11 |
12 | public enum Discord { Stable, Canary, PTB };
13 |
14 | public class Utilities {
15 | public static readonly Regex _matcher = new Regex(@"[0-9]+\.[0-9]+\.[0-9]+");
16 | public static string LADPath(string append) => $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\{append}";
17 | public static string PDPath(string append) => $"{Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)}\\{Environment.UserName}\\{append}";
18 | public static string EXEPath(string exe) => exe == string.Empty ? exe : Path.GetFullPath(Path.Combine(exe, "..\\.."));
19 |
20 | public static string StablePath => LADPath("Discord");
21 | public static string StablePathPD => PDPath("Discord");
22 | public static string StablePathEXE => EXEPath(GetProcess("Discord"));
23 |
24 | public static string CanaryPath => LADPath("DiscordCanary");
25 | public static string CanaryPathPD => PDPath("DiscordCanary");
26 | public static string CanaryPathEXE => EXEPath(GetProcess("DiscordCanary"));
27 |
28 | public static string PtbPath => LADPath("DiscordPTB");
29 | public static string PtbPathPD => PDPath("DiscordPTB");
30 | public static string PtbPathEXE => EXEPath(GetProcess("DiscordPTB"));
31 |
32 | public static string CurrentStablePath = Directory.Exists(StablePathEXE) ? StablePathEXE : Directory.Exists(StablePathPD) ? StablePathPD : Directory.Exists(StablePath) ? StablePath : null;
33 | public static string CurrentCanaryPath = Directory.Exists(CanaryPathEXE) ? CanaryPathEXE : Directory.Exists(CanaryPathPD) ? CanaryPathPD : Directory.Exists(CanaryPath) ? CanaryPath : null;
34 | public static string CurrentPtbPath = Directory.Exists(PtbPathEXE) ? PtbPathEXE : Directory.Exists(PtbPathPD) ? PtbPathPD : Directory.Exists(PtbPath) ? PtbPath : null;
35 |
36 | public static void OpenProcess(string url) {
37 | Process.Start(url);
38 | }
39 |
40 | public static void DeleteFolders(string[] paths, Action onMessage = null) {
41 | for (int i = 0; i < paths.Length; i++) {
42 | onMessage?.Invoke($"Deleting {paths[i]}");
43 | if (!Directory.Exists(paths[i])) {
44 | onMessage?.Invoke($"{paths[i]} does not exist, skipping.");
45 | continue;
46 | }
47 | try {
48 | Directory.Delete(paths[i], true);
49 | }
50 | catch {
51 | onMessage?.Invoke($"Could not delete {paths[i]} please delete manually.");
52 | }
53 | }
54 | }
55 |
56 | public static void DeleteFiles(string[] paths, Action onMessage = null) {
57 | for (int i = 0; i < paths.Length; i++) {
58 | onMessage?.Invoke($"Deleting {paths[i]}");
59 | try {
60 | File.Delete(paths[i]);
61 | }
62 | catch {
63 | onMessage?.Invoke($"Could not delete {paths[i]} please delete manually.");
64 | }
65 | }
66 | }
67 |
68 | public static string GetProcess(string processName) {
69 | var currentExecutable = string.Empty;
70 | try {
71 | foreach (var process in Process.GetProcessesByName(processName)) {
72 | currentExecutable = process.MainModule.FileName;
73 | break;
74 | }
75 | }
76 | catch { }
77 | return currentExecutable;
78 | }
79 |
80 | public static string KillProcess(string processName, Action onMessage = null) {
81 | return KillProcess(processName, (str, boolean) => {
82 | onMessage?.Invoke(str);
83 | });
84 | }
85 |
86 | public static string KillProcess(string processName, Action onMessage = null) {
87 | var currentExecutable = string.Empty;
88 | try {
89 | foreach (var process in Process.GetProcessesByName(processName)) {
90 | onMessage?.Invoke($"Killing {processName} process {process.Id}", true);
91 | currentExecutable = process.MainModule.FileName;
92 | process.Kill();
93 | }
94 | }
95 | catch { }
96 | return currentExecutable;
97 | }
98 |
99 | public static string[] GetExecutables(bool stable, bool canary, bool ptb) {
100 | List exes = new List();
101 | if (stable) exes.Add("Discord");
102 | if (canary) exes.Add("DiscordCanary");
103 | if (ptb) exes.Add("DiscordPTB");
104 | return exes.ToArray();
105 | }
106 |
107 | public static string[] GetRoamingPaths(bool stable, bool canary, bool ptb, string subFolder = "") {
108 | List roaming = new List();
109 | var stableFolder = GetRoaming("discord");
110 | var canaryFolder = GetRoaming("discordcanary");
111 | var ptbFolder = GetRoaming("discordptb");
112 | if (stable && stableFolder != string.Empty) roaming.Add($"{stableFolder}\\{subFolder}");
113 | if (canary && canaryFolder != string.Empty) roaming.Add($"{canaryFolder}\\{subFolder}");
114 | if (ptb && ptbFolder != string.Empty) roaming.Add($"{ptbFolder}\\{subFolder}");
115 | return roaming.ToArray();
116 | }
117 |
118 | public static string[] GetLocalPaths(bool stable, bool canary, bool ptb, string subFolder = "") {
119 | List paths = new List();
120 | if (stable) paths.Add($"{CurrentStablePath}\\{subFolder}");
121 | if (canary) paths.Add($"{CurrentCanaryPath}\\{subFolder}");
122 | if (ptb) paths.Add($"{CurrentPtbPath}\\{subFolder}");
123 | return paths.ToArray();
124 | }
125 |
126 | public static string GetExe(Discord which) {
127 | if (which == Discord.Stable) return "Discord";
128 | if (which == Discord.Canary) return "DiscordCanary";
129 | if (which == Discord.PTB) return "DiscordPTB";
130 | return "";
131 | }
132 |
133 | public static void EnsureDiscord(TextBox tb, CheckBox cb, Discord which) {
134 | if (tb.Text.ToLower().Contains("could not find")) {
135 | cb.Checked = false;
136 | return;
137 | }
138 |
139 | var baseFolder = GetLatestVersion(tb.Text);
140 | if (baseFolder == string.Empty) baseFolder = tb.Text;
141 | string executable = GetExe(which);
142 | tb.ForeColor = Properties.Settings.Default.TextColor;
143 | if (!File.Exists(baseFolder + $"\\{executable}.exe")) {
144 | tb.Text = $"Could not find {executable}.exe!";
145 | tb.ForeColor = Color.Red;
146 | cb.Checked = false;
147 | }
148 | else {
149 | tb.Text = baseFolder;
150 | if (which == Discord.Stable) CurrentStablePath = baseFolder;
151 | if (which == Discord.Canary) CurrentCanaryPath = baseFolder;
152 | if (which == Discord.PTB) CurrentPtbPath = baseFolder;
153 | }
154 | }
155 |
156 | public static string GetLatestVersion(string path) {
157 | if (path == string.Empty) return path;
158 | if (!Directory.Exists(path)) return string.Empty;
159 | var dirs = Directory.GetDirectories(path);
160 | if (dirs.Length <= 0) return string.Empty;
161 | var latest = Path.GetFileName(dirs[0]);
162 |
163 | foreach (var dir in dirs) {
164 | if (!_matcher.IsMatch(Path.GetFileName(dir))) continue;
165 | if (string.CompareOrdinal(Path.GetFileName(dir), latest) > 0) latest = Path.GetFileName(dir);
166 | }
167 |
168 | return _matcher.IsMatch(latest) ? Path.Combine(path, latest) : string.Empty;
169 | }
170 |
171 | public static string GetRoaming(string version) {
172 | return GetLatestVersion($"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}\\{version}");
173 | }
174 | }
175 |
176 | public class TimedWebClient : WebClient {
177 | public WebHeaderCollection DefaultHeaders = new WebHeaderCollection { ["User-Agent"] = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11" };
178 | public TimedWebClient() {
179 | Headers = DefaultHeaders;
180 | }
181 | protected override WebRequest GetWebRequest(Uri uri) {
182 | WebRequest w = base.GetWebRequest(uri);
183 | w.Timeout = 5 * 60 * 1000;
184 | return w;
185 | }
186 | }
187 | }
188 |
--------------------------------------------------------------------------------
/BandagedBD/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
56 |
63 |
64 |
65 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2018 Zack Rauen www.ZackRauen.com
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software the rights to use, copy, modify, merge, publish, distribute, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # This repo has been archived and is no longer active. If you are looking to install BetterDiscord. Please use the new installers found here: https://github.com/BetterDiscord/Installer
2 |
3 | # BandagedBD Installer
4 |
5 | This is the source for the Windows installer of [BandagedBD](https://github.com/rauenzi/BetterDiscordApp), a mod for Discord. I decided to put this in a separate repo mainly because it didn't feel quite right to have it in with the actual application itself as the application is JavaScript injection onto an Electron.js platform, and this is an actual executable that only sets ups files for it.
6 |
7 | ## Preview
8 |
9 | 
10 |
11 | ## System Structure
12 |
13 | The system starts through the `FormMain` object which then adds the necessary control to the form. The controls to be added implement the interface `IPanel` and are represented in the accomanying enumeration `PanelTypes`. These two in tandem determine how the navigation through the installer occurs.
14 |
15 | ### PanelTypes
16 |
17 | An enumeration representing all the available panels to have in the installer.
18 |
19 | ### IPanel
20 |
21 | The interface `IPanel` requires the following functions:
22 |
23 | 1. `void OnShow` - Called when the control is added to the form
24 | 2. `void SetWindow(FormMain)` - Called when the main form prepares the panels, allows panels to keep a reference to the window/form
25 |
26 | The interface also requires the following gettable properties:
27 |
28 | 1. `string Title` - The title of the panel to be shown in the form
29 | 2. `UserControl Control` - Returns an implied cast of self (useful for passing to other function in the main form)
30 | 3. `PanelTypes PreviousPanel` - Representation of the panel to go to when going "back"
31 | 4. `PanelTypes NextPanel` - Representation of the panel to go to when going "forward"
32 |
33 | ### FormMain
34 |
35 | Creates and keeps a reference to all the `IPanel`s and even handles the navigation through the application. Also holds the enumeration of `PanelTypes`. Includes a function to return a reference to a specific panel so panels may reference each other (mainly used for panels to refer to the configuration panel).
36 |
37 | ### Discord
38 |
39 | An enumeration representing the 3 release channels of Discord: Stable, Canary and PTB.
40 |
41 | ### Utilities
42 |
43 | Utilities contains several functions used multple times throughout the application including things like killing and launching processes as well as searching for and resolving paths. Contains the `Discord` enumeration.
44 |
45 | ## Custom Components
46 |
47 | The installer makes use of a few custom components either for modularity as in the `DiscordLocator` control or for the custom "flat" design as in WinForms not all controls have a decent flat style.
48 |
49 | ### DiscordLocator
50 |
51 | This is a custom group of controls consisting of: 3 checkboxes that represent location enable, 3 textboxes showing the currently entered/found path, and 3 buttons that allow the user to browse for the path.
52 |
53 | ### Button
54 |
55 | This is a simple wrap around the normal `Button` object to add some helpful functions.
56 |
57 | ### FlatCheckBox
58 |
59 | The native checkbox leaves a lot to be desired in terms of extensibility and customization. To create custom styling this component paints it's own checkbox using the current graphics and imposing the string "✔" overtop.
60 |
61 | ### FlatProgressBar
62 |
63 | Similar to the checkbox the native progressbar has little to no customization options. This paints a flat checkbox using the an offscreen image as adapted from this [StackOverflow answer](https://stackoverflow.com/a/7490884).
64 |
--------------------------------------------------------------------------------