diff --git a/ZitiUpdateService/App.config b/ZitiUpdateService/App.config index bc30bb6b..bcacd1c9 100644 --- a/ZitiUpdateService/App.config +++ b/ZitiUpdateService/App.config @@ -2,7 +2,28 @@ + + + + + + + diff --git a/ZitiUpdateService/Program.cs b/ZitiUpdateService/Program.cs index d9bdd216..449ad561 100644 --- a/ZitiUpdateService/Program.cs +++ b/ZitiUpdateService/Program.cs @@ -11,12 +11,18 @@ namespace ZitiUpdateService { /// The main entry point for the application. /// static void Main() { + UpdateService updateSvc = new UpdateService(); +#if DEBUG + updateSvc.Debug(); + System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite); +#else ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { - new UpdateService() + updateSvc }; ServiceBase.Run(ServicesToRun); +#endif } } } diff --git a/ZitiUpdateService/UpdateService.cs b/ZitiUpdateService/UpdateService.cs index 40b05921..61279ac9 100644 --- a/ZitiUpdateService/UpdateService.cs +++ b/ZitiUpdateService/UpdateService.cs @@ -40,9 +40,9 @@ namespace ZitiUpdateService { } public void Debug() - { + { OnStart(null); - } + } protected override void OnStart(string[] args) { try { @@ -56,14 +56,14 @@ namespace ZitiUpdateService { _logDirectory = Path.Combine(_rootDirectory, "Logs"); if (!Directory.Exists(_logDirectory)) Directory.CreateDirectory(_logDirectory); Log("Setup Watchers"); - SetupServiceWatcher(); + SetupServiceWatchers(); } protected override void OnStop() { Log("Stopping update Service"); } - private void SetupWatcher() { + private void SetupServiceWatchers() { Log("Setting Up Watchers"); var serviceTimerInterval = ConfigurationManager.AppSettings.Get("ServiceTimer"); @@ -214,7 +214,7 @@ namespace ZitiUpdateService { Log("Starting Service"); controller.Start(); controller.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(30)); - SetupWatcher(); + SetupServiceWatchers(); } catch (Exception e) { Log("Cannot Start Service - " + e.ToString()); }