mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 19:26:39 +02:00
Rename the project.
This commit is contained in:
25
Wox.Plugin/AllowedLanguage.cs
Normal file
25
Wox.Plugin/AllowedLanguage.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Wox.Plugin
|
||||
{
|
||||
public static class AllowedLanguage
|
||||
{
|
||||
public static string Python
|
||||
{
|
||||
get { return "python"; }
|
||||
}
|
||||
|
||||
public static string CSharp
|
||||
{
|
||||
get { return "csharp"; }
|
||||
}
|
||||
|
||||
public static bool IsAllowed(string language)
|
||||
{
|
||||
return language.ToUpper() == Python.ToUpper() || language.ToUpper() == CSharp.ToUpper();
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Wox.Plugin/IPlugin.cs
Normal file
10
Wox.Plugin/IPlugin.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Wox.Plugin
|
||||
{
|
||||
public interface IPlugin
|
||||
{
|
||||
List<Result> Query(Query query);
|
||||
void Init(PluginInitContext context);
|
||||
}
|
||||
}
|
||||
13
Wox.Plugin/Plugin.cs
Normal file
13
Wox.Plugin/Plugin.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Wox.Plugin
|
||||
{
|
||||
public class PluginPair
|
||||
{
|
||||
public IPlugin Plugin { get; set; }
|
||||
public PluginMetadata Metadata { get; set; }
|
||||
}
|
||||
}
|
||||
20
Wox.Plugin/PluginInitContext.cs
Normal file
20
Wox.Plugin/PluginInitContext.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Wox.Plugin
|
||||
{
|
||||
public class PluginInitContext
|
||||
{
|
||||
public List<PluginPair> Plugins { get; set; }
|
||||
public PluginMetadata PluginMetadata { get; set; }
|
||||
|
||||
public Action<string> ChangeQuery { get; set; }
|
||||
public Action CloseApp { get; set; }
|
||||
public Action HideApp { get; set; }
|
||||
public Action ShowApp { get; set; }
|
||||
public Action<string,string,string> ShowMsg { get; set; }
|
||||
public Action OpenSettingDialog { get; set; }
|
||||
}
|
||||
}
|
||||
21
Wox.Plugin/PluginMetadata.cs
Normal file
21
Wox.Plugin/PluginMetadata.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Wox.Plugin
|
||||
{
|
||||
public class PluginMetadata
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Author { get; set; }
|
||||
public string Version { get; set; }
|
||||
public string Language { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string ExecuteFilePath { get; set; }
|
||||
public string ExecuteFileName { get; set; }
|
||||
public string PluginDirecotry { get; set; }
|
||||
public string ActionKeyword { get; set; }
|
||||
public PluginType PluginType { get; set; }
|
||||
}
|
||||
}
|
||||
13
Wox.Plugin/PluginType.cs
Normal file
13
Wox.Plugin/PluginType.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Wox.Plugin
|
||||
{
|
||||
public enum PluginType
|
||||
{
|
||||
System,
|
||||
ThirdParty
|
||||
}
|
||||
}
|
||||
36
Wox.Plugin/Properties/AssemblyInfo.cs
Normal file
36
Wox.Plugin/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的常规信息通过以下
|
||||
// 特性集控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("Wox.Plugin")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("Wox.Plugin")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 使此程序集中的类型
|
||||
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
|
||||
// 则将该类型上的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("c22be00d-a6f5-4e45-8ecc-09ebf297c812")]
|
||||
|
||||
// 程序集的版本信息由下面四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
13
Wox.Plugin/PythonResult.cs
Normal file
13
Wox.Plugin/PythonResult.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Wox.Plugin
|
||||
{
|
||||
public class PythonResult : Result
|
||||
{
|
||||
public string ActionName { get; set; }
|
||||
public string ActionPara { get; set; }
|
||||
}
|
||||
}
|
||||
35
Wox.Plugin/Query.cs
Normal file
35
Wox.Plugin/Query.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Wox.Plugin
|
||||
{
|
||||
public class Query
|
||||
{
|
||||
public string RawQuery { get; set; }
|
||||
public string ActionName { get; private set; }
|
||||
public List<string> ActionParameters { get; private set; }
|
||||
|
||||
public Query(string rawQuery)
|
||||
{
|
||||
RawQuery = rawQuery;
|
||||
ActionParameters = new List<string>();
|
||||
ParseQuery();
|
||||
}
|
||||
|
||||
private void ParseQuery()
|
||||
{
|
||||
if (string.IsNullOrEmpty(RawQuery)) return;
|
||||
|
||||
string[] strings = RawQuery.Split(' ');
|
||||
if (strings.Length == 1) return; //we consider a valid query must contain a space
|
||||
|
||||
ActionName = strings[0];
|
||||
for (int i = 1; i < strings.Length; i++)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(strings[i]))
|
||||
{
|
||||
ActionParameters.Add(strings[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
50
Wox.Plugin/Result.cs
Normal file
50
Wox.Plugin/Result.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Wox.Plugin
|
||||
{
|
||||
public class Result
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public string SubTitle { get; set; }
|
||||
public string IcoPath { get; set; }
|
||||
public Action Action { get; set; }
|
||||
public int Score { get; set; }
|
||||
|
||||
public bool DontHideWoxAfterSelect { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Auto add scores for MRU items
|
||||
/// </summary>
|
||||
public bool AutoAjustScore { get; set; }
|
||||
|
||||
//todo: this should be controlled by system, not visible to users
|
||||
/// <summary>
|
||||
/// Only resulsts that originQuery match with curren query will be displayed in the panel
|
||||
/// </summary>
|
||||
public Query OriginQuery { get; set; }
|
||||
/// <summary>
|
||||
/// context results connected with current reuslt, usually, it can use <- or -> navigate context results
|
||||
/// </summary>
|
||||
public List<Result> ContextResults { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// you don't need to set this property if you are developing a plugin
|
||||
/// </summary>
|
||||
public string PluginDirectory { get; set; }
|
||||
|
||||
public new bool Equals(object obj)
|
||||
{
|
||||
if (obj == null || !(obj is Result)) return false;
|
||||
|
||||
Result r = (Result)obj;
|
||||
return r.Title == Title && r.SubTitle == SubTitle;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Title + SubTitle;
|
||||
}
|
||||
}
|
||||
}
|
||||
79
Wox.Plugin/Wox.Plugin.csproj
Normal file
79
Wox.Plugin/Wox.Plugin.csproj
Normal file
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{8451ECDD-2EA4-4966-BB0A-7BBC40138E80}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Wox.Plugin</RootNamespace>
|
||||
<AssemblyName>Wox.Plugin</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AllowedLanguage.cs" />
|
||||
<Compile Include="IPlugin.cs" />
|
||||
<Compile Include="Plugin.cs" />
|
||||
<Compile Include="PluginInitContext.cs" />
|
||||
<Compile Include="PluginMetadata.cs" />
|
||||
<Compile Include="PluginType.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="PythonResult.cs" />
|
||||
<Compile Include="Query.cs" />
|
||||
<Compile Include="Result.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
Reference in New Issue
Block a user