mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
Fix dependency references issue of c# plugins.
This commit is contained in:
@@ -23,53 +23,36 @@ namespace Wox.Plugin.Doc
|
||||
List<Result> results = new List<Result>();
|
||||
if (query.ActionParameters.Count == 0)
|
||||
{
|
||||
results.Add(new Result()
|
||||
{
|
||||
Title = "Current supported docs:"
|
||||
});
|
||||
results.AddRange(docs.Select(o => new Result()
|
||||
{
|
||||
Title = o.Name.Replace(".docset", ""),
|
||||
Title = o.Name.Replace(".docset", "").Replace(" ",""),
|
||||
IcoPath = o.IconPath
|
||||
}).ToList());
|
||||
return results;
|
||||
}
|
||||
|
||||
foreach (Doc doc in docs)
|
||||
if (query.ActionParameters.Count >= 2)
|
||||
{
|
||||
results.AddRange(QuerySqllite(doc, query.ActionParameters[0]));
|
||||
Doc firstOrDefault = docs.FirstOrDefault(o => o.Name.Replace(".docset", "").Replace(" ","").ToLower() == query.ActionParameters[0]);
|
||||
if (firstOrDefault != null)
|
||||
{
|
||||
results.AddRange(QuerySqllite(firstOrDefault, query.ActionParameters[1]));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (Doc doc in docs)
|
||||
{
|
||||
results.AddRange(QuerySqllite(doc, query.ActionParameters[0]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
public void Init(PluginInitContext context)
|
||||
{
|
||||
|
||||
//todo:move to common place
|
||||
var otherCompanyDlls = new DirectoryInfo(context.PluginMetadata.PluginDirecotry).GetFiles("*.dll");
|
||||
AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
|
||||
{
|
||||
var dll = otherCompanyDlls.FirstOrDefault(fi =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Assembly assembly = Assembly.LoadFile(fi.FullName);
|
||||
return assembly.FullName == args.Name;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (dll == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return Assembly.LoadFile(dll.FullName);
|
||||
};
|
||||
|
||||
docsetBasePath = context.PluginMetadata.PluginDirecotry + @"Docset";
|
||||
if (!Directory.Exists(docsetBasePath))
|
||||
Directory.CreateDirectory(docsetBasePath);
|
||||
@@ -110,7 +93,6 @@ namespace Wox.Plugin.Doc
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return imagePath;
|
||||
}
|
||||
|
||||
5
Plugins/Wox.Plugin.Doc/README.md
Normal file
5
Plugins/Wox.Plugin.Doc/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
How to use?
|
||||
|
||||
1. Docset download link:[http://kapeli.com/docset_links](http://kapeli.com/docset_links)
|
||||
2. Unzip doc zip into "Plugins\Doc\Docset\{docname}"
|
||||
3. Restart Wox
|
||||
@@ -83,6 +83,7 @@
|
||||
<None Include="plugin.ini">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="README.md" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
|
||||
@@ -101,7 +102,7 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>xcopy /Y /E $(TargetDir)*.* $(SolutionDir)Wox\bin\Debug\Plugins\Doc\</PostBuildEvent>
|
||||
<PostBuildEvent>xcopy /Y /E $(TargetDir)*.* $(SolutionDir)Wox\bin\Debug\Plugins\$(ProjectName)\</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<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.
|
||||
|
||||
Reference in New Issue
Block a user