project stucture change

This commit is contained in:
qianlifeng
2013-12-19 23:55:23 +08:00
parent fd1ee23adc
commit c8fca3d63f
6 changed files with 2 additions and 17 deletions

View File

@@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace WinAlfred.Plugin.Everything
{
public sealed class EverythingAPI
{
const int EVERYTHING_OK = 0;
const int EVERYTHING_ERROR_MEMORY = 1;
const int EVERYTHING_ERROR_IPC = 2;
const int EVERYTHING_ERROR_REGISTERCLASSEX = 3;
const int EVERYTHING_ERROR_CREATEWINDOW = 4;
const int EVERYTHING_ERROR_CREATETHREAD = 5;
const int EVERYTHING_ERROR_INVALIDINDEX = 6;
const int EVERYTHING_ERROR_INVALIDCALL = 7;
[DllImport("Everything.dll")]
private static extern int Everything_SetSearch(string lpSearchString);
[DllImport("Everything.dll")]
private static extern void Everything_SetMatchPath(bool bEnable);
[DllImport("Everything.dll")]
private static extern void Everything_SetMatchCase(bool bEnable);
[DllImport("Everything.dll")]
private static extern void Everything_SetMatchWholeWord(bool bEnable);
[DllImport("Everything.dll")]
private static extern void Everything_SetRegex(bool bEnable);
[DllImport("Everything.dll")]
private static extern void Everything_SetMax(int dwMax);
[DllImport("Everything.dll")]
private static extern void Everything_SetOffset(int dwOffset);
[DllImport("Everything.dll")]
private static extern bool Everything_GetMatchPath();
[DllImport("Everything.dll")]
private static extern bool Everything_GetMatchCase();
[DllImport("Everything.dll")]
private static extern bool Everything_GetMatchWholeWord();
[DllImport("Everything.dll")]
private static extern bool Everything_GetRegex();
[DllImport("Everything.dll")]
private static extern UInt32 Everything_GetMax();
[DllImport("Everything.dll")]
private static extern UInt32 Everything_GetOffset();
[DllImport("Everything.dll")]
private static extern string Everything_GetSearch();
[DllImport("Everything.dll")]
private static extern int Everything_GetLastError();
[DllImport("Everything.dll")]
private static extern bool Everything_Query();
[DllImport("Everything.dll")]
private static extern void Everything_SortResultsByPath();
[DllImport("Everything.dll")]
private static extern int Everything_GetNumFileResults();
[DllImport("Everything.dll")]
private static extern int Everything_GetNumFolderResults();
[DllImport("Everything.dll")]
private static extern int Everything_GetNumResults();
[DllImport("Everything.dll")]
private static extern int Everything_GetTotFileResults();
[DllImport("Everything.dll")]
private static extern int Everything_GetTotFolderResults();
[DllImport("Everything.dll")]
private static extern int Everything_GetTotResults();
[DllImport("Everything.dll")]
private static extern bool Everything_IsVolumeResult(int nIndex);
[DllImport("Everything.dll")]
private static extern bool Everything_IsFolderResult(int nIndex);
[DllImport("Everything.dll")]
private static extern bool Everything_IsFileResult(int nIndex);
[DllImport("Everything.dll")]
private static extern void Everything_GetResultFullPathName(int nIndex, StringBuilder lpString, int nMaxCount);
[DllImport("Everything.dll")]
private static extern void Everything_Reset();
public void Search(string query)
{
int i;
const int bufsize = 260;
StringBuilder buf = new StringBuilder(bufsize);
Everything_SetSearch(query);
Everything_Query();
// loop through the results, adding each result to the listbox.
for (i = 0; i < Everything_GetNumResults(); i++)
{
// get the result's full path and file name.
Everything_GetResultFullPathName(i, buf, bufsize);
}
}
}
}

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WinAlfred.Plugin.Everything
{
public class Main : IPlugin
{
EverythingAPI api = new EverythingAPI();
public string GetActionName()
{
return "ev";
}
public List<Result> Query(Query query)
{
var results = new List<Result>();
if (query.ActionParameters.Count > 0)
{
api.Search(query.ActionParameters[0]);
}
return results;
}
public void Init()
{
//init everything
}
}
}

View File

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

View File

@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{230AE83F-E92E-4E69-8355-426B305DA9C0}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WinAlfred.Plugin.Everything</RootNamespace>
<AssemblyName>WinAlfred.Plugin.Everything</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<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="Main.cs" />
<Compile Include="EverythingAPI.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\WinAlfred.Plugin\WinAlfred.Plugin.csproj">
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
<Name>WinAlfred.Plugin</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>