Merge branch 'V1.2.0'

This commit is contained in:
qianlifeng 2015-02-11 00:01:44 +08:00
commit 48f7c37d3b
146 changed files with 5577 additions and 1828 deletions

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
@ -8,11 +9,12 @@ using WindowsInput;
using WindowsInput.Native;
using Wox.Infrastructure;
using Wox.Infrastructure.Hotkey;
using Wox.Plugin.Features;
using Control = System.Windows.Controls.Control;
namespace Wox.Plugin.CMD
{
public class CMD : IPlugin, ISettingProvider, IPluginI18n, IInstantSearch
public class CMD : IPlugin, ISettingProvider, IPluginI18n, IInstantQuery, IExclusiveQuery,IContextMenu
{
private PluginInitContext context;
private bool WinRStroked;
@ -68,8 +70,7 @@ namespace Wox.Plugin.CMD
{
ExecuteCmd(m);
return true;
},
ContextMenu = GetContextMenus(m)
}
}));
}
}
@ -100,8 +101,7 @@ namespace Wox.Plugin.CMD
{
ExecuteCmd(m.Key);
return true;
},
ContextMenu = GetContextMenus(m.Key)
}
};
return ret;
}).Where(o => o != null).Take(4);
@ -120,8 +120,7 @@ namespace Wox.Plugin.CMD
{
ExecuteCmd(cmd);
return true;
},
ContextMenu = GetContextMenus(cmd)
}
};
return result;
@ -139,30 +138,11 @@ namespace Wox.Plugin.CMD
{
ExecuteCmd(m.Key);
return true;
},
ContextMenu = GetContextMenus(m.Key)
}
}).Take(5);
return history.ToList();
}
private List<Result> GetContextMenus(string cmd)
{
return new List<Result>()
{
new Result()
{
Title = "Run As Administrator",
Action = c =>
{
context.API.HideApp();
ExecuteCmd(cmd, true);
return true;
},
IcoPath = "Images/cmd.png"
}
};
}
private void ExecuteCmd(string cmd, bool runAsAdministrator = false)
{
if (context.API.ShellRun(cmd, runAsAdministrator))
@ -211,10 +191,43 @@ namespace Wox.Plugin.CMD
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
}
public bool IsInstantSearch(string query)
public string GetTranslatedPluginTitle()
{
return context.API.GetTranslation("wox_plugin_cmd_plugin_name");
}
public string GetTranslatedPluginDescription()
{
return context.API.GetTranslation("wox_plugin_cmd_plugin_description");
}
public bool IsInstantQuery(string query)
{
if (query.StartsWith(">")) return true;
return false;
}
public bool IsExclusiveQuery(Query query)
{
return query.Search.StartsWith(">");
}
public List<Result> LoadContextMenus(Result selectedResult)
{
return new List<Result>()
{
new Result()
{
Title = "Run As Administrator",
Action = c =>
{
context.API.HideApp();
ExecuteCmd(selectedResult.Title, true);
return true;
},
IcoPath = "Images/cmd.png"
}
};
}
}
}

View File

@ -4,5 +4,7 @@
<system:String x:Key="wox_plugin_cmd_relace_winr">Replace Win+R</system:String>
<system:String x:Key="wox_plugin_cmd_leave_cmd_open">Do not close Command Prompt after command execution</system:String>
<system:String x:Key="wox_plugin_cmd_plugin_name">Shell</system:String>
<system:String x:Key="wox_plugin_cmd_plugin_description">Provide executing commands from Wox. Commands should start with ></system:String>
</ResourceDictionary>

View File

@ -1,8 +1,10 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_cmd_relace_winr">替换 Win+R</system:String>
<system:String x:Key="wox_plugin_cmd_leave_cmd_open">执行后不关闭命令窗口</system:String>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_cmd_relace_winr">替换 Win+R</system:String>
<system:String x:Key="wox_plugin_cmd_leave_cmd_open">执行后不关闭命令窗口</system:String>
<system:String x:Key="wox_plugin_cmd_plugin_name">命令行</system:String>
<system:String x:Key="wox_plugin_cmd_plugin_description">提供从Wox中执行命令行的能力命令应该以>开头</system:String>
</ResourceDictionary>

View File

@ -1,8 +1,10 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_cmd_relace_winr">替換 Win+R</system:String>
<system:String x:Key="wox_plugin_cmd_leave_cmd_open">執行後不關閉命令窗口</system:String>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_cmd_relace_winr">替換 Win+R</system:String>
<system:String x:Key="wox_plugin_cmd_leave_cmd_open">執行後不關閉命令窗口</system:String>
<system:String x:Key="wox_plugin_cmd_plugin_name">命令行</system:String>
<system:String x:Key="wox_plugin_cmd_plugin_description">提供從Wox中執行命令行的能力命令應該以>開頭</system:String>
</ResourceDictionary>

View File

