|
@@ -0,0 +1,32 @@
|
|
|
+
|
|
|
+namespace Yuuna.OpenWith
|
|
|
+{
|
|
|
+ using System;
|
|
|
+ using System.Diagnostics;
|
|
|
+ using System.Runtime.CompilerServices;
|
|
|
+ using Yuuna.Contracts.Interaction;
|
|
|
+ using Yuuna.Contracts.Modules;
|
|
|
+ using Yuuna.Contracts.Optimization;
|
|
|
+ using Yuuna.Contracts.Patterns;
|
|
|
+ using Yuuna.Contracts.Semantics;
|
|
|
+
|
|
|
+ public class OpenWith : ModuleBase
|
|
|
+ {
|
|
|
+ protected override void BuildPatterns(IGroupManager g, IPatternBuilder p, dynamic config)
|
|
|
+ {
|
|
|
+ g.Define("open").AppendOrCreate(new[] { "打開", "開啟" });
|
|
|
+ g.Define("handshake").AppendOrCreate(new[] { "握手" });
|
|
|
+ g.Define("facebook").AppendOrCreate(new[] { "臉書", "facebook", "fb" });
|
|
|
+
|
|
|
+ p.Build(g["handshake"]).OnInvoke(this.OnInvoke);
|
|
|
+
|
|
|
+ p.Build(g["open"], g["facebook"]).OnInvoke(m => { Process.Start(@"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", "http://fb.me"); return "ok"; });
|
|
|
+ }
|
|
|
+
|
|
|
+ private Response OnInvoke(Match m)
|
|
|
+ {
|
|
|
+ Process.Start("notepad");
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|