some API changes for Query class and renames.

This commit is contained in:
qianlifeng
2015-01-26 17:46:55 +08:00
parent ddf6154600
commit 7821f41723
29 changed files with 371 additions and 289 deletions

View File

@@ -21,14 +21,14 @@ namespace Wox.Plugin.CMD
{
List<Result> results = new List<Result>();
List<Result> pushedResults = new List<Result>();
if (query.RawQuery == ">")
if (query.Search == ">")
{
return GetAllHistoryCmds();
}
if (query.RawQuery.StartsWith(">") && query.RawQuery.Length > 1)
if (query.Search.StartsWith(">") && query.Search.Length > 1)
{
string cmd = query.RawQuery.Substring(1);
string cmd = query.Search.Substring(1);
var queryCmd = GetCurrentCmd(cmd);
context.API.PushResults(query, context.CurrentPluginMetadata, new List<Result>() { queryCmd });
pushedResults.Add(queryCmd);

View File

@@ -28,13 +28,13 @@ namespace Wox.Plugin.Caculator
public List<Result> Query(Query query)
{
if (query.RawQuery.Length <= 2 // don't affect when user only input "e" or "i" keyword
|| !regValidExpressChar.IsMatch(query.RawQuery)
|| !IsBracketComplete(query.RawQuery)) return new List<Result>();
if (query.Search.Length <= 2 // don't affect when user only input "e" or "i" keyword
|| !regValidExpressChar.IsMatch(query.Search)
|| !IsBracketComplete(query.Search)) return new List<Result>();
try
{
var result = yampContext.Run(query.RawQuery);
var result = yampContext.Run(query.Search);
if (result.Output != null && !string.IsNullOrEmpty(result.Result))
{
return new List<Result>() { new Result() {

View File

@@ -29,7 +29,7 @@ namespace Wox.Plugin.Color
public List<Result> Query(Query query)
{
var raw = query.RawQuery;
var raw = query.Search;
if (!IsAvailable(raw)) return new List<Result>(0);
try
{

View File

@@ -38,9 +38,7 @@ namespace Wox.Plugin.ControlPanel
public List<Result> Query(Query query)
{
if (query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1) return new List<Result>();
string myQuery = query.RawQuery.Trim();
string myQuery = query.Search.Trim();
List<Result> results = new List<Result>();
foreach (var item in controlPanelItems)

View File

@@ -53,8 +53,7 @@ namespace Wox.Plugin.Folder
public List<Result> Query(Query query)
{
if(string.IsNullOrEmpty(query.RawQuery)) return new List<Result>();
string input = query.RawQuery.ToLower();
string input = query.Search.ToLower();
List<FolderLink> userFolderLinks = FolderStorage.Instance.FolderLinks.Where(
x => x.Nickname.StartsWith(input, StringComparison.OrdinalIgnoreCase)).ToList();

View File

@@ -13,16 +13,14 @@ namespace Wox.Plugin.PluginIndicator
public List<Result> Query(Query query)
{
List<Result> results = new List<Result>();
if (string.IsNullOrEmpty(query.RawQuery)) return results;
if (allPlugins.Count == 0)
{
allPlugins = context.API.GetAllPlugins().Where(o => !PluginManager.IsWildcardPlugin(o.Metadata)).ToList();
allPlugins = context.API.GetAllPlugins().Where(o => !PluginManager.IsSystemPlugin(o.Metadata)).ToList();
}
foreach (PluginMetadata metadata in allPlugins.Select(o => o.Metadata))
{
if (metadata.ActionKeyword.StartsWith(query.RawQuery))
if (metadata.ActionKeyword.StartsWith(query.Search))
{
PluginMetadata metadataCopy = metadata;
var customizedPluginConfig = UserSettingStorage.Instance.CustomizedPluginConfigs.FirstOrDefault(o => o.ID == metadataCopy.ID);
@@ -47,7 +45,7 @@ namespace Wox.Plugin.PluginIndicator
}
}
results.AddRange(UserSettingStorage.Instance.WebSearches.Where(o => o.ActionWord.StartsWith(query.RawQuery) && o.Enabled).Select(n => new Result()
results.AddRange(UserSettingStorage.Instance.WebSearches.Where(o => o.ActionWord.StartsWith(query.Search) && o.Enabled).Select(n => new Result()
{
Title = n.ActionWord,
SubTitle = string.Format("Activate {0} web search", n.ActionWord),

View File

@@ -10,59 +10,37 @@ using Newtonsoft.Json;
namespace Wox.Plugin.PluginManagement
{
public class WoxPluginResult
{
public string plugin_file;
public string description;
public int liked_count;
public string name;
public string version;
}
public class Main : IPlugin
{
private static string APIBASE = "https://api.getwox.com";
private static string PluginPath = AppDomain.CurrentDomain.BaseDirectory + "Plugins";
private static string PluginConfigName = "plugin.json";
private static string pluginSearchUrl = APIBASE +"/plugin/search/";
private static string pluginSearchUrl = APIBASE + "/plugin/search/";
private PluginInitContext context;
public List<Result> Query(Query query)
{
List<Result> results = new List<Result>();
if (query.ActionParameters.Count == 0)
if (string.IsNullOrEmpty(query.Search))
{
results.Add(new Result("wpm install <pluginName>", "Images\\plugin.png", "search and install wox plugins")
results.Add(new Result("install <pluginName>", "Images\\plugin.png", "search and install wox plugins")
{
Action = e =>
{
context.API.ChangeQuery("wpm install ");
return false;
}
Action = e => ChangeToInstallCommand()
});
results.Add(new Result("wpm uninstall <pluginName>", "Images\\plugin.png", "uninstall plugin")
results.Add(new Result("uninstall <pluginName>", "Images\\plugin.png", "uninstall plugin")
{
Action = e =>
{
context.API.ChangeQuery("wpm uninstall ");
return false;
}
Action = e => ChangeToUninstallCommand()
});
results.Add(new Result("wpm list", "Images\\plugin.png", "list plugins installed")
results.Add(new Result("list", "Images\\plugin.png", "list plugins installed")
{
Action = e =>
{
context.API.ChangeQuery("wpm list");
return false;
}
Action = e => ChangeToListCommand()
});
return results;
}
if (query.ActionParameters.Count > 0)
if (!string.IsNullOrEmpty(query.FirstSearch))
{
bool hit = false;
switch (query.ActionParameters[0].ToLower())
switch (query.FirstSearch.ToLower())
{
case "list":
hit = true;
@@ -71,51 +49,39 @@ namespace Wox.Plugin.PluginManagement
case "uninstall":
hit = true;
results = ListUnInstalledPlugins(query);
results = UnInstallPlugins(query);
break;
case "install":
hit = true;
if (query.ActionParameters.Count > 1)
if (!string.IsNullOrEmpty(query.SecondSearch))
{
results = InstallPlugin(query);
results = InstallPlugin(query.SecondSearch);
}
break;
}
if (!hit)
{
if ("install".Contains(query.ActionParameters[0].ToLower()))
if ("install".Contains(query.FirstSearch.ToLower()))
{
results.Add(new Result("wpm install <pluginName>", "Images\\plugin.png", "search and install wox plugins")
results.Add(new Result("install <pluginName>", "Images\\plugin.png", "search and install wox plugins")
{
Action = e =>
{
context.API.ChangeQuery("wpm install ");
return false;
}
Action = e => ChangeToInstallCommand()
});
}
if ("uninstall".Contains(query.ActionParameters[0].ToLower()))
if ("uninstall".Contains(query.FirstSearch.ToLower()))
{
results.Add(new Result("wpm uninstall <pluginName>", "Images\\plugin.png", "uninstall plugin")
results.Add(new Result("uninstall <pluginName>", "Images\\plugin.png", "uninstall plugin")
{
Action = e =>
{
context.API.ChangeQuery("wpm uninstall ");
return false;
}
Action = e => ChangeToUninstallCommand()
});
}
if ("list".Contains(query.ActionParameters[0].ToLower()))
if ("list".Contains(query.FirstSearch.ToLower()))
{
results.Add(new Result("wpm list", "Images\\plugin.png", "list plugins installed")
results.Add(new Result("list", "Images\\plugin.png", "list plugins installed")
{
Action = e =>
{
context.API.ChangeQuery("wpm list");
return false;
}
Action = e => ChangeToListCommand()
});
}
}
@@ -124,10 +90,49 @@ namespace Wox.Plugin.PluginManagement
return results;
}
private List<Result> InstallPlugin(Query query)
private bool ChangeToListCommand()
{
if (context.CurrentPluginMetadata.ActionKeyword == "*")
{
context.API.ChangeQuery("list ");
}
else
{
context.API.ChangeQuery(string.Format("{0} list ", context.CurrentPluginMetadata.ActionKeyword));
}
return false;
}
private bool ChangeToUninstallCommand()
{
if (context.CurrentPluginMetadata.ActionKeyword == "*")
{
context.API.ChangeQuery("uninstall ");
}
else
{
context.API.ChangeQuery(string.Format("{0} uninstall ", context.CurrentPluginMetadata.ActionKeyword));
}
return false;
}
private bool ChangeToInstallCommand()
{
if (context.CurrentPluginMetadata.ActionKeyword == "*")
{
context.API.ChangeQuery("install ");
}
else
{
context.API.ChangeQuery(string.Format("{0} install ", context.CurrentPluginMetadata.ActionKeyword));
}
return false;
}
private List<Result> InstallPlugin(string queryPluginName)
{
List<Result> results = new List<Result>();
HttpWebResponse response = HttpRequest.CreateGetHttpResponse(pluginSearchUrl + query.ActionParameters[1], context.Proxy);
HttpWebResponse response = HttpRequest.CreateGetHttpResponse(pluginSearchUrl + queryPluginName, context.Proxy);
Stream s = response.GetResponseStream();
if (s != null)
{
@@ -140,7 +145,7 @@ namespace Wox.Plugin.PluginManagement
}
catch
{
context.API.ShowMsg("Coundn't parse api search results", "Please update your Wox!",string.Empty);
context.API.ShowMsg("Coundn't parse api search results", "Please update your Wox!", string.Empty);
return results;
}
@@ -194,19 +199,19 @@ namespace Wox.Plugin.PluginManagement
return results;
}
private List<Result> ListUnInstalledPlugins(Query query)
private List<Result> UnInstallPlugins(Query query)
{
List<Result> results = new List<Result>();
List<PluginMetadata> allInstalledPlugins = ParseRegularPlugins();
if (query.ActionParameters.Count > 1)
List<PluginMetadata> allInstalledPlugins = context.API.GetAllPlugins().Select(o => o.Metadata).ToList();
if (!string.IsNullOrEmpty(query.SecondSearch))
{
string pluginName = query.ActionParameters[1];
allInstalledPlugins =
allInstalledPlugins.Where(o => o.Name.ToLower().Contains(pluginName.ToLower())).ToList();
allInstalledPlugins.Where(o => o.Name.ToLower().Contains(query.SecondSearch.ToLower())).ToList();
}
foreach (PluginMetadata plugin in allInstalledPlugins)
{
var plugin1 = plugin;
results.Add(new Result()
{
Title = plugin.Name,
@@ -214,7 +219,7 @@ namespace Wox.Plugin.PluginManagement
IcoPath = plugin.FullIcoPath,
Action = e =>
{
UnInstalledPlugins(plugin);
UnInstallPlugin(plugin1);
return false;
}
});
@@ -222,7 +227,7 @@ namespace Wox.Plugin.PluginManagement
return results;
}
private void UnInstalledPlugins(PluginMetadata plugin)
private void UnInstallPlugin(PluginMetadata plugin)
{
string content = string.Format("Do you want to uninstall following plugin?\r\n\r\nName: {0}\r\nVersion: {1}\r\nAuthor: {2}", plugin.Name, plugin.Version, plugin.Author);
if (MessageBox.Show(content, "Wox", MessageBoxButtons.YesNo) == DialogResult.Yes)
@@ -235,7 +240,7 @@ namespace Wox.Plugin.PluginManagement
private List<Result> ListInstalledPlugins()
{
List<Result> results = new List<Result>();
foreach (PluginMetadata plugin in ParseRegularPlugins())
foreach (PluginMetadata plugin in context.API.GetAllPlugins().Select(o => o.Metadata))
{
results.Add(new Result()
{
@@ -247,61 +252,6 @@ namespace Wox.Plugin.PluginManagement
return results;
}
private static List<PluginMetadata> ParseRegularPlugins()
{
List<PluginMetadata> pluginMetadatas = new List<PluginMetadata>();
if (!Directory.Exists(PluginPath))
Directory.CreateDirectory(PluginPath);
string[] directories = Directory.GetDirectories(PluginPath);
foreach (string directory in directories)
{
PluginMetadata metadata = GetMetadataFromJson(directory);
if (metadata != null) pluginMetadatas.Add(metadata);
}
return pluginMetadatas;
}
private static PluginMetadata GetMetadataFromJson(string pluginDirectory)
{
string configPath = Path.Combine(pluginDirectory, PluginConfigName);
PluginMetadata metadata;
if (!File.Exists(configPath))
{
return null;
}
try
{
metadata = JsonConvert.DeserializeObject<PluginMetadata>(File.ReadAllText(configPath));
metadata.PluginType = PluginType.User;
metadata.PluginDirectory = pluginDirectory;
}
catch (Exception)
{
string error = string.Format("Parse plugin config {0} failed: json format is not valid", configPath);
return null;
}
if (!AllowedLanguage.IsAllowed(metadata.Language))
{
string error = string.Format("Parse plugin config {0} failed: invalid language {1}", configPath,
metadata.Language);
return null;
}
if (!File.Exists(metadata.ExecuteFilePath))
{
string error = string.Format("Parse plugin config {0} failed: ExecuteFile {1} didn't exist", configPath,
metadata.ExecuteFilePath);
return null;
}
return metadata;
}
public void Init(PluginInitContext context)
{
this.context = context;

View File

@@ -1,91 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{049490F0-ECD2-4148-9B39-2135EC346EBE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Wox.Plugin.PluginManagement</RootNamespace>
<AssemblyName>Wox.Plugin.PluginManagement</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.PluginManagement\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\Release\Plugins\Wox.Plugin.PluginManagement\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="HttpRequest.cs" />
<Compile Include="Main.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
<Name>Wox.Plugin</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Images\plugin.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{049490F0-ECD2-4148-9B39-2135EC346EBE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Wox.Plugin.PluginManagement</RootNamespace>
<AssemblyName>Wox.Plugin.PluginManagement</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.PluginManagement\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\Release\Plugins\Wox.Plugin.PluginManagement\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="HttpRequest.cs" />
<Compile Include="Main.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WoxPluginResult.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
<Name>Wox.Plugin</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Images\plugin.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
-->
</Project>

View File

@@ -0,0 +1,11 @@
namespace Wox.Plugin.PluginManagement
{
public class WoxPluginResult
{
public string plugin_file;
public string description;
public int liked_count;
public string name;
public string version;
}
}

View File

@@ -26,9 +26,7 @@ namespace Wox.Plugin.Program
public List<Result> Query(Query query)
{
if (query.RawQuery.Trim().Length <= 1) return new List<Result>();
var fuzzyMather = FuzzyMatcher.Create(query.RawQuery);
var fuzzyMather = FuzzyMatcher.Create(query.Search);
List<Program> returnList = programs.Where(o => MatchProgram(o, fuzzyMather)).ToList();
returnList.ForEach(ScoreFilter);
returnList = returnList.OrderByDescending(o => o.Score).ToList();

View File

@@ -13,7 +13,7 @@ namespace Wox.Plugin.QueryHistory
public List<Result> Query(Query query)
{
var histories = QueryHistoryStorage.Instance.GetHistory();
string filter = query.GetAllRemainingParameter();
string filter = query.Search;
if (!string.IsNullOrEmpty(filter))
{
histories = histories.Where(o => o.Query.Contains(filter)).ToList();

View File

@@ -34,7 +34,6 @@ namespace Wox.Plugin.Sys
public List<Result> Query(Query query)
{
if (query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1) return new List<Result>();
if (availableResults.Count == 0)
{
LoadCommands();
@@ -43,7 +42,7 @@ namespace Wox.Plugin.Sys
List<Result> results = new List<Result>();
foreach (Result availableResult in availableResults)
{
if (availableResult.Title.ToLower().StartsWith(query.RawQuery.ToLower()))
if (availableResult.Title.ToLower().StartsWith(query.Search.ToLower()))
{
results.Add(availableResult);
}

View File

@@ -45,9 +45,7 @@ namespace Wox.Plugin.Url
public List<Result> Query(Query query)
{
if(string.IsNullOrEmpty(query.RawQuery)) return new List<Result>();
var raw = query.RawQuery;
var raw = query.Search;
if (IsURL(raw))
{
return new List<Result>

View File

@@ -18,11 +18,11 @@ namespace Wox.Plugin.WebSearch
List<Result> results = new List<Result>();
Core.UserSettings.WebSearch webSearch =
UserSettingStorage.Instance.WebSearches.FirstOrDefault(o => o.ActionWord == query.ActionName && o.Enabled);
UserSettingStorage.Instance.WebSearches.FirstOrDefault(o => o.ActionWord == query.FirstSearch.Trim() && o.Enabled);
if (webSearch != null)
{
string keyword = query.ActionParameters.Count > 0 ? query.GetAllRemainingParameter() : "";
string keyword = query.SecondToEndSearch;
string title = keyword;
string subtitle = "Search " + webSearch.Title;
if (string.IsNullOrEmpty(keyword))