Argument parsing options, fixed some bugs.

nsis
Sean McArdle 2016-11-03 20:01:07 -07:00
parent cf00d19dd0
commit 6bf4cd4c56
2 changed files with 19 additions and 4 deletions

View File

@ -93,7 +93,7 @@ USAGE
case "/console":
ServiceExecutionMode = ServiceExecutionMode.Console;
Console.WriteLine("Starting Service...");
OnStart(new string[0]);
OnStart(args);
OnStartCommandLine();
OnStop();
break;
@ -277,7 +277,17 @@ USAGE
private void UninstallService()
{
GetInstaller(".UninstallLog").Uninstall(null);
try {
GetInstaller(".UninstallLog").Uninstall(null);
}
catch (Exception e) {
if (e?.InnerException?.Message == "The specified service does not exist as an installed service") {
/* Service not installed, we're uninstalling so that's what we want anyhow. */
}
else {
throw e;
}
}
RemoveRegKeys();
RemoveUninstaller();
}

View File

@ -36,8 +36,6 @@ namespace WifiSitter
this.AutoLog = true;
this.CanPauseAndContinue = true;
}
Intialize();
}
#endregion // constructor
@ -345,6 +343,13 @@ namespace WifiSitter
#region overrides
protected override void OnStartImpl(string[] args) {
if (args == null) return;
if (args[0].ToLower() == "/install" ||
args[0].ToLower() == "/uninstall") return;
Intialize();
_thread = new Thread(WorkerThreadFunc);
_thread.Name = "WifiSitter Main Loop";
_thread.IsBackground = true;