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,10 +10,15 @@ 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
|
||||||
|
if (args.Length > 0) {
|
||||||
switch (args[0].ToLower()) {
|
switch (args[0].ToLower()) {
|
||||||
// Silent Install switches
|
// Silent Install switches
|
||||||
case "-install":
|
case "-install":
|
||||||
|
@ -30,6 +36,7 @@ namespace BandagedBD {
|
||||||
case "-help":
|
case "-help":
|
||||||
case "-h":
|
case "-h":
|
||||||
launchMode = LaunchMode.None;
|
launchMode = LaunchMode.None;
|
||||||
|
AttachConsole(ATTACH_PARENT_PROCESS);
|
||||||
Console.WriteLine("-install, -i Install BBD\n" +
|
Console.WriteLine("-install, -i Install BBD\n" +
|
||||||
"-uninstall, -u Uninstall BBD\n" +
|
"-uninstall, -u Uninstall BBD\n" +
|
||||||
" Optional switches for uninstall\n" +
|
" Optional switches for uninstall\n" +
|
||||||
|
@ -48,6 +55,7 @@ namespace BandagedBD {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (launchMode) {
|
switch (launchMode) {
|
||||||
case LaunchMode.GUI:
|
case LaunchMode.GUI:
|
||||||
|
@ -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