using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; namespace Wox.Plugin.Everything { public class Main : IPlugin { Wox.Plugin.PluginInitContext context; EverythingAPI api = new EverythingAPI(); public List Query(Query query) { var results = new List(); if (query.ActionParameters.Count > 0 && query.ActionParameters[0].Length > 0) { IEnumerable enumerable = api.Search(query.ActionParameters[0], 0, 100); foreach (string s in enumerable) { Result r = new Result(); r.Title = Path.GetFileName(s); r.SubTitle = s; r.Action = (c) => { context.HideApp(); System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo(); info.UseShellExecute = true; info.FileName = s; try { System.Diagnostics.Process.Start(info); } catch (Exception ex) { context.ShowMsg("Could not start " + r.Title, ex.Message, null); } }; results.Add(r); } } api.Reset(); return results; } [System.Runtime.InteropServices.DllImport("kernel32.dll")] private static extern int LoadLibrary(string name); public void Init(Wox.Plugin.PluginInitContext context) { this.context = context; LoadLibrary(Path.Combine( Path.Combine(context.PluginMetadata.PluginDirecotry, (IntPtr.Size == 4) ? "x86" : "x64"), "Everything.dll" )); //init everything } } }