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,10 +10,15 @@ 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
|
||||
if (args.Length > 0) {
|
||||
switch (args[0].ToLower()) {
|
||||
// Silent Install switches
|
||||
case "-install":
|
||||
|
@ -30,6 +36,7 @@ namespace BandagedBD {
|
|||
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" +
|
||||
|
@ -48,6 +55,7 @@ namespace BandagedBD {
|
|||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (launchMode) {
|
||||
case LaunchMode.GUI:
|
||||
|
@ -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