예제 #1
0
        public void AddWebAppItem(string url, string keywords, string profile)
        {
            var item = new WebAppItem
            {
                Url      = url,
                Keywords = keywords,
                Profile  = profile,
            };

            WebAppItemRepository.AddItem(item);
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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, "");
        }
예제 #4
0
 public IEnumerable <WebAppItem> Search(IEnumerable <string> terms)
 {
     return(WebAppItemRepository.SearchItems(terms));
 }
예제 #5
0
 public void EditWebAppItem(string url, string newUrl, string newKeywords, string newProfile)
 {
     WebAppItemRepository.EditWebAppItem(url, newUrl, newKeywords, newProfile);
 }
예제 #6
0
 public WebAppItem GetUrlInfo(string url)
 {
     return(WebAppItemRepository.GetItem(url));
 }
예제 #7
0
 public void RemoveUrl(string url) => WebAppItemRepository.RemoveItem(url);