@ -1,11 +1,13 @@
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Windows;
using YAMP;
namespace Wox.Plugin.Caculator
{
public class Calculator : IPlugin
public class Calculator : IPlugin, IPluginI18n
{
private static Regex regValidExpressChar = new Regex(
@"^(" +
@ -87,5 +89,20 @@ namespace Wox.Plugin.Caculator
{
this.context = context;
}
public string GetLanguagesFolder()
{
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
}
public string GetTranslatedPluginTitle()
{
return context.API.GetTranslation("wox_plugin_caculator_plugin_name");
}
public string GetTranslatedPluginDescription()
{
return context.API.GetTranslation("wox_plugin_caculator_plugin_description");
}
}
}

View File

@ -0,0 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_caculator_plugin_name">Calculator</system:String>
<system:String x:Key="wox_plugin_caculator_plugin_description">Provide mathematical calculations.(Try 5*3-2 in Wox)</system:String>
</ResourceDictionary>

View File

@ -0,0 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_caculator_plugin_name">计算器</system:String>
<system:String x:Key="wox_plugin_caculator_plugin_description">为Wox提供数学计算能力。(试着在Wox输入 5*3-2)</system:String>
</ResourceDictionary>

View File

@ -0,0 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_caculator_plugin_name">計算器</system:String>
<system:String x:Key="wox_plugin_caculator_plugin_description">為Wox提供數學計算能力。(試著在Wox輸入 5*3-2)</system:String>
</ResourceDictionary>

View File

@ -1,95 +1,116 @@
<?xml version="1.0" encoding="utf-8"?>
<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')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{59BD9891-3837-438A-958D-ADC7F91F6F7E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Wox.Plugin.Caculator</RootNamespace>
<AssemblyName>Wox.Plugin.Caculator</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.Caculator\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\Release\Plugins\Wox.Plugin.Caculator\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<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" />
<Reference Include="YAMP, Version=1.4.0.22422, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\YAMP.1.4.0\lib\net35\YAMP.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Calculator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
<Name>Wox.Infrastructure</Name>
</ProjectReference>
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
<Name>Wox.Plugin</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Images\calculator.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<?xml version="1.0" encoding="utf-8"?>
<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')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{59BD9891-3837-438A-958D-ADC7F91F6F7E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Wox.Plugin.Caculator</RootNamespace>
<AssemblyName>Wox.Plugin.Caculator</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.Caculator\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\Release\Plugins\Wox.Plugin.Caculator\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<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" />
<Reference Include="YAMP, Version=1.4.0.22422, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\YAMP.1.4.0\lib\net35\YAMP.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Calculator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
<Name>Wox.Infrastructure</Name>
</ProjectReference>
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
<Name>Wox.Plugin</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Images\calculator.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="Languages\en.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="Languages\zh-cn.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Languages\zh-tw.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<!-- 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>

View File

@ -4,13 +4,15 @@ using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows;
namespace Wox.Plugin.Color
{
public sealed class ColorsPlugin : IPlugin
public sealed class ColorsPlugin : IPlugin, IPluginI18n
{
private string DIR_PATH = Path.Combine(Path.GetTempPath(), @"Plugins\Colors\");
private PluginInitContext context;
private const int IMG_SIZE = 32;
private DirectoryInfo ColorsDirectory { get; set; }
@ -103,6 +105,23 @@ namespace Wox.Plugin.Color
public void Init(PluginInitContext context)
{
this.context = context;
}
public string GetLanguagesFolder()
{
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
}
public string GetTranslatedPluginTitle()
{
return context.API.GetTranslation("wox_plugin_color_plugin_name");
}
public string GetTranslatedPluginDescription()
{
return context.API.GetTranslation("wox_plugin_color_plugin_description");
}
}
}

View File

@ -0,0 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_color_plugin_name">Colors</system:String>
<system:String x:Key="wox_plugin_color_plugin_description">Provide hex color preview.(Try #000 in Wox)</system:String>
</ResourceDictionary>

View File

@ -0,0 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_color_plugin_name">颜色</system:String>
<system:String x:Key="wox_plugin_color_plugin_description">提供在Wox查询hex颜色。(尝试在Wox中输入#000)</system:String>
</ResourceDictionary>

View File

@ -0,0 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_color_plugin_name">顏色</system:String>
<system:String x:Key="wox_plugin_color_plugin_description">提供在Wox查詢hex顏色。(嘗試在Wox中輸入#000)</system:String>
</ResourceDictionary>

View File

@ -34,6 +34,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
@ -62,6 +63,27 @@
<Name>Wox.Plugin</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Languages\en.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="Languages\zh-cn.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Languages\zh-tw.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</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.

View File

@ -3,11 +3,12 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using Wox.Infrastructure;
namespace Wox.Plugin.ControlPanel
{
public class ControlPanel : IPlugin
public class ControlPanel : IPlugin,IPluginI18n
{
private PluginInitContext context;
private List<ControlPanelItem> controlPanelItems = new List<ControlPanelItem>();
@ -81,5 +82,20 @@ namespace Wox.Plugin.ControlPanel
return false;
}
public string GetLanguagesFolder()
{
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
}
public string GetTranslatedPluginTitle()
{
return context.API.GetTranslation("wox_plugin_controlpanel_plugin_name");
}
public string GetTranslatedPluginDescription()
{
return context.API.GetTranslation("wox_plugin_controlpanel_plugin_description");
}
}
}

View File

@ -326,8 +326,6 @@ namespace Wox.Plugin.ControlPanel
private static bool EnumRes(IntPtr hModule, IntPtr lpszType, IntPtr lpszName, IntPtr lParam)
{
//Debug.WriteLine("Type: " + GET_RESOURCE_NAME(lpszType));
//Debug.WriteLine("Name: " + GET_RESOURCE_NAME(lpszName));
defaultIconPtr = lpszName;
return false;
}

View File

@ -0,0 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_controlpanel_plugin_name">Control Panel</system:String>
<system:String x:Key="wox_plugin_controlpanel_plugin_description">Search within the Control Panel</system:String>
</ResourceDictionary>

View File

@ -0,0 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_controlpanel_plugin_name">控制面板</system:String>
<system:String x:Key="wox_plugin_controlpanel_plugin_description">搜索控制面板</system:String>
</ResourceDictionary>

View File

@ -0,0 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_controlpanel_plugin_name">控制面板</system:String>
<system:String x:Key="wox_plugin_controlpanel_plugin_description">搜索控制面板</system:String>
</ResourceDictionary>

View File

@ -33,6 +33,7 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
@ -67,6 +68,27 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="Languages\en.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="Languages\zh-cn.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Languages\zh-tw.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</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.

View File

@ -11,13 +11,13 @@ namespace Wox.Plugin.Everything
{
public class ContextMenuStorage : JsonStrorage<ContextMenuStorage>
{
[JsonProperty]
public List<ContextMenu> ContextMenus = new List<ContextMenu>();
[JsonProperty] public List<ContextMenu> ContextMenus = new List<ContextMenu>();
[JsonProperty]
public int MaxSearchCount { get; set; }
public IPublicAPI API { get; set; }
protected override string ConfigName
{
get { return "EverythingContextMenu"; }
@ -28,20 +28,14 @@ namespace Wox.Plugin.Everything
get { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); }
}
protected override void OnAfterLoad(ContextMenuStorage obj)
{
}
protected override ContextMenuStorage LoadDefault()
{
ContextMenus = new List<ContextMenu>()
{
new ContextMenu()
{
Name = "Open Containing Folder",
Command = "explorer.exe",
Argument = " /select,\"{path}\"",
ImagePath ="Images\\folder.png"
}
};
MaxSearchCount = 100;
Save();
return this;
}
}
@ -60,4 +54,4 @@ namespace Wox.Plugin.Everything
[JsonProperty]
public string ImagePath { get; set; }
}
}
}

View File

@ -0,0 +1,14 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_everything_is_not_running">Everything is not runnin</system:String>
<system:String x:Key="wox_plugin_everything_query_error">Everything plugin has an error (enter to copy error message)</system:String>
<system:String x:Key="wox_plugin_everything_copied">Copied</system:String>
<system:String x:Key="wox_plugin_everything_canot_start">Can't start {0}</system:String>
<system:String x:Key="wox_plugin_everything_open_containing_folder">Open containing folder</system:String>
<system:String x:Key="wox_plugin_everything_plugin_name">Everything</system:String>
<system:String x:Key="wox_plugin_everything_plugin_description">Search disk files using Everything</system:String>
</ResourceDictionary>

View File

@ -0,0 +1,14 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_everything_is_not_running">Everything没有运行我们将自动为您启动内置Everything请稍后进行查询</system:String>
<system:String x:Key="wox_plugin_everything_query_error">Everything插件发生了一个错误回车拷贝具体错误信息</system:String>
<system:String x:Key="wox_plugin_everything_copied">拷贝成功</system:String>
<system:String x:Key="wox_plugin_everything_canot_start">不能启动 {0}</system:String>
<system:String x:Key="wox_plugin_everything_open_containing_folder">打开所属文件夹</system:String>
<system:String x:Key="wox_plugin_everything_plugin_name">Everything</system:String>
<system:String x:Key="wox_plugin_everything_plugin_description">利用Everything搜索磁盘文件</system:String>
</ResourceDictionary>

View File

@ -0,0 +1,13 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_everything_is_not_running">Everything沒有運行我們將自動為您啟動內置Everything請稍後進行查詢</system:String>
<system:String x:Key="wox_plugin_everything_query_error">Everything插件發生了一個錯誤回車拷貝具體錯誤信息</system:String>
<system:String x:Key="wox_plugin_everything_copied">拷貝成功</system:String>
<system:String x:Key="wox_plugin_everything_canot_start">不能啟動 {0}</system:String>
<system:String x:Key="wox_plugin_everything_open_containing_folder">打開所屬文件夾</system:String>
<system:String x:Key="wox_plugin_everything_plugin_name">Everything</system:String>
<system:String x:Key="wox_plugin_everything_plugin_description">利用Everything搜索磁盤文件</system:String>
</ResourceDictionary>

View File

@ -3,13 +3,15 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.ServiceProcess;
using Wox.Infrastructure;
using System.Reflection;
using Wox.Plugin.Everything.Everything;
using Wox.Plugin.Features;
namespace Wox.Plugin.Everything
{
public class Main : IPlugin
public class Main : IPlugin, IPluginI18n, IContextMenu
{
PluginInitContext context;
EverythingAPI api = new EverythingAPI();
@ -24,10 +26,25 @@ namespace Wox.Plugin.Everything
var keyword = query.Search;
if (ContextMenuStorage.Instance.MaxSearchCount <= 0)
{
ContextMenuStorage.Instance.MaxSearchCount = 100;
ContextMenuStorage.Instance.MaxSearchCount = 50;
ContextMenuStorage.Instance.Save();
}
if (keyword == "uninstalleverything")
{
Result r = new Result();
r.Title = "Uninstall Everything";
r.SubTitle = "You need to uninstall everything service if you can not move/delete wox folder";
r.IcoPath = "Images\\find.png";
r.Action = (c) =>
{
UnInstallEverything();
return true;
};
r.Score = 2000;
results.Add(r);
}
try
{
var searchList = api.Search(keyword, maxCount: ContextMenuStorage.Instance.MaxSearchCount).ToList();
@ -50,7 +67,7 @@ namespace Wox.Plugin.Everything
context.API.ShellRun(path);
return true;
};
r.ContextMenu = GetContextMenu(s);
r.ContextData = s;
results.Add(r);
}
}
@ -59,7 +76,7 @@ namespace Wox.Plugin.Everything
StartEverything();
results.Add(new Result()
{
Title = "Everything is not running, we already run it for you now. Try search again",
Title = context.API.GetTranslation("wox_plugin_everything_is_not_running"),
IcoPath = "Images\\warning.png"
});
}
@ -67,12 +84,12 @@ namespace Wox.Plugin.Everything
{
results.Add(new Result()
{
Title = "Everything plugin has an error (enter to copy error message)",
Title = context.API.GetTranslation("wox_plugin_everything_query_error"),
SubTitle = e.Message,
Action = _ =>
{
System.Windows.Clipboard.SetText(e.Message + "\r\n" + e.StackTrace);
context.API.ShowMsg("Copied", "Error message has copied to your clipboard", string.Empty);
context.API.ShowMsg(context.API.GetTranslation("wox_plugin_everything_copied"), null, string.Empty);
return false;
},
IcoPath = "Images\\error.png"
@ -110,42 +127,25 @@ namespace Wox.Plugin.Everything
[System.Runtime.InteropServices.DllImport("kernel32.dll")]
private static extern int LoadLibrary(string name);
private List<Result> GetContextMenu(SearchResult record)
private List<ContextMenu> GetDefaultContextMenu()
{
List<Result> contextMenus = new List<Result>();
List<ContextMenu> defaultContextMenus = new List<ContextMenu>();
ContextMenu openFolderContextMenu = new ContextMenu()
{
Name = context.API.GetTranslation("wox_plugin_everything_open_containing_folder"),
Command = "explorer.exe",
Argument = " /select,\"{path}\"",
ImagePath = "Images\\folder.png"
};
if (record.Type == ResultType.File)
{
foreach (ContextMenu contextMenu in ContextMenuStorage.Instance.ContextMenus)
{
contextMenus.Add(new Result()
{
Title = contextMenu.Name,
Action = _ =>
{
string argument = contextMenu.Argument.Replace("{path}", record.FullPath);
try
{
System.Diagnostics.Process.Start(contextMenu.Command, argument);
}
catch
{
context.API.ShowMsg("Can't start " + record.FullPath, string.Empty, string.Empty);
return false;
}
return true;
},
IcoPath = contextMenu.ImagePath
});
}
}
return contextMenus;
defaultContextMenus.Add(openFolderContextMenu);
return defaultContextMenus;
}
public void Init(PluginInitContext context)
{
this.context = context;
ContextMenuStorage.Instance.API = context.API;
LoadLibrary(Path.Combine(
Path.Combine(context.CurrentPluginMetadata.PluginDirectory, (IntPtr.Size == 4) ? "x86" : "x64"),
@ -157,15 +157,92 @@ namespace Wox.Plugin.Everything
private void StartEverything()
{
if (!CheckEverythingIsRunning())
if (!CheckEverythingServiceRunning())
{
if (InstallAndRunEverythingService())
{
StartEverythingClient();
}
}
else
{
StartEverythingClient();
}
}
private bool InstallAndRunEverythingService()
{
try
{
Process p = new Process();
p.StartInfo.Verb = "runas";
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.StartInfo.FileName = GetEverythingPath();
p.StartInfo.UseShellExecute = true;
p.StartInfo.Arguments = "-install-service";
p.Start();
return true;
}
catch (Exception e)
{
return false;
}
}
private bool UnInstallEverything()
{
try
{
Process p = new Process();
p.StartInfo.Verb = "runas";
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.StartInfo.FileName = GetEverythingPath();
p.StartInfo.UseShellExecute = true;
p.StartInfo.Arguments = "-uninstall-service";
p.Start();
Process[] proc = Process.GetProcessesByName("Everything");
foreach (Process process in proc)
{
process.Kill();
}
return true;
}
catch (Exception e)
{
return false;
}
}
private void StartEverythingClient()
{
try
{
Process p = new Process();
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.StartInfo.FileName = GetEverythingPath();
p.StartInfo.UseShellExecute = true;
p.StartInfo.Arguments = "-startup";
p.Start();
}
catch (Exception e)
{
context.API.ShowMsg("Start Everything failed");
}
}
private bool CheckEverythingServiceRunning()
{
try
{
ServiceController sc = new ServiceController("Everything");
return sc.Status == ServiceControllerStatus.Running;
}
catch
{
}
return false;
}
private bool CheckEverythingIsRunning()
@ -178,5 +255,60 @@ namespace Wox.Plugin.Everything
string everythingFolder = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "PortableEverything");
return Path.Combine(everythingFolder, "Everything.exe");
}
public string GetLanguagesFolder()
{
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
}
public string GetTranslatedPluginTitle()
{
return context.API.GetTranslation("wox_plugin_everything_plugin_name");
}
public string GetTranslatedPluginDescription()
{
return context.API.GetTranslation("wox_plugin_everything_plugin_description");
}
public List<Result> LoadContextMenus(Result selectedResult)
{
SearchResult record = selectedResult.ContextData as SearchResult;
List<Result> contextMenus = new List<Result>();
if (record == null) return contextMenus;
List<ContextMenu> availableContextMenus = new List<ContextMenu>();
availableContextMenus.AddRange(GetDefaultContextMenu());
availableContextMenus.AddRange(ContextMenuStorage.Instance.ContextMenus);
if (record.Type == ResultType.File)
{
foreach (ContextMenu contextMenu in availableContextMenus)
{
var menu = contextMenu;
contextMenus.Add(new Result()
{
Title = contextMenu.Name,
Action = _ =>
{
string argument = menu.Argument.Replace("{path}", record.FullPath);
try
{
Process.Start(menu.Command, argument);
}
catch
{
context.API.ShowMsg(string.Format(context.API.GetTranslation("wox_plugin_everything_canot_start"), record.FullPath), string.Empty, string.Empty);
return false;
}
return true;
},
IcoPath = contextMenu.ImagePath
});
}
}
return contextMenus;
}
}
}

View File

@ -0,0 +1,485 @@
[Everything]
app_data=0
run_as_admin=0
window_x=75
window_y=37
window_wide=1097
window_high=664
maximized=0
minimized=0
fullscreen=0
ontop=0
match_whole_word=0
match_path=0
match_case=0
match_diacritics=0
match_regex=0
selection_mask_right_bottom_inclusive=1
allow_multiple_windows=0
allow_multiple_instances=0
run_in_background=1
show_tray_icon=0
alternate_row_color=0
show_mouseover=0
check_for_updates_on_startup=0
beta_updates=0
show_highlighted_search_terms=1
text_size=0
hide_empty_search_results=0
clear_selection_on_search=1
new_window_key=0
show_window_key=0
toggle_window_key=0
language=0
show_selected_item_in_statusbar=0
open_folder_command2=
open_file_command2=
open_path_command2=
explore_command2=
explore_path_command2=
window_title_format=
taskbar_notification_title_format=
instance_name=
translucent_selection_rectangle_alpha=70
min_zoom=-6
max_zoom=27
context_menu_type=0
auto_include_fixed_volumes=1
auto_include_removable_volumes=0
last_export_type=0
max_threads=0
reuse_threads=1
single_parent_context_menu=0
auto_size_1=512
auto_size_2=640
auto_size_3=768
auto_size_aspect_ratio_x=9
auto_size_aspect_ratio_y=7
auto_size_path_x=1
auto_size_path_y=2
sticky_vscroll_bottom=1
last_options_page=0
draw_focus_rect=1
date_format=
time_format=
invert_layout=0
listview_item_high=0
debug=0
home_match_case=0
home_match_whole_word=0
home_match_path=0
home_match_diacritics=0
home_regex=0
home_search=1
home_filter=0
home_sort=0
home_index=1
allow_multiple_windows_from_tray=0
single_click_tray=0
close_on_execute=0
double_click_path=0
update_display_after_scroll=0
update_display_after_mask=1
auto_scroll_view=0
double_quote_copy_as_path=0
snap=0
snaplen=10
rename_select_filepart_only=0
rename_move_caret_to_selection_end=0
search_edit_move_caret_to_selection_end=0
select_search_on_mouse_click=1
focus_search_on_activate=0
reset_vscroll_on_search=1
wrap_focus=0
load_icon_priority=0
load_fileinfo_priority=0
header_high=0
hide_on_close=0
winmm=0
menu_escape_amp=1
fast_ascii_search=1
match_path_when_search_contains_path_separator=1
allow_literal_operators=0
allow_round_bracket_parenthesis=0
expand_environment_variables=0
search_as_you_type=1
convert_forward_slash_to_backslash=0
match_whole_filename_when_using_wildcards=1
double_buffer=1
search=
show_number_of_results_with_selection=0
date_descending_first=0
size_descending_first=1
size_format=2
alpha_select=0
tooltips=1
rtl_listview_edit=0
bookmark_remember_case=1
bookmark_remember_wholeword=1
bookmark_remember_path=1
bookmark_remember_diacritic=1
bookmark_remember_regex=1
bookmark_remember_sort=1
bookmark_remember_filter=1
bookmark_remember_index=1
exclude_list_enabled=1
exclude_hidden_files_and_folders=0
exclude_system_files_and_folders=0
include_only_files=
exclude_files=
db_location=
db_multi_user_filename=0
db_compress=0
extended_information_cache_monitor=1
keep_missing_indexes=0
editor_x=0
editor_y=0
editor_wide=0
editor_high=0
editor_maximized=0
file_list_relative_paths=1
max_recv_size=8388608
display_full_path_name=0
size_tiny=10240
size_small=102400
size_medium=1048576
size_large=16777216
size_huge=134217728
themed_toolbar=1
show_copy_path=2
show_copy_full_name=2
show_open_path=2
show_explore=2
show_explore_path=2
copy_path_folder_append_backslash=0
custom_verb01=
custom_verb02=
custom_verb03=
custom_verb04=
custom_verb05=
custom_verb06=
custom_verb07=
custom_verb08=
custom_verb09=
custom_verb10=
custom_verb11=
custom_verb12=
filters_visible=0
filters_wide=128
filters_right_align=1
filters_tab_stop=0
filter=
filter_everything_name=
sort=Name
sort_ascending=1
always_keep_sort=0
index=0
index_file_list=
index_etp_server=
index_link_type=1
status_bar_visible=1
select_search_on_focus_mode=1
select_search_on_set_mode=2
search_history_enabled=0
run_history_enabled=0
search_history_days_to_keep=90
run_history_days_to_keep=90
search_history_always_suggest=0
search_history_max_results=24
search_history_show_above=0
service_port=15485
etp_server_enabled=0
etp_server_bindings=
etp_server_port=21
etp_server_username=
etp_server_password=
etp_server_welcome_message=
etp_server_log_file_name=
etp_server_logging_enabled=1
etp_server_log_max_size=4194304
etp_server_log_delta_size=524288
etp_server_allow_file_download=1
http_server_enabled=0
http_server_bindings=
http_title_format=
http_server_port=80
http_server_username=
http_server_password=
http_server_home=
http_server_default_page=
http_server_log_file_name=
http_server_logging_enabled=1
http_server_log_max_size=4194304
http_server_log_delta_size=524288
http_server_allow_file_download=1
name_column_pos=0
name_column_width=256
path_column_visible=1
path_column_pos=1
path_column_width=559
size_column_visible=1
size_column_pos=2
size_column_width=96
extension_column_visible=0
extension_column_pos=3
extension_column_width=96
type_column_visible=0
type_column_pos=4
type_column_width=96
last_write_time_column_visible=1
last_write_time_column_pos=3
last_write_time_column_width=153
creation_time_column_visible=0
creation_time_column_pos=6
creation_time_column_width=140
date_accessed_column_visible=0
date_accessed_column_pos=7
date_accessed_column_width=140
attribute_column_visible=0
attribute_column_pos=8
attribute_column_width=70
date_recently_changed_column_visible=0
date_recently_changed_column_pos=9
date_recently_changed_column_width=96
run_count_column_visible=0
run_count_column_pos=10
run_count_column_width=96
date_run_column_visible=0
date_run_column_pos=11
date_run_column_width=140
file_list_filename_column_visible=0
file_list_filename_column_pos=12
file_list_filename_column_width=96
translucent_selection_rectangle_background_color=
translucent_selection_rectangle_border_color=
ntfs_volume_paths="C:"
ntfs_volume_includes=1
ntfs_volume_load_recent_changes=0
ntfs_volume_include_onlys=""
ntfs_volume_monitors=1
filelists=
folders=
folder_monitor_changes=
folder_update_types=
folder_update_days=
folder_update_ats=
folder_update_intervals=
folder_update_interval_types=
exclude_folders=
connect_history_hosts=
connect_history_ports=
connect_history_usernames=
connect_history_link_types=
file_new_search_window_keys=334
file_open_file_list_keys=335
file_close_file_list_keys=
file_close_keys=343,27
file_export_keys=339
file_copy_full_name_to_clipboard_keys=9539
file_copy_path_to_clipboard_keys=
file_set_run_count_keys=
file_create_shortcut_keys=
file_delete_keys=8238
file_delete_permanently_keys=9262
file_edit_keys=
file_open_keys=8205
file_open_selection_and_close_everything_keys=
file_explore_path_keys=
file_open_new_keys=
file_open_path_keys=8461
file_open_with_keys=
file_open_with_default_verb_keys=
file_play_keys=
file_preview_keys=
file_print_keys=
file_print_to_keys=
file_properties_keys=8717
file_read_extended_information_keys=8517
file_rename_keys=8305
file_run_as_keys=
file_exit_keys=337
file_custom_verb_1_keys=
file_custom_verb_2_keys=
file_custom_verb_3_keys=
file_custom_verb_4_keys=
file_custom_verb_5_keys=
file_custom_verb_6_keys=
file_custom_verb_7_keys=
file_custom_verb_8_keys=
file_custom_verb_9_keys=
file_custom_verb_10_keys=
file_custom_verb_11_keys=
file_custom_verb_12_keys=
edit_cut_keys=8536
edit_copy_keys=8515,8493
edit_paste_keys=8534,9261
edit_select_all_keys=8513
edit_invert_selection_keys=
view_filters_keys=
view_status_bar_keys=
view_window_size_small_keys=561
view_window_size_medium_keys=562
view_window_size_large_keys=563
view_window_size_auto_fit_keys=564
view_zoom_zoom_in_keys=443,363
view_zoom_zoom_out_keys=445,365
view_zoom_reset_keys=304,352
view_go_to_back_keys=549,166
view_go_to_forward_keys=551,167
view_go_to_home_keys=548
view_sort_by_name_keys=305
view_sort_by_path_keys=306
view_sort_by_size_keys=307
view_sort_by_extension_keys=308
view_sort_by_type_keys=309
view_sort_by_date_modified_keys=310
view_sort_by_date_created_keys=311
view_sort_by_attributes_keys=312
view_sort_by_file_list_filename_keys=
view_sort_by_run_count_keys=
view_sort_by_date_run_keys=
view_sort_by_date_recently_changed_keys=313
view_sort_by_date_accessed_keys=
view_sort_by_ascending_keys=
view_sort_by_descending_keys=
view_refresh_keys=116
view_fullscreen_keys=122
view_toggle_ltrrtl_keys=
view_on_top_never_keys=
view_on_top_always_keys=340
view_on_top_while_searching_keys=
search_match_case_keys=329
search_match_whole_word_keys=322
search_match_path_keys=341
search_match_diacritics_keys=333
search_enable_regex_keys=338
search_add_to_filters_keys=
search_organize_filters_keys=1350
bookmarks_add_to_bookmarks_keys=324
bookmarks_organize_bookmarks_keys=1346
tools_options_keys=336
tools_console_keys=448
tools_file_list_editor_keys=
tools_connect_to_etp_server_keys=
tools_disconnect_from_etp_server_keys=
help_everything_help_keys=112
help_search_syntax_keys=
help_regex_syntax_keys=
help_command_line_options_keys=
help_everything_website_keys=
help_check_for_updates_keys=
help_about_everything_keys=368
search_edit_focus_search_edit_keys=326,114
search_edit_delete_previous_word_keys=4360
search_edit_auto_complete_search_keys=4384
search_edit_show_search_history_keys=
search_edit_show_all_search_history_keys=4646,4648
result_list_item_up_keys=8230,4134
result_list_item_down_keys=8232,4136
result_list_page_up_keys=8225,4129
result_list_page_down_keys=8226,4130
result_list_start_of_list_keys=8228
result_list_end_of_list_keys=8227
result_list_item_up_extend_keys=9254,5158
result_list_item_down_extend_keys=9256,5160
result_list_page_up_extend_keys=9249,5153
result_list_page_down_extend_keys=9250,5154
result_list_start_of_list_extend_keys=9252
result_list_end_of_list_extend_keys=9251
result_list_focus_up_keys=8486,4390
result_list_focus_down_keys=8488,4392
result_list_focus_page_up_keys=8481,4385
result_list_focus_page_down_keys=8482,4386
result_list_focus_start_of_list_keys=8484
result_list_focus_end_of_list_keys=8483
result_list_focus_up_extend_keys=9510,5414
result_list_focus_down_extend_keys=9512,5416
result_list_focus_page_up_extend_keys=9505,5409
result_list_focus_page_down_extend_keys=9506,5410
result_list_focus_start_of_list_extend_keys=9508
result_list_focus_end_of_list_extend_keys=9507
result_list_focus_result_list_keys=
result_list_toggle_path_column_keys=1330
result_list_toggle_size_column_keys=1331
result_list_toggle_extension_column_keys=1332
result_list_toggle_type_column_keys=1333
result_list_toggle_date_modified_column_keys=1334
result_list_toggle_date_created_column_keys=1335
result_list_toggle_attributes_column_keys=1336
result_list_toggle_file_list_filename_column_keys=
result_list_toggle_run_count_column_keys=
result_list_toggle_date_recently_changed_column_keys=1337
result_list_toggle_date_accessed_column_keys=
result_list_toggle_date_run_column_keys=
result_list_size_all_columns_to_fit_keys=8555
result_list_size_result_list_to_fit_keys=
result_list_context_menu_keys=9337
result_list_scroll_left_keys=8229
result_list_scroll_right_keys=8231
result_list_scroll_page_left_keys=8485
result_list_scroll_page_right_keys=8487
result_list_select_focus_keys=8224
result_list_toggle_focus_selection_keys=8480
result_list_copy_selection_to_clipboard_as_csv_keys=
result_list_font=
result_list_font_size=
search_edit_font=
search_edit_font_size=
status_bar_font=
status_bar_font_size=
header_font=
header_font_size=
normal_background_color=
normal_foreground_color=
normal_bold=
highlighted_background_color=
highlighted_foreground_color=
highlighted_bold=
selected_background_color=
selected_foreground_color=
selected_bold=
highlighted_selected_background_color=
highlighted_selected_foreground_color=
highlighted_selected_bold=
selected_inactive_background_color=
selected_inactive_foreground_color=
selected_inactive_bold=
highlighted_selected_inactive_background_color=
highlighted_selected_inactive_foreground_color=
highlighted_selected_inactive_bold=
drop_target_background_color=
drop_target_foreground_color=
drop_target_bold=
highlighted_drop_target_background_color=
highlighted_drop_target_foreground_color=
highlighted_drop_target_bold=
current_sort_background_color=
current_sort_foreground_color=
current_sort_bold=
highlighted_current_sort_background_color=
highlighted_current_sort_foreground_color=
highlighted_current_sort_bold=
mouseover_background_color=
mouseover_foreground_color=
mouseover_bold=
mouseover_highlighted_background_color=
mouseover_highlighted_foreground_color=
mouseover_highlighted_bold=
current_sort_mouseover_background_color=
current_sort_mouseover_foreground_color=
current_sort_mouseover_bold=
mouseover_current_sort_highlighted_background_color=
mouseover_current_sort_highlighted_foreground_color=
mouseover_current_sort_highlighted_bold=
alternate_row_background_color=
alternate_row_foreground_color=
alternate_row_bold=
alternate_row_highlighted_background_color=
alternate_row_highlighted_foreground_color=
alternate_row_highlighted_bold=
current_sort_alternate_row_background_color=
current_sort_alternate_row_foreground_color=
current_sort_alternate_row_bold=
current_sort_alternate_row_highlighted_background_color=
current_sort_alternate_row_highlighted_foreground_color=
current_sort_alternate_row_highlighted_bold=

View File

@ -1,130 +1,153 @@
<?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>{230AE83F-E92E-4E69-8355-426B305DA9C0}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Wox.Plugin.Everything</RootNamespace>
<AssemblyName>Wox.Plugin.Everything</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\Wox\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.Everything\</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>..\..\Output\Release\Plugins\Wox.Plugin.Everything\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<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="Everything\Exceptions\CreateThreadException.cs" />
<Compile Include="Everything\Exceptions\CreateWindowException.cs" />
<Compile Include="Everything\EverythingAPI.cs" />
<Compile Include="Everything\Exceptions\MemoryErrorException.cs" />
<Compile Include="Everything\Exceptions\InvalidCallException.cs" />
<Compile Include="Everything\Exceptions\InvalidIndexException.cs" />
<Compile Include="Everything\Exceptions\IPCErrorException.cs" />
<Compile Include="Everything\Exceptions\RegisterClassExException.cs" />
<Compile Include="Everything\ResultType.cs" />
<Compile Include="Everything\SearchResult.cs" />
<Compile Include="ContextMenuStorage.cs" />
<Compile Include="Main.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Images\error.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Images\file.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Images\find.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Images\folder.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Images\image.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Images\warning.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="packages.config" />
<None Include="PortableEverything\Everything.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="x64\Everything.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="x86\Everything.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
<Name>Wox.Infrastructure</Name>
</ProjectReference>
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
<Name>Wox.Plugin</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<?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>{230AE83F-E92E-4E69-8355-426B305DA9C0}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Wox.Plugin.Everything</RootNamespace>
<AssemblyName>Wox.Plugin.Everything</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\Wox\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.Everything\</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>..\..\Output\Release\Plugins\Wox.Plugin.Everything\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Everything\Exceptions\CreateThreadException.cs" />
<Compile Include="Everything\Exceptions\CreateWindowException.cs" />
<Compile Include="Everything\EverythingAPI.cs" />
<Compile Include="Everything\Exceptions\MemoryErrorException.cs" />
<Compile Include="Everything\Exceptions\InvalidCallException.cs" />
<Compile Include="Everything\Exceptions\InvalidIndexException.cs" />
<Compile Include="Everything\Exceptions\IPCErrorException.cs" />
<Compile Include="Everything\Exceptions\RegisterClassExException.cs" />
<Compile Include="Everything\ResultType.cs" />
<Compile Include="Everything\SearchResult.cs" />
<Compile Include="ContextMenuStorage.cs" />
<Compile Include="Main.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Images\error.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Images\file.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Images\find.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Images\folder.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Images\image.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Images\warning.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="packages.config" />
<None Include="PortableEverything\Everything.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="x64\Everything.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="x86\Everything.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
<Name>Wox.Infrastructure</Name>
</ProjectReference>
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
<Name>Wox.Plugin</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Languages\en.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="Languages\zh-cn.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Languages\zh-tw.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<!-- 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>

View File

@ -1,6 +1,6 @@
{
"ID":"D2D2C23B084D411DB66FE0C79D6C2A6E",
"ActionKeyword":"f",
"ActionKeyword":"*",
"Name":"Everything",
"Description":"Search Everything",
"Author":"qianlifeng,orzfly",

View File

@ -9,20 +9,21 @@ using Control = System.Windows.Controls.Control;
namespace Wox.Plugin.Folder
{
public class FolderPlugin : IPlugin, ISettingProvider,IPluginI18n
public class FolderPlugin : IPlugin, ISettingProvider, IPluginI18n
{
private static List<string> driverNames;
private PluginInitContext context;
public Control CreateSettingPanel()
{
return new FileSystemSettings(context);
return new FileSystemSettings(context.API);
}
public void Init(PluginInitContext context)
{
this.context = context;
this.context.API.BackKeyDownEvent += ApiBackKeyDownEvent;
this.context.API.ResultItemDropEvent += API_ResultItemDropEvent;
InitialDriverList();
if (FolderStorage.Instance.FolderLinks == null)
{
@ -31,6 +32,38 @@ namespace Wox.Plugin.Folder
}
}
void API_ResultItemDropEvent(Result result, IDataObject dropObject, DragEventArgs e)
{
if (dropObject.GetDataPresent(DataFormats.FileDrop))
{
HanldeFilesDrop(result, dropObject);
}
e.Handled = true;
}
private void HanldeFilesDrop(Result targetResult, IDataObject dropObject)
{
List<string> files = ((string[])dropObject.GetData(DataFormats.FileDrop, false)).ToList();
context.API.ShowContextMenu(context.CurrentPluginMetadata, GetContextMenusForFileDrop(targetResult, files));
}
private static List<Result> GetContextMenusForFileDrop(Result targetResult, List<string> files)
{
List<Result> contextMenus = new List<Result>();
string folderPath = ((FolderLink) targetResult.ContextData).Path;
contextMenus.Add(new Result()
{
Title = "Copy to this folder",
IcoPath = "Images/copy.png",
Action = _ =>
{
MessageBox.Show("Copy");
return true;
}
});
return contextMenus;
}
private void ApiBackKeyDownEvent(WoxKeyDownEventArgs e)
{
string query = e.Query;
@ -78,7 +111,8 @@ namespace Wox.Plugin.Folder
}
context.API.ChangeQuery(item.Path);
return false;
}
},
ContextData = item
}).ToList();
if (driverNames != null && !driverNames.Any(input.StartsWith))
@ -92,9 +126,7 @@ namespace Wox.Plugin.Folder
results.AddRange(QueryInternal_Directory_Exists(input));
return results;
}
private void InitialDriverList()
} private void InitialDriverList()
{
if (driverNames == null)
{
@ -188,5 +220,15 @@ namespace Wox.Plugin.Folder
{
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
}
public string GetTranslatedPluginTitle()
{
return context.API.GetTranslation("wox_plugin_folder_plugin_name");
}
public string GetTranslatedPluginDescription()
{
return context.API.GetTranslation("wox_plugin_folder_plugin_description");
}
}
}

