Merge pull request #347 from happlebao/refactoring

Refactoring
This commit is contained in:
qianlifeng 2015-11-03 18:21:15 +08:00
commit ff3a2f6b67
146 changed files with 772 additions and 1921 deletions

1
.gitignore vendored
View file

@ -121,3 +121,4 @@ Wox/Wox.csproj
*.sublime-*
*.dgml
migrateToAutomaticPackageRestore.ps1

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>

Binary file not shown.

View file

@ -1,136 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
<!-- Enable the restore command to run before builds -->
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>
<!-- Property that enables building a package from a project -->
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
<!-- Determines if package restore consent is required to restore packages -->
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>
<!-- Download NuGet.exe if it does not already exist -->
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
</PropertyGroup>
<ItemGroup Condition=" '$(PackageSources)' == '' ">
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
<!--
<PackageSource Include="https://www.nuget.org/api/v2/" />
<PackageSource Include="https://my-nuget-source/nuget/" />
-->
</ItemGroup>
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
<!-- Windows specific commands -->
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
<PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
<PackagesConfig>packages.config</PackagesConfig>
</PropertyGroup>
<PropertyGroup>
<!-- NuGet command -->
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>
<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
<!-- Commands -->
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
<!-- We need to ensure packages are restored prior to assembly resolve -->
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
RestorePackages;
$(BuildDependsOn);
</BuildDependsOn>
<!-- Make the build depend on restore packages -->
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
$(BuildDependsOn);
BuildPackage;
</BuildDependsOn>
</PropertyGroup>
<Target Name="CheckPrerequisites">
<!-- Raise an error if we're unable to locate nuget.exe -->
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
<!--
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
This effectively acts as a lock that makes sure that the download operation will only happen once and all
parallel builds will have to wait for it to complete.
-->
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
</Target>
<Target Name="_DownloadNuGet">
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
</Target>
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(RestoreCommand)"
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
<Exec Command="$(RestoreCommand)"
LogStandardErrorAsError="true"
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
</Target>
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(BuildCommand)"
Condition=" '$(OS)' != 'Windows_NT' " />
<Exec Command="$(BuildCommand)"
LogStandardErrorAsError="true"
Condition=" '$(OS)' == 'Windows_NT' " />
</Target>
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<OutputFilename ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Core" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Net" />
<Using Namespace="Microsoft.Build.Framework" />
<Using Namespace="Microsoft.Build.Utilities" />
<Code Type="Fragment" Language="cs">
<![CDATA[
try {
OutputFilename = Path.GetFullPath(OutputFilename);
Log.LogMessage("Downloading latest version of NuGet.exe...");
WebClient webClient = new WebClient();
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
return true;
}
catch (Exception ex) {
Log.LogErrorFromException(ex);
return false;
}
]]>
</Code>
</Task>
</UsingTask>
</Project>

View file

