/// <summary> /// Gets the installed version of the product. /// </summary> /// <returns></returns> public async Task <Version> GetInstalledVersionAsync() { // 3 major components should be present to detect a valid installation. // - the binaries (lib, svc executable) // - the daemon // - the database var libVersion = GetInstalledBinaryVersion(); var serviceIsPresent = WindowsServiceIsPresent(); var databaseIsPresent = await DatabaseClient.DatabaseIsPresentAsync().ConfigureAwait(false); if (libVersion == null && !serviceIsPresent && !databaseIsPresent) { // if all the components are missing, return null (product is not installed). return(null); } else if (libVersion != null && serviceIsPresent && databaseIsPresent) { // if all the components are present, return the version. return(libVersion); } else { // if some of the components are missing (but not all), throw since the installation is damaged. throw new CmdletExecutionFailedDamagedProductInstallationException("The Archivial Cloud Backup product installation appears to be damaged or partially installed."); } }