public override List<Result> Query(Query query) { if (query.RawQuery.StartsWith("qr ") || query.RawQuery.StartsWith("qrcode ")) { var rl = new List<Result>(); var r = new Result(); if (query.RawQuery.StartsWith("qr ")) { r.Title = query.RawQuery.Substring(3); } else { r.Title = query.RawQuery.Substring(7); } r.SubTitle = "Show me the Qrcode"; r.IcoPath = "[Res]:app"; r.Score = 80; r.Action = e => { context_.Api.HideAndClear(); QrcodeForm window = new QrcodeForm(r.Title); window.Show(); return true; }; rl.Add(r); return rl; } return null; }
public override List<Result> Query(Query query) { if (query.RawQuery == "h mem") { var rl = new List<Result>(); var r = new Result(); r.Title = GetTotalPhysicalMemory(); r.SubTitle = "Copy this number to the clipboard"; r.IcoPath = "[Res]:sys"; r.Score = 100; r.Action = e => { context_.Api.HideAndClear(); try { Clipboard.SetText(r.Title); return true; } catch (System.Runtime.InteropServices.ExternalException) { return false; } }; rl.Add(r); return rl; } return null; }
public override List<Result> Query(Query query) { if (query.RawQuery == "mryj") { var model = Request(url_); var rl = new List<Result>(); var r = new Result(); r.Title = model.note; r.SubTitle = model.content; r.IcoPath = "[Res]:txt"; r.Score = 100; r.Action = e => { context_.Api.HideAndClear(); try { Clipboard.SetText(r.SubTitle); return true; } catch (System.Runtime.InteropServices.ExternalException) { return false; } }; rl.Add(r); return rl; } return null; }
public override List<Result> Query(Query query) { if (query.RawQuery == "fnl") { return genResult(); } return null; }
public override List<Result> Query(Query query) { if (query.RawQuery.StartsWith("ydfy ")) { var result = new List<Result>(); var queryString = query.RawQuery.Substring(5); var model = Request(queryString); if (model.ErrorCode == 0) { result.Add(new Result { Title = model.Translation[0], SubTitle = "Copy this text to the clipboard", IcoPath = "txt", Score = 90, Action = e => { context_.Api.HideAndClear(); try { Clipboard.SetText(model.Translation[0]); return true; } catch (System.Runtime.InteropServices.ExternalException) { return false; } } }); if (model.Detail != null) { result.AddRange(model.Detail.Explains .Select(x => new Result { Title = x, SubTitle = "Copy this text to the clipboard", IcoPath = "[Res]:txt", Score = 80, Action = e => { context_.Api.HideAndClear(); try { Clipboard.SetText(x); return true; } catch (System.Runtime.InteropServices.ExternalException) { return false; } } })); } return result; } } return null; }
public override List<Result> Query(Query query) { if (query.RawQuery.StartsWith("b ")) { var rl = new List<Result>(); return rl; } return null; }
public void Query(Query query) { List<Result> results = new List<Result>(); foreach (var p in plugins_) { var r = p.Query(query); var e = r?.AsEnumerable(); if (e != null) results.AddRange(e); } results.Sort(CompareResult); api_?.PushResults(results); }
public override List<Result> Query(Query query) { if (query.RawQuery.StartsWith("t ")) { var result = new List<Result>(); var querySrting = query.RawQuery.Substring(2); result.Add(new Result { Title = $"回车搜索 {querySrting}", SubTitle = "KickassTorrents暂不支持中文搜索", Action = e => { var stream = Request(querySrting); var torrentList = LoadData(stream); if (torrentList.Count > 0) { context_.Api.PushResults(torrentList.Select(x => new Result { Title = x.FileName, SubTitle = x.SubTitle, IcoPath = "sys", Action = ex => { try { Process.Start(x.TorrentUrl); } catch (Exception) { } context_.Api.HideAndClear(); return true; } }).ToList()); } else { //context_.Api.Clear(); context_.Api.PushResults(new[] { new Result { Title = "找不到内容", IcoPath = "sys", Action = ex => { context_.Api.HideAndClear(); return true; } } }.ToList()); } return true; } }); return result; } return null; }
public override List<Result> Query(Query query) { if (query.RawQuery == "manual") { LoadActionData(); } ActionOpenDirctory acDir; if (ad_.actionOpenDirctory.TryGetValue(query.RawQuery, out acDir)) { var rl = new List<Result>(); var r = new Result(); r.Title = acDir.Key; r.SubTitle = acDir.Dirctory; r.IcoPath = "folder_open"; r.Score = 100; r.Action = e => { Process.Start("explorer.exe", acDir.Dirctory); context_.Api.HideAndClear(); return true; }; rl.Add(r); return rl; } ActionOpenExe acExe; if (ad_.actionOpenExe.TryGetValue(query.RawQuery, out acExe)) { var rl = new List<Result>(); var r = new Result(); r.Title = acExe.Key; r.SubTitle = acExe.Exe; r.IcoPath = "[Res]:app"; r.Score = 100; r.Action = e => { context_.Api.HideApp(); Process.Start(acExe.Exe, acExe.Param); return true; }; rl.Add(r); return rl; } return null; }
public override List<Result> Query(Query query) { if (query.RawQuery == "pass") { return genResult(16); } else if (query.RawQuery.StartsWith("pass ")) { var querySrting = query.RawQuery.Substring(5); int num = 0; if (int.TryParse(querySrting, out num)) { return genResult(num); } } return null; }
public override List<Result> Query(Query query) { if (query.RawQuery.StartsWith(">")) { var result = new List<Result>(); var queryString = query.RawQuery.Substring(1); result.Add(new Result { Title = queryString, SubTitle = $"使用命令行打开 {queryString}", IcoPath = "sys", Action = e => { Process.Start("cmd", $"/k {queryString}"); context_.Api.HideAndClear(); return true; } }); return result; } return null; }
public override List<Result> Query(Query query) { if (query.RawQuery.StartsWith("g ")) { var s = query.RawQuery.Substring(2); var rl = new List<Result>(); var r = new Result(); r.Title = s; r.SubTitle = "Search Google"; r.IcoPath = google+ "/favicon.ico"; r.Score = 70; r.Action = e => { context_.Api.HideAndClear(); try { Process.Start( google + "/?gws_rd=ssl#q=" + s); } catch (Exception) { } return true; }; var r2 = new Result(); r2.Title = s; r2.SubTitle = "Search Baidu"; r2.IcoPath = "[Res]:baidu"/*baiduUrl + "/favicon.ico"*/; r2.Score = 69; r2.Action = e => { context_.Api.HideAndClear(); try { Process.Start( baiduUrl + "/s?wd=" + s); } catch (Exception) { } return true; }; rl.Add(r); rl.Add(r2); return rl; } return null; }
public override List<Result> Query(Query query) { if (query.RawQuery == "xiuxi") { var rl = new List<Result>(); var r = new Result(); r.Title = "Config BreakReminder"; r.SubTitle = @"Open the BreakReminder`s setting panel"; r.IcoPath = "[Res]:sys"; r.Score = 100; r.Action = e => { context_.Api.HideAndClear(); return true; }; rl.Add(r); return rl; } return null; }
public List<Result> Query(int id, Query query) { try { var data = CppPluginInterop.Query(id, Marshal.StringToCoTaskMemAuto(query.RawQuery)); var r = Marshal.PtrToStringAuto(data); if (r != null && r != "") { return new List<Result>() { new Result() { Title = r, } }; } } catch (Exception) { } return null; }
public override List<Result> Query(Query query) { if (query.RawQuery.Length <= 2 // don't affect when user only input "e" or "i" keyword || !regValidExpressChar.IsMatch(query.RawQuery) || !IsBracketComplete(query.RawQuery)) return null; try { var result = yampContext.Run(query.RawQuery); if (result.Output != null && !string.IsNullOrEmpty(result.Result)) { var rl = new List<Result>(); var r = new Result(); r.Title = result.Result; r.SubTitle = "Copy this number to the clipboard"; r.IcoPath = "[Res]:calc"; r.Score = 100; r.Action = e => { context_.Api.HideAndClear(); try { Clipboard.SetText(result.Result); return true; } catch (System.Runtime.InteropServices.ExternalException) { return false; } }; rl.Add(r); return rl; } } catch { } return null; }
public override List<Result> Query(Query query) { if (query.RawQuery == "ip") { string hostname = Dns.GetHostName(); IPHostEntry localhost = Dns.GetHostByName(hostname); IPAddress localaddr = localhost.AddressList[0]; if (localhost.AddressList.Count() > 0) { var rl = new List<Result>(); foreach (var ip in localhost.AddressList) { var r = new Result(); r.Title = ip.ToString(); r.SubTitle = "Copy this number to the clipboard"; r.IcoPath = "[Res]:sys"; r.Score = 100; r.Action = e => { context_.Api.HideAndClear(); try { Clipboard.SetText(ip.ToString()); return true; } catch (System.Runtime.InteropServices.ExternalException) { return false; } }; rl.Add(r); } return rl; } } return null; }
public override List<Result> Query(Query query) { if (query.RawQuery == "host" || query.RawQuery == "hosts") { var rl = new List<Result>(); var r = new Result(); r.Title = "Hosts"; r.SubTitle = "open hosts file"; r.IcoPath = "[Res]:sys"; r.Score = 90; r.Action = e => { Process.Start("notepad", Environment.GetFolderPath(Environment.SpecialFolder.System) + "/drivers/etc/hosts"); context_.Api.HideAndClear(); return true; }; rl.Add(r); return rl; } else if (query.RawQuery == "cs") { var rl = new List<Result>(); var r = new Result(); r.Title = "关闭屏幕"; r.SubTitle = ""; r.IcoPath = "sys"; r.Score = 90; r.Action = e => { context_.Api.HideAndClear(); PostMessage(HWND_BROADCAST, WM_SYSCOMMAND, (IntPtr)SC_MONITORPOWER, new IntPtr(2)); return true; }; rl.Add(r); return rl; } return null; }
public override List<Result> Query(Query query) { if (query.RawQuery.StartsWith("mouseclick ")) { var s = query.RawQuery.Substring(2); var rl = new List<Result>(); var r = new Result(); r.Title = "Mouse Click"; r.SubTitle = "鼠标自动点击"; r.IcoPath = "[Res]:sys"; r.Score = 60; r.Action = e => { context_.Api.HideApp(); Thread.Sleep(3000); mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); return true; }; rl.Add(r); return rl; } return null; }
public override List<Result> Query(Query query) { var matcher = FuzzyMatcher.Create(query.RawQuery); var ret = new List<Result>(); foreach(var file in FileCache) { var fn = Path.GetFileName(file); var ans = matcher.Evaluate(fn); if (ans.Success) { ret.Add(CreateResult(file, ans.Score)); } else { var pyans = matcher.EvaluatePinYin(fn); if (pyans.Success) { ret.Add(CreateResult(file, pyans.Score)); } } } return ret; }
public override List<Result> Query(Query query) { Environment.SpecialFolder f; if (paths_.TryGetValue(query.RawQuery, out f)) { var path = Environment.GetFolderPath(f); var rl = new List<Result>(); var r = new Result(); r.Title = f.ToString(); r.SubTitle = path; r.IcoPath = "[Res]:folder_open"; r.Score = 50; r.Action = e => { Process.Start("explorer.exe", path); context_.Api.HideAndClear(); return true; }; rl.Add(r); return rl; } return null; }
public override List<Result> Query(Query query) { var rl = new List<Result>(); if (query.RawQuery == "exit") { var r = new Result() { Title = "Exit", SubTitle = "关闭", IcoPath = "[Res]:exit", Score = 100, Action = e => { _context.Api.CloseApp(); return true; } }; rl.Add(r); } else if(query.RawQuery == "config" || query.RawQuery == "setting") { var r = new Result() { Title = "Config / Setting", SubTitle = "设置", IcoPath = "[Res]:setting", Score = 100, Action = e => { _context.Api.HideAndClear(); _context.Api.ShowPanel("config"); return true; } }; rl.Add(r); } else if (query.RawQuery == "about") { var r = new Result() { Title = "About", SubTitle = "关于", IcoPath = "[Res]:help", Score = 100, Action = e => { _context.Api.HideAndClear(); _context.Api.ShowPanel("about"); _context.Api.Clear(); return true; } }; rl.Add(r); } else if (query.RawQuery == "guide" || query.RawQuery == "help") { var r = new Result() { Title = "Guide / Help", SubTitle = "向导", IcoPath = "[Res]:help", Score = 100, Action = e => { _context.Api.HideAndClear(); _context.Api.ShowPanel("guide"); _context.Api.Clear(); return true; } }; rl.Add(r); } else if(query.RawQuery == "cozy") { var r = new Result() { Title = "Cozy", SubTitle = "主页", IcoPath = "[Res]:help", Score = 100, Action = e => { Process.Start(@"http://cozy.laorouji.com"); _context.Api.HideAndClear(); return true; } }; rl.Add(r); } else if(query.RawQuery == "update") { var r = new Result() { Title = "Update", SubTitle = "更新", IcoPath = "", Score = 100, Action = e => { _context.Api.HideAndClear(); _context.Api.Update(); return true; } }; rl.Add(r); } return rl; }
public override List<Result> Query(Query query) { if (query.RawQuery.StartsWith(__KEYWORD + " ")) { List<Result> _list = new List<Result>(); // 判断快递名称 var _str = query.RawQuery.Substring(__KEYWORD.Length + 1); // 需要查询的信息 string[] _info = _str.Split(' '); if (_info.Length < 2 || _info[1].Equals("")) { _list.Add(new Result { Title = __TIPS, SubTitle = "", IcoPath = "txt", Score = 20, Action = e => { return true; } }); return _list; } else { // 查询快递id string _id = _info[0]; // 快递公司名 string _expressName = "未知快递"; foreach (ExpressDataInfo i in m_listInfo) { if (_id.Equals(i.Key)) { _id = i.Key; _expressName = i.Name; break; } } // 单号 string _order = _info[1]; // 开始查询 if (_order.Length > 0) { _list.Add(new Result { Title = "查询" + _expressName + "_单号:" + _order, SubTitle = "点击开始查询", IcoPath = "txt", Score = 20, Action = e => { QueryExpress(_id, _order); return true; } }); } return _list; } } if (query.RawQuery.StartsWith("k")) { return new List<Result> { new Result { Title = __TIPS, SubTitle = "", IcoPath = "txt", Score = 80, Action = e => { return true; } }}; } return null; }
public List<Result> Query(Query query) { return null; }
public List<Result> Query(Query query) { return plugins_.Query(id_, query); }
public virtual List<Result> Query(Query query) { return null; }
public override List<Result> Query(Query query) { var list = new List<Result>(); if(!query.RawQuery.StartsWith("tt")) { return list; } var r = new Result(); var q = query.RawQuery.Remove(0, 2); q = q.Trim(); if (q.Length == 10) { var match = regTimestamp.Match(q); if (!match.Success) { return list; } var timestamp = int.Parse(q); var date = UnixTimeStampToDateTime(timestamp).ToString(); r.IcoPath = "[Res]:app"; r.Title = date; r.SubTitle = "Copy date to clipboard"; r.Action = e => { context_.Api.HideAndClear(); try { Clipboard.SetText(r.Title); return true; } catch (System.Runtime.InteropServices.ExternalException) { return false; } }; list.Add(r); return list; } if (q.Length > 0) { DateTime date; if (DateTime.TryParse(q, out date)) { var timestamp = DateTimeToUnixTimeStamp(date).ToString(); r.IcoPath = "[Res]:app"; r.Title = timestamp; r.SubTitle = "Copy unix timestamp to clipboard"; r.Action = e => { context_.Api.HideAndClear(); try { Clipboard.SetText(r.Title); return true; } catch (System.Runtime.InteropServices.ExternalException) { return false; } }; list.Add(r); return list; } } // show current timestamp if (q == "") { var timestamp = DateTimeToUnixTimeStamp(DateTime.Now).ToString(); r.IcoPath = "[Res]:app"; r.Title = timestamp; r.SubTitle = "Copy unix timestamp to clipboard"; r.Score = 90; r.Action = e => { context_.Api.HideAndClear(); try { Clipboard.SetText(r.Title); return true; } catch (System.Runtime.InteropServices.ExternalException) { return false; } }; list.Add(r); return list; } return list; }