Updated Installer with 2 New options and fixed PTB Installing for latest Build

This commit is contained in:
AraHaan 2016-02-02 18:21:52 -06:00
parent df542fe3c9
commit 40262cd068
5 changed files with 150 additions and 5 deletions

View File

@ -9,4 +9,4 @@
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
</assembly>

View File

@ -33,7 +33,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>BetterDiscord-icon.ico</ApplicationIcon>
<ApplicationIcon>Resources\BetterDiscord-icon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup />
<PropertyGroup>
@ -144,7 +144,7 @@
<None Include="Resources\bd_logo_large_nobg.png" />
</ItemGroup>
<ItemGroup>
<Content Include="BetterDiscord-icon.ico" />
<Content Include="Resources\BetterDiscord-icon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -34,6 +34,8 @@
this.tbPath = new BetterDiscordWI.components.CTextBox();
this.label3 = new System.Windows.Forms.Label();
this.cbRestart = new System.Windows.Forms.CheckBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// label1
@ -94,10 +96,35 @@
this.cbRestart.Text = "Restart Discord after installation";
this.cbRestart.UseVisualStyleBackColor = true;
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(23, 140);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(137, 17);
this.checkBox1.TabIndex = 7;
this.checkBox1.Text = "Install to DiscordCanary";
this.checkBox1.UseVisualStyleBackColor = true;
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
//
// checkBox2
//
this.checkBox2.AutoSize = true;
this.checkBox2.Location = new System.Drawing.Point(23, 163);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(436, 17);
this.checkBox2.TabIndex = 8;
this.checkBox2.Text = "Install to DiscordPTB (Can break at any time)(Installer will be updated frequentl" +
"y for this)";
this.checkBox2.UseVisualStyleBackColor = true;
this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
//
// Panel1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.checkBox2);
this.Controls.Add(this.checkBox1);
this.Controls.Add(this.cbRestart);
this.Controls.Add(this.label3);
this.Controls.Add(this.tbPath);
@ -119,5 +146,7 @@
private System.Windows.Forms.Label label3;
private System.Windows.Forms.CheckBox cbRestart;
internal components.CTextBox tbPath;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.CheckBox checkBox2;
}
}

View File

@ -69,5 +69,121 @@ namespace BetterDiscordWI.panels
tbPath.Text = fbd.SelectedPath;
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked == true)
{
checkBox2.Checked = false;
String[] directories = Directory.GetDirectories(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\DiscordCanary");
String highestVersion = null;
foreach (String s in directories)
{
Debug.Print(s);
if (!s.Contains("app-")) continue;
if (String.IsNullOrEmpty(highestVersion))
{
highestVersion = s;
continue;
}
if (String.CompareOrdinal(s, highestVersion) > 0)
{
highestVersion = s;
}
}
tbPath.Text = highestVersion;
}
if (checkBox1.Checked == false)
{
if (checkBox2.Checked == false)
{
String[] directories = Directory.GetDirectories(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Discord");
String highestVersion = null;
foreach (String s in directories)
{
Debug.Print(s);
if (!s.Contains("app-")) continue;
if (String.IsNullOrEmpty(highestVersion))
{
highestVersion = s;
continue;
}
if (String.CompareOrdinal(s, highestVersion) > 0)
{
highestVersion = s;
}
}
tbPath.Text = highestVersion;
}
}
}
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
if (checkBox2.Checked == true)
{
checkBox1.Checked = false;
String[] directories = Directory.GetDirectories(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\DiscordPTB");
String highestVersion = null;
foreach (String s in directories)
{
Debug.Print(s);
if (!s.Contains("app-")) continue;
if (String.IsNullOrEmpty(highestVersion))
{
highestVersion = s;
continue;
}
if (String.CompareOrdinal(s, highestVersion) > 0)
{
highestVersion = s;
}
}
tbPath.Text = highestVersion;
}
if (checkBox2.Checked == false)
{
if (checkBox1.Checked == false)
{
String[] directories = Directory.GetDirectories(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Discord");
String highestVersion = null;
foreach (String s in directories)
{
Debug.Print(s);
if (!s.Contains("app-")) continue;
if (String.IsNullOrEmpty(highestVersion))
{
highestVersion = s;
continue;
}
if (String.CompareOrdinal(s, highestVersion) > 0)
{
highestVersion = s;
}
}
tbPath.Text = highestVersion;
}
}
}
}
}

View File

@ -234,13 +234,13 @@ namespace BetterDiscordWI.panels
}
if (GetParent().DiscordPath.Contains("DiscordPTB\\"))
{
//"mainWindow = new _browserWindow2"
if (line.Contains("var _discord_overlay2"))
{
lines.Add(line);
lines.Add("var _betterDiscord = require('betterdiscord');");
}
else if (line.Contains("mainWindow = new _browserWindow2"))
//"mainWindow = new _browserWindow2" was changed in DiscordPTB v0.0.6
else if (line.Contains("mainWindow = new _electron.BrowserWindow"))
{
lines.Add(line);
lines.Add(File.ReadAllText("splice"));