View File

@ -13,11 +13,11 @@ namespace Wox.Plugin.Folder
/// </summary>
public partial class FileSystemSettings : UserControl
{
PluginInitContext context;
private IPublicAPI woxAPI;
public FileSystemSettings(PluginInitContext context)
public FileSystemSettings(IPublicAPI woxAPI)
{
this.context = context;
this.woxAPI = woxAPI;
InitializeComponent();
lbxFolders.ItemsSource = FolderStorage.Instance.FolderLinks;
}
@ -27,7 +27,7 @@ namespace Wox.Plugin.Folder
var selectedFolder = lbxFolders.SelectedItem as FolderLink;
if (selectedFolder != null)
{
string msg = string.Format(context.API.GetTranslation("wox_plugin_folder_delete_folder_link"), selectedFolder.Path);
string msg = string.Format(woxAPI.GetTranslation("wox_plugin_folder_delete_folder_link"), selectedFolder.Path);
if (MessageBox.Show(msg, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
@ -37,7 +37,7 @@ namespace Wox.Plugin.Folder
}
else
{
string warning = context.API.GetTranslation("wox_plugin_folder_select_folder_link_warning");
string warning = woxAPI.GetTranslation("wox_plugin_folder_select_folder_link_warning");
MessageBox.Show(warning);
}
}
@ -61,7 +61,7 @@ namespace Wox.Plugin.Folder
}
else
{
string warning = context.API.GetTranslation("wox_plugin_folder_select_folder_link_warning");
string warning = woxAPI.GetTranslation("wox_plugin_folder_select_folder_link_warning");
MessageBox.Show(warning);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 898 B

View File

@ -8,5 +8,8 @@
<system:String x:Key="wox_plugin_folder_folder_path">Folder Path</system:String>
<system:String x:Key="wox_plugin_folder_select_folder_link_warning">Please select a folder link</system:String>
<system:String x:Key="wox_plugin_folder_delete_folder_link">Are your sure to delete {0}?</system:String>
<system:String x:Key="wox_plugin_folder_plugin_name">Folder</system:String>
<system:String x:Key="wox_plugin_folder_plugin_description">Open favorite folder from wox directorily</system:String>
</ResourceDictionary>

View File

@ -1,12 +1,15 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_folder_delete">删除</system:String>
<system:String x:Key="wox_plugin_folder_edit">编辑</system:String>
<system:String x:Key="wox_plugin_folder_add">添加</system:String>
<system:String x:Key="wox_plugin_folder_folder_path">文件夹路径</system:String>
<system:String x:Key="wox_plugin_folder_select_folder_link_warning">请选择一个文件夹</system:String>
<system:String x:Key="wox_plugin_folder_delete_folder_link">你确定要删除{0}吗?</system:String>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_folder_delete">删除</system:String>
<system:String x:Key="wox_plugin_folder_edit">编辑</system:String>
<system:String x:Key="wox_plugin_folder_add">添加</system:String>
<system:String x:Key="wox_plugin_folder_folder_path">文件夹路径</system:String>
<system:String x:Key="wox_plugin_folder_select_folder_link_warning">请选择一个文件夹</system:String>
<system:String x:Key="wox_plugin_folder_delete_folder_link">你确定要删除{0}吗?</system:String>
<system:String x:Key="wox_plugin_folder_plugin_name">文件夹</system:String>
<system:String x:Key="wox_plugin_folder_plugin_description">在Wox中直接打开收藏的文件夹</system:String>
</ResourceDictionary>

View File

@ -1,12 +1,15 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_folder_delete">刪除</system:String>
<system:String x:Key="wox_plugin_folder_edit">編輯</system:String>
<system:String x:Key="wox_plugin_folder_add">添加</system:String>
<system:String x:Key="wox_plugin_folder_folder_path">文件夾路徑</system:String>
<system:String x:Key="wox_plugin_folder_select_folder_link_warning">請選擇一個文件夾</system:String>
<system:String x:Key="wox_plugin_folder_delete_folder_link">你確認要刪除{0}嗎?</system:String>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_folder_delete">刪除</system:String>
<system:String x:Key="wox_plugin_folder_edit">編輯</system:String>
<system:String x:Key="wox_plugin_folder_add">添加</system:String>
<system:String x:Key="wox_plugin_folder_folder_path">文件夾路徑</system:String>
<system:String x:Key="wox_plugin_folder_select_folder_link_warning">請選擇一個文件夾</system:String>
<system:String x:Key="wox_plugin_folder_delete_folder_link">你確認要刪除{0}嗎?</system:String>
<system:String x:Key="wox_plugin_folder_plugin_name">文件夾</system:String>
<system:String x:Key="wox_plugin_folder_plugin_description">在Wox中直接打開收藏的文件夾</system:String>
</ResourceDictionary>

View File

@ -1,120 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<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')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{787B8AA6-CA93-4C84-96FE-DF31110AD1C4}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Wox.Plugin.Folder</RootNamespace>
<AssemblyName>Wox.Plugin.Folder</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.Folder\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\Release\Plugins\Wox.Plugin.Folder\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="FolderLink.cs" />
<Compile Include="FolderPlugin.cs" />
<Compile Include="FolderPluginSettings.xaml.cs">
<DependentUpon>FolderPluginSettings.xaml</DependentUpon>
</Compile>
<Compile Include="FolderStorage.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Page Include="FolderPluginSettings.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Content Include="Languages\en.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="Languages\zh-cn.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Languages\zh-tw.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
<Name>Wox.Infrastructure</Name>
</ProjectReference>
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
<Name>Wox.Plugin</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Images\folder.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<!-- 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>
-->
<?xml version="1.0" encoding="utf-8"?>
<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')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{787B8AA6-CA93-4C84-96FE-DF31110AD1C4}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Wox.Plugin.Folder</RootNamespace>
<AssemblyName>Wox.Plugin.Folder</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.Folder\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\Release\Plugins\Wox.Plugin.Folder\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="FolderLink.cs" />
<Compile Include="FolderPlugin.cs" />
<Compile Include="FolderPluginSettings.xaml.cs">
<DependentUpon>FolderPluginSettings.xaml</DependentUpon>
</Compile>
<Compile Include="FolderStorage.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Page Include="FolderPluginSettings.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<None Include="Images\copy.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="Languages\en.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="Languages\zh-cn.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Languages\zh-tw.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
<Name>Wox.Infrastructure</Name>
</ProjectReference>
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
<Name>Wox.Plugin</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Images\folder.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<!-- 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>

View File

@ -2,7 +2,7 @@
"ID":"B4D3B69656E14D44865C8D818EAE47C4",
"ActionKeyword":"*",
"Name":"Folder",
"Description":"Provide opening folder from wox directorily. You can add your favorite folders.",
"Description":"Open favorite folder from wox directorily",
"Author":"qianlifeng",
"Version":"1.0.0",
"Language":"csharp",

View File

@ -0,0 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_pluginindicator_plugin_name">Plugin Indicator</system:String>
<system:String x:Key="wox_plugin_pluginindicator_plugin_description">Provide plugin actionword suggestion</system:String>
</ResourceDictionary>

View File

@ -0,0 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_pluginindicator_plugin_name">插件关键词提示</system:String>
<system:String x:Key="wox_plugin_pluginindicator_plugin_description">提供插件关键词搜索提示</system:String>
</ResourceDictionary>

View File

@ -0,0 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_pluginindicator_plugin_name">插件關鍵詞提示</system:String>
<system:String x:Key="wox_plugin_pluginindicator_plugin_description">提供插件關鍵詞搜索提示</system:String>
</ResourceDictionary>

View File

@ -1,11 +1,13 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using Wox.Core.Plugin;
using Wox.Core.UserSettings;
namespace Wox.Plugin.PluginIndicator
{
public class PluginIndicator : IPlugin
public class PluginIndicator : IPlugin,IPluginI18n
{
private List<PluginPair> allPlugins = new List<PluginPair>();
private PluginInitContext context;
@ -15,7 +17,7 @@ namespace Wox.Plugin.PluginIndicator
List<Result> results = new List<Result>();
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))
@ -45,19 +47,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;
}
@ -65,5 +54,20 @@ namespace Wox.Plugin.PluginIndicator
{
this.context = context;
}
public string GetLanguagesFolder()
{
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
}
public string GetTranslatedPluginTitle()
{
return context.API.GetTranslation("wox_plugin_pluginindicator_plugin_name");
}
public string GetTranslatedPluginDescription()
{
return context.API.GetTranslation("wox_plugin_pluginindicator_plugin_description");
}
}
}

