PowerToys/Wox.Plugin.System/DirectoryIndicator.cs

44 lines
1.1 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
2014-01-29 18:33:24 +08:00
namespace Wox.Plugin.System
{
2014-01-15 22:45:02 +08:00
public class DirectoryIndicator : BaseSystemPlugin
{
2014-01-15 22:45:02 +08:00
protected override List<Result> QueryInternal(Query query)
{
List<Result> results = new List<Result>();
if (string.IsNullOrEmpty(query.RawQuery)) return results;
2014-01-15 22:45:02 +08:00
if (Directory.Exists(query.RawQuery))
{
Result result = new Result
{
Title = "Open this directory",
SubTitle = string.Format("path: {0}", query.RawQuery),
Score = 50,
IcoPath = "Images/folder.png",
Action = (c) =>
{
Process.Start(query.RawQuery);
2014-02-28 23:21:01 +08:00
return true;
}
};
results.Add(result);
}
return results;
}
2014-01-15 22:45:02 +08:00
protected override void InitInternal(PluginInitContext context)
{
}
}
}