mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 12:18:50 +02:00
Add support for Everything both 32-bit and 64-bit
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -7,6 +8,7 @@ namespace Wox.Plugin.Everything
|
||||
{
|
||||
public class Main : IPlugin
|
||||
{
|
||||
Wox.Plugin.PluginInitContext context;
|
||||
EverythingAPI api = new EverythingAPI();
|
||||
|
||||
public List<Result> Query(Query query)
|
||||
@@ -14,20 +16,47 @@ namespace Wox.Plugin.Everything
|
||||
var results = new List<Result>();
|
||||
if (query.ActionParameters.Count > 0 && query.ActionParameters[0].Length > 0)
|
||||
{
|
||||
IEnumerable<string> enumerable = api.Search(query.ActionParameters[0]);
|
||||
IEnumerable<string> enumerable = api.Search(query.ActionParameters[0], 0, 100);
|
||||
foreach (string s in enumerable)
|
||||
{
|
||||
Result r = new Result();
|
||||
r.Title = s;
|
||||
r.Title = Path.GetFileName(s);
|
||||
r.SubTitle = s;
|
||||
r.Action = () =>
|
||||
{
|
||||
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()
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user