@ -1,15 +1,13 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;
using WindowsInput;
using WindowsInput.Native;
using Wox.Infrastructure;
using Wox.Infrastructure.Hotkey;
using Wox.Plugin.Features;
using Wox.Infrastructure.Logger;
using Control = System.Windows.Controls.Control;
namespace Wox.Plugin.CMD
@ -24,14 +22,13 @@ namespace Wox.Plugin.CMD
{
List<Result> results = new List<Result>();
List<Result> pushedResults = new List<Result>();
if (query.Search == ">")
string cmd = query.Search;
if (string.IsNullOrEmpty(cmd))
{
return GetAllHistoryCmds();
}
if (query.Search.StartsWith(">") && query.Search.Length > 1)
else
{
string cmd = query.Search.Substring(1);
var queryCmd = GetCurrentCmd(cmd);
context.API.PushResults(query, context.CurrentPluginMetadata, new List<Result>() { queryCmd });
pushedResults.Add(queryCmd);
@ -51,7 +48,7 @@ namespace Wox.Plugin.CMD
basedir = excmd;
dir = cmd;
}
else if (Directory.Exists(Path.GetDirectoryName(excmd)))
else if (Directory.Exists(Path.GetDirectoryName(excmd) ?? string.Empty))
{
basedir = Path.GetDirectoryName(excmd);
var dirn = Path.GetDirectoryName(cmd);
@ -74,10 +71,12 @@ namespace Wox.Plugin.CMD
}));
}
}
catch (Exception) { }
catch (Exception e)
{
Log.Error(e);
}
return results;
}
return results;
}
private List<Result> GetHistoryCmds(string cmd, Result result)
@ -201,11 +200,7 @@ namespace Wox.Plugin.CMD
return context.API.GetTranslation("wox_plugin_cmd_plugin_description");
}
public bool IsInstantQuery(string query)
{
if (query.StartsWith(">")) return true;
return false;
}
public bool IsInstantQuery(string query) => false;
public bool IsExclusiveQuery(Query query)
{

View file

@ -1,8 +1,8 @@
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Newtonsoft.Json;
using Wox.Infrastructure.Storage;
using System.IO;
namespace Wox.Plugin.CMD
{

View file

@ -12,7 +12,6 @@
<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' ">
@ -44,7 +43,6 @@
<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" />
@ -105,13 +103,6 @@
</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">
@ -119,4 +110,5 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>

View file

@ -1,6 +1,6 @@
{
"ID":"D409510CD0D2481F853690A07E6DC426",
"ActionKeyword":"*",
"ActionKeyword":">",
"Name":"Shell",
"Description":"Provide executing commands from Wox. Commands should start with >",
"Author":"qianlifeng",

View file

@ -1,116 +1,100 @@
<?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>
<?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>
<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="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.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" />
<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

@ -34,14 +34,8 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Color.cs" />

View file

@ -33,14 +33,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ControlPanel.cs" />

View file

@ -1,11 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using Wox.Infrastructure.Storage;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Newtonsoft.Json;
using Wox.Infrastructure.Storage;
namespace Wox.Plugin.Everything
{

View file

@ -3,11 +3,10 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.ServiceProcess;
using Wox.Infrastructure;
using System.Reflection;
using Wox.Plugin.Everything.Everything;
using Wox.Plugin.Features;
namespace Wox.Plugin.Everything
{

View file

@ -12,7 +12,6 @@
<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>
@ -41,14 +40,9 @@
<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" />
@ -136,13 +130,6 @@
<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">
@ -150,4 +137,5 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>

View file

@ -1,29 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Plugin.Everything", "Wox.Plugin.Everything.csproj", "{230AE83F-E92E-4E69-8355-426B305DA9C0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{9BEA8C30-8CC3-48FE-87FD-8D7E65898C1A}"
ProjectSection(SolutionItems) = preProject
.nuget\NuGet.Config = .nuget\NuGet.Config
.nuget\NuGet.exe = .nuget\NuGet.exe
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{230AE83F-E92E-4E69-8355-426B305DA9C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{230AE83F-E92E-4E69-8355-426B305DA9C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{230AE83F-E92E-4E69-8355-426B305DA9C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{230AE83F-E92E-4E69-8355-426B305DA9C0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -5,7 +5,7 @@ using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows;
using Control = System.Windows.Controls.Control;
using System.Windows.Controls;
namespace Wox.Plugin.Folder
{

View file

@ -1,11 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
using Newtonsoft.Json;
using Wox.Infrastructure.Storage;
using System.IO;
namespace Wox.Plugin.Folder
{

View file

@ -12,7 +12,6 @@
<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' ">
@ -44,7 +43,6 @@
<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" />
@ -106,13 +104,6 @@
</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">
@ -120,4 +111,5 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>

View file

@ -17,7 +17,7 @@ namespace Wox.Plugin.PluginIndicator
List<Result> results = new List<Result>();
if (allPlugins.Count == 0)
{
allPlugins = context.API.GetAllPlugins().Where(o => !PluginManager.IsGenericPlugin(o.Metadata)).ToList();
allPlugins = context.API.GetAllPlugins().Where(o => !PluginManager.IsSystemPlugin(o.Metadata)).ToList();
}
foreach (PluginMetadata metadata in allPlugins.Select(o => o.Metadata))

View file

@ -33,13 +33,7 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<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" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />

View file

@ -1,7 +1,6 @@
using System;
using System.Net;
namespace Wox.Plugin.PluginManagement
{
public class HttpRequest

View file

@ -12,7 +12,6 @@
<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' ">
@ -39,14 +38,9 @@
<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" />
@ -97,13 +91,6 @@
<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">
@ -111,4 +98,5 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>

View file

@ -1,16 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows;
namespace Wox.Plugin.Program
{

View file

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

View file

@ -1,21 +1,21 @@
using System;
using System.Collections.Generic;
using Wox.Infrastructure.Logger;
namespace Wox.Plugin.Program.ProgramSources
{
[Serializable]
[global::System.ComponentModel.Browsable(false)]
public class AppPathsProgramSource: AbstractProgramSource
[System.ComponentModel.Browsable(false)]
public class AppPathsProgramSource : AbstractProgramSource
{
public AppPathsProgramSource()
{
this.BonusPoints = -10;
BonusPoints = -10;
}
public AppPathsProgramSource(ProgramSource source)
: this()
public AppPathsProgramSource(ProgramSource source) : this()
{
this.BonusPoints = source.BonusPoints;
BonusPoints = source.BonusPoints;
}
public override List<Program> LoadPrograms()
@ -33,17 +33,31 @@ namespace Wox.Plugin.Program.ProgramSources
if (root == null) return;
foreach (var item in root.GetSubKeyNames())
{
using (var key = root.OpenSubKey(item))
try
{
object path = key.GetValue("");
if (path is string && global::System.IO.File.Exists((string)path))
using (var key = root.OpenSubKey(item))
{
var entry = CreateEntry((string)path);
string path = key.GetValue("") as string;
if (path == null) continue;
// fix path like this ""\"C:\\folder\\executable.exe\"""
const int begin = 0;
int end = path.Length - 1;
const char quotationMark = '"';
if (path[begin] == quotationMark && path[end] == quotationMark)
{
path = path.Substring(begin + 1, path.Length - 2);
}
if (!System.IO.File.Exists(path)) continue;
var entry = CreateEntry(path);
entry.ExecuteName = item;
list.Add(entry);
}
key.Close();
}
catch (Exception e)
{
Log.Error(e.StackTrace);
}
}
}

View file

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Log = Wox.Infrastructure.Logger.Log;
using Wox.Infrastructure.Logger;
namespace Wox.Plugin.Program.ProgramSources
{

View file

@ -1,12 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using Newtonsoft.Json;
using Wox.Infrastructure.Storage;
using System.ComponentModel;
namespace Wox.Plugin.Program
{

View file

@ -4,12 +4,10 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Windows;
using IWshRuntimeLibrary;
using Wox.Infrastructure;
using Wox.Plugin.Program.ProgramSources;
using IWshRuntimeLibrary;
using Wox.Plugin.Features;
namespace Wox.Plugin.Program
{
@ -76,7 +74,7 @@ namespace Wox.Plugin.Program
{
programs = ProgramCacheStorage.Instance.Programs;
}
DebugHelper.WriteLine(string.Format("Preload {0} programs from cache", programs.Count));
Debug.WriteLine(string.Format("Preload {0} programs from cache", programs.Count));
using (new Timeit("Program Index"))
{
IndexPrograms();

View file

@ -12,7 +12,6 @@
<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' ">
@ -139,13 +138,6 @@
</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">
@ -153,4 +145,5 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>

View file

@ -12,7 +12,6 @@
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -75,13 +74,6 @@
</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">
@ -89,4 +81,5 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>

View file

@ -5,8 +5,6 @@ using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Wox.Infrastructure;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Control = System.Windows.Controls.Control;
namespace Wox.Plugin.Sys

View file

@ -12,7 +12,6 @@
<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' ">
@ -40,7 +39,6 @@
<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" />
@ -124,13 +122,6 @@
</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">
@ -138,4 +129,5 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>

View file

@ -4,7 +4,6 @@ using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Windows;
namespace Wox.Plugin.Url
{

View file

@ -33,16 +33,8 @@
<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="Properties\AssemblyInfo.cs" />

View file

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Wox.Plugin.WebSearch
{

View file

@ -4,9 +4,6 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Timers;
using System.Windows.Threading;
using Wox.Plugin.Features;
using Wox.Plugin.WebSearch.SuggestionSources;
namespace Wox.Plugin.WebSearch
@ -123,19 +120,16 @@ namespace Wox.Plugin.WebSearch
return context.API.GetTranslation("wox_plugin_websearch_plugin_description");
}
public bool IsInstantQuery(string query)
public bool IsInstantQuery(string query) => false;
public bool IsExclusiveQuery(Query query)
{
var strings = query.Split(' ');
var strings = query.RawQuery.Split(' ');
if (strings.Length > 1)
{
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,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using Newtonsoft.Json;
using Wox.Infrastructure.Storage;

View file

@ -12,7 +12,6 @@
<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' ">
@ -43,7 +42,6 @@
<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" />
@ -130,13 +128,6 @@
</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">
@ -144,4 +135,5 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>

Binary file not shown.

View file

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Wox.Core
namespace Wox.Core
{
public static class APIServer
{

View file

@ -1,38 +0,0 @@
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

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Xml;

View file

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Wox.Core.Exception
namespace Wox.Core.Exception
{
/// <summary>
/// Represent exceptions that wox can't handle and MUST close running Wox.

View file

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Wox.Core.Exception
namespace Wox.Core.Exception
{
public class WoxI18nException:WoxException
{

View file

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Wox.Core.Exception
namespace Wox.Core.Exception
{
public class WoxPluginException : WoxException
{

View file

@ -1,14 +1,13 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Threading;
using System.Windows.Forms;
using Newtonsoft.Json;
using Wox.Core.Exception;
using Wox.Infrastructure.Logger;
using Wox.Plugin;
using Wox.Core.Exception;
namespace Wox.Core.Plugin
{

View file

@ -6,7 +6,7 @@ namespace Wox.Core.Plugin
{
internal class JsonRPCPluginLoader<T> : IPluginLoader where T : JsonRPCPlugin, new()
{
public virtual IEnumerable<PluginPair> LoadPlugin(List<PluginMetadata> pluginMetadatas)
public IEnumerable<PluginPair> LoadPlugin(List<PluginMetadata> pluginMetadatas)
{
T jsonRPCPlugin = new T();
List<PluginMetadata> jsonRPCPluginMetadatas = pluginMetadatas.Where(o => o.Language.ToUpper() == jsonRPCPlugin.SupportedLanguage.ToUpper()).ToList();

View file

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using Newtonsoft.Json;
using Wox.Core.Exception;
using Wox.Core.UserSettings;
@ -30,11 +28,6 @@ namespace Wox.Core.Plugin
ParsePluginConfigs(pluginDirectory);
}
if (PluginManager.DebuggerMode != null)
{
PluginMetadata metadata = GetPluginMetadata(PluginManager.DebuggerMode);
if (metadata != null) pluginMetadatas.Add(metadata);
}
return pluginMetadatas;
}

View file

@ -1,12 +1,10 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Windows;
using System.Windows.Forms;
using ICSharpCode.SharpZipLib.Zip;
using Newtonsoft.Json;
using Wox.Plugin;
using MessageBox = System.Windows.Forms.MessageBox;
namespace Wox.Core.Plugin
{

View file

@ -1,19 +1,17 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Windows.Documents;
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
{
@ -22,33 +20,37 @@ namespace Wox.Core.Plugin
/// </summary>
public static class PluginManager
{
public const string ActionKeywordWildcardSign = "*";
public const string DirectoryName = "Plugins";
private static List<PluginMetadata> pluginMetadatas;
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; }
private static List<PluginPair> plugins = new List<PluginPair>();
private static IEnumerable<PluginPair> instantQueryPlugins;
private static IEnumerable<PluginPair> exclusiveSearchPlugins;
private static IEnumerable<PluginPair> contextMenuPlugins;
private static List<PluginPair> plugins;
/// <summary>
/// Directories that will hold Wox plugin directory
/// </summary>
private static List<string> pluginDirectories = new List<string>();
public static IEnumerable<PluginPair> AllPlugins
{
get { return plugins; }
private set { plugins = value.OrderBy(o => o.Metadata.Name).ToList(); }
}
public static IPublicAPI API { private set; get; }
public static string PluginDirectory
{
get { return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), DirectoryName); }
}
private static void SetupPluginDirectories()
{
pluginDirectories.Add(PluginDirectory);
MakesurePluginDirectoriesExist();
}
public static string PluginDirectory
{
get { return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Plugins"); }
}
private static void MakesurePluginDirectoriesExist()
{
foreach (string pluginDirectory in pluginDirectories)
@ -76,38 +78,38 @@ namespace Wox.Core.Plugin
SetupPluginDirectories();
API = api;
plugins.Clear();
pluginMetadatas = PluginConfig.Parse(pluginDirectories);
plugins.AddRange(new CSharpPluginLoader().LoadPlugin(pluginMetadatas));
plugins.AddRange(new JsonRPCPluginLoader<PythonPlugin>().LoadPlugin(pluginMetadatas));
AllPlugins = (new CSharpPluginLoader().LoadPlugin(pluginMetadatas)).
Concat(new JsonRPCPluginLoader<PythonPlugin>().LoadPlugin(pluginMetadatas));
//load plugin i18n languages
ResourceMerger.ApplyPluginLanguages();
foreach (PluginPair pluginPair in plugins)
foreach (PluginPair pluginPair in AllPlugins)
{
PluginPair pair = pluginPair;
ThreadPool.QueueUserWorkItem(o =>
{
Stopwatch sw = new Stopwatch();
sw.Start();
pair.Plugin.Init(new PluginInitContext()
using (var time = new Timeit($"Plugin init: {pair.Metadata.Name}"))
{
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;
pair.Plugin.Init(new PluginInitContext
{
CurrentPluginMetadata = pair.Metadata,
Proxy = HttpProxy.Instance,
API = API
});
pair.InitTime = time.Current;
}
InternationalizationManager.Instance.UpdatePluginMetadataTranslations(pair);
});
}
ThreadPool.QueueUserWorkItem(o =>
{
LoadInstantSearches();
instantQueryPlugins = GetPlugins<IInstantQuery>();
exclusiveSearchPlugins = GetPlugins<IExclusiveQuery>();
contextMenuPlugins = GetPlugins<IContextMenu>();
});
}
@ -116,97 +118,71 @@ namespace Wox.Core.Plugin
PluginInstaller.Install(path);
}
public static void Query(Query query)
public static Query QueryInit(string text) //todo is that possible to move it into type Query?
{
if (!string.IsNullOrEmpty(query.RawQuery.Trim()))
// replace multiple white spaces with one white space
var terms = text.Split(new[] { Query.Seperater }, StringSplitOptions.RemoveEmptyEntries);
var rawQuery = string.Join(Query.Seperater, terms.ToArray());
var actionKeyword = string.Empty;
var search = rawQuery;
IEnumerable<string> actionParameters = terms;
if (terms.Length == 0) return null;
if (IsVailldActionKeyword(terms[0]))
{
query.Search = IsActionKeywordQuery(query) ? query.RawQuery.Substring(query.RawQuery.IndexOf(' ') + 1) : query.RawQuery;
QueryDispatcher.QueryDispatcher.Dispatch(query);
actionKeyword = terms[0];
}
}
public static List<PluginPair> AllPlugins
{
get
if (!string.IsNullOrEmpty(actionKeyword))
{
return plugins.OrderBy(o => o.Metadata.Name).ToList();
actionParameters = terms.Skip(1);
search = string.Join(Query.Seperater, actionParameters.ToArray());
}
}
/// <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;
var actionKeyword = strings[0].Trim();
if (string.IsNullOrEmpty(actionKeyword)) return false;
PluginPair pair = plugins.FirstOrDefault(o => o.Metadata.ActionKeyword == actionKeyword);
if (pair != null)
return new Query
{
var customizedPluginConfig = UserSettingStorage.Instance.CustomizedPluginConfigs.FirstOrDefault(o => o.ID == pair.Metadata.ID);
if (customizedPluginConfig != null && customizedPluginConfig.Disabled)
{
return false;
}
return true;
}
return false;
Terms = terms, RawQuery = rawQuery, ActionKeyword = actionKeyword, Search = search,
// Obsolete value initialisation
ActionName = actionKeyword, ActionParameters = actionParameters.ToList()
};
}
public static bool IsGenericPlugin(PluginMetadata metadata)
public static void QueryForAllPlugins(Query query)
{
return metadata.ActionKeyword == ActionKeywordWildcardSign;
}
public static void ActivatePluginDebugger(string path)
{
DebuggerMode = path;
}
public static bool IsInstantQuery(string query)
{
return LoadInstantSearches().Any(o => o.Value.IsInstantQuery(query));
}
public static bool IsInstantSearchPlugin(PluginMetadata pluginMetadata)
{
//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);
}
internal static void ExecutePluginQuery(PluginPair pair, Query query)
{
try
var pluginPairs = GetNonSystemPlugin(query) != null ?
new List<PluginPair> { GetNonSystemPlugin(query) } : GetSystemPlugins();
foreach (var plugin in pluginPairs)
{
Stopwatch sw = new Stopwatch();
sw.Start();
List<Result> results = pair.Plugin.Query(query) ?? new List<Result>();
results.ForEach(o =>
var customizedPluginConfig = UserSettingStorage.Instance.
CustomizedPluginConfigs.FirstOrDefault(o => o.ID == plugin.Metadata.ID);
if (customizedPluginConfig != null && customizedPluginConfig.Disabled) return;
if (IsInstantQueryPlugin(plugin))
{
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)
{
pair.AvgQueryTime = sw.ElapsedMilliseconds;
using (new Timeit($"Plugin {plugin.Metadata.Name} is executing instant search"))
{
QueryForPlugin(plugin, query);
}
}
else
{
pair.AvgQueryTime = (pair.AvgQueryTime + sw.ElapsedMilliseconds) / 2;
ThreadPool.QueueUserWorkItem(state =>
{
QueryForPlugin(plugin, query);
});
}
}
}
private static void QueryForPlugin(PluginPair pair, Query query)
{
try
{
using (var time = new Timeit($"Query For {pair.Metadata.Name}"))
{
var results = pair.Plugin.Query(query) ?? new List<Result>();
results.ForEach(o => { o.PluginID = pair.Metadata.ID; });
var seconds = time.Current;
pair.QueryCount += 1;
pair.AvgQueryTime = pair.QueryCount == 1 ? seconds : (pair.AvgQueryTime + seconds) / 2;
API.PushResults(query, pair.Metadata, results);
}
API.PushResults(query, pair.Metadata, results);
}
catch (System.Exception e)
{
@ -214,13 +190,32 @@ namespace Wox.Core.Plugin
}
}
private static List<KeyValuePair<PluginPair, IInstantQuery>> LoadInstantSearches()
/// <summary>
/// Check if a query contains valid action keyword
/// </summary>
/// <param name="actionKeyword"></param>
/// <returns></returns>
private static bool IsVailldActionKeyword(string actionKeyword)
{
if (instantSearches != null) return instantSearches;
if (string.IsNullOrEmpty(actionKeyword) || actionKeyword == Query.WildcardSign) return false;
PluginPair pair = AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeyword == actionKeyword);
if (pair == null) return false;
var customizedPluginConfig = UserSettingStorage.Instance.
CustomizedPluginConfigs.FirstOrDefault(o => o.ID == pair.Metadata.ID);
return customizedPluginConfig == null || !customizedPluginConfig.Disabled;
}
instantSearches = AssemblyHelper.LoadPluginInterfaces<IInstantQuery>();
public static bool IsSystemPlugin(PluginMetadata metadata)
{
return metadata.ActionKeyword == Query.WildcardSign;
}
return instantSearches;
private static bool IsInstantQueryPlugin(PluginPair plugin)
{
//any plugin that takes more than 200ms for AvgQueryTime won't be treated as IInstantQuery plugin anymore.
return plugin.AvgQueryTime < 200 &&
plugin.Plugin is IInstantQuery &&
instantQueryPlugins.Any(p => p.Metadata.ID == plugin.Metadata.ID);
}
/// <summary>
@ -233,63 +228,46 @@ namespace Wox.Core.Plugin
return AllPlugins.FirstOrDefault(o => o.Metadata.ID == id);
}
internal static List<KeyValuePair<PluginPair, IExclusiveQuery>> LoadExclusiveSearchPlugins()
public static IEnumerable<PluginPair> GetPlugins<T>() where T : IFeatures
{
if (exclusiveSearchPlugins != null) return exclusiveSearchPlugins;
exclusiveSearchPlugins = AssemblyHelper.LoadPluginInterfaces<IExclusiveQuery>();
return exclusiveSearchPlugins;
return AllPlugins.Where(p => p.Plugin is T);
}
internal static PluginPair GetExclusivePlugin(Query query)
private static PluginPair GetExclusivePlugin(Query query)
{
KeyValuePair<PluginPair, IExclusiveQuery> plugin = LoadExclusiveSearchPlugins().FirstOrDefault(o => o.Value.IsExclusiveQuery((query)));
return plugin.Key;
return exclusiveSearchPlugins.FirstOrDefault(p => ((IExclusiveQuery)p.Plugin).IsExclusiveQuery(query));
}
internal static PluginPair GetActionKeywordPlugin(Query query)
private 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;
//if a query doesn't contain a vaild action keyword, it should not be a action keword plugin query
if (string.IsNullOrEmpty(query.ActionKeyword)) return null;
return AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeyword == query.ActionKeyword);
}
internal static bool IsExclusivePluginQuery(Query query)
private static PluginPair GetNonSystemPlugin(Query query)
{
return GetExclusivePlugin(query) != null || GetActionKeywordPlugin(query) != null;
return GetExclusivePlugin(query) ?? GetActionKeywordPlugin(query);
}
private static List<PluginPair> GetSystemPlugins()
{
return AllPlugins.Where(o => IsSystemPlugin(o.Metadata)).ToList();
}
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)
var pluginPair = contextMenuPlugins.FirstOrDefault(o => o.Metadata.ID == result.PluginID);
var plugin = (IContextMenu)pluginPair?.Plugin;
if (plugin != null)
{
try
{
return contextMenuPlugin.Value.LoadContextMenus(result);
return plugin.LoadContextMenus(result);
}
catch (System.Exception e)
{
Log.Error(string.Format("Couldn't load plugin context menus {0}: {1}", contextMenuPlugin.Key.Metadata.Name, e.Message));
Log.Error($"Couldn't load plugin context menus {pluginPair.Metadata.Name}: {e.Message}");
#if (DEBUG)
{
throw;
@ -298,7 +276,7 @@ namespace Wox.Core.Plugin
}
}
return contextContextMenus;
return new List<Result>();
}
}
}

View file

@ -2,7 +2,6 @@
using System.IO;
using System.Reflection;
using Wox.Core.UserSettings;
using Wox.Infrastructure.Http;
using Wox.Plugin;
namespace Wox.Core.Plugin

View file

@ -1,46 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using Wox.Infrastructure;
using Wox.Plugin;
using Wox.Core.UserSettings;
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))
{
var customizedPluginConfig = UserSettingStorage.Instance.
CustomizedPluginConfigs.FirstOrDefault(o => o.ID == pair.Metadata.ID);
if (customizedPluginConfig != null && customizedPluginConfig.Disabled)
{
return;
}
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

@ -1,30 +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 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

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

View file

@ -1,7 +0,0 @@
namespace Wox.Core.Plugin.QueryDispatcher
{
internal interface IQueryDispatcher
{
void Dispatch(Wox.Plugin.Query query);
}
}

View file

@ -1,24 +0,0 @@

using System.Threading;
using Wox.Plugin;
namespace Wox.Core.Plugin.QueryDispatcher
{
internal static class QueryDispatcher
{
private static readonly IQueryDispatcher exclusivePluginDispatcher = new ExclusiveQueryDispatcher();
private static readonly IQueryDispatcher genericQueryDispatcher = new GenericQueryDispatcher();
public static void Dispatch(Query query)
{
if (PluginManager.IsExclusivePluginQuery(query))
{
exclusivePluginDispatcher.Dispatch(query);
}
else
{
genericQueryDispatcher.Dispatch(query);
}
}
}
}

View file

@ -8,9 +8,9 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Wox.Core")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Oracle Corporation")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Wox.Core")]
[assembly: AssemblyCopyright("Copyright © Oracle Corporation 2014")]
[assembly: AssemblyCopyright("The MIT License (MIT)")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View file

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Generic;
namespace Wox.Core.Theme
{

View file

@ -14,11 +14,12 @@ namespace Wox.Core.Theme
{
public class Theme : IUIResource,ITheme
{
public const string DirectoryName = "Themes";
private static List<string> themeDirectories = new List<string>();
static Theme()
{
themeDirectories.Add(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Themes"));
themeDirectories.Add(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), DirectoryName));
MakesureThemeDirectoriesExist();
}
@ -55,7 +56,7 @@ namespace Wox.Core.Theme
UserSettingStorage.Instance.Theme = themeName;
UserSettingStorage.Instance.Save();
ResourceMerger.ApplyResources();
ResourceMerger.ApplyThemeResource(this);
}
public ResourceDictionary GetResourceDictionary()

View file

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Wox.Core.Theme
namespace Wox.Core.Theme
{
public class ThemeManager
{

View file

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using Wox.Core.i18n;
using System.Windows;
namespace Wox.Core.UI
{

View file

@ -1,48 +1,53 @@
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;
namespace Wox.Core.UI
{
public class ResourceMerger
public static class ResourceMerger
{
internal static void ApplyResources()
private static void RemoveResource(string resourceDirectoryName)
{
Application.Current.Resources.MergedDictionaries.Clear();
ApplyPluginLanguages();
ApplyThemeAndLanguageResources();
}
internal static void ApplyThemeAndLanguageResources()
{
var UIResources = AssemblyHelper.LoadInterfacesFromAppDomain<IUIResource>();
foreach (var uiResource in UIResources)
var mergedDictionaries = Application.Current.Resources.MergedDictionaries;
foreach (var resource in mergedDictionaries)
{
Application.Current.Resources.MergedDictionaries.Add(uiResource.GetResourceDictionary());
}
}
internal static void ApplyPluginLanguages()
{
var pluginI18ns = AssemblyHelper.LoadInterfacesFromAppDomain<IPluginI18n>();
foreach (var pluginI18n in pluginI18ns)
{
string languageFile = InternationalizationManager.Instance.GetLanguageFile(pluginI18n.GetLanguagesFolder());
if (!string.IsNullOrEmpty(languageFile))
int directoryPosition = resource.Source.Segments.Length - 2;
string currentDirectoryName = resource.Source.Segments[directoryPosition];
if (currentDirectoryName == resourceDirectoryName)
{
Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary
{
Source = new Uri(languageFile, UriKind.Absolute)
});
mergedDictionaries.Remove(resource);
break;
}
}
}
public static void ApplyThemeResource(Theme.Theme t)
{
RemoveResource(Theme.Theme.DirectoryName);
Application.Current.Resources.MergedDictionaries.Add(t.GetResourceDictionary());
}
public static void ApplyLanguageResources(Internationalization i)
{
RemoveResource(Internationalization.DirectoryName);
Application.Current.Resources.MergedDictionaries.Add(i.GetResourceDictionary());
}
internal static void ApplyPluginLanguages()
{
RemoveResource(PluginManager.DirectoryName);
foreach (var languageFile in PluginManager.GetPlugins<IPluginI18n>().
Select(plugin => InternationalizationManager.Instance.GetLanguageFile(((IPluginI18n)plugin.Plugin).GetLanguagesFolder())).
Where(file => !string.IsNullOrEmpty(file)))
{
Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary
{
Source = new Uri(languageFile, UriKind.Absolute)
});
}
}
}
}

View file

@ -1,11 +1,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Threading;
using System.Windows.Forms;
using System.Windows.Threading;
using NAppUpdate.Framework;
using NAppUpdate.Framework.Common;
using NAppUpdate.Framework.Sources;
@ -15,7 +12,6 @@ using Wox.Core.i18n;
using Wox.Core.UserSettings;
using Wox.Infrastructure.Http;
using Wox.Infrastructure.Logger;
using System.Threading;
namespace Wox.Core.Updater
{

View file

@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using NAppUpdate.Framework.Common;
using NAppUpdate.Framework.Sources;
using NAppUpdate.Framework.Utils;

View file

@ -1,12 +1,10 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using System.Reflection;
using Newtonsoft.Json;
using Wox.Infrastructure.Storage;
using Wox.Plugin;
using System.Drawing;
using System.Reflection;
namespace Wox.Core.UserSettings
{

View file

@ -12,7 +12,6 @@
<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' ">
@ -39,9 +38,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="NAppUpdate.Framework, Version=0.1.0.0, Culture=neutral, PublicKeyToken=d1f1d1f19f9e5a56, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\References\NAppUpdate.Framework.dll</HintPath>
<Reference Include="NAppUpdate.Framework, Version=0.3.2.0, Culture=neutral, PublicKeyToken=d1f1d1f19f9e5a56, processorArchitecture=MSIL">
<HintPath>..\packages\NAppUpdate.Framework.0.3.2.0\lib\net20\NAppUpdate.Framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@ -53,10 +52,6 @@
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<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>
@ -69,8 +64,6 @@
<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,10 +78,6 @@
<Compile Include="UI\IUIResource.cs" />
<Compile Include="UI\ResourceMerger.cs" />
<Compile Include="Plugin\PluginInstaller.cs" />
<Compile Include="Plugin\QueryDispatcher\IQueryDispatcher.cs" />
<Compile Include="Plugin\QueryDispatcher\QueryDispatcher.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" />
@ -121,7 +110,6 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View file

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Generic;
namespace Wox.Core.i18n
{

View file

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Generic;
namespace Wox.Core.i18n
{

View file

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Windows;
using Wox.Core.Exception;
using Wox.Core.UI;
@ -15,7 +14,8 @@ namespace Wox.Core.i18n
{
public class Internationalization : IInternationalization, IUIResource
{
private static string DefaultLanguageDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
public const string DirectoryName = "Languages";
private static readonly string DefaultDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), DirectoryName);
static Internationalization()
{
@ -24,11 +24,11 @@ namespace Wox.Core.i18n
private static void MakesureThemeDirectoriesExist()
{
if (!Directory.Exists(DefaultLanguageDirectory))
if (!Directory.Exists(DefaultDirectory))
{
try
{
Directory.CreateDirectory(DefaultLanguageDirectory);
Directory.CreateDirectory(DefaultDirectory);
}
catch (System.Exception e)
{
@ -70,15 +70,14 @@ namespace Wox.Core.i18n
UserSettingStorage.Instance.Language = language.LanguageCode;
UserSettingStorage.Instance.Save();
ResourceMerger.ApplyResources();
UpdateAllPluginMetadataTranslations();
ResourceMerger.ApplyLanguageResources(this);
}
public ResourceDictionary GetResourceDictionary()
{
return new ResourceDictionary
{
Source = new Uri(GetLanguageFile(DefaultLanguageDirectory), UriKind.Absolute)
Source = new Uri(GetLanguageFile(DefaultDirectory), UriKind.Absolute)
};
}
@ -112,15 +111,6 @@ namespace Wox.Core.i18n
}
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;
@ -143,7 +133,7 @@ namespace Wox.Core.i18n
private string GetLanguagePath(Language language)
{
string path = Path.Combine(DefaultLanguageDirectory, language.LanguageCode + ".xaml");
string path = Path.Combine(DefaultDirectory, language.LanguageCode + ".xaml");
if (File.Exists(path))
{
return path;

View file

@ -1,13 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows;
using Wox.Core.UI;
using Wox.Infrastructure.Logger;
namespace Wox.Core.i18n
namespace Wox.Core.i18n
{
public static class InternationalizationManager
{

View file

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Wox.Core.i18n
namespace Wox.Core.i18n
{
public class Language
{

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NAppUpdate.Framework" version="0.3.2.0" targetFramework="net35" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net35" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net35" />
</packages>

View file

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Wox.CrashReporter
{

View file

@ -1,26 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
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;
using Wox.Core.UI;
using Wox.Core.Updater;
using Wox.Core.UserSettings;
using Wox.Infrastructure.Http;
using Wox.Infrastructure.Logger;
namespace Wox.CrashReporter
{

View file

@ -12,7 +12,6 @@
<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' ">
@ -38,14 +37,10 @@
<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" />
@ -70,14 +65,6 @@
<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">
@ -101,13 +88,6 @@
<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">
@ -115,4 +95,5 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>

View file

@ -1,17 +0,0 @@
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

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Text;
namespace Wox.Infrastructure
{

View file

@ -1,5 +1,4 @@
using System;
using System.Drawing;
using System.IO;
using System.Net;
using System.Text;

View file

@ -1,5 +1,4 @@
using System;
using System.Reflection;
using NLog;
namespace Wox.Infrastructure.Logger

View file

@ -18,6 +18,6 @@
<target xsi:type="File" name="file" fileName="${basedir}/Logs/${shortdate}.log"/>
</targets>
<rules>
<logger name="*" minlevel="Warn" writeTo="file" />
<logger name="*" minlevel="Info" writeTo="file" />
</rules>
</nlog>

View file

@ -126,6 +126,11 @@
<xs:documentation>Ignore further rules if this one matches.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="enabled" type="xs:boolean" default="true">
<xs:annotation>
<xs:documentation>Enable or disable logging rule. Disabled rules are ignored.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="NLogFilters">
<xs:choice minOccurs="0" maxOccurs="unbounded">
@ -147,6 +152,15 @@
<xs:enumeration value="Fatal" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="LineEndingMode">
<xs:restriction base="xs:string">
<xs:enumeration value="Default" />
<xs:enumeration value="CRLF" />
<xs:enumeration value="CR" />
<xs:enumeration value="LF" />
<xs:enumeration value="None" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="NLogLevelList">
<xs:restriction base="xs:string">
<xs:pattern value="(|Trace|Debug|Info|Warn|Error|Fatal)(,(Trace|Debug|Info|Warn|Error|Fatal))*" />
@ -226,58 +240,6 @@
<xs:minLength value="1" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="AspNetBufferingWrapper">
<xs:complexContent>
<xs:extension base="WrapperTargetBase">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="bufferGrowLimit" minOccurs="0" maxOccurs="1" type="xs:integer" />
<xs:element name="bufferSize" minOccurs="0" maxOccurs="1" type="xs:integer" />
<xs:element name="growBufferAsNeeded" minOccurs="0" maxOccurs="1" type="xs:boolean" />
</xs:choice>
<xs:attribute name="name" type="xs:string">
<xs:annotation>
<xs:documentation>Name of the target.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="bufferGrowLimit" type="xs:integer">
<xs:annotation>
<xs:documentation>Maximum number of log events that the buffer can keep.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="bufferSize" type="xs:integer">
<xs:annotation>
<xs:documentation>Number of log events to be buffered.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="growBufferAsNeeded" type="xs:boolean">
<xs:annotation>
<xs:documentation>Indicates whether buffer should grow as needed.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="AspNetTrace">
<xs:complexContent>
<xs:extension base="Target">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="layout" minOccurs="0" maxOccurs="1" type="Layout" />
</xs:choice>
<xs:attribute name="name" type="xs:string">
<xs:annotation>
<xs:documentation>Name of the target.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="layout" type="SimpleLayoutAttribute">
<xs:annotation>
<xs:documentation>Layout used to format log messages.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="AspResponse">
<xs:complexContent>
<xs:extension base="Target">
@ -540,6 +502,7 @@
<xs:element name="useDefaultRowHighlightingRules" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="highlight-row" minOccurs="0" maxOccurs="unbounded" type="NLog.Targets.ConsoleRowHighlightingRule" />
<xs:element name="highlight-word" minOccurs="0" maxOccurs="unbounded" type="NLog.Targets.ConsoleWordHighlightingRule" />
<xs:element name="encoding" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="errorStream" minOccurs="0" maxOccurs="1" type="xs:boolean" />
</xs:choice>
<xs:attribute name="name" type="xs:string">
@ -567,6 +530,11 @@
<xs:documentation>Indicates whether to use default row highlighting rules.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="encoding" type="xs:string">
<xs:annotation>
<xs:documentation>The encoding for writing messages to the .</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="errorStream" type="xs:boolean">
<xs:annotation>
<xs:documentation>Indicates whether the error stream (stderr) should be used instead of the output stream (stdout).</xs:documentation>
@ -667,6 +635,7 @@
<xs:element name="header" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="footer" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="error" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="encoding" minOccurs="0" maxOccurs="1" type="xs:string" />
</xs:choice>
<xs:attribute name="name" type="xs:string">
<xs:annotation>
@ -693,6 +662,11 @@
<xs:documentation>Indicates whether to send the log messages to the standard error instead of the standard output.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="encoding" type="xs:string">
<xs:annotation>
<xs:documentation>The encoding for writing messages to the .</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
@ -709,7 +683,6 @@
<xs:element name="dbProvider" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="dbUserName" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="keepConnection" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="useTransactions" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="installConnectionString" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="install-command" minOccurs="0" maxOccurs="unbounded" type="NLog.Targets.DatabaseCommandInfo" />
<xs:element name="uninstall-command" minOccurs="0" maxOccurs="unbounded" type="NLog.Targets.DatabaseCommandInfo" />
@ -762,11 +735,6 @@
<xs:documentation>Indicates whether to keep the database connection open between the log events.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="useTransactions" type="xs:boolean">
<xs:annotation>
<xs:documentation>Indicates whether to use database transactions. Some data providers require this.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="installConnectionString" type="SimpleLayoutAttribute">
<xs:annotation>
<xs:documentation>Connection string using for installation and uninstallation. If not provided, regular ConnectionString is being used.</xs:documentation>
@ -855,7 +823,7 @@
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="DebugHelper">
<xs:complexType name="Debugger">
<xs:complexContent>
<xs:extension base="Target">
<xs:choice minOccurs="0" maxOccurs="unbounded">
@ -917,7 +885,8 @@
<xs:element name="eventId" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="log" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="machineName" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="source" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="source" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="entryType" minOccurs="0" maxOccurs="1" type="Layout" />
</xs:choice>
<xs:attribute name="name" type="xs:string">
<xs:annotation>
@ -949,11 +918,16 @@
<xs:documentation>Name of the machine on which Event Log service is running.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="source" type="xs:string">
<xs:attribute name="source" type="SimpleLayoutAttribute">
<xs:annotation>
<xs:documentation>Value to be used as the event Source.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="entryType" type="SimpleLayoutAttribute">
<xs:annotation>
<xs:documentation>Optional entrytype. When not set, or when not convertable to then determined by </xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
@ -986,30 +960,32 @@
<xs:element name="header" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="footer" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="encoding" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="lineEnding" minOccurs="0" maxOccurs="1" type="NLog.Targets.LineEndingMode" />
<xs:element name="lineEnding" minOccurs="0" maxOccurs="1" type="LineEndingMode" />
<xs:element name="maxArchiveFiles" minOccurs="0" maxOccurs="1" type="xs:integer" />
<xs:element name="archiveNumbering" minOccurs="0" maxOccurs="1" type="NLog.Targets.ArchiveNumberingMode" />
<xs:element name="archiveFileName" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="archiveEvery" minOccurs="0" maxOccurs="1" type="NLog.Targets.FileArchivePeriod" />
<xs:element name="archiveAboveSize" minOccurs="0" maxOccurs="1" type="xs:long" />
<xs:element name="maxArchiveFiles" minOccurs="0" maxOccurs="1" type="xs:integer" />
<xs:element name="enableArchiveFileCompression" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="forceManaged" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="fileAttributes" minOccurs="0" maxOccurs="1" type="NLog.Targets.Win32FileAttributes" />
<xs:element name="replaceFileContentsOnEachWrite" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="deleteOldFileOnStartup" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="fileName" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="archiveDateFormat" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="archiveOldFileOnStartup" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="createDirs" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="deleteOldFileOnStartup" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="enableFileDelete" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="openFileCacheTimeout" minOccurs="0" maxOccurs="1" type="xs:integer" />
<xs:element name="networkWrites" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="maxLogFilenames" minOccurs="0" maxOccurs="1" type="xs:integer" />
<xs:element name="keepFileOpen" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="concurrentWrites" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="concurrentWriteAttempts" minOccurs="0" maxOccurs="1" type="xs:integer" />
<xs:element name="concurrentWriteAttemptDelay" minOccurs="0" maxOccurs="1" type="xs:integer" />
<xs:element name="bufferSize" minOccurs="0" maxOccurs="1" type="xs:integer" />
<xs:element name="openFileCacheSize" minOccurs="0" maxOccurs="1" type="xs:integer" />
<xs:element name="autoFlush" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="openFileCacheSize" minOccurs="0" maxOccurs="1" type="xs:integer" />
<xs:element name="bufferSize" minOccurs="0" maxOccurs="1" type="xs:integer" />
</xs:choice>
<xs:attribute name="name" type="xs:string">
<xs:annotation>
@ -1036,11 +1012,16 @@
<xs:documentation>File encoding.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="lineEnding" type="NLog.Targets.LineEndingMode">
<xs:attribute name="lineEnding" type="LineEndingMode">
<xs:annotation>
<xs:documentation>Line ending mode.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="maxArchiveFiles" type="xs:integer">
<xs:annotation>
<xs:documentation>Maximum number of archive files that should be kept.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="archiveNumbering" type="NLog.Targets.ArchiveNumberingMode">
<xs:annotation>
<xs:documentation>Way file archives are numbered.</xs:documentation>
@ -1058,17 +1039,17 @@
</xs:attribute>
<xs:attribute name="archiveAboveSize" type="xs:long">
<xs:annotation>
<xs:documentation>Size in bytes above which log files will be automatically archived.</xs:documentation>
<xs:documentation>Size in bytes above which log files will be automatically archived. Warning: combining this with isn't supported. We cannot create multiple archive files, if they should have the same name. Choose: </xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="maxArchiveFiles" type="xs:integer">
<xs:attribute name="enableArchiveFileCompression" type="xs:boolean">
<xs:annotation>
<xs:documentation>Maximum number of archive files that should be kept.</xs:documentation>
<xs:documentation>Indicates whether to compress archive files into the zip archive format.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="forceManaged" type="xs:boolean">
<xs:annotation>
<xs:documentation>Gets ors set a value indicating whether a managed file stream is forced, instead of used the native implementation.</xs:documentation>
<xs:documentation>Gets or set a value indicating whether a managed file stream is forced, instead of used the native implementation.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="fileAttributes" type="NLog.Targets.Win32FileAttributes">
@ -1081,11 +1062,6 @@
<xs:documentation>Indicates whether to replace file contents on each write instead of appending log message at the end.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="deleteOldFileOnStartup" type="xs:boolean">
<xs:annotation>
<xs:documentation>Indicates whether to delete old log file on startup.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="fileName" type="SimpleLayoutAttribute">
<xs:annotation>
<xs:documentation>Name of the file to write to.</xs:documentation>
@ -1103,7 +1079,12 @@
</xs:attribute>
<xs:attribute name="createDirs" type="xs:boolean">
<xs:annotation>
<xs:documentation>Indicates whether to create directories if they don't exist.</xs:documentation>
<xs:documentation>Indicates whether to create directories if they do not exist.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="deleteOldFileOnStartup" type="xs:boolean">
<xs:annotation>
<xs:documentation>Indicates whether to delete old log file on startup.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="enableFileDelete" type="xs:boolean">
@ -1121,6 +1102,11 @@
<xs:documentation>Indicates whether concurrent writes to the log file by multiple processes on different network hosts.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="maxLogFilenames" type="xs:integer">
<xs:annotation>
<xs:documentation>Maximum number of log filenames that should be stored as existing.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="keepFileOpen" type="xs:boolean">
<xs:annotation>
<xs:documentation>Indicates whether to keep log file open instead of opening and closing it on each logging event.</xs:documentation>
@ -1141,9 +1127,9 @@
<xs:documentation>Delay in milliseconds to wait before attempting to write to the file again.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="bufferSize" type="xs:integer">
<xs:attribute name="autoFlush" type="xs:boolean">
<xs:annotation>
<xs:documentation>Log file buffer size in bytes.</xs:documentation>
<xs:documentation>Indicates whether to automatically flush the file buffers after each log message.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="openFileCacheSize" type="xs:integer">
@ -1151,23 +1137,14 @@
<xs:documentation>Number of files to be kept open. Setting this to a higher value may improve performance in a situation where a single File target is writing to many files (such as splitting by level or by logger).</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="autoFlush" type="xs:boolean">
<xs:attribute name="bufferSize" type="xs:integer">
<xs:annotation>
<xs:documentation>Indicates whether to automatically flush the file buffers after each log message.</xs:documentation>
<xs:documentation>Log file buffer size in bytes.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:simpleType name="NLog.Targets.LineEndingMode">
<xs:restriction base="xs:string">
<xs:enumeration value="Default" />
<xs:enumeration value="CRLF" />
<xs:enumeration value="CR" />
<xs:enumeration value="LF" />
<xs:enumeration value="None" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="NLog.Targets.ArchiveNumberingMode">
<xs:restriction base="xs:string">
<xs:enumeration value="Sequence" />
@ -1226,50 +1203,6 @@
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="FormControl">
<xs:complexContent>
<xs:extension base="Target">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="layout" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="append" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="controlName" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="formName" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="reverseOrder" minOccurs="0" maxOccurs="1" type="xs:boolean" />
</xs:choice>
<xs:attribute name="name" type="xs:string">
<xs:annotation>
<xs:documentation>Name of the target.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="layout" type="SimpleLayoutAttribute">
<xs:annotation>
<xs:documentation>Layout used to format log messages.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="append" type="xs:boolean">
<xs:annotation>
<xs:documentation>Indicates whether log text should be appended to the text of the control instead of overwriting it.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="controlName" type="xs:string">
<xs:annotation>
<xs:documentation>Name of control to which NLog will log write log text.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="formName" type="xs:string">
<xs:annotation>
<xs:documentation>Name of the Form on which the control is located.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="reverseOrder" type="xs:boolean">
<xs:annotation>
<xs:documentation>Whether new log entry are added to the start or the end of the control</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="ImpersonatingWrapper">
<xs:complexContent>
<xs:extension base="WrapperTargetBase">
@ -1356,6 +1289,7 @@
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="endpointAddress" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="endpointConfigurationName" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="useOneWayContract" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="clientId" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="includeEventProperties" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="parameter" minOccurs="0" maxOccurs="unbounded" type="NLog.Targets.MethodCallParameter" />
@ -1376,6 +1310,11 @@
<xs:documentation>Name of the endpoint configuration in WCF configuration file.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="useOneWayContract" type="xs:boolean">
<xs:annotation>
<xs:documentation>Indicates whether to use a WCF service contract that is one way (fire and forget) or two way (request-reply)</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="clientId" type="SimpleLayoutAttribute">
<xs:annotation>
<xs:documentation>Client ID.</xs:documentation>
@ -1402,7 +1341,7 @@
</xs:choice>
<xs:attribute name="layout" type="SimpleLayoutAttribute">
<xs:annotation>
<xs:documentation>Layout that should be use to calcuate the value for the parameter.</xs:documentation>
<xs:documentation>Layout that should be use to calculate the value for the parameter.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="name" type="xs:string">
@ -1427,9 +1366,9 @@
<xs:element name="html" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="encoding" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="addNewLines" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="bcc" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="to" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="cc" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="to" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="bcc" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="body" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="subject" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="from" minOccurs="0" maxOccurs="1" type="Layout" />
@ -1443,6 +1382,8 @@
<xs:element name="enableSsl" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="smtpPort" minOccurs="0" maxOccurs="1" type="xs:integer" />
<xs:element name="useSystemNetMailSettings" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="pickupDirectoryLocation" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="deliveryMethod" minOccurs="0" maxOccurs="1" type="System.Net.Mail.SmtpDeliveryMethod" />
</xs:choice>
<xs:attribute name="name" type="xs:string">
<xs:annotation>
@ -1479,9 +1420,9 @@
<xs:documentation>Indicates whether to add new lines between log entries.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="bcc" type="SimpleLayoutAttribute">
<xs:attribute name="cc" type="SimpleLayoutAttribute">
<xs:annotation>
<xs:documentation>BCC email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com).</xs:documentation>
<xs:documentation>CC email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com).</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="to" type="SimpleLayoutAttribute">
@ -1489,9 +1430,9 @@
<xs:documentation>Recipients' email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com).</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="cc" type="SimpleLayoutAttribute">
<xs:attribute name="bcc" type="SimpleLayoutAttribute">
<xs:annotation>
<xs:documentation>CC email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com).</xs:documentation>
<xs:documentation>BCC email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com).</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="body" type="SimpleLayoutAttribute">
@ -1559,6 +1500,16 @@
<xs:documentation>Indicates whether the default Settings from System.Net.MailSettings should be used.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="pickupDirectoryLocation" type="xs:string">
<xs:annotation>
<xs:documentation>Folder where applications save mail messages to be processed by the local SMTP server.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="deliveryMethod" type="System.Net.Mail.SmtpDeliveryMethod">
<xs:annotation>
<xs:documentation>Specifies how outgoing email messages will be handled.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
@ -1569,6 +1520,13 @@
<xs:enumeration value="Ntlm" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="System.Net.Mail.SmtpDeliveryMethod">
<xs:restriction base="xs:string">
<xs:enumeration value="Network" />
<xs:enumeration value="SpecifiedPickupDirectory" />
<xs:enumeration value="PickupDirectoryFromIis" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="Memory">
<xs:complexContent>
<xs:extension base="Target">
@ -1589,32 +1547,6 @@
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="MessageBox">
<xs:complexContent>
<xs:extension base="Target">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="layout" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="caption" minOccurs="0" maxOccurs="1" type="Layout" />
</xs:choice>
<xs:attribute name="name" type="xs:string">
<xs:annotation>
<xs:documentation>Name of the target.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="layout" type="SimpleLayoutAttribute">
<xs:annotation>
<xs:documentation>Layout used to format log messages.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="caption" type="SimpleLayoutAttribute">
<xs:annotation>
<xs:documentation>Message box title.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="MSMQ">
<xs:complexContent>
<xs:extension base="Target">
@ -1939,6 +1871,7 @@
<xs:element name="counterHelp" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="counterName" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="counterType" minOccurs="0" maxOccurs="1" type="System.Diagnostics.PerformanceCounterType" />
<xs:element name="incrementValue" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="instanceName" minOccurs="0" maxOccurs="1" type="xs:string" />
</xs:choice>
<xs:attribute name="name" type="xs:string">
@ -1971,6 +1904,11 @@
<xs:documentation>Performance counter type.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="incrementValue" type="SimpleLayoutAttribute">
<xs:annotation>
<xs:documentation>The value by which to increment the counter.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="instanceName" type="xs:string">
<xs:annotation>
<xs:documentation>Performance counter instance name.</xs:documentation>
@ -2108,165 +2046,6 @@
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="RichTextBox">
<xs:complexContent>
<xs:extension base="Target">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="layout" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="autoScroll" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="controlName" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="formName" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="height" minOccurs="0" maxOccurs="1" type="xs:integer" />
<xs:element name="maxLines" minOccurs="0" maxOccurs="1" type="xs:integer" />
<xs:element name="showMinimized" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="toolWindow" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="width" minOccurs="0" maxOccurs="1" type="xs:integer" />
<xs:element name="row-coloring" minOccurs="0" maxOccurs="unbounded" type="NLog.Targets.RichTextBoxRowColoringRule" />
<xs:element name="useDefaultRowColoringRules" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="word-coloring" minOccurs="0" maxOccurs="unbounded" type="NLog.Targets.RichTextBoxWordColoringRule" />
</xs:choice>
<xs:attribute name="name" type="xs:string">
<xs:annotation>
<xs:documentation>Name of the target.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="layout" type="SimpleLayoutAttribute">
<xs:annotation>
<xs:documentation>Layout used to format log messages.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="autoScroll" type="xs:boolean">
<xs:annotation>
<xs:documentation>Indicates whether scroll bar will be moved automatically to show most recent log entries.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="controlName" type="xs:string">
<xs:annotation>
<xs:documentation>Name of RichTextBox to which Nlog will write.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="formName" type="xs:string">
<xs:annotation>
<xs:documentation>Name of the Form on which the control is located. If there is no open form of a specified name than NLog will create a new one.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="height" type="xs:integer">
<xs:annotation>
<xs:documentation>Initial height of the form with rich text box.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="maxLines" type="xs:integer">
<xs:annotation>
<xs:documentation>Maximum number of lines the rich text box will store (or 0 to disable this feature).</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="showMinimized" type="xs:boolean">
<xs:annotation>
<xs:documentation>Indicates whether the created form will be initially minimized.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="toolWindow" type="xs:boolean">
<xs:annotation>
<xs:documentation>Indicates whether the created window will be a tool window.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="width" type="xs:integer">
<xs:annotation>
<xs:documentation>Initial width of the form with rich text box.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="useDefaultRowColoringRules" type="xs:boolean">
<xs:annotation>
<xs:documentation>Indicates whether to use default coloring rules.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:simpleType name="System.Drawing.FontStyle">
<xs:restriction base="xs:string">
<xs:enumeration value="Regular" />
<xs:enumeration value="Bold" />
<xs:enumeration value="Italic" />
<xs:enumeration value="Underline" />
<xs:enumeration value="Strikeout" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="NLog.Targets.RichTextBoxRowColoringRule">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="condition" minOccurs="0" maxOccurs="1" type="Condition" />
<xs:element name="backgroundColor" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="fontColor" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="style" minOccurs="0" maxOccurs="1" type="System.Drawing.FontStyle" />
</xs:choice>
<xs:attribute name="condition" type="Condition">
<xs:annotation>
<xs:documentation>Condition that must be met in order to set the specified font color.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="backgroundColor" type="xs:string">
<xs:annotation>
<xs:documentation>Background color.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="fontColor" type="xs:string">
<xs:annotation>
<xs:documentation>Font color.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="style" type="System.Drawing.FontStyle">
<xs:annotation>
<xs:documentation>Font style of matched text.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="NLog.Targets.RichTextBoxWordColoringRule">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="ignoreCase" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="regex" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="text" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="wholeWords" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="backgroundColor" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="fontColor" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="style" minOccurs="0" maxOccurs="1" type="System.Drawing.FontStyle" />
</xs:choice>
<xs:attribute name="ignoreCase" type="xs:boolean">
<xs:annotation>
<xs:documentation>Indicates whether to ignore case when comparing texts.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="regex" type="xs:string">
<xs:annotation>
<xs:documentation>Regular expression to be matched. You must specify either text or regex.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="text" type="xs:string">
<xs:annotation>
<xs:documentation>Text to be matched. You must specify either text or regex.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="wholeWords" type="xs:boolean">
<xs:annotation>
<xs:documentation>Indicates whether to match whole words only.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="backgroundColor" type="xs:string">
<xs:annotation>
<xs:documentation>Background color. Names are identical with KnownColor enum extended with Empty value which means that background color won't be changed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="fontColor" type="xs:string">
<xs:annotation>
<xs:documentation>Font color. Names are identical with KnownColor enum extended with Empty value which means that font color won't be changed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="style" type="System.Drawing.FontStyle">
<xs:annotation>
<xs:documentation>Font style of matched text. Possible values are the same as in FontStyle enum in System.Drawing.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="RoundRobinGroup">
<xs:complexContent>
<xs:extension base="CompoundTargetBase">
@ -2320,6 +2099,7 @@
<xs:extension base="Target">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="includeBOM" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="parameter" minOccurs="0" maxOccurs="unbounded" type="NLog.Targets.MethodCallParameter" />
<xs:element name="encoding" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="methodName" minOccurs="0" maxOccurs="1" type="xs:string" />
@ -2332,6 +2112,11 @@
<xs:documentation>Name of the target.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="includeBOM" type="xs:boolean">
<xs:annotation>
<xs:documentation>Should we include the BOM (Byte-order-mark) for UTF? Influences the property. This will only work for UTF-8.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="encoding" type="xs:string">
<xs:annotation>
<xs:documentation>Encoding.</xs:documentation>
@ -2339,12 +2124,12 @@
</xs:attribute>
<xs:attribute name="methodName" type="xs:string">
<xs:annotation>
<xs:documentation>Web service method name.</xs:documentation>
<xs:documentation>Web service method name. Only used with Soap.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="namespace" type="xs:string">
<xs:annotation>
<xs:documentation>Web service namespace.</xs:documentation>
<xs:documentation>Web service namespace. Only used with Soap.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="protocol" type="NLog.Targets.WebServiceProtocol">
@ -2459,6 +2244,43 @@
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="JsonLayout">
<xs:complexContent>
<xs:extension base="Layout">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="attribute" minOccurs="0" maxOccurs="unbounded" type="NLog.Layouts.JsonAttribute" />
<xs:element name="suppressSpaces" minOccurs="0" maxOccurs="1" type="xs:boolean" />
</xs:choice>
<xs:attribute name="suppressSpaces" type="xs:boolean">
<xs:annotation>
<xs:documentation>Option to suppress the extra spaces in the output json</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="NLog.Layouts.JsonAttribute">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="encode" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="layout" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
</xs:choice>
<xs:attribute name="encode" type="xs:boolean">
<xs:annotation>
<xs:documentation>Determines wether or not this attribute will be Json encoded.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="layout" type="SimpleLayoutAttribute">
<xs:annotation>
<xs:documentation>Layout that will be rendered as the attribute's value.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="name" type="xs:string">
<xs:annotation>
<xs:documentation>Name of the attribute.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="LayoutWithHeaderAndFooter">
<xs:complexContent>
<xs:extension base="Layout">

View file

@ -1,12 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices.ComTypes;
using System.Text;
using System.Windows.Forms;
using Newtonsoft.Json;
namespace Wox.Infrastructure.Storage
{

View file

@ -1,11 +1,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization.Formatters;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading;
using Wox.Infrastructure.Logger;

View file

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Wox.Infrastructure.Storage
namespace Wox.Infrastructure.Storage
{
public interface IStorage
{

View file

@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using Newtonsoft.Json;

View file

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Wox.Infrastructure
namespace Wox.Infrastructure
{
public class StringMatcher
{

View file

@ -1,26 +1,38 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Wox.Infrastructure.Logger;
namespace Wox.Infrastructure
{
public class Timeit : IDisposable
{
private Stopwatch stopwatch = new Stopwatch();
private string name;
private readonly Stopwatch _stopwatch = new Stopwatch();
private readonly string _name;
public Timeit(string name)
{
this.name = name;
stopwatch.Start();
_name = name;
_stopwatch.Start();
}
public long Current
{
get
{
_stopwatch.Stop();
long seconds = _stopwatch.ElapsedMilliseconds;
_stopwatch.Start();
return seconds;
}
}
public void Dispose()
{
stopwatch.Stop();
DebugHelper.WriteLine(name + ":" + stopwatch.ElapsedMilliseconds + "ms");
_stopwatch.Stop();
string info = _name + " : " + _stopwatch.ElapsedMilliseconds + "ms";
Debug.WriteLine(info);
Log.Info(info);
}
}
}

View file

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Wox.Infrastructure
{

View file

@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
namespace Wox.Infrastructure
{

View file

@ -12,7 +12,6 @@
<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' ">
@ -37,28 +36,19 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualBasic" />
<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="NLog">
<HintPath>..\packages\NLog.3.2.0.0\lib\net35\NLog.dll</HintPath>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.2.0\lib\net35\NLog.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<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="DebugHelper.cs" />
<Compile Include="Hotkey\InterceptKeys.cs" />
<Compile Include="Hotkey\KeyEvent.cs" />
<Compile Include="Logger\Log.cs" />
@ -88,13 +78,12 @@
<Content Include="NLog.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="Logger\NLog.xsd">
<None Include="NLog.xsd">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net35" />
<package id="NLog" version="3.2.0.0" targetFramework="net35" />
<package id="NLog" version="4.2.0" targetFramework="net35" />
<package id="NLog.Schema" version="4.2.0" targetFramework="net35" />
</packages>

View file

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Wox.Plugin
namespace Wox.Plugin
{
public static class AllowedLanguage
{

View file

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows;
using System.Windows.Input;
namespace Wox.Plugin

39
Wox.Plugin/Feature.cs Normal file
View file

@ -0,0 +1,39 @@
using System.Collections.Generic;
using System;
namespace Wox.Plugin
{
public interface IFeatures { }
public interface IContextMenu : IFeatures
{
List<Result> LoadContextMenus(Result selectedResult);
}
public interface IExclusiveQuery : IFeatures
{
bool IsExclusiveQuery(Query query);
}
/// <summary>
/// Represent plugin query will be executed in UI thread directly. Don't do long-running operation in Query method if you implement this interface
/// <remarks>This will improve the performance of instant search like websearch or cmd plugin</remarks>
/// </summary>
public interface IInstantQuery : IFeatures
{
[Obsolete("Empty interface is enough. it will be removed in v1.3.0 and possibly replaced by attribute")]
bool IsInstantQuery(string query);
}
/// <summary>
/// Represent plugins that support internationalization
/// </summary>
public interface IPluginI18n : IFeatures
{
string GetLanguagesFolder();
string GetTranslatedPluginTitle();
string GetTranslatedPluginDescription();
}
}

View file

@ -1,12 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Wox.Plugin.Features
{
public interface IContextMenu
{
List<Result> LoadContextMenus(Result selectedResult);
}
[Obsolete("Delete Wox.Plugin.Features using directive, " +
"and use Wox.Plugin.Feature.IContextMenu instead, " +
"this method will be removed in v1.3.0")]
public interface IContextMenu { }
}

View file

@ -1,12 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Wox.Plugin.Features
{
public interface IExclusiveQuery
{
bool IsExclusiveQuery(Query query);
}
[Obsolete("Delete Wox.Plugin.Features using directive, " +
"and use Wox.Plugin.Feature.IInstantQuery instead, " +
"this method will be removed in v1.3.0")]
public interface IExclusiveQuery { }
}

View file

@ -1,11 +1,9 @@
namespace Wox.Plugin.Features
using System;
namespace Wox.Plugin.Features
{
/// <summary>
/// Represent plugin query will be executed in UI thread directly. Don't do long-running operation in Query method if you implement this interface
/// <remarks>This will improve the performance of instant search like websearch or cmd plugin</remarks>
/// </summary>
public interface IInstantQuery
{
bool IsInstantQuery(string query);
}
[Obsolete("Delete Wox.Plugin.Features using directive, " +
"and use Wox.Plugin.Feature.IInstantQuery instead, " +
"this method will be removed in v1.3.0")]
public interface IInstantQuery { }
}

View file

@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace Wox.Plugin
{
/// <summary>
/// Represent plugins that support internationalization
/// </summary>
public interface IPluginI18n
{
string GetLanguagesFolder();
string GetTranslatedPluginTitle();
string GetTranslatedPluginDescription();
}
}

View file

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Windows.Documents;
using System.Collections.Generic;
namespace Wox.Plugin
{

View file

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows.Controls;
namespace Wox.Plugin
{

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