IEnumerable <ShortcutCreationRequest> uninstallAppVersion(IAppSetup app, Version ver) { try { app.OnVersionUninstalling(ver); } catch (Exception ex) { log.ErrorException("App threw exception on uninstall: " + app.GetType().FullName, ex); } var shortcuts = Enumerable.Empty <ShortcutCreationRequest>(); try { shortcuts = app.GetAppShortcutList(); } catch (Exception ex) { log.ErrorException("App threw exception on shortcut uninstall: " + app.GetType().FullName, ex); } // Get the list of shortcuts that *should've* been there, but aren't; // this means that the user deleted them by hand and that they should // stay dead return(shortcuts.Aggregate(new List <ShortcutCreationRequest>(), (acc, x) => { var path = x.GetLinkTarget(applicationName); var fi = fileSystem.GetFileInfo(path); if (fi.Exists) { fi.Delete(); } else { acc.Add(x); } return acc; })); }
IEnumerable<ShortcutCreationRequest> uninstallAppVersion(IAppSetup app, Version ver) { try { app.OnVersionUninstalling(ver); } catch (Exception ex) { log.ErrorException("App threw exception on uninstall: " + app.GetType().FullName, ex); } var shortcuts = Enumerable.Empty<ShortcutCreationRequest>(); try { shortcuts = app.GetAppShortcutList(); } catch (Exception ex) { log.ErrorException("App threw exception on shortcut uninstall: " + app.GetType().FullName, ex); } // Get the list of shortcuts that *should've* been there, but aren't; // this means that the user deleted them by hand and that they should // stay dead return shortcuts.Aggregate(new List<ShortcutCreationRequest>(), (acc, x) => { var path = x.GetLinkTarget(applicationName); var fi = fileSystem.GetFileInfo(path); if (fi.Exists) { fi.Delete(); log.Info("Deleting shortcut: {0}", fi.FullName); } else { acc.Add(x); log.Info("Shortcut not found: {0}, capturing for future reference", fi.FullName); } return acc; }); }
string installAppVersion(IAppSetup app, Version newCurrentVersion, IEnumerable <ShortcutCreationRequest> shortcutRequestsToIgnore, bool isFirstInstall) { try { if (isFirstInstall) { log.Info("installAppVersion: Doing first install for {0}", app.Target); app.OnAppInstall(); } log.Info("installAppVersion: Doing install for version {0} {1}", newCurrentVersion, app.Target); app.OnVersionInstalled(newCurrentVersion); } catch (Exception ex) { log.ErrorException("App threw exception on install: " + app.GetType().FullName, ex); throw; } var shortcutList = Enumerable.Empty <ShortcutCreationRequest>(); try { shortcutList = app.GetAppShortcutList(); shortcutList.ForEach(x => log.Info("installAppVersion: we have a shortcut {0}", x.TargetPath)); } catch (Exception ex) { log.ErrorException("App threw exception on shortcut uninstall: " + app.GetType().FullName, ex); throw; } shortcutList .Where(x => !shortcutRequestsToIgnore.Contains(x)) .ForEach(x => { var shortcut = x.GetLinkTarget(applicationName, true); var fi = fileSystem.GetFileInfo(shortcut); log.Info("installAppVersion: checking shortcut {0}", fi.FullName); if (fi.Exists) { log.Info("installAppVersion: deleting existing file"); fi.Delete(); } fileSystem.CreateDirectoryRecursive(fi.Directory.FullName); var sl = new ShellLink { Target = x.TargetPath, IconPath = x.IconLibrary, IconIndex = x.IconIndex, Arguments = x.Arguments, WorkingDirectory = x.WorkingDirectory, Description = x.Description, }; sl.Save(shortcut); }); return(app.LaunchOnSetup ? app.Target : null); }
void installAppVersion(IAppSetup app, Version newCurrentVersion, IEnumerable <ShortcutCreationRequest> shortcutRequestsToIgnore, bool isFirstInstall) { try { if (isFirstInstall) { app.OnAppInstall(); } app.OnVersionInstalled(newCurrentVersion); } catch (Exception ex) { this.Log().ErrorException("App threw exception on install: " + app.GetType().FullName, ex); throw; } var shortcutList = Enumerable.Empty <ShortcutCreationRequest>(); try { shortcutList = app.GetAppShortcutList(); } catch (Exception ex) { this.Log().ErrorException("App threw exception on shortcut uninstall: " + app.GetType().FullName, ex); throw; } shortcutList .Where(x => !shortcutRequestsToIgnore.Contains(x)) .ForEach(x => { var shortcut = x.GetLinkTarget(applicationName, true); var fi = fileSystem.GetFileInfo(shortcut); if (fi.Exists) { fi.Delete(); } fileSystem.CreateDirectoryRecursive(fi.Directory.FullName); var sl = new ShellLink() { Target = x.TargetPath, IconPath = x.IconLibrary, IconIndex = x.IconIndex, Arguments = x.Arguments, WorkingDirectory = x.WorkingDirectory, Description = x.Description }; sl.Save(shortcut); }); }
string installAppVersion(IAppSetup app, Version newCurrentVersion, IEnumerable<ShortcutCreationRequest> shortcutRequestsToIgnore, bool isFirstInstall) { try { if (isFirstInstall) { log.Info("installAppVersion: Doing first install for {0}", app.Target); app.OnAppInstall(); } log.Info("installAppVersion: Doing install for version {0} {1}", newCurrentVersion, app.Target); app.OnVersionInstalled(newCurrentVersion); } catch (Exception ex) { log.ErrorException("App threw exception on install: " + app.GetType().FullName, ex); throw; } var shortcutList = Enumerable.Empty<ShortcutCreationRequest>(); try { shortcutList = app.GetAppShortcutList(); shortcutList.ForEach(x => log.Info("installAppVersion: we have a shortcut {0}", x.TargetPath)); } catch (Exception ex) { log.ErrorException("App threw exception on shortcut uninstall: " + app.GetType().FullName, ex); throw; } shortcutList .Where(x => !shortcutRequestsToIgnore.Contains(x)) .ForEach(x => { var shortcut = x.GetLinkTarget(applicationName, true); var fi = fileSystem.GetFileInfo(shortcut); log.Info("installAppVersion: checking shortcut {0}", fi.FullName); if (fi.Exists) { log.Info("installAppVersion: deleting existing file"); fi.Delete(); } fileSystem.CreateDirectoryRecursive(fi.Directory.FullName); var sl = new ShellLink { Target = x.TargetPath, IconPath = x.IconLibrary, IconIndex = x.IconIndex, Arguments = x.Arguments, WorkingDirectory = x.WorkingDirectory, Description = x.Description, }; sl.Save(shortcut); }); return app.LaunchOnSetup ? app.Target : null; }
public static IAdvancedAppSetup <T, IDispatchQuery> UseContainerQueryDispatch <T>(this IAppSetup <T> setup, IServiceLocator locator) { return(setup.UseQueryDispatch(new IocQueryDispatcher(locator))); }
public static IAdvancedAppSetup <T, IDispatchQuery> UseQueryDispatch <T>(this IAppSetup <T> setup, IDispatchQuery dispatch) { dispatch.VerifyParam("dispatch").IsNotNull(); return(new AdvancedAppSetup <T, IDispatchQuery>(setup, dispatch)); }