View File

@ -33,6 +33,7 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@ -68,6 +69,27 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="Languages\en.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="Languages\zh-cn.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Languages\zh-tw.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</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.

View File

@ -2,7 +2,7 @@
"ID":"6A122269676E40EB86EB543B945932B9",
"ActionKeyword":"*",
"Name":"Plugin Indicator",
"Description":"Provide plugin actionword suggestion.",
"Description":"Provide plugin actionword suggestion",
"Author":"qianlifeng",
"Version":"1.0.0",
"Language":"csharp",

View File

@ -0,0 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_plugin_management_plugin_name">Wox Plugin Management</system:String>
<system:String x:Key="wox_plugin_plugin_management_plugin_description">Install/Remove/Update wox plugins</system:String>
</ResourceDictionary>

View File

@ -0,0 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_plugin_management_plugin_name">Wox插件管理</system:String>
<system:String x:Key="wox_plugin_plugin_management_plugin_description">安装/卸载/更新Wox插件</system:String>
</ResourceDictionary>

View File

@ -0,0 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_plugin_management_plugin_name">Wox插件管理</system:String>
<system:String x:Key="wox_plugin_plugin_management_plugin_description">安裝/卸載/更新Wox插件</system:String>
</ResourceDictionary>

View File

@ -1,8 +1,10 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Windows.Forms;
@ -10,7 +12,7 @@ using Newtonsoft.Json;
namespace Wox.Plugin.PluginManagement
{
public class Main : IPlugin
public class Main : IPlugin,IPluginI18n
{
private static string APIBASE = "https://api.getwox.com";
private static string PluginConfigName = "plugin.json";
@ -233,7 +235,19 @@ namespace Wox.Plugin.PluginManagement
if (MessageBox.Show(content, "Wox", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
File.Create(Path.Combine(plugin.PluginDirectory, "NeedDelete.txt")).Close();
MessageBox.Show("This plugin has been removed, restart Wox to take effect");
if (MessageBox.Show(
"You have uninstalled plugin " + plugin.Name + " successfully.\r\n Restart Wox to take effect?",
"Install plugin",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
ProcessStartInfo Info = new ProcessStartInfo();
Info.Arguments = "/C ping 127.0.0.1 -n 1 && \"" + Application.ExecutablePath + "\"";
Info.WindowStyle = ProcessWindowStyle.Hidden;
Info.CreateNoWindow = true;
Info.FileName = "cmd.exe";
Process.Start(Info);
context.API.CloseApp();
}
}
}
@ -256,5 +270,20 @@ namespace Wox.Plugin.PluginManagement
{
this.context = context;
}
public string GetLanguagesFolder()
{
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
}
public string GetTranslatedPluginTitle()
{
return context.API.GetTranslation("wox_plugin_plugin_management_plugin_name");
}
public string GetTranslatedPluginDescription()
{
return context.API.GetTranslation("wox_plugin_plugin_management_plugin_description");
}
}
}

View File

@ -1,92 +1,114 @@
<?xml version="1.0" encoding="utf-8"?>
<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')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{049490F0-ECD2-4148-9B39-2135EC346EBE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Wox.Plugin.PluginManagement</RootNamespace>
<AssemblyName>Wox.Plugin.PluginManagement</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.PluginManagement\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\Release\Plugins\Wox.Plugin.PluginManagement\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="HttpRequest.cs" />
<Compile Include="Main.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WoxPluginResult.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
<Name>Wox.Plugin</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Images\plugin.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<?xml version="1.0" encoding="utf-8"?>
<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')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{049490F0-ECD2-4148-9B39-2135EC346EBE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Wox.Plugin.PluginManagement</RootNamespace>
<AssemblyName>Wox.Plugin.PluginManagement</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.PluginManagement\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\Release\Plugins\Wox.Plugin.PluginManagement\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="HttpRequest.cs" />
<Compile Include="Main.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WoxPluginResult.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
<Name>Wox.Plugin</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Images\plugin.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="Languages\en.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="Languages\zh-cn.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Languages\zh-tw.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<!-- 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>

View File

@ -2,7 +2,7 @@
"ID":"D2D2C23B084D422DB66FE0C79D6C2A6A",
"ActionKeyword":"wpm",
"Name":"Wox Plugin Management",
"Description":"Manage your plugins in Wox",
"Description":"Install/Remove/Update wox plugins",
"Author":"qianlifeng",
"Version":"1.0",
"Language":"csharp",

View File

@ -2,6 +2,7 @@
using System.Diagnostics;
using System.IO;
using System.Threading;
using Wox.Infrastructure;
namespace Wox.Plugin.Program
{
@ -15,7 +16,7 @@ namespace Wox.Plugin.Program
if (watchedPath.Contains(path)) return;
if (!Directory.Exists(path))
{
Debug.WriteLine(string.Format("FileChangeWatcher: {0} doesn't exist", path),"WoxDebug");
DebugHelper.WriteLine(string.Format("FileChangeWatcher: {0} doesn't exist", path));
return;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -19,5 +19,11 @@
<system:String x:Key="wox_plugin_program_split_by_tip">(Each suffix should split by ;)</system:String>
<system:String x:Key="wox_plugin_program_update_file_suffixes">Sucessfully update file suffixes</system:String>
<system:String x:Key="wox_plugin_program_suffixes_cannot_empty">File suffixes can't be empty</system:String>
<system:String x:Key="wox_plugin_program_run_as_administrator">Run As Administrator</system:String>
<system:String x:Key="wox_plugin_program_open_containing_folder">Open containing folder</system:String>
<system:String x:Key="wox_plugin_program_plugin_name">Program</system:String>
<system:String x:Key="wox_plugin_program_plugin_description">Search programs in Wox</system:String>
</ResourceDictionary>

View File

@ -1,24 +1,30 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<!--Program setting-->
<system:String x:Key="wox_plugin_program_delete">删除</system:String>
<system:String x:Key="wox_plugin_program_edit">编辑</system:String>
<system:String x:Key="wox_plugin_program_add">增加</system:String>
<system:String x:Key="wox_plugin_program_location">位置</system:String>
<system:String x:Key="wox_plugin_program_suffixes">索引文件后缀</system:String>
<system:String x:Key="wox_plugin_program_reindex">重新索引</system:String>
<system:String x:Key="wox_plugin_program_indexing">索引中</system:String>
<system:String x:Key="wox_plugin_program_pls_select_program_source">请先选择一项</system:String>
<system:String x:Key="wox_plugin_program_delete_program_source">你确定要删除{0}吗?</system:String>
<system:String x:Key="wox_plugin_program_update">更新</system:String>
<system:String x:Key="wox_plugin_program_only_index_tip">Wox仅索引下列后缀的文件</system:String>
<system:String x:Key="wox_plugin_program_split_by_tip">(每个后缀以英文状态下的分号分隔)</system:String>
<system:String x:Key="wox_plugin_program_update_file_suffixes">成功更新索引文件后缀</system:String>
<system:String x:Key="wox_plugin_program_suffixes_cannot_empty">文件后缀不能为空</system:String>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<!--Program setting-->
<system:String x:Key="wox_plugin_program_delete">删除</system:String>
<system:String x:Key="wox_plugin_program_edit">编辑</system:String>
<system:String x:Key="wox_plugin_program_add">增加</system:String>
<system:String x:Key="wox_plugin_program_location">位置</system:String>
<system:String x:Key="wox_plugin_program_suffixes">索引文件后缀</system:String>
<system:String x:Key="wox_plugin_program_reindex">重新索引</system:String>
<system:String x:Key="wox_plugin_program_indexing">索引中</system:String>
<system:String x:Key="wox_plugin_program_pls_select_program_source">请先选择一项</system:String>
<system:String x:Key="wox_plugin_program_delete_program_source">你确定要删除{0}吗?</system:String>
<system:String x:Key="wox_plugin_program_update">更新</system:String>
<system:String x:Key="wox_plugin_program_only_index_tip">Wox仅索引下列后缀的文件</system:String>
<system:String x:Key="wox_plugin_program_split_by_tip">(每个后缀以英文状态下的分号分隔)</system:String>
<system:String x:Key="wox_plugin_program_update_file_suffixes">成功更新索引文件后缀</system:String>
<system:String x:Key="wox_plugin_program_suffixes_cannot_empty">文件后缀不能为空</system:String>
<system:String x:Key="wox_plugin_program_run_as_administrator">以管理员身份运行</system:String>
<system:String x:Key="wox_plugin_program_open_containing_folder">打开所属文件夹</system:String>
<system:String x:Key="wox_plugin_program_plugin_name">程序</system:String>
<system:String x:Key="wox_plugin_program_plugin_description">在Wox中搜索程序</system:String>
</ResourceDictionary>

View File

@ -1,24 +1,29 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<!--Program setting-->
<system:String x:Key="wox_plugin_program_delete">刪除</system:String>
<system:String x:Key="wox_plugin_program_edit">編輯</system:String>
<system:String x:Key="wox_plugin_program_add">增加</system:String>
<system:String x:Key="wox_plugin_program_location">位置</system:String>
<system:String x:Key="wox_plugin_program_suffixes">索引文件後綴</system:String>
<system:String x:Key="wox_plugin_program_reindex">重新索引</system:String>
<system:String x:Key="wox_plugin_program_indexing">索引中</system:String>
<system:String x:Key="wox_plugin_program_pls_select_program_source">請先選擇一項</system:String>
<system:String x:Key="wox_plugin_program_delete_program_source">你確定要刪除{0}嗎?</system:String>
<system:String x:Key="wox_plugin_program_update">更新</system:String>
<system:String x:Key="wox_plugin_program_only_index_tip">Wox僅索引下列後綴的文件</system:String>
<system:String x:Key="wox_plugin_program_split_by_tip">(每個後綴以英文狀態下的分號分隔)</system:String>
<system:String x:Key="wox_plugin_program_update_file_suffixes">成功更新索引文件後綴</system:String>
<system:String x:Key="wox_plugin_program_suffixes_cannot_empty">文件後綴不能為空</system:String>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<!--Program setting-->
<system:String x:Key="wox_plugin_program_delete">刪除</system:String>
<system:String x:Key="wox_plugin_program_edit">編輯</system:String>
<system:String x:Key="wox_plugin_program_add">增加</system:String>
<system:String x:Key="wox_plugin_program_location">位置</system:String>
<system:String x:Key="wox_plugin_program_suffixes">索引文件後綴</system:String>
<system:String x:Key="wox_plugin_program_reindex">重新索引</system:String>
<system:String x:Key="wox_plugin_program_indexing">索引中</system:String>
<system:String x:Key="wox_plugin_program_pls_select_program_source">請先選擇一項</system:String>
<system:String x:Key="wox_plugin_program_delete_program_source">你確定要刪除{0}嗎?</system:String>
<system:String x:Key="wox_plugin_program_update">更新</system:String>
<system:String x:Key="wox_plugin_program_only_index_tip">Wox僅索引下列後綴的文件</system:String>
<system:String x:Key="wox_plugin_program_split_by_tip">(每個後綴以英文狀態下的分號分隔)</system:String>
<system:String x:Key="wox_plugin_program_update_file_suffixes">成功更新索引文件後綴</system:String>
<system:String x:Key="wox_plugin_program_suffixes_cannot_empty">文件後綴不能為空</system:String>
<system:String x:Key="wox_plugin_program_run_as_administrator">以管理員身份運行</system:String>
<system:String x:Key="wox_plugin_program_open_containing_folder">打開所屬文件夾</system:String>
<system:String x:Key="wox_plugin_program_plugin_name">程序</system:String>
<system:String x:Key="wox_plugin_program_plugin_description">在Wox中搜索程序</system:String>
</ResourceDictionary>

View File

@ -16,7 +16,8 @@ namespace Wox.Plugin.Program.ProgramSources
this.baseDirectory = baseDirectory;
}
public FileSystemProgramSource(ProgramSource source):this(source.Location)
public FileSystemProgramSource(ProgramSource source)
: this(source.Location)
{
this.BonusPoints = source.BonusPoints;
}
@ -50,17 +51,9 @@ namespace Wox.Plugin.Program.ProgramSources
GetAppFromDirectory(subDirectory, list);
}
}
catch (UnauthorizedAccessException e)
catch (Exception e)
{
Log.Warn(string.Format("Can't access to directory {0}", path));
}
catch (DirectoryNotFoundException e)
{
Log.Warn(string.Format("Directory {0} doesn't exist", path));
}
catch (PathTooLongException e)
{
Log.Warn(string.Format("File path too long: {0}", e.Message));
Log.Warn(string.Format("GetAppFromDirectory failed: {0} - {1}", path, e.Message));
}
}

