From 27ae913809fbfff40f211e5bd1cfafc1bd4f9b16 Mon Sep 17 00:00:00 2001 From: Sleevezipper Date: Thu, 7 Jan 2021 15:58:19 +0100 Subject: [PATCH 1/2] autostart path for standalone wip --- .../Data/ConfigurationService.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/hass-workstation-service/Data/ConfigurationService.cs b/hass-workstation-service/Data/ConfigurationService.cs index a00eb76..fb2029e 100644 --- a/hass-workstation-service/Data/ConfigurationService.cs +++ b/hass-workstation-service/Data/ConfigurationService.cs @@ -273,8 +273,19 @@ namespace hass_workstation_service.Data // The path to the key where Windows looks for startup applications RegistryKey rkApp = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true); - //Path to launch shortcut - string startPath = Environment.GetFolderPath(Environment.SpecialFolder.Programs) + @"\Sleevezipper\Hass Workstation Service.appref-ms"; + string startPath; + // if the app is installed in appdata, we can assume it was installed using the installer + if (Environment.CurrentDirectory.Contains(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData))) + { + // so we set the autostart Path to launch shortcut + startPath = Environment.GetFolderPath(Environment.SpecialFolder.Programs) + @"\Sleevezipper\Hass Workstation Service.appref-ms"; + } + else + { + // if it isn't in appdata, it's probably running as standalone and we set the startpath to the path of the executable + startPath = Environment.CurrentDirectory + @"\hass-workstation-service.exe"; + } + rkApp.SetValue("hass-workstation-service", startPath); rkApp.Close(); From 725d86e8cc744a0ab430e86127fcd51bd93619bb Mon Sep 17 00:00:00 2001 From: sleevezipper Date: Thu, 7 Jan 2021 22:09:42 +0100 Subject: [PATCH 2/2] update readme --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e7244be..ea2b8cc 100644 --- a/README.md +++ b/README.md @@ -21,14 +21,16 @@ It will try to futher accomplish this goal in the future by: ## Installation -You can get the installer from [here](https://hassworkstationstorage.z6.web.core.windows.net/publish/setup.exe). When using the installer, the application checks for updates on startup. +You can get the installer from [here](https://hassworkstationstorage.z6.web.core.windows.net/publish/setup.exe). When using the installer, the application checks for updates on startup. This is the recommended way to install for most users. Note: You'll get a Windows Smartscreen warning because the code was self signed. You can click "More info" and then "Run anyway" to proceed with installing. -If you don't want to use the installer, you can find releases on GitHub [here](https://github.com/sleevezipper/hass-workstation-service/releases). `hass-workstation-service.exe` is the background service and you can use `UserInterface.exe` to configure the service. If you don't use the installer autostart won't work. +### Standalone + +If you don't want to use the installer, you can find the standalone version releases on GitHub [here](https://github.com/sleevezipper/hass-workstation-service/releases). Unpack all files to a folder and run `hass-workstation-service.exe`. This is the background service and you can use `UserInterface.exe` to configure the service. There is no automatic (or prompted) updating in the standalone version. ### Updating -The app checks for updates on startup. If an update is available you will be prompted to install. +If you used the installer, the app checks for updates on startup. If an update is available you will be prompted to install. If you use the standalone, just delete all files from the previous install and unpack the zip to the same location as before. ## Sensors