Fixed error with using args array when no args were sent.
Added console process when ran in silent mode(I guess its more automatic mode rather than silent)
This commit is contained in:
parent
f9b6cce1b0
commit
13c2021d96
|
@ -1,5 +1,6 @@
|
||||||
using BandagedBD.Silent;
|
using BandagedBD.Silent;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace BandagedBD {
|
namespace BandagedBD {
|
||||||
|
@ -9,44 +10,51 @@ namespace BandagedBD {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[STAThread]
|
[STAThread]
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll")]
|
||||||
|
static extern bool AttachConsole(int dwProcessId);
|
||||||
|
private const int ATTACH_PARENT_PROCESS = -1;
|
||||||
|
|
||||||
static void Main(string[] args) {
|
static void Main(string[] args) {
|
||||||
LaunchMode launchMode = LaunchMode.GUI;
|
LaunchMode launchMode = LaunchMode.GUI;
|
||||||
|
|
||||||
// check first argument to check if it is a silent install switch
|
// check first argument to check if it is a silent install switch
|
||||||
switch (args[0].ToLower()) {
|
if (args.Length > 0) {
|
||||||
// Silent Install switches
|
switch (args[0].ToLower()) {
|
||||||
case "-install":
|
// Silent Install switches
|
||||||
case "-i":
|
case "-install":
|
||||||
launchMode = LaunchMode.Install;
|
case "-i":
|
||||||
break;
|
launchMode = LaunchMode.Install;
|
||||||
case "-repair":
|
break;
|
||||||
case "-r":
|
case "-repair":
|
||||||
launchMode = LaunchMode.Repair;
|
case "-r":
|
||||||
break;
|
launchMode = LaunchMode.Repair;
|
||||||
case "-uninstall":
|
break;
|
||||||
case "-u":
|
case "-uninstall":
|
||||||
launchMode = LaunchMode.Uninstall;
|
case "-u":
|
||||||
break;
|
launchMode = LaunchMode.Uninstall;
|
||||||
case "-help":
|
break;
|
||||||
case "-h":
|
case "-help":
|
||||||
launchMode = LaunchMode.None;
|
case "-h":
|
||||||
Console.WriteLine("-install, -i Install BBD\n" +
|
launchMode = LaunchMode.None;
|
||||||
"-uninstall, -u Uninstall BBD\n" +
|
AttachConsole(ATTACH_PARENT_PROCESS);
|
||||||
" Optional switches for uninstall\n" +
|
Console.WriteLine("-install, -i Install BBD\n" +
|
||||||
" -deleteuserdata deletes all user settings of betterdiscord\n" +
|
"-uninstall, -u Uninstall BBD\n" +
|
||||||
"-repair, -r Repair BBD\n" +
|
" Optional switches for uninstall\n" +
|
||||||
" Optional switches for repair, for the following issues\n" +
|
" -deleteuserdata deletes all user settings of betterdiscord\n" +
|
||||||
" -repairupdateloop Discord update loop\n" +
|
"-repair, -r Repair BBD\n" +
|
||||||
" -repairnotlaunching BandagedBD not launching with Discord\n" +
|
" Optional switches for repair, for the following issues\n" +
|
||||||
" -repairloadingindefinitely BandagedBD loading indefinitely\n" +
|
" -repairupdateloop Discord update loop\n" +
|
||||||
" -repairjavascripterror Fatal JavaScript error on launch\n" +
|
" -repairnotlaunching BandagedBD not launching with Discord\n" +
|
||||||
"\nall require using one or more of the following\n" +
|
" -repairloadingindefinitely BandagedBD loading indefinitely\n" +
|
||||||
" -stable [path], -canary [path], -ptb [path]\n" +
|
" -repairjavascripterror Fatal JavaScript error on launch\n" +
|
||||||
"\n-norestart By default discord will be restarted, this disables restarting of processes" +
|
"\nall require using one or more of the following\n" +
|
||||||
"");
|
" -stable [path], -canary [path], -ptb [path]\n" +
|
||||||
break;
|
"\n-norestart By default discord will be restarted, this disables restarting of processes" +
|
||||||
default:
|
"");
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (launchMode) {
|
switch (launchMode) {
|
||||||
|
@ -58,6 +66,7 @@ namespace BandagedBD {
|
||||||
case LaunchMode.None:
|
case LaunchMode.None:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
AttachConsole(ATTACH_PARENT_PROCESS);
|
||||||
new SilentOnlyUtilities(launchMode, args);
|
new SilentOnlyUtilities(launchMode, args);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue