- Removed IWshRuntimeLibrary. It is no longer needed for the plugin.

- Added ShortcutHelper for invocation calls.
This commit is contained in:
Boris Makogonyuk
2015-12-13 22:22:17 +01:00
parent dd65c173a9
commit ba8300508d
3 changed files with 180 additions and 21 deletions

View File

@@ -5,7 +5,6 @@ using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows;
using IWshRuntimeLibrary;
using Wox.Infrastructure;
using Wox.Plugin.Program.ProgramSources;
using Wox.Infrastructure.Logger;
@@ -50,14 +49,6 @@ namespace Wox.Plugin.Program
return results;
}
static string ResolveShortcut(string filePath)
{
// IWshRuntimeLibrary is in the COM library "Windows Script Host Object Model"
WshShell shell = new WshShell();
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(filePath);
return shortcut.TargetPath;
}
private bool MatchProgram(Program program, FuzzyMatcher matcher)
{
var scores = new List<string> { program.Title, program.PinyinTitle, program.AbbrTitle, program.ExecuteName };
@@ -224,7 +215,7 @@ namespace Wox.Plugin.Program
if (Path.EndsWith(".lnk"))
{
//get location of shortcut
var resolved = ResolveShortcut(Path);
var resolved = ShortcutHelper.ResolveShortcut(Path);
if(!string.IsNullOrEmpty(resolved))
Path = resolved;
}