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