Argument parsing options, fixed some bugs.
parent
cf00d19dd0
commit
6bf4cd4c56
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue