protected override List <Result> QueryInternal(Query query) { var results = new List <Result>(); var input = query.RawQuery.ToLower(); var inputName = input.Split(new string[] { @"\" }, StringSplitOptions.None).First().ToLower(); var link = UserSettingStorage.Instance.FolderLinks.FirstOrDefault(x => x.Nickname.Equals(inputName, StringComparison.OrdinalIgnoreCase)); var currentPath = link == null ? input : link.Path + input.Remove(0, inputName.Length); InitialDriverList(); foreach (var item in UserSettingStorage.Instance.FolderLinks.Where(x => x.Nickname.StartsWith(input, StringComparison.OrdinalIgnoreCase))) { results.Add(new Result(item.Nickname, "Images/folder.png") { Action = (c) => { context.ChangeQuery(item.Nickname); return(false); } }); } if (link == null && !driverNames.Any(input.StartsWith)) { return(results); } QueryInternal_Directory_Exists(currentPath, input, results); return(results); }
public List <Result> Query(Query query) { List <Result> results = new List <Result>(); if (query.ActionParameters.Count == 0) { results.Add(new Result("wpm install <pluginName>", "Images\\plugin.png", "search and install wox plugins") { Action = e => { context.ChangeQuery("wpm install "); return(false); } }); results.Add(new Result("wpm uninstall <pluginName>", "Images\\plugin.png", "uninstall plugin") { Action = e => { context.ChangeQuery("wpm uninstall "); return(false); } }); results.Add(new Result("wpm list", "Images\\plugin.png", "list plugins installed") { Action = e => { context.ChangeQuery("wpm list"); return(false); } }); return(results); } if (query.ActionParameters.Count > 0) { bool hit = false; switch (query.ActionParameters[0].ToLower()) { case "list": hit = true; results = ListInstalledPlugins(); break; case "uninstall": hit = true; results = ListUnInstalledPlugins(query); break; case "install": hit = true; if (query.ActionParameters.Count > 1) { results = InstallPlugin(query); } break; } if (!hit) { if ("install".Contains(query.ActionParameters[0].ToLower())) { results.Add(new Result("wpm install <pluginName>", "Images\\plugin.png", "search and install wox plugins") { Action = e => { context.ChangeQuery("wpm install "); return(false); } }); } if ("uninstall".Contains(query.ActionParameters[0].ToLower())) { results.Add(new Result("wpm uninstall <pluginName>", "Images\\plugin.png", "uninstall plugin") { Action = e => { context.ChangeQuery("wpm uninstall "); return(false); } }); } if ("list".Contains(query.ActionParameters[0].ToLower())) { results.Add(new Result("wpm list", "Images\\plugin.png", "list plugins installed") { Action = e => { context.ChangeQuery("wpm list"); return(false); } }); } } } return(results); }