View File

@ -9,10 +9,11 @@ using System.Windows;
using Wox.Infrastructure;
using Wox.Plugin.Program.ProgramSources;
using IWshRuntimeLibrary;
using Wox.Plugin.Features;
namespace Wox.Plugin.Program
{
public class Programs : ISettingProvider, IPlugin, IPluginI18n
public class Programs : ISettingProvider, IPlugin, IPluginI18n, IContextMenu
{
private static object lockObject = new object();
private static List<Program> programs = new List<Program>();
@ -38,46 +39,12 @@ namespace Wox.Plugin.Program
SubTitle = c.ExecutePath,
IcoPath = c.IcoPath,
Score = c.Score,
ContextData = c,
Action = (e) =>
{
context.API.HideApp();
context.API.ShellRun(c.ExecutePath);
return true;
},
ContextMenu = new List<Result>()
{
new Result()
{
Title = "Run As Administrator",
Action = _ =>
{
context.API.HideApp();
context.API.ShellRun(c.ExecutePath,true);
return true;
},
IcoPath = "Images/cmd.png"
},
new Result()
{
Title = "Open Containing Folder",
Action = _ =>
{
context.API.HideApp();
String Path=c.ExecutePath;
//check if shortcut
if (Path.EndsWith(".lnk"))
{
//get location of shortcut
Path = ResolveShortcut(Path);
}
//get parent folder
Path=System.IO.Directory.GetParent(Path).FullName;
//open the folder
context.API.ShellRun("explorer.exe "+Path,false);
return true;
},
IcoPath = "Images/folder.png"
}
}
}).ToList();
}
@ -85,8 +52,8 @@ namespace Wox.Plugin.Program
static string ResolveShortcut(string filePath)
{
// IWshRuntimeLibrary is in the COM library "Windows Script Host Object Model"
IWshRuntimeLibrary.WshShell shell = new IWshRuntimeLibrary.WshShell();
IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(filePath);
WshShell shell = new WshShell();
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(filePath);
return shortcut.TargetPath;
}
@ -103,17 +70,24 @@ namespace Wox.Plugin.Program
public void Init(PluginInitContext context)
{
this.context = context;
this.context.API.ResultItemDropEvent += API_ResultItemDropEvent;
using (new Timeit("Preload programs"))
{
programs = ProgramCacheStorage.Instance.Programs;
}
Debug.WriteLine(string.Format("Preload {0} programs from cache", programs.Count), "Wox");
DebugHelper.WriteLine(string.Format("Preload {0} programs from cache", programs.Count));
using (new Timeit("Program Index"))
{
IndexPrograms();
}
}
void API_ResultItemDropEvent(Result result, IDataObject dropObject, DragEventArgs e)
{
e.Handled = true;
}
public static void IndexPrograms()
{
lock (lockObject)
@ -216,5 +190,55 @@ namespace Wox.Plugin.Program
{
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
}
public string GetTranslatedPluginTitle()
{
return context.API.GetTranslation("wox_plugin_program_plugin_name");
}
public string GetTranslatedPluginDescription()
{
return context.API.GetTranslation("wox_plugin_program_plugin_description");
}
public List<Result> LoadContextMenus(Result selectedResult)
{
Program p = selectedResult.ContextData as Program;
List<Result> contextMenus = new List<Result>()
{
new Result()
{
Title = context.API.GetTranslation("wox_plugin_program_run_as_administrator"),
Action = _ =>
{
context.API.HideApp();
context.API.ShellRun(p.ExecutePath, true);
return true;
},
IcoPath = "Images/cmd.png"
},
new Result()
{
Title = context.API.GetTranslation("wox_plugin_program_open_containing_folder"),
Action = _ =>
{
context.API.HideApp();
String Path = p.ExecutePath;
//check if shortcut
if (Path.EndsWith(".lnk"))
{
//get location of shortcut
Path = ResolveShortcut(Path);
}
//get parent folder
Path = Directory.GetParent(Path).FullName;
//open the folder
context.API.ShellRun("explorer.exe " + Path, false);
return true;
},
IcoPath = "Images/folder.png"
}
};
return contextMenus;
}
}
}
}

View File

