public void AddWebAppItem(string url, string keywords, string profile) { var item = new WebAppItem { Url = url, Keywords = keywords, Profile = profile, }; WebAppItemRepository.AddItem(item); }
public void Init() { DataAccessService.Init(); WebAppItemRepository.Init(); WebAppConfigurationRepository.Init(); var configurations = WebAppConfigurationRepository.GetConfigurations(); if (configurations == null) { var configuration = new WebAppConfiguration() { Profile = "default", WebAppLauncher = "chrome.exe", WebAppArgumentPattern = "--app=\"{0}\" --profile-directory=\"Default\"" }; WebAppConfigurationRepository.SaveConfiguration(configuration); } }
public void Export() { var exportDirectory = SystemService.GetExportPath(); var exportFilename = string.Format("Wox.WebApp-Save-{0}.wap.txt", SystemService.GetUID()); var exportFullFilename = Path.Combine(exportDirectory, exportFilename); using (var fileGenerator = FileGeneratorService.CreateGenerator(exportFullFilename)) { var configurations = GetConfigurations(); if (configurations.ContainsKey("default")) { var configuration = configurations["default"]; fileGenerator.AddLine(string.Format("# launcher: {0}", configuration.WebAppLauncher)); fileGenerator.AddLine(string.Format("# argumentsPattern: {0}", configuration.WebAppArgumentPattern)); } foreach (var configuration in configurations.Values) { if (configuration.Profile != "default") { fileGenerator.AddLine(string.Format("# launcher[{1}]: {0}", configuration.WebAppLauncher, configuration.Profile)); fileGenerator.AddLine(string.Format("# argumentsPattern[{1}]: {0}", configuration.WebAppArgumentPattern, configuration.Profile)); } } foreach (var webAppItem in WebAppItemRepository.SearchItems(new List <string>())) { if (webAppItem.Profile == "default") { fileGenerator.AddLine(string.Format("{0} ({1})", webAppItem.Url, webAppItem.Keywords)); } else { fileGenerator.AddLine(string.Format("{0} ({1}) [{2}]", webAppItem.Url, webAppItem.Keywords, webAppItem.Profile)); } } fileGenerator.Generate(); } SystemService.StartCommandLine(exportDirectory, ""); }
public IEnumerable <WebAppItem> Search(IEnumerable <string> terms) { return(WebAppItemRepository.SearchItems(terms)); }
public void EditWebAppItem(string url, string newUrl, string newKeywords, string newProfile) { WebAppItemRepository.EditWebAppItem(url, newUrl, newKeywords, newProfile); }
public WebAppItem GetUrlInfo(string url) { return(WebAppItemRepository.GetItem(url)); }
public void RemoveUrl(string url) => WebAppItemRepository.RemoveItem(url);