/// <exception cref="ArgumentNullException"><paramref name="spec"/> or <paramref name="storageDirectory"/> is <see langword="null" />.</exception> internal Installation(InstallationSpec spec, string storageDirectory) { if (spec == null) { throw new ArgumentNullException("spec"); } if (storageDirectory == null) { throw new ArgumentNullException("storageDirectory"); } Spec = spec; _storageDirectory = storageDirectory; _modPackShortcut = ShortcutFile.New(Path.Combine(storageDirectory, "mods")); _savesShortcut = ShortcutFile.New(Path.Combine(storageDirectory, "saves")); _configShortcut = ShortcutFile.New(Path.Combine(storageDirectory, "config")); }
public LauncherPlugin() { try { var settingsManager = VA.SettingsManager; var applicationListSettings = settingsManager[Constants.ApplicationList]; var directoryListSettings = settingsManager[Constants.DirectoryList]; var searchEngineListSettings = settingsManager[Constants.SearchEngineList]; var websiteListSettings = settingsManager[Constants.WebsiteList]; if (applicationListSettings != null) { foreach (var shortcutFile in Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), "*.lnk", SearchOption.AllDirectories)) { var fullPath = ShortcutFile.ResolveShortcut(shortcutFile); var fileName = Path.GetFileNameWithoutExtension(fullPath); if (!string.IsNullOrEmpty(fullPath) && !string.IsNullOrEmpty(fileName)) { applicationListSettings.Add(fileName, () => fullPath); } } } if (directoryListSettings != null) { directoryListSettings.Add("document", () => SynUtility.Directory.GetPath(SpecialFolders.MyDocuments)); directoryListSettings.Add("music", () => SynUtility.Directory.GetPath(SpecialFolders.MyMusic)); directoryListSettings.Add("pictures", () => SynUtility.Directory.GetPath(SpecialFolders.MyPictures)); directoryListSettings.Add("desktop", () => SynUtility.Directory.GetPath(SpecialFolders.Desktop)); directoryListSettings.Add("wallpapers", () => SynUtility.Directory.GetPath(SpecialFolders.Wallpaper)); directoryListSettings.Add("videos", () => SynUtility.Directory.GetPath(SpecialFolders.MyVideos)); } var bot = VA.Components.Get <SimlBot>(); bot.Adapters.Add(new AppAdapter()); bot.Adapters.Add(new FolderAdapter()); bot.Adapters.Add(new SearchSiteAdapter()); bot.Adapters.Add(new WebsiteAdapter()); if (applicationListSettings != null) { applicationListSettings.SettingsChanged += delegate { UpdateApplicationView.Invoke(); CreateMap(applicationListSettings); VA.SettingsManager.Save(applicationListSettings); }; } if (directoryListSettings != null) { directoryListSettings.SettingsChanged += delegate { UpdateDirectoryView.Invoke(); CreateMap(directoryListSettings); VA.SettingsManager.Save(directoryListSettings); }; } if (searchEngineListSettings != null) { searchEngineListSettings.SettingsChanged += delegate { UpdateSearchEngineView.Invoke(); CreateMap(searchEngineListSettings); VA.SettingsManager.Save(searchEngineListSettings); }; } if (websiteListSettings != null) { websiteListSettings.SettingsChanged += delegate { UpdateWebsiteView.Invoke(); CreateMap(websiteListSettings); VA.SettingsManager.Save(websiteListSettings); }; } RefreshMaps(); } catch (Exception exception) { VA.Logger.Error(exception); } }