Esempio n. 1
0
        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;
            }));
        }
Esempio n. 2
0
        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());
        }
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
        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;
                });
        }
Esempio n. 5
0
        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;
        }