Explorar o código

加入專案檔案。

0x0001F36D %!s(int64=5) %!d(string=hai) anos
pai
achega
3fc1c55a6d
Modificáronse 3 ficheiros con 76 adicións e 0 borrados
  1. 32 0
      Program.cs
  2. 19 0
      Yuuna.OpenWith.csproj
  3. 25 0
      Yuuna.OpenWith.sln

+ 32 - 0
Program.cs

@@ -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";
+        }
+    }
+}

+ 19 - 0
Yuuna.OpenWith.csproj

@@ -0,0 +1,19 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Library</OutputType>
+    <TargetFramework>netcoreapp3.0</TargetFramework>
+    <ApplicationIcon />
+    <StartupObject />
+  </PropertyGroup>
+
+  <ItemGroup>
+    <Reference Include="Yuuna.Common">
+      <HintPath>..\Yuuna\src\Yuuna\bin\Release\netcoreapp3.0\Yuuna.Common.dll</HintPath>
+    </Reference>
+    <Reference Include="Yuuna.Contracts">
+      <HintPath>..\Yuuna\src\Yuuna\bin\Release\netcoreapp3.0\Yuuna.Contracts.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+
+</Project>

+ 25 - 0
Yuuna.OpenWith.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29503.13
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yuuna.OpenWith", "Yuuna.OpenWith.csproj", "{D3DC5F2C-7878-4982-9E8F-19DACF19267B}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{D3DC5F2C-7878-4982-9E8F-19DACF19267B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{D3DC5F2C-7878-4982-9E8F-19DACF19267B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{D3DC5F2C-7878-4982-9E8F-19DACF19267B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{D3DC5F2C-7878-4982-9E8F-19DACF19267B}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {94374214-0638-475F-BD00-706646BD30F1}
+	EndGlobalSection
+EndGlobal