@ -1,150 +1,153 @@
<?xml version="1.0" encoding="utf-8"?>
<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')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{FDB3555B-58EF-4AE6-B5F1-904719637AB4}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Wox.Plugin.Program</RootNamespace>
<AssemblyName>Wox.Plugin.Program</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.Program\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\Release\Plugins\Wox.Plugin.Program\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="FileChangeWatcher.cs" />
<Compile Include="IProgramSource.cs" />
<Compile Include="Program.cs" />
<Compile Include="ProgramCacheStorage.cs" />
<Compile Include="Programs.cs" />
<Compile Include="ProgramSetting.xaml.cs">
<DependentUpon>ProgramSetting.xaml</DependentUpon>
</Compile>
<Compile Include="ProgramSource.cs" />
<Compile Include="ProgramSources\AppPathsProgramSource.cs" />
<Compile Include="ProgramSources\CommonStartMenuProgramSource.cs" />
<Compile Include="ProgramSources\FileSystemProgramSource.cs" />
<Compile Include="ProgramSources\UserStartMenuProgramSource.cs" />
<Compile Include="ProgramStorage.cs" />
<Compile Include="ProgramSuffixes.xaml.cs">
<DependentUpon>ProgramSuffixes.xaml</DependentUpon>
</Compile>
<Compile Include="StringEmptyConverter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Images\program.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Images\cmd.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="Languages\en.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="Languages\zh-cn.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Languages\zh-tw.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Page Include="ProgramSetting.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="ProgramSuffixes.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
<Name>Wox.Infrastructure</Name>
</ProjectReference>
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
<Name>Wox.Plugin</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<COMReference Include="IWshRuntimeLibrary">
<Guid>{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<?xml version="1.0" encoding="utf-8"?>
<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')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{FDB3555B-58EF-4AE6-B5F1-904719637AB4}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Wox.Plugin.Program</RootNamespace>
<AssemblyName>Wox.Plugin.Program</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.Program\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\Release\Plugins\Wox.Plugin.Program\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="FileChangeWatcher.cs" />
<Compile Include="IProgramSource.cs" />
<Compile Include="Program.cs" />
<Compile Include="ProgramCacheStorage.cs" />
<Compile Include="Programs.cs" />
<Compile Include="ProgramSetting.xaml.cs">
<DependentUpon>ProgramSetting.xaml</DependentUpon>
</Compile>
<Compile Include="ProgramSource.cs" />
<Compile Include="ProgramSources\AppPathsProgramSource.cs" />
<Compile Include="ProgramSources\CommonStartMenuProgramSource.cs" />
<Compile Include="ProgramSources\FileSystemProgramSource.cs" />
<Compile Include="ProgramSources\UserStartMenuProgramSource.cs" />
<Compile Include="ProgramStorage.cs" />
<Compile Include="ProgramSuffixes.xaml.cs">
<DependentUpon>ProgramSuffixes.xaml</DependentUpon>
</Compile>
<Compile Include="StringEmptyConverter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Images\program.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Images\cmd.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Images\folder.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="Languages\en.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="Languages\zh-cn.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Languages\zh-tw.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Page Include="ProgramSetting.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="ProgramSuffixes.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
<Name>Wox.Infrastructure</Name>
</ProjectReference>
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
<Name>Wox.Plugin</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<COMReference Include="IWshRuntimeLibrary">
<Guid>{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<!-- 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>

View File

@ -2,7 +2,7 @@
"ID":"791FC278BA414111B8D1886DFE447410",
"ActionKeyword":"*",
"Name":"Program",
"Description":"Provide programs search for Wox.",
"Description":"Search programs in Wox",
"Author":"qianlifeng",
"Version":"1.0.0",
"Language":"csharp",

View File

@ -34,8 +34,6 @@ namespace Wox.Plugin.QueryHistory
public void Init(PluginInitContext context)
{
this.context = context;
context.API.AfterWoxQueryEvent += API_AfterWoxQueryEvent;
context.API.BeforeWoxQueryEvent += API_BeforeWoxQueryEvent;
}
void API_BeforeWoxQueryEvent(WoxQueryEventArgs e)

View File

@ -11,5 +11,8 @@
<system:String x:Key="wox_plugin_sys_exit">Close Wox</system:String>
<system:String x:Key="wox_plugin_sys_restart">Restart Wox</system:String>
<system:String x:Key="wox_plugin_sys_setting">Tweak this app</system:String>
<system:String x:Key="wox_plugin_sys_plugin_name">System Commands</system:String>
<system:String x:Key="wox_plugin_sys_plugin_description">Provide System related commands. e.g. shutdown,lock,setting etc.</system:String>
</ResourceDictionary>

View File

@ -1,15 +1,18 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_sys_command">命令</system:String>
<system:String x:Key="wox_plugin_sys_desc">描述</system:String>
<system:String x:Key="wox_plugin_sys_shutdown_computer">关闭电脑</system:String>
<system:String x:Key="wox_plugin_sys_log_off">注销</system:String>
<system:String x:Key="wox_plugin_sys_lock">锁定这台电脑</system:String>
<system:String x:Key="wox_plugin_sys_exit">退出Wox</system:String>
<system:String x:Key="wox_plugin_sys_restart">重启Wox</system:String>
<system:String x:Key="wox_plugin_sys_setting">设置</system:String>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_sys_command">命令</system:String>
<system:String x:Key="wox_plugin_sys_desc">描述</system:String>
<system:String x:Key="wox_plugin_sys_shutdown_computer">关闭电脑</system:String>
<system:String x:Key="wox_plugin_sys_log_off">注销</system:String>
<system:String x:Key="wox_plugin_sys_lock">锁定这台电脑</system:String>
<system:String x:Key="wox_plugin_sys_exit">退出Wox</system:String>
<system:String x:Key="wox_plugin_sys_restart">重启Wox</system:String>
<system:String x:Key="wox_plugin_sys_setting">设置</system:String>
<system:String x:Key="wox_plugin_sys_plugin_name">系统命令</system:String>
<system:String x:Key="wox_plugin_sys_plugin_description">系统系统相关的命令。例如,关机,锁定,设置等</system:String>
</ResourceDictionary>

View File

@ -1,15 +1,18 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_sys_command">命令</system:String>
<system:String x:Key="wox_plugin_sys_desc">描述</system:String>
<system:String x:Key="wox_plugin_sys_shutdown_computer">關閉電腦</system:String>
<system:String x:Key="wox_plugin_sys_log_off">註銷</system:String>
<system:String x:Key="wox_plugin_sys_lock">鎖定這臺電腦</system:String>
<system:String x:Key="wox_plugin_sys_exit">退出Wox</system:String>
<system:String x:Key="wox_plugin_sys_restart">重啟Wox</system:String>
<system:String x:Key="wox_plugin_sys_setting">設置</system:String>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_sys_command">命令</system:String>
<system:String x:Key="wox_plugin_sys_desc">描述</system:String>
<system:String x:Key="wox_plugin_sys_shutdown_computer">關閉電腦</system:String>
<system:String x:Key="wox_plugin_sys_log_off">註銷</system:String>
<system:String x:Key="wox_plugin_sys_lock">鎖定這臺電腦</system:String>
<system:String x:Key="wox_plugin_sys_exit">退出Wox</system:String>
<system:String x:Key="wox_plugin_sys_restart">重啟Wox</system:String>
<system:String x:Key="wox_plugin_sys_setting">設置</system:String>
<system:String x:Key="wox_plugin_sys_plugin_name">系統命令</system:String>
<system:String x:Key="wox_plugin_sys_plugin_description">系統系統相關的命令。例如,關機,鎖定,設置等</system:String>
</ResourceDictionary>

View File

@ -4,6 +4,7 @@ using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Wox.Infrastructure;
namespace Wox.Plugin.Sys
{
@ -42,7 +43,7 @@ namespace Wox.Plugin.Sys
List<Result> results = new List<Result>();
foreach (Result availableResult in availableResults)
{
if (availableResult.Title.ToLower().StartsWith(query.Search.ToLower()))
if (StringMatcher.IsMatch(availableResult.Title, query.Search) || StringMatcher.IsMatch(availableResult.SubTitle, query.Search))
{
results.Add(availableResult);
}
@ -142,5 +143,15 @@ namespace Wox.Plugin.Sys
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
}
}
public string GetTranslatedPluginTitle()
{
return context.API.GetTranslation("wox_plugin_sys_plugin_name");
}
public string GetTranslatedPluginDescription()
{
return context.API.GetTranslation("wox_plugin_sys_plugin_description");
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -0,0 +1,11 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_url_open_url">Open url:{0}</system:String>
<system:String x:Key="wox_plugin_url_canot_open_url">Can't open url:{0}</system:String>
<system:String x:Key="wox_plugin_url_plugin_name">URL</system:String>
<system:String x:Key="wox_plugin_url_plugin_description">Open the typed URL from Wox</system:String>
</ResourceDictionary>

View File

@ -0,0 +1,11 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_url_open_url">打开链接:{0}</system:String>
<system:String x:Key="wox_plugin_url_canot_open_url">无法打开链接:{0}</system:String>
<system:String x:Key="wox_plugin_url_plugin_name">URL</system:String>
<system:String x:Key="wox_plugin_url_plugin_description">从Wox打开链接</system:String>
</ResourceDictionary>

View File

@ -0,0 +1,11 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_url_open_url">打開鏈接:{0}</system:String>
<system:String x:Key="wox_plugin_url_canot_open_url">無法打開鏈接:{0}</system:String>
<system:String x:Key="wox_plugin_url_plugin_name">URL</system:String>
<system:String x:Key="wox_plugin_url_plugin_description">從Wox打開鏈接</system:String>
</ResourceDictionary>

View File

@ -1,15 +1,17 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Windows;
namespace Wox.Plugin.Url
{
public class UrlPlugin : IPlugin
public class UrlPlugin : IPlugin, IPluginI18n
{
//based on https://gist.github.com/dperini/729294
private const string urlPattern ="^" +
private const string urlPattern = "^" +
// protocol identifier
"(?:(?:https?|ftp)://|)" +
// user:pass authentication
@ -42,6 +44,7 @@ namespace Wox.Plugin.Url
"(?:/\\S*)?" +
"$";
Regex reg = new Regex(urlPattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);
private PluginInitContext context;
public List<Result> Query(Query query)
{
@ -53,7 +56,7 @@ namespace Wox.Plugin.Url
new Result
{
Title = raw,
SubTitle = "Open " + raw,
SubTitle = string.Format(context.API.GetTranslation("wox_plugin_url_open_url"),raw),
IcoPath = "Images/url.png",
Score = 8,
Action = _ =>
@ -69,7 +72,7 @@ namespace Wox.Plugin.Url
}
catch(Exception ex)
{
MessageBox.Show(ex.Message, "Could not open " + raw);
context.API.ShowMsg(string.Format(context.API.GetTranslation("wox_plugin_url_canot_open_url"), raw));
return false;
}
}
@ -98,7 +101,22 @@ namespace Wox.Plugin.Url
public void Init(PluginInitContext context)
{
this.context = context;
}
public string GetLanguagesFolder()
{
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
}
public string GetTranslatedPluginTitle()
{
return context.API.GetTranslation("wox_plugin_url_plugin_name");
}
public string GetTranslatedPluginDescription()
{
return context.API.GetTranslation("wox_plugin_url_plugin_description");
}
}
}

View File

@ -64,6 +64,27 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="Languages\en.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="Languages\zh-cn.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Languages\zh-tw.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</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.

View File

@ -1,8 +1,8 @@
{
"ID":"0308FD86DE0A4DEE8D62B9B535370992",
"ActionKeyword":"*",
"Name":"URL handler",
"Description":"Provide Opening the typed URL from Wox.",
"Name":"URL",
"Description":"Open the typed URL from Wox",
"Author":"qianlifeng",
"Version":"1.0.0",
"Language":"csharp",

View File

@ -24,5 +24,8 @@
<system:String x:Key="wox_plugin_websearch_input_url">Please input URL</system:String>
<system:String x:Key="wox_plugin_websearch_action_keyword_exist">ActionWord has existed, please input a new one</system:String>
<system:String x:Key="wox_plugin_websearch_succeed">Succeed</system:String>
<system:String x:Key="wox_plugin_websearch_plugin_name">Web Searches</system:String>
<system:String x:Key="wox_plugin_websearch_plugin_description">Provide the web search ability</system:String>
</ResourceDictionary>

View File

@ -1,28 +1,31 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_websearch_delete">删除</system:String>
<system:String x:Key="wox_plugin_websearch_edit">编辑</system:String>
<system:String x:Key="wox_plugin_websearch_add">添加</system:String>
<system:String x:Key="wox_plugin_websearch_action_keyword">触发关键字</system:String>
<system:String x:Key="wox_plugin_websearch_url">URL</system:String>
<system:String x:Key="wox_plugin_websearch_enable_suggestion">启用搜索建议</system:String>
<system:String x:Key="wox_plugin_websearch_pls_select_web_search">请选择一项</system:String>
<system:String x:Key="wox_plugin_websearch_delete_warning">你确定要删除 {0} 吗?</system:String>
<!--web search edit-->
<system:String x:Key="wox_plugin_websearch_title">标题</system:String>
<system:String x:Key="wox_plugin_websearch_enable">启用</system:String>
<system:String x:Key="wox_plugin_websearch_icon">图标</system:String>
<system:String x:Key="wox_plugin_websearch_select_icon">选择图标</system:String>
<system:String x:Key="wox_plugin_websearch_cancel">取消</system:String>
<system:String x:Key="wox_plugin_websearch_invalid_web_search">非法的网页搜索</system:String>
<system:String x:Key="wox_plugin_websearch_input_title">请输入标题</system:String>
<system:String x:Key="wox_plugin_websearch_input_action_keyword">请输入触发关键字</system:String>
<system:String x:Key="wox_plugin_websearch_input_url">请输入URL</system:String>
<system:String x:Key="wox_plugin_websearch_action_keyword_exist">触发关键字已经存在,请选择一个新的关键字</system:String>
<system:String x:Key="wox_plugin_websearch_succeed">操作成功</system:String>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_websearch_delete">删除</system:String>
<system:String x:Key="wox_plugin_websearch_edit">编辑</system:String>
<system:String x:Key="wox_plugin_websearch_add">添加</system:String>
<system:String x:Key="wox_plugin_websearch_action_keyword">触发关键字</system:String>
<system:String x:Key="wox_plugin_websearch_url">URL</system:String>
<system:String x:Key="wox_plugin_websearch_enable_suggestion">启用搜索建议</system:String>
<system:String x:Key="wox_plugin_websearch_pls_select_web_search">请选择一项</system:String>
<system:String x:Key="wox_plugin_websearch_delete_warning">你确定要删除 {0} 吗?</system:String>
<!--web search edit-->
<system:String x:Key="wox_plugin_websearch_title">标题</system:String>
<system:String x:Key="wox_plugin_websearch_enable">启用</system:String>
<system:String x:Key="wox_plugin_websearch_icon">图标</system:String>
<system:String x:Key="wox_plugin_websearch_select_icon">选择图标</system:String>
<system:String x:Key="wox_plugin_websearch_cancel">取消</system:String>
<system:String x:Key="wox_plugin_websearch_invalid_web_search">非法的网页搜索</system:String>
<system:String x:Key="wox_plugin_websearch_input_title">请输入标题</system:String>
<system:String x:Key="wox_plugin_websearch_input_action_keyword">请输入触发关键字</system:String>
<system:String x:Key="wox_plugin_websearch_input_url">请输入URL</system:String>
<system:String x:Key="wox_plugin_websearch_action_keyword_exist">触发关键字已经存在,请选择一个新的关键字</system:String>
<system:String x:Key="wox_plugin_websearch_succeed">操作成功</system:String>
<system:String x:Key="wox_plugin_websearch_plugin_name">网页搜索</system:String>
<system:String x:Key="wox_plugin_websearch_plugin_description">提供网页搜索能力</system:String>
</ResourceDictionary>

View File

@ -1,28 +1,31 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_websearch_delete">刪除</system:String>
<system:String x:Key="wox_plugin_websearch_edit">編輯</system:String>
<system:String x:Key="wox_plugin_websearch_add">添加</system:String>
<system:String x:Key="wox_plugin_websearch_action_keyword">觸發關鍵字</system:String>
<system:String x:Key="wox_plugin_websearch_url">URL</system:String>
<system:String x:Key="wox_plugin_websearch_enable_suggestion">啟用搜索建議</system:String>
<system:String x:Key="wox_plugin_websearch_pls_select_web_search">請選擇一項</system:String>
<system:String x:Key="wox_plugin_websearch_delete_warning">你確定要刪除 {0} 嗎?</system:String>
<!--web search edit-->
<system:String x:Key="wox_plugin_websearch_title">標題</system:String>
<system:String x:Key="wox_plugin_websearch_enable">啟用</system:String>
<system:String x:Key="wox_plugin_websearch_icon">圖標</system:String>
<system:String x:Key="wox_plugin_websearch_select_icon">選擇圖標</system:String>
<system:String x:Key="wox_plugin_websearch_cancel">取消</system:String>
<system:String x:Key="wox_plugin_websearch_invalid_web_search">非法的網頁搜索</system:String>
<system:String x:Key="wox_plugin_websearch_input_title">請輸入標題</system:String>
<system:String x:Key="wox_plugin_websearch_input_action_keyword">請輸入觸發關鍵字</system:String>
<system:String x:Key="wox_plugin_websearch_input_url">請輸入URL</system:String>
<system:String x:Key="wox_plugin_websearch_action_keyword_exist">觸發關鍵字已經存在,請選擇一個新的關鍵字</system:String>
<system:String x:Key="wox_plugin_websearch_succeed">操作成功</system:String>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_websearch_delete">刪除</system:String>
<system:String x:Key="wox_plugin_websearch_edit">編輯</system:String>
<system:String x:Key="wox_plugin_websearch_add">添加</system:String>
<system:String x:Key="wox_plugin_websearch_action_keyword">觸發關鍵字</system:String>
<system:String x:Key="wox_plugin_websearch_url">URL</system:String>
<system:String x:Key="wox_plugin_websearch_enable_suggestion">啟用搜索建議</system:String>
<system:String x:Key="wox_plugin_websearch_pls_select_web_search">請選擇一項</system:String>
<system:String x:Key="wox_plugin_websearch_delete_warning">你確定要刪除 {0} 嗎?</system:String>
<!--web search edit-->
<system:String x:Key="wox_plugin_websearch_title">標題</system:String>
<system:String x:Key="wox_plugin_websearch_enable">啟用</system:String>
<system:String x:Key="wox_plugin_websearch_icon">圖標</system:String>
<system:String x:Key="wox_plugin_websearch_select_icon">選擇圖標</system:String>
<system:String x:Key="wox_plugin_websearch_cancel">取消</system:String>
<system:String x:Key="wox_plugin_websearch_invalid_web_search">非法的網頁搜索</system:String>
<system:String x:Key="wox_plugin_websearch_input_title">請輸入標題</system:String>
<system:String x:Key="wox_plugin_websearch_input_action_keyword">請輸入觸發關鍵字</system:String>
<system:String x:Key="wox_plugin_websearch_input_url">請輸入URL</system:String>
<system:String x:Key="wox_plugin_websearch_action_keyword_exist">觸發關鍵字已經存在,請選擇一個新的關鍵字</system:String>
<system:String x:Key="wox_plugin_websearch_succeed">操作成功</system:String>
<system:String x:Key="wox_plugin_websearch_plugin_name">網頁搜索</system:String>
<system:String x:Key="wox_plugin_websearch_plugin_description">提供網頁搜索能力</system:String>
</ResourceDictionary>

View File

@ -5,17 +5,22 @@ using System.IO;
using System.Linq;
using System.Reflection;
using Wox.Core.UserSettings;
using Wox.Plugin.Features;
using Wox.Plugin.WebSearch.SuggestionSources;
namespace Wox.Plugin.WebSearch
{
public class WebSearchPlugin : IPlugin, ISettingProvider, IPluginI18n, IInstantSearch
public class WebSearchPlugin : IPlugin, ISettingProvider, IPluginI18n, IInstantQuery, IExclusiveQuery
{
private PluginInitContext context;
public List<Result> Query(Query query)
{
List<Result> results = new List<Result>();
if (!query.Search.Contains(' '))
{
return results;
}
WebSearch webSearch =
WebSearchStorage.Instance.WebSearches.FirstOrDefault(o => o.ActionWord == query.FirstSearch.Trim() && o.Enabled);
@ -98,15 +103,29 @@ namespace Wox.Plugin.WebSearch
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
}
public bool IsInstantSearch(string query)
public string GetTranslatedPluginTitle()
{
return context.API.GetTranslation("wox_plugin_websearch_plugin_name");
}
public string GetTranslatedPluginDescription()
{
return context.API.GetTranslation("wox_plugin_websearch_plugin_description");
}
public bool IsInstantQuery(string query)
{
var strings = query.Split(' ');
if (strings.Length > 1)
{
return WebSearchStorage.Instance.EnableWebSearchSuggestion &&
WebSearchStorage.Instance.WebSearches.Exists(o => o.ActionWord == strings[0] && o.Enabled);
return WebSearchStorage.Instance.WebSearches.Exists(o => o.ActionWord == strings[0] && o.Enabled);
}
return false;
}
public bool IsExclusiveQuery(Query query)
{
return IsInstantQuery(query.RawQuery);
}
}
}

View File

@ -1,147 +1,150 @@
<?xml version="1.0" encoding="utf-8"?>
<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')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{403B57F2-1856-4FC7-8A24-36AB346B763E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Wox.Plugin.WebSearch</RootNamespace>
<AssemblyName>Wox.Plugin.WebSearch</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.WebSearch\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\Release\Plugins\Wox.Plugin.WebSearch\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SuggestionSources\Baidu.cs" />
<Compile Include="SuggestionSources\Google.cs" />
<Compile Include="SuggestionSources\ISuggestionSource.cs" />
<Compile Include="SuggestionSources\SuggestionSourceFactory.cs" />
<Compile Include="WebSearch.cs" />
<Compile Include="WebSearchesSetting.xaml.cs">
<DependentUpon>WebSearchesSetting.xaml</DependentUpon>
</Compile>
<Compile Include="WebSearchPlugin.cs" />
<Compile Include="WebSearchSetting.xaml.cs">
<DependentUpon>WebSearchSetting.xaml</DependentUpon>
</Compile>
<Compile Include="WebSearchStorage.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Languages\en.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="Languages\zh-cn.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Languages\zh-tw.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Page Include="WebSearchesSetting.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="WebSearchSetting.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Wox.Core\Wox.Core.csproj">
<Project>{B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}</Project>
<Name>Wox.Core</Name>
</ProjectReference>
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
<Name>Wox.Infrastructure</Name>
</ProjectReference>
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
<Name>Wox.Plugin</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Images\web_search.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Images\websearch\google.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Images\websearch\wiki.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<?xml version="1.0" encoding="utf-8"?>
<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')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{403B57F2-1856-4FC7-8A24-36AB346B763E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Wox.Plugin.WebSearch</RootNamespace>
<AssemblyName>Wox.Plugin.WebSearch</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.WebSearch\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\Release\Plugins\Wox.Plugin.WebSearch\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SuggestionSources\Baidu.cs" />
<Compile Include="SuggestionSources\Google.cs" />
<Compile Include="SuggestionSources\ISuggestionSource.cs" />
<Compile Include="SuggestionSources\SuggestionSourceFactory.cs" />
<Compile Include="WebSearch.cs" />
<Compile Include="WebSearchesSetting.xaml.cs">
<DependentUpon>WebSearchesSetting.xaml</DependentUpon>
</Compile>
<Compile Include="WebQueryPlugin.cs" />
<Compile Include="WebSearchSetting.xaml.cs">
<DependentUpon>WebSearchSetting.xaml</DependentUpon>
</Compile>
<Compile Include="WebSearchStorage.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Images\websearch\pictures.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="Languages\en.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="Languages\zh-cn.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Languages\zh-tw.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Page Include="WebSearchesSetting.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="WebSearchSetting.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Wox.Core\Wox.Core.csproj">
<Project>{B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}</Project>
<Name>Wox.Core</Name>
</ProjectReference>
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
<Name>Wox.Infrastructure</Name>
</ProjectReference>
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
<Name>Wox.Plugin</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Images\web_search.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Images\websearch\google.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Images\websearch\wiki.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<!-- 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>

View File

@ -2,7 +2,7 @@
"ID":"565B73353DBF4806919830B9202EE3BF",
"ActionKeyword":"*",
"Name":"Web Searches",
"Description":"Provide the web search ability.",
"Description":"Provide the web search ability",
"Author":"qianlifeng",
"Version":"1.0.0",
"Language":"csharp",

View File

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Wox.Core.Plugin;
using Wox.Infrastructure.Logger;
using Wox.Plugin;
namespace Wox.Core
{
internal class AssemblyHelper
{
public static List<KeyValuePair<PluginPair, T>> LoadPluginInterfaces<T>() where T : class
{
List<KeyValuePair<PluginPair, T>> results = new List<KeyValuePair<PluginPair, T>>();
foreach (PluginPair pluginPair in PluginManager.AllPlugins)
{
//need to load types from AllPlugins
//PluginInitContext is only available in this instance
T type = pluginPair.Plugin as T;
if (type != null)
{
results.Add(new KeyValuePair<PluginPair, T>(pluginPair,type));
}
}
return results;
}
public static List<T> LoadInterfacesFromAppDomain<T>() where T : class
{
var interfaceObjects = AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(s => s.GetTypes())
.Where(p => p.IsClass && !p.IsAbstract && p.GetInterfaces().Contains(typeof(T)));
return interfaceObjects.Select(interfaceObject => (T) Activator.CreateInstance(interfaceObject)).ToList();
}
}
}

View File

@ -8,6 +8,7 @@ using System.Windows.Forms;
using Newtonsoft.Json;
using Wox.Infrastructure.Logger;
using Wox.Plugin;
using Wox.Core.Exception;
namespace Wox.Core.Plugin
{
@ -83,7 +84,7 @@ namespace Wox.Core.Plugin
private void ExecuteWoxAPI(string method, object[] parameters)
{
MethodInfo methodInfo = PluginManager.API.GetType().GetMethod(method);
if (methodInfo != null)
if (methodInfo != null)
{
try
{
@ -141,8 +142,7 @@ namespace Wox.Core.Plugin
string error = errorReader.ReadToEnd();
if (!string.IsNullOrEmpty(error))
{
//todo:
// ErrorReporting.TryShowErrorMessageBox(error, new WoxJsonRPCException(error));
throw new WoxJsonRPCException(error);
}
}
}
@ -151,9 +151,9 @@ namespace Wox.Core.Plugin
}
}
}
catch
catch(System.Exception e)
{
return null;
throw new WoxJsonRPCException(e.Message);
}
return null;
}

View File

@ -78,7 +78,6 @@ namespace Wox.Core.Plugin
try
{
metadata = JsonConvert.DeserializeObject<PluginMetadata>(File.ReadAllText(configPath));
metadata.PluginType = PluginType.User;
metadata.PluginDirectory = pluginDirectory;
}
catch (System.Exception)

View File

@ -112,7 +112,6 @@ namespace Wox.Core.Plugin
try
{
metadata = JsonConvert.DeserializeObject<PluginMetadata>(File.ReadAllText(configPath));
metadata.PluginType = PluginType.User;
metadata.PluginDirectory = pluginDirectory;
}
catch (System.Exception)

View File

@ -1,16 +1,19 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using Wox.Core.Exception;
using Wox.Core.i18n;
using Wox.Core.UI;
using Wox.Core.UserSettings;
using Wox.Infrastructure;
using Wox.Infrastructure.Http;
using Wox.Infrastructure.Logger;
using Wox.Plugin;
using Wox.Plugin.Features;
namespace Wox.Core.Plugin
{
@ -21,8 +24,9 @@ namespace Wox.Core.Plugin
{
public const string ActionKeywordWildcardSign = "*";
private static List<PluginMetadata> pluginMetadatas;
private static List<IInstantSearch> instantSearches = new List<IInstantSearch>();
private static List<KeyValuePair<PluginPair, IInstantQuery>> instantSearches;
private static List<KeyValuePair<PluginPair, IExclusiveQuery>> exclusiveSearchPlugins;
private static List<KeyValuePair<PluginPair, IContextMenu>> contextMenuPlugins;
public static String DebuggerMode { get; private set; }
public static IPublicAPI API { get; private set; }
@ -86,19 +90,25 @@ namespace Wox.Core.Plugin
PluginPair pair = pluginPair;
ThreadPool.QueueUserWorkItem(o =>
{
using (new Timeit(string.Format("Init {0}", pair.Metadata.Name)))
Stopwatch sw = new Stopwatch();
sw.Start();
pair.Plugin.Init(new PluginInitContext()
{
pair.Plugin.Init(new PluginInitContext()
{
CurrentPluginMetadata = pair.Metadata,
Proxy = HttpProxy.Instance,
API = API
});
}
CurrentPluginMetadata = pair.Metadata,
Proxy = HttpProxy.Instance,
API = API
});
sw.Stop();
DebugHelper.WriteLine(string.Format("Plugin init:{0} - {1}", pair.Metadata.Name, sw.ElapsedMilliseconds));
pair.InitTime = sw.ElapsedMilliseconds;
InternationalizationManager.Instance.UpdatePluginMetadataTranslations(pair);
});
}
LoadInstantSearches();
ThreadPool.QueueUserWorkItem(o =>
{
LoadInstantSearches();
});
}
public static void InstallPlugin(string path)
@ -110,6 +120,7 @@ namespace Wox.Core.Plugin
{
if (!string.IsNullOrEmpty(query.RawQuery.Trim()))
{
query.Search = IsActionKeywordQuery(query) ? query.RawQuery.Substring(query.RawQuery.IndexOf(' ') + 1) : query.RawQuery;
QueryDispatcher.QueryDispatcher.Dispatch(query);
}
}
@ -122,19 +133,36 @@ namespace Wox.Core.Plugin
}
}
public static bool IsUserPluginQuery(Query query)
/// <summary>
/// Check if a query contains valid action keyword
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public static bool IsActionKeywordQuery(Query query)
{
if (string.IsNullOrEmpty(query.RawQuery)) return false;
var strings = query.RawQuery.Split(' ');
if(strings.Length == 1) return false;
if (strings.Length == 1) return false;
var actionKeyword = strings[0].Trim();
if (string.IsNullOrEmpty(actionKeyword)) return false;
return plugins.Any(o => o.Metadata.PluginType == PluginType.User && o.Metadata.ActionKeyword == actionKeyword);
PluginPair pair = plugins.FirstOrDefault(o => o.Metadata.ActionKeyword == actionKeyword);
if (pair != null)
{
var customizedPluginConfig = UserSettingStorage.Instance.CustomizedPluginConfigs.FirstOrDefault(o => o.ID == pair.Metadata.ID);
if (customizedPluginConfig != null && customizedPluginConfig.Disabled)
{
return false;
}
return true;
}
return false;
}
public static bool IsSystemPlugin(PluginMetadata metadata)
public static bool IsGenericPlugin(PluginMetadata metadata)
{
return metadata.ActionKeyword == ActionKeywordWildcardSign;
}
@ -144,42 +172,53 @@ namespace Wox.Core.Plugin
DebuggerMode = path;
}
public static bool IsInstantSearch(string query)
public static bool IsInstantQuery(string query)
{
return LoadInstantSearches().Any(o => o.IsInstantSearch(query));
return LoadInstantSearches().Any(o => o.Value.IsInstantQuery(query));
}
private static List<IInstantSearch> LoadInstantSearches()
public static bool IsInstantSearchPlugin(PluginMetadata pluginMetadata)
{
if (instantSearches.Count > 0) return instantSearches;
List<PluginMetadata> CSharpPluginMetadatas = pluginMetadatas.Where(o => o.Language.ToUpper() == AllowedLanguage.CSharp.ToUpper()).ToList();
//todo:to improve performance, any instant search plugin that takes long than 200ms will not consider a instant plugin anymore
return pluginMetadata.Language.ToUpper() == AllowedLanguage.CSharp &&
LoadInstantSearches().Any(o => o.Key.Metadata.ID == pluginMetadata.ID);
}
foreach (PluginMetadata metadata in CSharpPluginMetadatas)
internal static void ExecutePluginQuery(PluginPair pair, Query query)
{
try
{
try
Stopwatch sw = new Stopwatch();
sw.Start();
List<Result> results = pair.Plugin.Query(query) ?? new List<Result>();
results.ForEach(o =>
{
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();
if (types.Count == 0)
{
continue;
}
foreach (Type type in types)
{
instantSearches.Add(Activator.CreateInstance(type) as IInstantSearch);
}
}
catch (System.Exception e)
o.PluginID = pair.Metadata.ID;
});
sw.Stop();
DebugHelper.WriteLine(string.Format("Plugin query: {0} - {1}", pair.Metadata.Name, sw.ElapsedMilliseconds));
pair.QueryCount += 1;
if (pair.QueryCount == 1)
{
Log.Error(string.Format("Couldn't load plugin {0}: {1}", metadata.Name, e.Message));
#if (DEBUG)
{
throw;
}
#endif
pair.AvgQueryTime = sw.ElapsedMilliseconds;
}
else
{
pair.AvgQueryTime = (pair.AvgQueryTime + sw.ElapsedMilliseconds) / 2;
}
API.PushResults(query, pair.Metadata, results);
}
catch (System.Exception e)
{
throw new WoxPluginException(pair.Metadata.Name, e);
}
}
private static List<KeyValuePair<PluginPair, IInstantQuery>> LoadInstantSearches()
{
if (instantSearches != null) return instantSearches;
instantSearches = AssemblyHelper.LoadPluginInterfaces<IInstantQuery>();
return instantSearches;
}
@ -193,5 +232,73 @@ namespace Wox.Core.Plugin
{
return AllPlugins.FirstOrDefault(o => o.Metadata.ID == id);
}
internal static List<KeyValuePair<PluginPair, IExclusiveQuery>> LoadExclusiveSearchPlugins()
{
if (exclusiveSearchPlugins != null) return exclusiveSearchPlugins;
exclusiveSearchPlugins = AssemblyHelper.LoadPluginInterfaces<IExclusiveQuery>();
return exclusiveSearchPlugins;
}
internal static PluginPair GetExclusivePlugin(Query query)
{
KeyValuePair<PluginPair, IExclusiveQuery> plugin = LoadExclusiveSearchPlugins().FirstOrDefault(o => o.Value.IsExclusiveQuery((query)));
return plugin.Key;
}
internal static PluginPair GetActionKeywordPlugin(Query query)
{
//if a query doesn't contain at least one space, it should not be a action keword plugin query
if (!query.RawQuery.Contains(" ")) return null;
PluginPair actionKeywordPluginPair = AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeyword == query.GetActionKeyword());
if (actionKeywordPluginPair != null)
{
var customizedPluginConfig = UserSettingStorage.Instance.
CustomizedPluginConfigs.FirstOrDefault(o => o.ID == actionKeywordPluginPair.Metadata.ID);
if (customizedPluginConfig != null && customizedPluginConfig.Disabled)
{
return null;
}
return actionKeywordPluginPair;
}
return null;
}
internal static bool IsExclusivePluginQuery(Query query)
{
return GetExclusivePlugin(query) != null || GetActionKeywordPlugin(query) != null;
}
public static List<Result> GetPluginContextMenus(Result result)
{
List<Result> contextContextMenus = new List<Result>();
if (contextMenuPlugins == null)
{
contextMenuPlugins = AssemblyHelper.LoadPluginInterfaces<IContextMenu>();
}
var contextMenuPlugin = contextMenuPlugins.FirstOrDefault(o => o.Key.Metadata.ID == result.PluginID);
if (contextMenuPlugin.Value != null)
{
try
{
return contextMenuPlugin.Value.LoadContextMenus(result);
}
catch (System.Exception e)
{
Log.Error(string.Format("Couldn't load plugin context menus {0}: {1}", contextMenuPlugin.Key.Metadata.Name, e.Message));
#if (DEBUG)
{
throw;
}
#endif
}
}
return contextContextMenus;
}
}
}

View File

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using Wox.Infrastructure;
using Wox.Plugin;
namespace Wox.Core.Plugin.QueryDispatcher
{
public abstract class BaseQueryDispatcher : IQueryDispatcher
{
protected abstract List<PluginPair> GetPlugins(Query query);
public void Dispatch(Query query)
{
foreach (PluginPair pair in GetPlugins(query))
{
PluginPair localPair = pair;
if (query.IsIntantQuery && PluginManager.IsInstantSearchPlugin(pair.Metadata))
{
DebugHelper.WriteLine(string.Format("Plugin {0} is executing instant search.", pair.Metadata.Name));
using (new Timeit(" => instant search took: "))
{
PluginManager.ExecutePluginQuery(localPair, query);
}
}
else
{
ThreadPool.QueueUserWorkItem(state =>
{
PluginManager.ExecutePluginQuery(localPair, query);
});
}
}
}
}
}

View 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;
}
}
}

View File

@ -0,0 +1,18 @@
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 GenericQueryDispatcher : BaseQueryDispatcher
{
protected override List<PluginPair> GetPlugins(Query query)
{
return PluginManager.AllPlugins.Where(o => PluginManager.IsGenericPlugin(o.Metadata)).ToList();
}
}
}

View File

@ -1,22 +1,23 @@

using System.Threading;
using Wox.Plugin;
namespace Wox.Core.Plugin.QueryDispatcher
{
internal static class QueryDispatcher
{
private static readonly IQueryDispatcher UserPluginDispatcher = new UserPluginQueryDispatcher();
private static readonly IQueryDispatcher SystemPluginDispatcher = new SystemPluginQueryDispatcher();
private static readonly IQueryDispatcher exclusivePluginDispatcher = new ExclusiveQueryDispatcher();
private static readonly IQueryDispatcher genericQueryDispatcher = new GenericQueryDispatcher();
public static void Dispatch(Wox.Plugin.Query query)
public static void Dispatch(Query query)
{
if (PluginManager.IsUserPluginQuery(query))
if (PluginManager.IsExclusivePluginQuery(query))
{
query.Search = query.RawQuery.Substring(query.RawQuery.IndexOf(' ') + 1);
UserPluginDispatcher.Dispatch(query);
exclusivePluginDispatcher.Dispatch(query);
}
else
{
query.Search = query.RawQuery;
SystemPluginDispatcher.Dispatch(query);
genericQueryDispatcher.Dispatch(query);
}
}
}

View File

@ -1,41 +0,0 @@
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 SystemPluginQueryDispatcher : IQueryDispatcher
{
private IEnumerable<PluginPair> allSytemPlugins = PluginManager.AllPlugins.Where(o => PluginManager.IsSystemPlugin(o.Metadata));
public void Dispatch(Query query)
{
var queryPlugins = allSytemPlugins;
foreach (PluginPair pair in queryPlugins)
{
PluginPair pair1 = pair;
ThreadPool.QueueUserWorkItem(state =>
{
try
{
List<Result> results = pair1.Plugin.Query(query);
results.ForEach(o =>
{
o.PluginID = pair1.Metadata.ID;
});
PluginManager.API.PushResults(query, pair1.Metadata, results);
}
catch (System.Exception e)
{
throw new WoxPluginException(pair1.Metadata.Name,e);
}
});
}
}
}
}

View File

@ -1,46 +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 : IQueryDispatcher
{
public void Dispatch(Query query)
{
PluginPair userPlugin = PluginManager.AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeyword == query.GetActionKeyword());
if (userPlugin != null && !string.IsNullOrEmpty(userPlugin.Metadata.ActionKeyword))
{
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();
return;
}
ThreadPool.QueueUserWorkItem(t =>
{
try
{
List<Result> results = userPlugin.Plugin.Query(query) ?? new List<Result>();
results.ForEach(o =>
{
o.PluginID = userPlugin.Metadata.ID;
});
PluginManager.API.PushResults(query, userPlugin.Metadata, results);
}
catch (System.Exception e)
{
throw new WoxPluginException(userPlugin.Metadata.Name, e);
}
});
}
}
}
}

View File

@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using Wox.Core.i18n;
using Wox.Core.Plugin;
using Wox.Core.Theme;
using Wox.Plugin;
@ -9,38 +11,28 @@ namespace Wox.Core.UI
{
public class ResourceMerger
{
public static void ApplyResources()
internal static void ApplyResources()
{
Application.Current.Resources.MergedDictionaries.Clear();
ApplyPluginLanguages();
ApplyThemeAndLanguageResources();
}
private static void ApplyThemeAndLanguageResources()
internal static void ApplyThemeAndLanguageResources()
{
var UIResourceType = typeof(IUIResource);
var UIResources = AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(s => s.GetTypes())
.Where(p => p.IsClass && !p.IsAbstract && UIResourceType.IsAssignableFrom(p));
var UIResources = AssemblyHelper.LoadInterfacesFromAppDomain<IUIResource>();
foreach (var uiResource in UIResources)
{
Application.Current.Resources.MergedDictionaries.Add(
((IUIResource)Activator.CreateInstance(uiResource)).GetResourceDictionary());
Application.Current.Resources.MergedDictionaries.Add(uiResource.GetResourceDictionary());
}
}
public static void ApplyPluginLanguages()
internal static void ApplyPluginLanguages()
{
var pluginI18nType = typeof(IPluginI18n);
var pluginI18ns = AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(s => s.GetTypes())
.Where(p => p.IsClass && !p.IsAbstract && pluginI18nType.IsAssignableFrom(p));
var pluginI18ns = AssemblyHelper.LoadInterfacesFromAppDomain<IPluginI18n>();
foreach (var pluginI18n in pluginI18ns)
{
string languageFile = InternationalizationManager.Instance.GetLanguageFile(
((IPluginI18n)Activator.CreateInstance(pluginI18n)).GetLanguagesFolder());
string languageFile = InternationalizationManager.Instance.GetLanguageFile(pluginI18n.GetLanguagesFolder());
if (!string.IsNullOrEmpty(languageFile))
{
Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary
@ -50,5 +42,7 @@ namespace Wox.Core.UI
}
}
}
}
}

View File

@ -22,8 +22,8 @@ namespace Wox.Core.Updater
{
private static UpdaterManager instance;
private const string VersionCheckURL = "https://api.getwox.com/release/latest/";
//private const string UpdateFeedURL = "http://upgrade.getwox.com/update.xml";
private const string UpdateFeedURL = "http://127.0.0.1:8888/update.xml";
private const string UpdateFeedURL = "http://upgrade.getwox.com/update.xml";
//private const string UpdateFeedURL = "http://127.0.0.1:8888/update.xml";
private static SemanticVersion currentVersion;
public event EventHandler PrepareUpdateReady;

View File

@ -130,14 +130,7 @@ namespace Wox.Core.UserSettings
OpacityMode = OpacityMode.Normal;
LeaveCmdOpen = false;
HideWhenDeactive = false;
CustomPluginHotkeys = new List<CustomPluginHotkey>()
{
new CustomPluginHotkey()
{
ActionKeyword = "history ",
Hotkey = "Alt + H"
}
};
CustomPluginHotkeys = new List<CustomPluginHotkey>();
return this;
}

View File

@ -69,6 +69,8 @@
<Compile Include="Exception\WoxI18nException.cs" />
<Compile Include="Exception\WoxJsonRPCException.cs" />
<Compile Include="Exception\WoxPluginException.cs" />
<Compile Include="AssemblyHelper.cs" />
<Compile Include="Plugin\QueryDispatcher\BaseQueryDispatcher.cs" />
<Compile Include="Updater\Release.cs" />
<Compile Include="Updater\UpdaterManager.cs" />
<Compile Include="Updater\WoxUpdateSource.cs" />
@ -85,8 +87,8 @@
<Compile Include="Plugin\PluginInstaller.cs" />
<Compile Include="Plugin\QueryDispatcher\IQueryDispatcher.cs" />
<Compile Include="Plugin\QueryDispatcher\QueryDispatcher.cs" />
<Compile Include="Plugin\QueryDispatcher\UserPluginQueryDispatcher.cs" />
<Compile Include="Plugin\QueryDispatcher\SystemPluginQueryDispatcher.cs" />
<Compile Include="Plugin\QueryDispatcher\ExclusiveQueryDispatcher.cs" />
<Compile Include="Plugin\QueryDispatcher\GenericQueryDispatcher.cs" />
<Compile Include="Plugin\JsonRPCPlugin.cs" />
<Compile Include="Plugin\JsonRPCPluginLoader.cs" />
<Compile Include="Plugin\CSharpPluginLoader.cs" />

View File

@ -9,6 +9,7 @@ using Wox.Core.Exception;
using Wox.Core.UI;
using Wox.Core.UserSettings;
using Wox.Infrastructure.Logger;
using Wox.Plugin;
namespace Wox.Core.i18n
{
@ -70,6 +71,7 @@ namespace Wox.Core.i18n
UserSettingStorage.Instance.Language = language.LanguageCode;
UserSettingStorage.Instance.Save();
ResourceMerger.ApplyResources();
UpdateAllPluginMetadataTranslations();
}
public ResourceDictionary GetResourceDictionary()
@ -109,6 +111,36 @@ namespace Wox.Core.i18n
return GetLanguagePath(language);
}
internal void UpdateAllPluginMetadataTranslations()
{
List<KeyValuePair<PluginPair, IPluginI18n>> plugins = AssemblyHelper.LoadPluginInterfaces<IPluginI18n>();
foreach (var plugin in plugins)
{
UpdatePluginMetadataTranslations(plugin.Key);
}
}
internal void UpdatePluginMetadataTranslations(PluginPair pluginPair)
{
var pluginI18n = pluginPair.Plugin as IPluginI18n;
if (pluginI18n == null) return;
try
{
pluginPair.Metadata.Name = pluginI18n.GetTranslatedPluginTitle();
pluginPair.Metadata.Description = pluginI18n.GetTranslatedPluginDescription();
}
catch (System.Exception e)
{
Log.Warn("Update Plugin metadata translation failed:" + e.Message);
#if (DEBUG)
{
throw;
}
#endif
}
}
private string GetLanguagePath(Language language)
{
string path = Path.Combine(DefaultLanguageDirectory, language.LanguageCode + ".xaml");

View File

@ -1,36 +1,19 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Wox.CrashReporter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Wox.CrashReporter")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("0ea3743c-2c0d-4b13-b9ce-e5e1f85aea23")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Wox.CrashReporter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Wox.CrashReporter")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("0ea3743c-2c0d-4b13-b9ce-e5e1f85aea23")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -35,7 +35,7 @@
<TextBlock Padding="0 5 0 0" Grid.Row="1" Grid.Column="2" Text="{DynamicResource reportWindow_time}"></TextBlock>
<TextBlock Padding="0 5 0 0" Grid.Row="1" Grid.Column="3" Text="10201211-21-21" x:Name="tbDatetime"></TextBlock>
<TextBlock Padding="0 5 0 5" Grid.ColumnSpan="4" Grid.Row="2" Grid.Column="0" Text="{DynamicResource reportWindow_reproduce}"></TextBlock>
<RichTextBox Grid.Row="3" Grid.ColumnSpan="4" Grid.Column="0" Background="#FFFFE1"></RichTextBox>
<RichTextBox Grid.Row="3" Grid.ColumnSpan="4" Grid.Column="0" Background="#FFFFE1" x:Name="tbReproduceSteps"></RichTextBox>
</Grid>
</TabItem>
<TabItem Header="{DynamicResource reportWindow_exceptions}">

View File

@ -12,6 +12,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Exceptionless;
using Wox.Core;
using Wox.Core.Exception;
using Wox.Core.i18n;
@ -19,6 +20,7 @@ using Wox.Core.UI;
using Wox.Core.Updater;
using Wox.Core.UserSettings;
using Wox.Infrastructure.Http;
using Wox.Infrastructure.Logger;
namespace Wox.CrashReporter
{
@ -48,22 +50,24 @@ namespace Wox.CrashReporter
string sendingMsg = InternationalizationManager.Instance.GetTranslation("reportWindow_sending");
tbSendReport.Content = sendingMsg;
btnSend.IsEnabled = false;
ThreadPool.QueueUserWorkItem(o => SendReport());
SendReport();
}
private void SendReport()
{
string error = string.Format("{{\"data\":{0}}}", ExceptionFormatter.FormatExcpetion(exception));
string response = HttpRequest.Post(APIServer.ErrorReportURL, error, HttpProxy.Instance);
if (response.ToLower() == "ok")
Hide();
ThreadPool.QueueUserWorkItem(o =>
{
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("reportWindow_report_succeed"));
}
else
{
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("reportWindow_report_failed"));
}
Dispatcher.Invoke(new Action(Close));
string reproduceSteps = new TextRange(tbReproduceSteps.Document.ContentStart, tbReproduceSteps.Document.ContentEnd).Text;
exception.ToExceptionless()
.SetUserDescription(reproduceSteps)
.Submit();
ExceptionlessClient.Current.ProcessQueue();
Dispatcher.Invoke(new Action(() =>
{
Close();
}));
});
}
private void btnCancel_Click(object sender, RoutedEventArgs e)

View File

@ -1,109 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<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')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2FEB2298-7653-4009-B1EA-FFFB1A768BCC}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Wox.CrashReporter</RootNamespace>
<AssemblyName>Wox.CrashReporter</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\Output\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\Output\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="CrashReporter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ReportWindow.xaml.cs">
<DependentUpon>ReportWindow.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Page Include="ReportWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Wox.Core\Wox.Core.csproj">
<Project>{B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}</Project>
<Name>Wox.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Wox.Infrastructure\Wox.Infrastructure.csproj">
<Project>{4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}</Project>
<Name>Wox.Infrastructure</Name>
</ProjectReference>
<ProjectReference Include="..\Wox.Plugin\Wox.Plugin.csproj">
<Project>{8451ECDD-2EA4-4966-BB0A-7BBC40138E80}</Project>
<Name>Wox.Plugin</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Resource Include="Images\crash_warning.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\crash_go.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
</ItemGroup>
<ItemGroup>
<Resource Include="Images\crash_stop.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
</ItemGroup>
<ItemGroup>
<Resource Include="Images\app_error.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<!-- 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>
-->
<?xml version="1.0" encoding="utf-8"?>
<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')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2FEB2298-7653-4009-B1EA-FFFB1A768BCC}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Wox.CrashReporter</RootNamespace>
<AssemblyName>Wox.CrashReporter</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\Output\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\Output\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Exceptionless">
<HintPath>..\packages\Exceptionless.1.5.2121\lib\net35\Exceptionless.dll</HintPath>
</Reference>
<Reference Include="Exceptionless.Models">
<HintPath>..\packages\Exceptionless.1.5.2121\lib\net35\Exceptionless.Models.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="CrashReporter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ReportWindow.xaml.cs">
<DependentUpon>ReportWindow.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Page Include="ReportWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Wox.Core\Wox.Core.csproj">
<Project>{B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}</Project>
<Name>Wox.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Wox.Infrastructure\Wox.Infrastructure.csproj">
<Project>{4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}</Project>
<Name>Wox.Infrastructure</Name>
</ProjectReference>
<ProjectReference Include="..\Wox.Plugin\Wox.Plugin.csproj">
<Project>{8451ECDD-2EA4-4966-BB0A-7BBC40138E80}</Project>
<Name>Wox.Plugin</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Resource Include="Images\crash_warning.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\crash_go.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
</ItemGroup>
<ItemGroup>
<Resource Include="Images\crash_stop.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
</ItemGroup>
<ItemGroup>
<Resource Include="Images\app_error.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<!-- 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>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Exceptionless" version="1.5.2121" targetFramework="net35" />
</packages>

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace Wox.Infrastructure
{
public static class DebugHelper
{
public static void WriteLine(string msg)
{
return;
Debug.WriteLine(msg);
}
}
}

View File

@ -855,7 +855,7 @@
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="Debugger">
<xs:complexType name="DebugHelper">
<xs:complexContent>
<xs:extension base="Target">
<xs:choice minOccurs="0" maxOccurs="unbounded">

View File

@ -2,9 +2,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Wox.Infrastructure")]
[assembly: AssemblyDescription("https://github.com/qianlifeng/Wox")]
[assembly: AssemblyConfiguration("")]
@ -13,24 +11,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyright("The MIT License (MIT)")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("aee57a31-29e5-4f03-a41f-7917910fe90f")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -56,8 +56,9 @@ namespace Wox.Infrastructure.Storage
}
}
}
catch (Exception)
catch (Exception e)
{
Log.Error(e);
serializedObject = LoadDefault();
#if (DEBUG)
{

Some files were not shown because too many files have changed in this diff Show More