FinderSDK
所属分类:搜索引擎
开发工具:Others
文件大小:636KB
下载次数:8
上传日期:2015-03-25 16:03:54
上 传 者:
挖潜者
说明: 这是“光速搜索”软件发布的开发包,运用USN技术实现了极速搜索,很可惜的是这个开发团队解散了,软件终止在1.0.1.280 ,令人遗憾!!!这是解散前团队发布的一个开发包。有了这个开发包就可以开发出自己的光速搜索软件。
(This is the " speed of light search" software development kit released, using USN technology to achieve speed search, it is a pity that the development team disbanded, the software terminates at 1.0.1.280, regrettably! ! ! This is the dissolution of the former team released a development kit. With this SDK you can develop your own search software speed of light.)
文件列表:
SDK\cppdemo\cppdemo\FinderSDK.h (1968, 2011-11-25)
SDK\FinderSDK.h (1968, 2011-11-25)
SDK\cppdemo\cppdemo\stdafx.h (408, 2011-11-25)
SDK\cppdemo\cppdemo\targetver.h (765, 2011-11-02)
SDK\cppdemo\cppdemo\cppdemo.cpp (1963, 2011-11-25)
SDK\cppdemo\cppdemo\stdafx.cpp (294, 2011-11-02)
finderlib.dll (82432, 2011-11-28)
finderlib64.dll (2775960, 2011-11-28)
SDK\CSharpDemo\CSharpDemo\Properties\AssemblyInfo.cs (1432, 2011-11-28)
SDK\CSharpDemo\CSharpDemo\Program.cs (3535, 2011-11-28)
SDK\CSharpDemo\CSharpDemo\CSharpDemo.csproj (2533, 2011-11-28)
SDK\FinderSDK.pas (2356, 2011-11-25)
SDK\cppdemo\cppdemo.sln (887, 2011-11-02)
SDK\CSharpDemo\CSharpDemo.sln (920, 2011-11-28)
SDK\cppdemo\cppdemo\cppdemo.vcproj (4626, 2011-11-25)
SDK\CSharpDemo\CSharpDemo\Properties (0, 2011-11-28)
SDK\cppdemo\cppdemo (0, 2011-11-25)
SDK\CSharpDemo\CSharpDemo (0, 2011-11-28)
SDK\cppdemo (0, 2011-11-28)
SDK\CSharpDemo (0, 2011-11-28)
SDK (0, 2011-11-28)
光速搜索开发接口 Finder Development Interface
============================
摘要:
-----
本文档描述了finderlib.dll提供的开发接口,可用函数,参数的描述,以及一些使用案例。
函数列表
------
* [FindA / FindW](#finder)
* [LaunchFinder](#launchfinder)
* [IsFinderRunning](#isfinderrunning)
* [CheckRequirement](#checkrequirement)
Find
=====
回调函数:
---------
由调用方传入,搜索有结果返回时会被调用
TResultCallBack = procedure(Buffer: PPChar; BufferCount: Integer; TotalCount: Integer;
ErrorCode: Integer); stdcall;
Buffer: PPChar; 包含每个文件名的数组
BufferCount: Integer; 此次返回的(Buffer)文件名个数
TotalCount: Integer; 搜索结果总数
ErrorCode: Integer 错误代码 (0=无错,<> 0 有错)
搜索文件函数
------------
function FindA(const AStr: PAnsiChar; const ACallback: TResultCallBack;
const ADir, AFilter: PAnsiChar; const Afrom: Integer = 0;
const ACount: Integer = 100; const ASpaceOr: Boolean = False;
const AWholeWords: Boolean = False; const AIncludeDir: Boolean = True;
const AIncludeFiles: Boolean = True; const ACaseSensitive: Boolean = False;
const ATimeoutMS: Word = 1000): Integer; stdcall;
function FindW(const AStr: PWideChar; const ACallback: TResultCallBack;
const ADir, AFilter: PWideChar; const Afrom: Integer = 0;
const ACount: Integer = 100; const ASpaceOr: Boolean = False;
const AWholeWords: Boolean = False; const AIncludeDir: Boolean = True;
const AIncludeFiles: Boolean = True; const ACaseSensitive: Boolean = False;
const ATimeoutMS: Word = 1000): Integer; stdcall;
搜索文件函数
参数 (搜索关键词,回调函数,制定目录(单个),后缀过滤(多个),开始结果位置,返回结果数量,
是否匹配任一关键词,匹配全词,搜索目录,搜索文件,区分大小写,超时时间)
返回 Integer 错误代码 (0=无错,<> 0 有错)
const AStr: PChar; |
搜索关键词 |
ACallback: TResultCallBack; |
回调函数 |
const ADir: PChar; |
制定目录(单个) |
const AFilter: PChar; |
后缀过滤(多个) |
const ACount: Integer = 100; |
返回结果数量 |
const Afrom: Integer = 0; |
开始结果位置 |
const ASpaceOr: Boolean = False; |
是否匹配任一关键词 |
const AWholeWords: Boolean = False; |
匹配全词 |
const ACaseSensitive: Boolean = False; |
区分大小写 |
const AIncludeDir: Boolean = True; |
搜索目录 |
const AIncludeFiles: Boolean = True; |
搜索文件 |
const ATimeoutMS: Word = 1000 |
超时时间 |
返回值
------
ERR_OK |
0 |
无错 |
ERR_TIMEOUT |
1 |
超时 |
ERR_FINDER_NOT_RUN |
2 |
Finder没有运行 |
ERR_COMM |
3 |
通信出错 |
ERR_FINDER_VER |
4 |
Finder版本不支持 |
ERR_FINDER_NOT_INSTALLED |
9 |
Finder没有安装 |
ERR_FINDER_INITIALIZING |
10 |
Finder正在初始化当中 |
ERR_UNKNOWN |
99 |
未知错误 |
LaunchFinder
============
function LaunchFinder: Boolean; stdcall;
启动Finder
返回
----
是否启动成功
IsFinderRunning
===============
function IsFinderRunning: Boolean; stdcall;
Finder是否已经在运行
返回
----
Finder是否已经在运行
CheckRequirement
================
function CheckRequirement: Integer; stdcall;
监测调用环境,比如Finder是否存在
返回
----
返回错误值,参见Find函数返回值。
C++ 例子:
--------------
// cppdemo.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "FinderSDK.h"
TFNfind find = (TFNfind)GetProcAddress(LoadLibrary(__T("finderlib.dll")),FNFind);
TFNCheckRequirement CheckRequirement = (TFNCheckRequirement)GetProcAddress(LoadLibrary(__T("finderlib.dll")),FNCheckRequirement);
TFNLaunchFinder LaunchFinder = (TFNLaunchFinder)GetProcAddress(LoadLibrary(__T("finderlib.dll")),FNLaunchFinder);
std::string WChar2Ansi(LPCWSTR pwszSrc)
{
int nLen = WideCharToMultiByte(CP_ACP, 0, pwszSrc, -1, NULL, 0, NULL, NULL);
if (nLen<= 0) return std::string("");
char* pszDst = new char[nLen];
if (NULL == pszDst) return std::string("");
WideCharToMultiByte(CP_ACP, 0, pwszSrc, -1, pszDst, nLen, NULL, NULL);
pszDst[nLen -1] = 0;
std::string strTemp(pszDst);
delete [] pszDst;
return strTemp;
}
void __stdcall callback(TCHAR** buffer,int bufferCount, int totalCount,int ErrorCode){
for(int i=0; i
1)?argv[1]:(__T("")),
callback,
(argc > 2)?argv[2]:(__T("")),
(argc > 3)?argv[3]:(__T("")),
//(argc > 4)?argv[4]:(__T("")),
__T(""),
1000,
0,
true,
false,
false,
false,
true,
1000);
}
}
break;
case ERR_FINDER_NOT_RUN:
//LaunchFinder();
break;
}
return 0;
}
Delphi 例子
--------------
接受命令行参数为搜索条件,在C盘搜索
procedure FindCallback(Buffer: PPChar; BufferCount: Integer; TotalCount: Integer;
ErrorCode: Integer); stdcall;
var
i : Integer;
begin
OutputDebugString(PChar(Format('Buffer=%x, Count = %d',[Integer(Buffer), BufferCount])));
Writeln('Buffer Count', BufferCount);
Writeln('Result TotalCount', TotalCount);
Writeln('Error Code', ErrorCode);
Writeln('Result');
for i :=0 to BufferCount - 1 do
begin
Writeln(StrPas(PChar(Buffer^)));
Inc(Buffer);
end;
end;
var
r : string;
begin
try
{ TODO -oUser -cConsole Main : Insert code here }
Find(
ParamStr(1),
@FindCallback,
'c:\',
'',
0, 20
);
Readln(r);
except
on E:Exception do
Writeln(E.Classname, ': ', E.Message);
end;
end.
C# 例子
--------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace CSharpDemo
{
class Program
{
public delegate void TFNFindCallback (IntPtr buffer,int bufferCount, int totalCount,int ErrorCode);
[DllImport("finderlib***.dll", EntryPoint = "FindW", CharSet = CharSet.Unicode)]
public static extern int Find***(String AStr,
TFNFindCallback ACallback,
String ADir,
String AExcludeDir,
String AFilter,
int ACount,
int Afrom,
bool ASpaceOr,
bool AWholeWords,
bool ACaseSensitive,
bool AIncludeDir,
bool AIncludeFiles,
UInt16 ATimeoutMS);
[DllImport("finderlib.dll", EntryPoint = "FindW", CharSet = CharSet.Unicode)]
public static extern int Find(String AStr,
TFNFindCallback ACallback,
String ADir,
String AExcludeDir,
String AFilter,
int ACount,
int Afrom,
bool ASpaceOr,
bool AWholeWords,
bool ACaseSensitive,
bool AIncludeDir,
bool AIncludeFiles,
UInt16 ATimeoutMS);
static void Main(string[] args)
{
if (IntPtr.Size == 4)//32位系统
Find("*.exe", FindCallback, "", "", "", 1000, 0, true, false, false, false, true, 1000);
else if(IntPtr.Size == 8)//***位系统
Find***("*.exe", FindCallback, "", "", "", 1000, 0, true, false, false, false, true, 1000);
}
public static String[] getStringArrayFromPPChar(IntPtr buffer,int bufferCount, Encoding e)
{
String[] ret = new String[bufferCount];
for (int i = 0; i < bufferCount; i++)
{
IntPtr cur = Marshal.ReadIntPtr(buffer, IntPtr.Size * i);
List b = new List();
byte cb = 0;
byte lb = 0;
int pos = 0;
while (true)
{
cb = Marshal.ReadByte(cur, pos);
pos++;
b.Add(cb);
if (e.IsSingleByte)
{
if(cb == 0)
break;
}
else
if ((b.Count % 2) == 0 && cb == 0 && lb == 0)
{
break;
}
lb = cb;
}
ret[i] = e.GetString(b.ToArray());
}
return ret;
}
public static void FindCallback(IntPtr buffer, int bufferCount, int totalCount, int ErrorCode)
{
Encoding e = Encoding.Unicode;
String[] filenames = getStringArrayFromPPChar(buffer, bufferCount, e);
for(int i=0; i< filenames.Length; i++){
Console.WriteLine(filenames[i]);
}
}
}
}
近期下载者:
相关文件:
收藏者: