mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 04:07:40 +02:00
Add IExclusivePlugin
This commit is contained in:
@@ -14,7 +14,7 @@ using Control = System.Windows.Controls.Control;
|
|||||||
|
|
||||||
namespace Wox.Plugin.CMD
|
namespace Wox.Plugin.CMD
|
||||||
{
|
{
|
||||||
public class CMD : IPlugin, ISettingProvider, IPluginI18n, IInstantSearch,IExclusiveSearch
|
public class CMD : IPlugin, ISettingProvider, IPluginI18n, IInstantQuery, IExclusiveQuery
|
||||||
{
|
{
|
||||||
private PluginInitContext context;
|
private PluginInitContext context;
|
||||||
private bool WinRStroked;
|
private bool WinRStroked;
|
||||||
@@ -213,13 +213,13 @@ namespace Wox.Plugin.CMD
|
|||||||
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
|
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsInstantSearch(string query)
|
public bool IsInstantQuery(string query)
|
||||||
{
|
{
|
||||||
if (query.StartsWith(">")) return true;
|
if (query.StartsWith(">")) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsExclusiveSearch(Query query)
|
public bool IsExclusiveQuery(Query query)
|
||||||
{
|
{
|
||||||
return query.Search.StartsWith(">");
|
return query.Search.StartsWith(">");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Wox.Plugin.PluginIndicator
|
|||||||
List<Result> results = new List<Result>();
|
List<Result> results = new List<Result>();
|
||||||
if (allPlugins.Count == 0)
|
if (allPlugins.Count == 0)
|
||||||
{
|
{
|
||||||
allPlugins = context.API.GetAllPlugins().Where(o => !PluginManager.IsSystemPlugin(o.Metadata)).ToList();
|
allPlugins = context.API.GetAllPlugins().Where(o => !PluginManager.IsGenericPlugin(o.Metadata)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (PluginMetadata metadata in allPlugins.Select(o => o.Metadata))
|
foreach (PluginMetadata metadata in allPlugins.Select(o => o.Metadata))
|
||||||
@@ -45,19 +45,6 @@ namespace Wox.Plugin.PluginIndicator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//results.AddRange(UserSettingStorage.Instance.WebSearches.Where(o => o.ActionWord.StartsWith(query.Search) && o.Enabled).Select(n => new Result()
|
|
||||||
//{
|
|
||||||
// Title = n.ActionWord,
|
|
||||||
// SubTitle = string.Format("Activate {0} web search", n.ActionWord),
|
|
||||||
// Score = 100,
|
|
||||||
// IcoPath = "Images/work.png",
|
|
||||||
// Action = (c) =>
|
|
||||||
// {
|
|
||||||
// context.API.ChangeQuery(n.ActionWord + " ");
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//}));
|
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,12 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Wox.Core.UserSettings;
|
using Wox.Core.UserSettings;
|
||||||
|
using Wox.Plugin.Features;
|
||||||
using Wox.Plugin.WebSearch.SuggestionSources;
|
using Wox.Plugin.WebSearch.SuggestionSources;
|
||||||
|
|
||||||
namespace Wox.Plugin.WebSearch
|
namespace Wox.Plugin.WebSearch
|
||||||
{
|
{
|
||||||
public class WebSearchPlugin : IPlugin, ISettingProvider, IPluginI18n, IInstantSearch
|
public class WebQueryPlugin : IPlugin, ISettingProvider, IPluginI18n, IInstantQuery, IExclusiveQuery
|
||||||
{
|
{
|
||||||
private PluginInitContext context;
|
private PluginInitContext context;
|
||||||
|
|
||||||
@@ -18,7 +19,7 @@ namespace Wox.Plugin.WebSearch
|
|||||||
List<Result> results = new List<Result>();
|
List<Result> results = new List<Result>();
|
||||||
|
|
||||||
WebSearch webSearch =
|
WebSearch webSearch =
|
||||||
WebSearchStorage.Instance.WebSearches.FirstOrDefault(o => o.ActionWord == query.FirstSearch.Trim() && o.Enabled);
|
WebSearchStorage.Instance.WebSearches.FirstOrDefault(o => o.ActionWord == query.FirstSearch.Trim() && !string.IsNullOrEmpty(query.SecondSearch) && o.Enabled);
|
||||||
|
|
||||||
if (webSearch != null)
|
if (webSearch != null)
|
||||||
{
|
{
|
||||||
@@ -98,15 +99,19 @@ namespace Wox.Plugin.WebSearch
|
|||||||
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
|
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsInstantSearch(string query)
|
public bool IsInstantQuery(string query)
|
||||||
{
|
{
|
||||||
var strings = query.Split(' ');
|
var strings = query.Split(' ');
|
||||||
if (strings.Length > 1)
|
if (strings.Length > 1)
|
||||||
{
|
{
|
||||||
return WebSearchStorage.Instance.EnableWebSearchSuggestion &&
|
return WebSearchStorage.Instance.WebSearches.Exists(o => o.ActionWord == strings[0] && o.Enabled);
|
||||||
WebSearchStorage.Instance.WebSearches.Exists(o => o.ActionWord == strings[0] && o.Enabled);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsExclusiveQuery(Query query)
|
||||||
|
{
|
||||||
|
return IsInstantQuery(query.RawQuery);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,147 +1,147 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="12.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')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>{403B57F2-1856-4FC7-8A24-36AB346B763E}</ProjectGuid>
|
<ProjectGuid>{403B57F2-1856-4FC7-8A24-36AB346B763E}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>Wox.Plugin.WebSearch</RootNamespace>
|
<RootNamespace>Wox.Plugin.WebSearch</RootNamespace>
|
||||||
<AssemblyName>Wox.Plugin.WebSearch</AssemblyName>
|
<AssemblyName>Wox.Plugin.WebSearch</AssemblyName>
|
||||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
|
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
|
||||||
<RestorePackages>true</RestorePackages>
|
<RestorePackages>true</RestorePackages>
|
||||||
<TargetFrameworkProfile />
|
<TargetFrameworkProfile />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.WebSearch\</OutputPath>
|
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.WebSearch\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>..\..\Output\Release\Plugins\Wox.Plugin.WebSearch\</OutputPath>
|
<OutputPath>..\..\Output\Release\Plugins\Wox.Plugin.WebSearch\</OutputPath>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PresentationCore" />
|
<Reference Include="PresentationCore" />
|
||||||
<Reference Include="PresentationFramework" />
|
<Reference Include="PresentationFramework" />
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Xaml" />
|
<Reference Include="System.Xaml" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="WindowsBase" />
|
<Reference Include="WindowsBase" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="SuggestionSources\Baidu.cs" />
|
<Compile Include="SuggestionSources\Baidu.cs" />
|
||||||
<Compile Include="SuggestionSources\Google.cs" />
|
<Compile Include="SuggestionSources\Google.cs" />
|
||||||
<Compile Include="SuggestionSources\ISuggestionSource.cs" />
|
<Compile Include="SuggestionSources\ISuggestionSource.cs" />
|
||||||
<Compile Include="SuggestionSources\SuggestionSourceFactory.cs" />
|
<Compile Include="SuggestionSources\SuggestionSourceFactory.cs" />
|
||||||
<Compile Include="WebSearch.cs" />
|
<Compile Include="WebSearch.cs" />
|
||||||
<Compile Include="WebSearchesSetting.xaml.cs">
|
<Compile Include="WebSearchesSetting.xaml.cs">
|
||||||
<DependentUpon>WebSearchesSetting.xaml</DependentUpon>
|
<DependentUpon>WebSearchesSetting.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="WebSearchPlugin.cs" />
|
<Compile Include="WebQueryPlugin.cs" />
|
||||||
<Compile Include="WebSearchSetting.xaml.cs">
|
<Compile Include="WebSearchSetting.xaml.cs">
|
||||||
<DependentUpon>WebSearchSetting.xaml</DependentUpon>
|
<DependentUpon>WebSearchSetting.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="WebSearchStorage.cs" />
|
<Compile Include="WebSearchStorage.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Languages\en.xaml">
|
<Content Include="Languages\en.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<None Include="Languages\zh-cn.xaml">
|
<None Include="Languages\zh-cn.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="Languages\zh-tw.xaml">
|
<None Include="Languages\zh-tw.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<Page Include="WebSearchesSetting.xaml">
|
<Page Include="WebSearchesSetting.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="WebSearchSetting.xaml">
|
<Page Include="WebSearchSetting.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<WCFMetadata Include="Service References\" />
|
<WCFMetadata Include="Service References\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\Wox.Core\Wox.Core.csproj">
|
<ProjectReference Include="..\..\Wox.Core\Wox.Core.csproj">
|
||||||
<Project>{B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}</Project>
|
<Project>{B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}</Project>
|
||||||
<Name>Wox.Core</Name>
|
<Name>Wox.Core</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
|
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
|
||||||
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
|
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
|
||||||
<Name>Wox.Infrastructure</Name>
|
<Name>Wox.Infrastructure</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
|
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
|
||||||
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
|
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
|
||||||
<Name>Wox.Plugin</Name>
|
<Name>Wox.Plugin</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
<None Include="plugin.json">
|
<None Include="plugin.json">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Images\web_search.png">
|
<None Include="Images\web_search.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Images\websearch\google.png">
|
<None Include="Images\websearch\google.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Images\websearch\wiki.png">
|
<None Include="Images\websearch\wiki.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
|
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
|
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
|
||||||
</Target>
|
</Target>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- 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.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="BeforeBuild">
|
<Target Name="BeforeBuild">
|
||||||
</Target>
|
</Target>
|
||||||
<Target Name="AfterBuild">
|
<Target Name="AfterBuild">
|
||||||
</Target>
|
</Target>
|
||||||
-->
|
-->
|
||||||
</Project>
|
</Project>
|
||||||
@@ -78,7 +78,6 @@ namespace Wox.Core.Plugin
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
metadata = JsonConvert.DeserializeObject<PluginMetadata>(File.ReadAllText(configPath));
|
metadata = JsonConvert.DeserializeObject<PluginMetadata>(File.ReadAllText(configPath));
|
||||||
metadata.PluginType = PluginType.User;
|
|
||||||
metadata.PluginDirectory = pluginDirectory;
|
metadata.PluginDirectory = pluginDirectory;
|
||||||
}
|
}
|
||||||
catch (System.Exception)
|
catch (System.Exception)
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ namespace Wox.Core.Plugin
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
metadata = JsonConvert.DeserializeObject<PluginMetadata>(File.ReadAllText(configPath));
|
metadata = JsonConvert.DeserializeObject<PluginMetadata>(File.ReadAllText(configPath));
|
||||||
metadata.PluginType = PluginType.User;
|
|
||||||
metadata.PluginDirectory = pluginDirectory;
|
metadata.PluginDirectory = pluginDirectory;
|
||||||
}
|
}
|
||||||
catch (System.Exception)
|
catch (System.Exception)
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ namespace Wox.Core.Plugin
|
|||||||
{
|
{
|
||||||
public const string ActionKeywordWildcardSign = "*";
|
public const string ActionKeywordWildcardSign = "*";
|
||||||
private static List<PluginMetadata> pluginMetadatas;
|
private static List<PluginMetadata> pluginMetadatas;
|
||||||
private static List<KeyValuePair<PluginMetadata, IInstantSearch>> instantSearches;
|
private static List<KeyValuePair<PluginMetadata, IInstantQuery>> instantSearches;
|
||||||
private static List<KeyValuePair<PluginPair,IExclusiveSearch>> exclusiveSearchPlugins;
|
private static List<KeyValuePair<PluginPair, IExclusiveQuery>> exclusiveSearchPlugins;
|
||||||
|
|
||||||
public static String DebuggerMode { get; private set; }
|
public static String DebuggerMode { get; private set; }
|
||||||
public static IPublicAPI API { get; private set; }
|
public static IPublicAPI API { get; private set; }
|
||||||
@@ -117,7 +117,7 @@ namespace Wox.Core.Plugin
|
|||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(query.RawQuery.Trim()))
|
if (!string.IsNullOrEmpty(query.RawQuery.Trim()))
|
||||||
{
|
{
|
||||||
query.Search = IsUserPluginQuery(query) ? query.RawQuery.Substring(query.RawQuery.IndexOf(' ') + 1) : query.RawQuery;
|
query.Search = IsActionKeywordQuery(query) ? query.RawQuery.Substring(query.RawQuery.IndexOf(' ') + 1) : query.RawQuery;
|
||||||
QueryDispatcher.QueryDispatcher.Dispatch(query);
|
QueryDispatcher.QueryDispatcher.Dispatch(query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,7 +130,12 @@ namespace Wox.Core.Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsUserPluginQuery(Query query)
|
/// <summary>
|
||||||
|
/// Check if a query contains action keyword
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="query"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool IsActionKeywordQuery(Query query)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(query.RawQuery)) return false;
|
if (string.IsNullOrEmpty(query.RawQuery)) return false;
|
||||||
var strings = query.RawQuery.Split(' ');
|
var strings = query.RawQuery.Split(' ');
|
||||||
@@ -139,10 +144,10 @@ namespace Wox.Core.Plugin
|
|||||||
var actionKeyword = strings[0].Trim();
|
var actionKeyword = strings[0].Trim();
|
||||||
if (string.IsNullOrEmpty(actionKeyword)) return false;
|
if (string.IsNullOrEmpty(actionKeyword)) return false;
|
||||||
|
|
||||||
return plugins.Any(o => o.Metadata.PluginType == PluginType.User && o.Metadata.ActionKeyword == actionKeyword);
|
return plugins.Any(o => o.Metadata.ActionKeyword == actionKeyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsSystemPlugin(PluginMetadata metadata)
|
public static bool IsGenericPlugin(PluginMetadata metadata)
|
||||||
{
|
{
|
||||||
return metadata.ActionKeyword == ActionKeywordWildcardSign;
|
return metadata.ActionKeyword == ActionKeywordWildcardSign;
|
||||||
}
|
}
|
||||||
@@ -152,9 +157,9 @@ namespace Wox.Core.Plugin
|
|||||||
DebuggerMode = path;
|
DebuggerMode = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsInstantSearch(string query)
|
public static bool IsInstantQuery(string query)
|
||||||
{
|
{
|
||||||
return LoadInstantSearches().Any(o => o.Value.IsInstantSearch(query));
|
return LoadInstantSearches().Any(o => o.Value.IsInstantQuery(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsInstantSearchPlugin(PluginMetadata pluginMetadata)
|
public static bool IsInstantSearchPlugin(PluginMetadata pluginMetadata)
|
||||||
@@ -194,11 +199,11 @@ namespace Wox.Core.Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<KeyValuePair<PluginMetadata, IInstantSearch>> LoadInstantSearches()
|
private static List<KeyValuePair<PluginMetadata, IInstantQuery>> LoadInstantSearches()
|
||||||
{
|
{
|
||||||
if (instantSearches != null) return instantSearches;
|
if (instantSearches != null) return instantSearches;
|
||||||
|
|
||||||
instantSearches = new List<KeyValuePair<PluginMetadata, IInstantSearch>>();
|
instantSearches = new List<KeyValuePair<PluginMetadata, IInstantQuery>>();
|
||||||
List<PluginMetadata> CSharpPluginMetadatas = pluginMetadatas.Where(o => o.Language.ToUpper() == AllowedLanguage.CSharp.ToUpper()).ToList();
|
List<PluginMetadata> CSharpPluginMetadatas = pluginMetadatas.Where(o => o.Language.ToUpper() == AllowedLanguage.CSharp.ToUpper()).ToList();
|
||||||
|
|
||||||
foreach (PluginMetadata metadata in CSharpPluginMetadatas)
|
foreach (PluginMetadata metadata in CSharpPluginMetadatas)
|
||||||
@@ -206,7 +211,7 @@ namespace Wox.Core.Plugin
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Assembly asm = Assembly.Load(AssemblyName.GetAssemblyName(metadata.ExecuteFilePath));
|
Assembly asm = Assembly.Load(AssemblyName.GetAssemblyName(metadata.ExecuteFilePath));
|
||||||
List<Type> types = asm.GetTypes().Where(o => o.IsClass && !o.IsAbstract && o.GetInterfaces().Contains(typeof(IInstantSearch))).ToList();
|
List<Type> types = asm.GetTypes().Where(o => o.IsClass && !o.IsAbstract && o.GetInterfaces().Contains(typeof(IInstantQuery))).ToList();
|
||||||
if (types.Count == 0)
|
if (types.Count == 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -214,7 +219,7 @@ namespace Wox.Core.Plugin
|
|||||||
|
|
||||||
foreach (Type type in types)
|
foreach (Type type in types)
|
||||||
{
|
{
|
||||||
instantSearches.Add(new KeyValuePair<PluginMetadata, IInstantSearch>(metadata, Activator.CreateInstance(type) as IInstantSearch));
|
instantSearches.Add(new KeyValuePair<PluginMetadata, IInstantQuery>(metadata, Activator.CreateInstance(type) as IInstantQuery));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (System.Exception e)
|
catch (System.Exception e)
|
||||||
@@ -241,11 +246,11 @@ namespace Wox.Core.Plugin
|
|||||||
return AllPlugins.FirstOrDefault(o => o.Metadata.ID == id);
|
return AllPlugins.FirstOrDefault(o => o.Metadata.ID == id);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static List<KeyValuePair<PluginPair, IExclusiveSearch>> LoadExclusiveSearchPlugins()
|
internal static List<KeyValuePair<PluginPair, IExclusiveQuery>> LoadExclusiveSearchPlugins()
|
||||||
{
|
{
|
||||||
if (exclusiveSearchPlugins != null) return exclusiveSearchPlugins;
|
if (exclusiveSearchPlugins != null) return exclusiveSearchPlugins;
|
||||||
|
|
||||||
exclusiveSearchPlugins = new List<KeyValuePair<PluginPair, IExclusiveSearch>>();
|
exclusiveSearchPlugins = new List<KeyValuePair<PluginPair, IExclusiveQuery>>();
|
||||||
List<PluginMetadata> CSharpPluginMetadatas = pluginMetadatas.Where(o => o.Language.ToUpper() == AllowedLanguage.CSharp.ToUpper()).ToList();
|
List<PluginMetadata> CSharpPluginMetadatas = pluginMetadatas.Where(o => o.Language.ToUpper() == AllowedLanguage.CSharp.ToUpper()).ToList();
|
||||||
|
|
||||||
foreach (PluginMetadata metadata in CSharpPluginMetadatas)
|
foreach (PluginMetadata metadata in CSharpPluginMetadatas)
|
||||||
@@ -253,7 +258,7 @@ namespace Wox.Core.Plugin
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Assembly asm = Assembly.Load(AssemblyName.GetAssemblyName(metadata.ExecuteFilePath));
|
Assembly asm = Assembly.Load(AssemblyName.GetAssemblyName(metadata.ExecuteFilePath));
|
||||||
List<Type> types = asm.GetTypes().Where(o => o.IsClass && !o.IsAbstract && o.GetInterfaces().Contains(typeof(IExclusiveSearch))).ToList();
|
List<Type> types = asm.GetTypes().Where(o => o.IsClass && !o.IsAbstract && o.GetInterfaces().Contains(typeof(IExclusiveQuery))).ToList();
|
||||||
if (types.Count == 0)
|
if (types.Count == 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -261,8 +266,8 @@ namespace Wox.Core.Plugin
|
|||||||
|
|
||||||
foreach (Type type in types)
|
foreach (Type type in types)
|
||||||
{
|
{
|
||||||
exclusiveSearchPlugins.Add(new KeyValuePair<PluginPair, IExclusiveSearch>(AllPlugins.First(o => o.Metadata.ID == metadata.ID),
|
exclusiveSearchPlugins.Add(new KeyValuePair<PluginPair, IExclusiveQuery>(AllPlugins.First(o => o.Metadata.ID == metadata.ID),
|
||||||
Activator.CreateInstance(type) as IExclusiveSearch));
|
Activator.CreateInstance(type) as IExclusiveQuery));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (System.Exception e)
|
catch (System.Exception e)
|
||||||
@@ -279,12 +284,31 @@ namespace Wox.Core.Plugin
|
|||||||
return exclusiveSearchPlugins;
|
return exclusiveSearchPlugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static PluginPair GetExclusiveSearchPlugin(Query query)
|
internal static PluginPair GetExclusivePlugin(Query query)
|
||||||
{
|
{
|
||||||
KeyValuePair<PluginPair, IExclusiveSearch> plugin = LoadExclusiveSearchPlugins().FirstOrDefault(o => o.Value.IsExclusiveSearch((query)));
|
KeyValuePair<PluginPair, IExclusiveQuery> plugin = LoadExclusiveSearchPlugins().FirstOrDefault(o => o.Value.IsExclusiveQuery((query)));
|
||||||
if (plugin.Key != null) return plugin.Key;
|
return plugin.Key;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static PluginPair GetActionKeywordPlugin(Query query)
|
||||||
|
{
|
||||||
|
PluginPair exclusivePluginPair = AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeyword == query.GetActionKeyword());
|
||||||
|
if (exclusivePluginPair != null)
|
||||||
|
{
|
||||||
|
var customizedPluginConfig = UserSettingStorage.Instance.
|
||||||
|
CustomizedPluginConfigs.FirstOrDefault(o => o.ID == exclusivePluginPair.Metadata.ID);
|
||||||
|
if (customizedPluginConfig != null && !customizedPluginConfig.Disabled)
|
||||||
|
{
|
||||||
|
return exclusivePluginPair;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static bool IsExclusivePluginQuery(Query query)
|
||||||
|
{
|
||||||
|
return GetExclusivePlugin(query) != null || GetActionKeywordPlugin(query) != null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
30
Wox.Core/Plugin/QueryDispatcher/ExclusiveQueryDispatcher.cs
Normal file
30
Wox.Core/Plugin/QueryDispatcher/ExclusiveQueryDispatcher.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using Wox.Core.Exception;
|
||||||
|
using Wox.Core.UserSettings;
|
||||||
|
using Wox.Infrastructure.Logger;
|
||||||
|
using Wox.Plugin;
|
||||||
|
|
||||||
|
namespace Wox.Core.Plugin.QueryDispatcher
|
||||||
|
{
|
||||||
|
public class ExclusiveQueryDispatcher : BaseQueryDispatcher
|
||||||
|
{
|
||||||
|
protected override List<PluginPair> GetPlugins(Query query)
|
||||||
|
{
|
||||||
|
List<PluginPair> pluginPairs = new List<PluginPair>();
|
||||||
|
var exclusivePluginPair = PluginManager.GetExclusivePlugin(query) ??
|
||||||
|
PluginManager.GetActionKeywordPlugin(query);
|
||||||
|
if (exclusivePluginPair != null)
|
||||||
|
{
|
||||||
|
pluginPairs.Add(exclusivePluginPair);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pluginPairs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,14 +8,11 @@ using Wox.Plugin;
|
|||||||
|
|
||||||
namespace Wox.Core.Plugin.QueryDispatcher
|
namespace Wox.Core.Plugin.QueryDispatcher
|
||||||
{
|
{
|
||||||
public class SystemPluginQueryDispatcher : BaseQueryDispatcher
|
public class GenericQueryDispatcher : BaseQueryDispatcher
|
||||||
{
|
{
|
||||||
private readonly List<PluginPair> allSytemPlugins =
|
|
||||||
PluginManager.AllPlugins.Where(o => PluginManager.IsSystemPlugin(o.Metadata)).ToList();
|
|
||||||
|
|
||||||
protected override List<PluginPair> GetPlugins(Query query)
|
protected override List<PluginPair> GetPlugins(Query query)
|
||||||
{
|
{
|
||||||
return allSytemPlugins;
|
return PluginManager.AllPlugins.Where(o => PluginManager.IsGenericPlugin(o.Metadata)).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,28 +6,18 @@ namespace Wox.Core.Plugin.QueryDispatcher
|
|||||||
{
|
{
|
||||||
internal static class QueryDispatcher
|
internal static class QueryDispatcher
|
||||||
{
|
{
|
||||||
private static readonly IQueryDispatcher UserPluginDispatcher = new UserPluginQueryDispatcher();
|
private static readonly IQueryDispatcher exclusivePluginDispatcher = new ExclusiveQueryDispatcher();
|
||||||
private static readonly IQueryDispatcher SystemPluginDispatcher = new SystemPluginQueryDispatcher();
|
private static readonly IQueryDispatcher genericQueryDispatcher = new GenericQueryDispatcher();
|
||||||
|
|
||||||
public static void Dispatch(Wox.Plugin.Query query)
|
public static void Dispatch(Query query)
|
||||||
{
|
{
|
||||||
PluginPair exclusiveSearchPlugin = PluginManager.GetExclusiveSearchPlugin(query);
|
if (PluginManager.IsExclusivePluginQuery(query))
|
||||||
if (exclusiveSearchPlugin != null)
|
|
||||||
{
|
{
|
||||||
ThreadPool.QueueUserWorkItem(state =>
|
exclusivePluginDispatcher.Dispatch(query);
|
||||||
{
|
|
||||||
PluginManager.ExecutePluginQuery(exclusiveSearchPlugin, query);
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PluginManager.IsUserPluginQuery(query))
|
|
||||||
{
|
|
||||||
UserPluginDispatcher.Dispatch(query);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SystemPluginDispatcher.Dispatch(query);
|
genericQueryDispatcher.Dispatch(query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading;
|
|
||||||
using Wox.Core.Exception;
|
|
||||||
using Wox.Core.UserSettings;
|
|
||||||
using Wox.Infrastructure.Logger;
|
|
||||||
using Wox.Plugin;
|
|
||||||
|
|
||||||
namespace Wox.Core.Plugin.QueryDispatcher
|
|
||||||
{
|
|
||||||
public class UserPluginQueryDispatcher : BaseQueryDispatcher
|
|
||||||
{
|
|
||||||
protected override List<PluginPair> GetPlugins(Query query)
|
|
||||||
{
|
|
||||||
List<PluginPair> plugins = new List<PluginPair>();
|
|
||||||
//only first plugin that matches action keyword will get executed
|
|
||||||
PluginPair userPlugin = PluginManager.AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeyword == query.GetActionKeyword());
|
|
||||||
if (userPlugin != null)
|
|
||||||
{
|
|
||||||
var customizedPluginConfig = UserSettingStorage.Instance.
|
|
||||||
CustomizedPluginConfigs.FirstOrDefault(o => o.ID == userPlugin.Metadata.ID);
|
|
||||||
if (customizedPluginConfig != null && customizedPluginConfig.Disabled)
|
|
||||||
{
|
|
||||||
//need to stop the loading animation
|
|
||||||
PluginManager.API.StopLoadingBar();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
plugins.Add(userPlugin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return plugins;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -86,8 +86,8 @@
|
|||||||
<Compile Include="Plugin\PluginInstaller.cs" />
|
<Compile Include="Plugin\PluginInstaller.cs" />
|
||||||
<Compile Include="Plugin\QueryDispatcher\IQueryDispatcher.cs" />
|
<Compile Include="Plugin\QueryDispatcher\IQueryDispatcher.cs" />
|
||||||
<Compile Include="Plugin\QueryDispatcher\QueryDispatcher.cs" />
|
<Compile Include="Plugin\QueryDispatcher\QueryDispatcher.cs" />
|
||||||
<Compile Include="Plugin\QueryDispatcher\UserPluginQueryDispatcher.cs" />
|
<Compile Include="Plugin\QueryDispatcher\ExclusiveQueryDispatcher.cs" />
|
||||||
<Compile Include="Plugin\QueryDispatcher\SystemPluginQueryDispatcher.cs" />
|
<Compile Include="Plugin\QueryDispatcher\GenericQueryDispatcher.cs" />
|
||||||
<Compile Include="Plugin\JsonRPCPlugin.cs" />
|
<Compile Include="Plugin\JsonRPCPlugin.cs" />
|
||||||
<Compile Include="Plugin\JsonRPCPluginLoader.cs" />
|
<Compile Include="Plugin\JsonRPCPluginLoader.cs" />
|
||||||
<Compile Include="Plugin\CSharpPluginLoader.cs" />
|
<Compile Include="Plugin\CSharpPluginLoader.cs" />
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ namespace Wox.Infrastructure
|
|||||||
{
|
{
|
||||||
public static void WriteLine(string msg)
|
public static void WriteLine(string msg)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
Debug.WriteLine(msg);
|
Debug.WriteLine(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ using System.Text;
|
|||||||
|
|
||||||
namespace Wox.Plugin.Features
|
namespace Wox.Plugin.Features
|
||||||
{
|
{
|
||||||
public interface IExclusiveSearch
|
public interface IExclusiveQuery
|
||||||
{
|
{
|
||||||
bool IsExclusiveSearch(Query query);
|
bool IsExclusiveQuery(Query query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
7
Wox.Plugin/Features/IInstantQuery.cs
Normal file
7
Wox.Plugin/Features/IInstantQuery.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Wox.Plugin.Features
|
||||||
|
{
|
||||||
|
public interface IInstantQuery
|
||||||
|
{
|
||||||
|
bool IsInstantQuery(string query);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Wox.Plugin.Features;
|
|
||||||
|
|
||||||
namespace Wox.Plugin
|
|
||||||
{
|
|
||||||
public interface IInstantSearch
|
|
||||||
{
|
|
||||||
bool IsInstantSearch(string query);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -24,10 +24,10 @@ namespace Wox.Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
public string ExecuteFileName { get; set; }
|
public string ExecuteFileName { get; set; }
|
||||||
|
|
||||||
public string PluginDirectory { get; set; }
|
public string PluginDirectory { get; set; }
|
||||||
|
|
||||||
public string ActionKeyword { get; set; }
|
public string ActionKeyword { get; set; }
|
||||||
public PluginType PluginType { get; set; }
|
|
||||||
|
|
||||||
public string IcoPath { get; set; }
|
public string IcoPath { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Wox.Plugin
|
|
||||||
{
|
|
||||||
public enum PluginType
|
|
||||||
{
|
|
||||||
System,
|
|
||||||
User
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -46,8 +46,8 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AllowedLanguage.cs" />
|
<Compile Include="AllowedLanguage.cs" />
|
||||||
<Compile Include="EventHandler.cs" />
|
<Compile Include="EventHandler.cs" />
|
||||||
<Compile Include="Features\IExclusiveSearch.cs" />
|
<Compile Include="Features\IExclusiveQuery.cs" />
|
||||||
<Compile Include="IInstantSearch.cs" />
|
<Compile Include="Features\IInstantQuery.cs" />
|
||||||
<Compile Include="IHttpProxy.cs" />
|
<Compile Include="IHttpProxy.cs" />
|
||||||
<Compile Include="IPluginI18n.cs" />
|
<Compile Include="IPluginI18n.cs" />
|
||||||
<Compile Include="IPlugin.cs" />
|
<Compile Include="IPlugin.cs" />
|
||||||
@@ -56,7 +56,6 @@
|
|||||||
<Compile Include="PluginPair.cs" />
|
<Compile Include="PluginPair.cs" />
|
||||||
<Compile Include="PluginInitContext.cs" />
|
<Compile Include="PluginInitContext.cs" />
|
||||||
<Compile Include="PluginMetadata.cs" />
|
<Compile Include="PluginMetadata.cs" />
|
||||||
<Compile Include="PluginType.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Query.cs" />
|
<Compile Include="Query.cs" />
|
||||||
<Compile Include="Result.cs" />
|
<Compile Include="Result.cs" />
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace Wox.Test
|
|||||||
public class QueryTest
|
public class QueryTest
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void UserPluginQueryTest()
|
public void ExclusivePluginQueryTest()
|
||||||
{
|
{
|
||||||
Query q = new Query("f file.txt file2 file3");
|
Query q = new Query("f file.txt file2 file3");
|
||||||
q.Search = "file.txt file2 file3";
|
q.Search = "file.txt file2 file3";
|
||||||
@@ -23,7 +23,7 @@ namespace Wox.Test
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void SystemPluginQueryTest()
|
public void GenericPluginQueryTest()
|
||||||
{
|
{
|
||||||
Query q = new Query("file.txt file2 file3");
|
Query q = new Query("file.txt file2 file3");
|
||||||
q.Search = q.RawQuery;
|
q.Search = q.RawQuery;
|
||||||
|
|||||||
@@ -416,7 +416,7 @@ namespace Wox
|
|||||||
|
|
||||||
private int GetSearchDelay(string query)
|
private int GetSearchDelay(string query)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(query) && PluginManager.IsInstantSearch(query))
|
if (!string.IsNullOrEmpty(query) && PluginManager.IsInstantQuery(query))
|
||||||
{
|
{
|
||||||
DebugHelper.WriteLine("execute query without delay");
|
DebugHelper.WriteLine("execute query without delay");
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user