diff --git a/Plugins/WinAlfred.Plugin.System/Properties/AssemblyInfo.cs b/Plugins/WinAlfred.Plugin.System/Properties/AssemblyInfo.cs
deleted file mode 100644
index 9f1336c2fa..0000000000
--- a/Plugins/WinAlfred.Plugin.System/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// 有关程序集的常规信息通过以下
-// 特性集控制。更改这些特性值可修改
-// 与程序集关联的信息。
-[assembly: AssemblyTitle("WinAlfred.Plugin.System")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("WinAlfred.Plugin.System")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2013")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// 将 ComVisible 设置为 false 使此程序集中的类型
-// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
-// 则将该类型上的 ComVisible 特性设置为 true。
-[assembly: ComVisible(false)]
-
-// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
-[assembly: Guid("5cdfe514-80c9-4d82-94e7-c6f79a26ccda")]
-
-// 程序集的版本信息由下面四个值组成:
-//
-// 主版本
-// 次版本
-// 生成号
-// 修订号
-//
-// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
-// 方法是按如下所示使用“*”:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Plugins/WinAlfred.Plugin.System/WinAlfred.Plugin.System.csproj b/Plugins/WinAlfred.Plugin.System/WinAlfred.Plugin.System.csproj
deleted file mode 100644
index a8dacb8d11..0000000000
--- a/Plugins/WinAlfred.Plugin.System/WinAlfred.Plugin.System.csproj
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {E515011D-A769-418B-8761-ABE6F29827A0}
- Library
- Properties
- WinAlfred.Plugin.System
- WinAlfred.Plugin.System
- v3.5
- 512
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {8451ecdd-2ea4-4966-bb0a-7bbc40138e80}
- WinAlfred.Plugin
-
-
-
-
- Always
-
-
-
-
-
-
-
- xcopy /Y $(TargetDir)$(TargetFileName) $(SolutionDir)WinAlfred\bin\Debug\Plugins\System\
-xcopy /Y $(TargetDir)plugin.ini $(SolutionDir)WinAlfred\bin\Debug\Plugins\System\
-xcopy /Y $(ProjectDir)Images\*.* $(SolutionDir)WinAlfred\bin\Debug\Plugins\System\Images\
-
-
-
\ No newline at end of file
diff --git a/Plugins/WinAlfred.Plugin.System/plugin.ini b/Plugins/WinAlfred.Plugin.System/plugin.ini
deleted file mode 100644
index 5b49554ca6..0000000000
--- a/Plugins/WinAlfred.Plugin.System/plugin.ini
+++ /dev/null
@@ -1,8 +0,0 @@
-[plugin]
-ActionKeyword = sys
-Name = System Commands
-Author = qianlifeng
-Version = 0.1
-Language = csharp
-Description = test
-ExecuteFile = WinAlfred.Plugin.System.dll
diff --git a/WinAlfred.Plugin.System/CMD.cs b/WinAlfred.Plugin.System/CMD.cs
index 1175f58d7b..ef7aedd011 100644
--- a/WinAlfred.Plugin.System/CMD.cs
+++ b/WinAlfred.Plugin.System/CMD.cs
@@ -1,20 +1,59 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Linq;
using System.Text;
+using System.Windows.Forms;
namespace WinAlfred.Plugin.System
{
- public class CMD:IPlugin
+ public class CMD : ISystemPlugin
{
public List Query(Query query)
{
- throw new NotImplementedException();
+ List results = new List();
+ if (query.RawQuery.StartsWith(">") && query.RawQuery.Length > 1)
+ {
+ string cmd = query.RawQuery.Substring(1);
+ Result result = new Result
+ {
+ Title = cmd,
+ SubTitle = "execute command through command shell" ,
+ IcoPath = "Images/cmd.png",
+ Action = () =>
+ {
+ Process process = new Process();
+ ProcessStartInfo startInfo = new ProcessStartInfo();
+ startInfo.WindowStyle = ProcessWindowStyle.Hidden;
+ startInfo.FileName = "cmd.exe";
+ startInfo.Arguments = "/C " + cmd;
+ process.StartInfo = startInfo;
+ process.Start();
+ }
+ };
+ results.Add(result);
+ }
+ return results;
}
- public void Init()
+ public void Init(PluginInitContext context)
{
- throw new NotImplementedException();
+ }
+
+ public string Name
+ {
+ get
+ {
+ return "CMD";
+ }
+ }
+
+ public string Description
+ {
+ get
+ {
+ return "Execute shell commands.";
+ }
}
}
}
diff --git a/WinAlfred.Plugin.System/ISystemPlugin.cs b/WinAlfred.Plugin.System/ISystemPlugin.cs
index 3eb6f9dbf6..dcb428d352 100644
--- a/WinAlfred.Plugin.System/ISystemPlugin.cs
+++ b/WinAlfred.Plugin.System/ISystemPlugin.cs
@@ -7,5 +7,7 @@ namespace WinAlfred.Plugin.System
{
public interface ISystemPlugin : IPlugin
{
+ string Name { get; }
+ string Description { get; }
}
}
diff --git a/Plugins/WinAlfred.Plugin.System/Main.cs b/WinAlfred.Plugin.System/Sys.cs
similarity index 70%
rename from Plugins/WinAlfred.Plugin.System/Main.cs
rename to WinAlfred.Plugin.System/Sys.cs
index 9cd5d7d9ea..5dceba034b 100644
--- a/Plugins/WinAlfred.Plugin.System/Main.cs
+++ b/WinAlfred.Plugin.System/Sys.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
@@ -8,7 +7,7 @@ using System.Windows.Forms;
namespace WinAlfred.Plugin.System
{
- public class Main : IPlugin
+ public class Sys : ISystemPlugin
{
List availableResults = new List();
@@ -20,18 +19,18 @@ namespace WinAlfred.Plugin.System
public List Query(Query query)
{
List results = new List();
- if (query.ActionParameters.Count == 0)
+
+ foreach (Result availableResult in availableResults)
{
- results = availableResults;
- }
- else
- {
- results.AddRange(availableResults.Where(result => result.Title.ToLower().Contains(query.ActionParameters[0].ToLower())));
+ if (availableResult.Title.ToLower().StartsWith(query.RawQuery.ToLower()))
+ {
+ results.Add(availableResult);
+ }
}
return results;
}
- public void Init()
+ public void Init(PluginInitContext context)
{
availableResults.Add(new Result
{
@@ -54,7 +53,23 @@ namespace WinAlfred.Plugin.System
Score = 20,
IcoPath = "Images\\lock.png",
Action = () => LockWorkStation()
- });
+ });
+ }
+
+ public string Name
+ {
+ get
+ {
+ return "sys";
+ }
+ }
+
+ public string Description
+ {
+ get
+ {
+ return "provide system commands";
+ }
}
}
}
diff --git a/WinAlfred.Plugin.System/WinAlfred.Plugin.System.csproj b/WinAlfred.Plugin.System/WinAlfred.Plugin.System.csproj
index ae8c238f6c..b822bafe1d 100644
--- a/WinAlfred.Plugin.System/WinAlfred.Plugin.System.csproj
+++ b/WinAlfred.Plugin.System/WinAlfred.Plugin.System.csproj
@@ -32,6 +32,7 @@
+
@@ -41,6 +42,8 @@
+
+
@@ -49,6 +52,10 @@
+
+
+
+