public static Dictionary <string, ShortcutTemplate> GetNamesWithFilePaths() { Dictionary <string, ShortcutTemplate> parameters = new Dictionary <string, ShortcutTemplate>(); string path = Settings.Current.WebSearchExtensionFolder; if (path == null) { return(parameters); } CraftSynth.BuildingBlocks.IO.FileSystem.CreateFolderIfItDoesNotExist(path); string[] filePaths = Directory.GetFiles(path, "*.template.url"); foreach (string filePath in filePaths) { try { ShortcutTemplate shortcutTemplate = new ShortcutTemplate(); shortcutTemplate.caption = Path.GetFileNameWithoutExtension(filePath).Replace(".template", string.Empty); shortcutTemplate.filePath = filePath; shortcutTemplate.body = null; parameters.Add(shortcutTemplate.caption, shortcutTemplate); } catch (Exception exception) { string message = "ShortcutTemplates: Error occurred while reading file: " + filePath; throw new Exception(message, exception); } } return(parameters); }
public void Remove(IWorkItem workItemToRemove) { ShortcutTemplate shortcutTemplate = workItemToRemove as ShortcutTemplate; File.Delete(shortcutTemplate.filePath); SuggestionsCache.DropCache(this.GetType()); EnsoPlus.current.Reinitialize(); }