3D(排列3)大赢家过滤插件接口规范

来源:3D(排列3)大赢家软件说明书

library MZFBFlt;

// ************************************************************************ //
// AppName : 命中分布过滤插件
// Version : 1.0.3
// Company : bittime
// Author : yanxb
// Description: 命中分布过滤插件
// CreateDate : 2003-07-16
// ************************************************************************ //

uses
  SysUtils,
  Classes,
  Windows,
  Forms,
  BaseForm in '..\..\BaseForm.pas' {frmBase},
  MZFBForm in 'MZFBForm.pas' {frmMZFB},
  unt_IniFile in '..\..\unt_IniFile.pas',
  Filter_Base in '..\Filter_Base.pas';

///////////////////////////////////////////////////////////////////
{$R *.res}
///////////////////////////////////////////////////////////////////

var
  FFilterStr: string; //过滤条件字符串
  FCanErrLocal: boolean; //是否本级容错
  FCanErrMin, FCanErrMax: integer;//本级容错范围

///////////////////////////////////////////////////////////////////
// DLL入口函数
// 用户可在该函数中对过滤插件进行初始化处理以及资源释放处理
procedure DLLEntryPoint(dwReason: DWORD);
begin
  case dwReason of
    DLL_PROCESS_ATTACH: //DLL启动
    begin
      //变量初始化等处理
    end;
    DLL_PROCESS_DETACH: //DLL退出
    begin
      //释放资源等处理
    end;
  end;
end;

///////////////////////////////////////////////////////////////////
// 过滤插件信息函数

{ =====================================================================
Function : 获取过滤插件的名称
Result : 过滤插件的名称, 该名称应该不与现有的过滤模块同名
===================================================================== }
function GetFilterName(): PChar; stdcall;
begin
  Result := '分布过滤'; 
end;

{ =====================================================================
Function : 获取过滤插件的版本信息
Result : 过滤插件的版本信息
===================================================================== }
function GetVersion(): PChar; stdcall;
begin
  Result := '1.0.1';
end;

{ =====================================================================
Function : 获取过滤插件的作者信息
Result : 过滤插件的作者信息
===================================================================== }
function GetAuthor(): PChar; stdcall;
begin
  Result := '比特时代科技有限公司';
end;

///////////////////////////////////////////////////////////////////
// 过滤操作相关函数

{ =====================================================================
Function : 获取过滤插件的过滤条件字符串
Result : 过滤条件字符串
===================================================================== }
function GetFilterStr(): PChar; stdcall;
begin
  Result := PChar(FFilterStr);
end;

{ =====================================================================
Function : 设置过滤插件的过滤条件字符串
Arguments: 过滤条件字符串
===================================================================== }
procedure SetFilterStr(sFilterStr: PChar); stdcall;
begin
  FFilterStr := sFilterStr;
end;

{ =====================================================================
Function : 执行过滤操作,该函数为过滤插件的核心函数,必须实现
Arguments: AChip-要进行过滤的一个单式投注,如:331301130130
Result : 给定的单式投注不符合的过滤条件个数(即应被过滤的次数)
如单式投注符合所有过滤条件(即应保留)则返回0
===================================================================== }
function Execute(AChip: PChar): integer; stdcall;
begin
  Result := 0;
  //执行过滤操作 to do

  //判断是否本级容错
  if FCanErrLocal then
  begin
    if (Result < FCanErrMin) or (Result > FCanErrMax) then
      Result := 1
    else
      Result := 0;
  end else begin
    if Result > = 1 then Result := 1
    else Result := 0;
  end;
end;

{ =====================================================================
Function : 过滤校验
Arguments: AChip-要进行过滤的一个单式投注,如:331301130130
Result : 给定的单式投注的过滤校验信息,没条信息间以回车换行(#13#10)
符分隔,如单式投注符合所有过滤条件(即应保留)则返回空
===================================================================== }
function Debug(AChip: PChar; bShowAll: boolean = false): PChar; stdcall;
begin
  Result := '';
  //执行过滤校验操作,返回校验结果 to do
end;

{ =====================================================================
Function : 打开过滤条件设置窗口。
Arguments: no
Result : no
note : 必须在用户确认后及时刷新FFilterStr值
===================================================================== }
function Open(hApp: Integer = 0): boolean; stdcall;
var
  hOldApp: integer;
  frm: TfrmMZFB;
begin
  hOldApp := Application.Handle;
  Application.Handle := hApp;

  frm := TfrmMZFB.Create(nil);
  frm.SetFilter(FFilterStr);
  frm.ShowModal;
  if not frm.bCancel then
    FFilterStr := frm.GetFilter; 
  frm.Free;

  Application.Handle := hOldApp;
  Result := true;
end;

{ =====================================================================
Function : 过滤准备函数,在该函数中可执行过滤条件的优化处理以及过滤
条件的有效性检验
Result : 如过滤条件格式设置正确则返回true,否则返回false
===================================================================== }
function Prepare(): boolean; stdcall;
begin
  //to do
end;

///////////////////////////////////////////////////////////////////
// DLL对外接口函数

exports
  Execute, //过滤处理
  Debug,
  Open,
  Prepare,
  GetFilterStr,
  SetFilterStr,
  GetFilterName, //获取过滤插件的信息
  GetVersion,
  GetAuthor
  ;

///////////////////////////////////////////////////////////////////

begin
  DLLProc := @DLLEntryPoint;
  DLLEntryPoint(DLL_PROCESS_ATTACH);
end.
同步内容