求助Delphi的源码用c#实现
unit P2KApi3;
interface
type
TFilelistItem=record
dwFileLength:Cardinal;
dwAttr1,dwAttr2:Word;
Name:array[0..$1f7] of Char;
end;
TP2KApi2Callback=procedure(Status:Integer) stdcall;
TP2KApi3Callback=procedure(Status:Integer; lpszIFName:PChar) stdcall;
TP2KApiProgressFunc=procedure(var fl:array of TFileListItem; CurIndex,TotalCount:Integer) stdcall;
const
P2KAPIDLL='p2kapi3.dll';
function P2K_Init(StatusProc:TP2KApi2Callback): Integer; stdcall; external P2KAPIDLL;
function P2K3_Init(StatusProc:TP2KApi3Callback): Integer; stdcall; external P2KAPIDLL;
function P2K_GetStatus: Integer; stdcall; external P2KAPIDLL;
function File_List(var Buf:array of TFilelistItem; Count: Longword): Integer; stdcall; external P2KAPIDLL;
function File_Count: Integer; stdcall;external P2KAPIDLL;
function File_CountEx(PathAndMask:string): Integer; stdcall; external P2KAPIDLL;
function P2K_Restart: Integer; stdcall;external P2KAPIDLL;
function File_VolInfo(var Data: array of Byte): Integer; stdcall; external P2KAPIDLL;
function Mode_SwitchToAT:integer; stdcall;external P2KAPIDLL;
function Mode_SwitchToP2K(StatusProc:pointer):integer; external P2KAPIDLL;
function Mode_SwitchToTF:integer; stdcall; external P2KAPIDLL;
function Seem_Read(SeemNo, RecordNo, StartOffset, Bytes: Integer; var Data): Integer; stdcall; external P2KAPIDLL;
function Seem_Write(SeemNo, RecordNo, StartOffset, Bytes: Integer; var Data): Integer; stdcall; external P2KAPIDLL;
function File_Delete(FileName:String): Integer; stdcall; external P2KAPIDLL;
function File_Close: Integer; stdcall; external P2KAPIDLL;
function File_Write(Buffer: array of byte; Size: Word): integer; stdcall; external P2KAPIDLL;
function File_Create(FileName:String;Attribute:Integer): Integer; stdcall; external P2KAPIDLL;
function File_Read(Buffer: array of byte;Size:Cardinal): Integer; stdcall; external P2KAPIDLL;
function File_SetPointer(Offset:Cardinal; MoveMethod: Cardinal): integer; stdcall; external P2KAPIDLL;
function P2K_Suspend: Integer; stdcall;external P2KAPIDLL;
function File_CreateDir(Dir:string;Attribute: Integer): Integer; stdcall; external P2KAPIDLL;
function File_DeleteDir(Dir:string): Integer; stdcall;external P2KAPIDLL;
function SetCOMPort(Port:string):Integer; stdcall; external P2KAPIDLL;
function P2K_SuspendEx(mode:Integer):Integer; stdcall; external P2KAPIDLL;
function P2K_PowerOff:Integer; stdcall; external P2KAPIDLL;
function P2K_SendCMD(Opcode:Cardinal; const SendData; cbSend:Integer; var RecvBuff; var cbRecv:Integer):Integer; stdcall; external P2KAPIDLL;
function File_ListEx(var Buf:array of TFileListItem; Count: Cardinal; ProgressFunc:TP2KApiProgressFunc):Integer; stdcall; external P2KAPIDLL;
function File_GetFreeSpace(lpstrDisk:PChar):Cardinal; stdcall; external P2KAPIDLL;
function USB_WriteData(const Buff; var Size:Cardinal):Integer; stdcall; external P2KAPIDLL;
function USB_ReadData(var Buff; var Size:Cardinal):Integer; stdcall; external P2KAPIDLL;
function Flash_WriteData(const Buff; var Size:Cardinal; dwTimeout:Cardinal):Integer; stdcall; external P2KAPIDLL;
function Flash_ReadData(var Buff; var Size:Cardinal; dwTimeout:Cardinal):Integer; stdcall; external P2KAPIDLL;
function P2K_GetIFHandle:Cardinal; stdcall; external P2KAPIDLL;
function P2K_GetInterface(var Buff; cbBuff:Integer):Integer; stdcall; external P2KAPIDLL;
function Flash_SendCmd(lpszCmdName:PChar; lpArgs:Pointer; cbArgs:Cardinal; var RecvBuff; var RecvSize:Cardinal; dwTimeout:Cardinal):Integer; stdcall; external P2KAPIDLL;
function Flash_Addr(dwAddr:Cardinal):Integer; stdcall; external P2KAPIDLL;
function Flash_Jump(dwAddr:Cardinal):Integer; stdcall; external P2KAPIDLL;
function Flash_Bin(var Data; cbData:Cardinal):Integer; stdcall; external P2KAPIDLL;
function Flash_Dump(Base:Cardinal; var Buff):Integer; stdcall; external P2KAPIDLL;
implementation
end.