Merge pull request #162 from AraHaan/patch-1

Updated the Installer
This commit is contained in:
Jiiks 2016-02-02 01:10:27 +02:00
commit 288b401b26
7 changed files with 135 additions and 33 deletions

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="BetterDiscord Installer"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

View File

@ -32,9 +32,16 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>BetterDiscord-icon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup />
<PropertyGroup>
<ApplicationManifest>App.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="asardotnet">
<HintPath>..\..\..\..\..\VSProjects\asardotnet\asardotnet\bin\Release\asardotnet.dll</HintPath>
<HintPath>bin\dlls\asardotnet.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@ -109,6 +116,7 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="App.manifest" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@ -135,6 +143,9 @@
<ItemGroup>
<None Include="Resources\bd_logo_large_nobg.png" />
</ItemGroup>
<ItemGroup>
<Content Include="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.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Jiiks")]
[assembly: AssemblyProduct("BetterDiscordWI")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyCopyright("Copyright © 2015-2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyFileVersion("0.2.0.0")]
[assembly: AssemblyVersion("0.2.6.0")]
[assembly: AssemblyFileVersion("0.2.6.0")]

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

View File

@ -116,8 +116,8 @@
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btnBrowser;
private System.Windows.Forms.Label label2;
private components.CTextBox tbPath;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.CheckBox cbRestart;
internal components.CTextBox tbPath;
}
}

View File

@ -13,7 +13,6 @@ namespace BetterDiscordWI.panels
{
public partial class Panel2 : UserControl, IPanel
{
private String _dataPath, _tempPath;
private Utils _utils;
@ -31,13 +30,31 @@ namespace BetterDiscordWI.panels
GetParent().btnCancel.Enabled = false;
_utils = new Utils();
AppendLog("Killing Discord");
foreach (var process in Process.GetProcessesByName("Discord"))
if (GetParent().DiscordPath.Contains("Discord\\"))
{
process.Kill();
AppendLog("Killing Discord");
foreach (var process in Process.GetProcessesByName("Discord"))
{
process.Kill();
}
}
if (GetParent().DiscordPath.Contains("DiscordCanary\\"))
{
AppendLog("Killing DiscordCanary");
foreach (var process in Process.GetProcessesByName("DiscordCanary"))
{
process.Kill();
}
}
if (GetParent().DiscordPath.Contains("DiscordPTB\\"))
{
AppendLog("Killing DiscordPTB");
foreach (var process in Process.GetProcessesByName("DiscordPTB"))
{
process.Kill();
}
}
CreateDirectories();
}
@ -88,14 +105,24 @@ namespace BetterDiscordWI.panels
private void DeleteDirs()
{
int errors = 0;
Thread t = new Thread(() =>
{
String dir = GetParent().DiscordPath + "\\resources\\app";
if (Directory.Exists(dir))
{
AppendLog("Deleting " + dir);
Directory.Delete(dir, true);
try
{
AppendLog("Deleting " + dir);
Directory.Delete(dir, true);
}
catch
{
AppendLog("Error Failed to Delete the '" + dir + "\\resources\\app' Directory.");
errors = 1;
Finalize(errors);
}
}
while (Directory.Exists(dir))
@ -123,14 +150,22 @@ namespace BetterDiscordWI.panels
Directory.Move(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\BetterDiscord\\temp\\BetterDiscordApp-stable", GetParent().DiscordPath + "\\resources\\node_modules\\BetterDiscord");
AppendLog("Extracting app.asar");
try
{
AppendLog("Extracting app.asar");
AsarArchive archive = new AsarArchive(GetParent().DiscordPath + "\\resources\\app.asar");
AsarArchive archive = new AsarArchive(GetParent().DiscordPath + "\\resources\\app.asar");
AsarExtractor extractor = new AsarExtractor();
extractor.ExtractAll(archive, GetParent().DiscordPath + "\\resources\\app\\");
AsarExtractor extractor = new AsarExtractor();
extractor.ExtractAll(archive, GetParent().DiscordPath + "\\resources\\app\\");
Splice();
Splice();
}
catch
{
AppendLog("Error Extracting app.asar: Newtonsoft.Json.dll might not be present in the Installer Folder. Installation cannot Continue.");
errors = 1;
Finalize(errors);
}
});
@ -154,11 +189,8 @@ namespace BetterDiscordWI.panels
Thread t = new Thread(() =>
{
List<String> lines = new List<string>();
AppendLog("Spicing index");
using (FileStream fs = new FileStream(indexloc, FileMode.Open))
{
using (StreamReader reader = new StreamReader(fs))
@ -166,21 +198,57 @@ namespace BetterDiscordWI.panels
String line = "";
while((line = reader.ReadLine()) != null)
{
if (line.Contains("var _overlay2"))
if (GetParent().DiscordPath.Contains("Discord\\"))
{
lines.Add(line);
lines.Add("var _betterDiscord = require('betterdiscord');");
if (line.Contains("var _overlay2"))
{
lines.Add(line);
lines.Add("var _betterDiscord = require('betterdiscord');");
}
else if (line.Contains("mainWindow = new _BrowserWindow2"))
{
lines.Add(line);
lines.Add(File.ReadAllText("splice"));
}
else
{
lines.Add(line);
}
}
else if (line.Contains("mainWindow = new _BrowserWindow2"))
if (GetParent().DiscordPath.Contains("DiscordCanary\\"))
{
lines.Add(line);
lines.Add(File.ReadAllText("splice"));
if (line.Contains("var _overlay2"))
{
lines.Add(line);
lines.Add("var _betterDiscord = require('betterdiscord');");
}
else if (line.Contains("mainWindow = new _BrowserWindow2"))
{
lines.Add(line);
lines.Add(File.ReadAllText("splice"));
}
else
{
lines.Add(line);
}
}
else
if (GetParent().DiscordPath.Contains("DiscordPTB\\"))
{
lines.Add(line);
//"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"))
{
lines.Add(line);
lines.Add(File.ReadAllText("splice"));
}
else
{
lines.Add(line);
}
}
}
}
@ -242,7 +310,18 @@ namespace BetterDiscordWI.panels
if (GetParent().RestartDiscord)
{
Process.Start(GetParent().DiscordPath + "\\Discord.exe");
if (GetParent().DiscordPath.Contains("\\Discord\\"))
{
Process.Start(GetParent().DiscordPath + "\\Discord.exe");
}
if (GetParent().DiscordPath.Contains("\\DiscordCanary\\"))
{
Process.Start(GetParent().DiscordPath + "\\DiscordCanary.exe");
}
if (GetParent().DiscordPath.Contains("\\DiscordPTB\\"))
{
Process.Start(GetParent().DiscordPath + "\\DiscordPTB.exe");
}
}
}