IEnumerable <ShortcutCreationRequest> cleanUpOldVersions(Version newCurrentVersion) { var directory = fileSystem.GetDirectoryInfo(rootAppDirectory); if (!directory.Exists) { log.Warn("The directory '{0}' does not exist", rootAppDirectory); return(Enumerable.Empty <ShortcutCreationRequest>()); } return(directory.GetDirectories() .Where(x => x.Name.StartsWith("app-", StringComparison.InvariantCultureIgnoreCase)) .Where(x => x.Name != "app-" + newCurrentVersion) .OrderBy(x => x.Name) .SelectMany(oldAppRoot => { var path = oldAppRoot.FullName; var installerHooks = new InstallerHookOperations(fileSystem, applicationName); var ret = AppDomainHelper.ExecuteInNewAppDomain(path, installerHooks.RunAppSetupCleanups); try { Utility.DeleteDirectoryAtNextReboot(oldAppRoot.FullName); } catch (Exception ex) { var message = String.Format("Couldn't delete old app directory on next reboot {0}", oldAppRoot.FullName); log.WarnException(message, ex); } return ret; })); }
List <string> runPostInstallOnDirectory(string newAppDirectoryRoot, bool isFirstInstall, Version newCurrentVersion, IEnumerable <ShortcutCreationRequest> shortcutRequestsToIgnore) { var postInstallInfo = new PostInstallInfo { NewAppDirectoryRoot = newAppDirectoryRoot, IsFirstInstall = isFirstInstall, NewCurrentVersion = newCurrentVersion, ShortcutRequestsToIgnore = shortcutRequestsToIgnore.ToArray() }; var installerHooks = new InstallerHookOperations(fileSystem, applicationName); return(AppDomainHelper.ExecuteInNewAppDomain(postInstallInfo, installerHooks.RunAppSetupInstallers).ToList()); }
List<string> runPostInstallOnDirectory(string newAppDirectoryRoot, bool isFirstInstall, Version newCurrentVersion, IEnumerable<ShortcutCreationRequest> shortcutRequestsToIgnore) { var postInstallInfo = new PostInstallInfo { NewAppDirectoryRoot = newAppDirectoryRoot, IsFirstInstall = isFirstInstall, NewCurrentVersion = newCurrentVersion, ShortcutRequestsToIgnore = shortcutRequestsToIgnore.ToArray() }; var installerHooks = new InstallerHookOperations(fileSystem, applicationName); return AppDomainHelper.ExecuteInNewAppDomain(postInstallInfo, installerHooks.RunAppSetupInstallers).ToList(); }
IEnumerable<ShortcutCreationRequest> cleanUpOldVersions(Version newCurrentVersion) { var directory = fileSystem.GetDirectoryInfo(rootAppDirectory); if (!directory.Exists) { log.Warn("The directory '{0}' does not exist", rootAppDirectory); return Enumerable.Empty<ShortcutCreationRequest>(); } return directory.GetDirectories() .Where(x => x.Name.StartsWith("app-", StringComparison.InvariantCultureIgnoreCase)) .Where(x => x.Name != "app-" + newCurrentVersion) .OrderBy(x => x.Name) .SelectMany(oldAppRoot => { var path = oldAppRoot.FullName; var installerHooks = new InstallerHookOperations(fileSystem, applicationName); var ret = AppDomainHelper.ExecuteInNewAppDomain(path, installerHooks.RunAppSetupCleanups); try { Utility.DeleteDirectoryAtNextReboot(oldAppRoot.FullName); } catch (Exception ex) { var message = String.Format("Couldn't delete old app directory on next reboot {0}", oldAppRoot.FullName); log.WarnException(message, ex); } return ret; }); }
IEnumerable<ShortcutCreationRequest> runAppCleanup(string path) { var installerHooks = new InstallerHookOperations(fileSystem, applicationName); var ret = AppDomainHelper.ExecuteInNewAppDomain(path, installerHooks.RunAppSetupCleanups); try { Utility.DeleteDirectoryAtNextReboot(path); } catch (Exception ex) { var message = String.Format("Couldn't delete old app directory on next reboot {0}", path); log.WarnException(message, ex); } return ret; }