-
Notifications
You must be signed in to change notification settings - Fork 0
/
FindDup.dpr
142 lines (129 loc) · 3.4 KB
/
FindDup.dpr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
{
Project: FindDupFar http://code.google.com/p/findupfar/
Author: Alexey Suhinin http://x-alexey.narod.ru
License: GPL v.2
}
library FindDup;
{.$O-}
{$I PRJDefines.inc}
{$APPTYPE CONSOLE}
uses
{$IFDEF DEBUG}
DebugLog,
{$ENDIF}
Windows,
Plugin,
Main,
FarApi,
SysUtils;
{$R *.res}
var
StartDir: array[1..MAX_PATH] of Char;
function OpenPlugin(OpenFrom: integer{TOpenModes}; Item: integer): THandle; StdCall; Export;
begin
{$IFDEF DEBUG}
AddDebugStringToLog('Enter to "OpenPlugin"', 2);
{$ENDIF}
try
Result:=THandle(TFarPlugin.Create);
GetCurrentDirectory(MAX_PATH, @StartDir);
except
Result:=INVALID_HANDLE_VALUE;
end;
{$IFDEF DEBUG}
AddDebugStringToLog('Exit to "OpenPlugin"', -2);
{$ENDIF}
end;
procedure ClosePlugin(Plugin: THandle); StdCall; Export;
begin
// try
{$IFDEF DEBUG}
AddDebugStringToLog('Enter to "ClosePlugin"', 2);
{$ENDIF}
try
TFarPlugin(Plugin).Free;
finally
Control(INVALID_HANDLE_VALUE, FCTL_SETPANELDIR, @StartDir);
end;
{$IFDEF DEBUG}
AddDebugStringToLog('Exit to "ClosePlugin"', -2);
{$ENDIF}
// except
// end;
end;
procedure GetOpenPluginInfo(Plugin: THandle; var aInfo: TOpenPluginInfo); StdCall; Export;
begin
{$IFDEF DEBUG}
AddDebugStringToLog('Enter to "GetOpenPluginInfo"', 2);
{$ENDIF}
TFarPlugin(Plugin).GetOpenPluginInfo(aInfo);
{$IFDEF DEBUG}
AddDebugStringToLog('Exit to "GetOpenPluginInfo"', -2);
{$ENDIF}
end;
function GetFindData(Plugin: THandle; var aPanelItems: PPluginPanelItemArray;
var aItemsNumber: integer; opMode: integer): integer; StdCall; Export;
begin
{$IFDEF DEBUG}
AddDebugStringToLog('Enter to "GetFindData"', 2);
{$ENDIF}
Result:=TFarPlugin(Plugin).GetFindData(aPanelItems, aItemsNumber, opMode);
{$IFDEF DEBUG}
AddDebugStringToLog('Exit to "GetFindData"', -2);
{$ENDIF}
end;
procedure FreeFindData(Plugin: THandle; aPanelItems: PPluginPanelItemArray;
aItemsNumber: integer); StdCall; Export;
begin
{$IFDEF DEBUG}
AddDebugStringToLog('Enter to "FreeFindData"', 2);
{$ENDIF}
TFarPlugin(Plugin).FreeFindData(aPanelItems, aItemsNumber);
{$IFDEF DEBUG}
AddDebugStringToLog('Exit to "FreeFindData"', -2);
{$ENDIF}
end;
{
function DeleteFiles(Plugin: THandle; PanelItem: PPluginPanelItemArr;
ItemsNumber, opMode: integer): integer; StdCall; Export;
begin
result:=Integer(False);
end;
}
function ProcessEvent(hPlugin: THandle; Event: Integer; Param: pointer): integer; StdCall; Export;
begin
{$IFDEF DEBUG}
AddDebugStringToLog('Enter to "ProcessEvent"', 2);
{$ENDIF}
// if flPlugOpen then
Result:=TFarPlugin(hPlugin).ProcessEvent(Event, Param);
{$IFDEF DEBUG}
AddDebugStringToLog('Exit to "ProcessEvent"', -2);
{$ENDIF}
end;
function ProcessKey(hPlugin: THandle; Key: Integer; ControlState: UINT): integer; StdCall; Export;
begin
{$IFDEF DEBUG}
AddDebugStringToLog('Enter to "ProcessKey"', 2);
{$ENDIF}
result:= TFarPlugin(hPlugin).ProcessKey(Key, ControlState);
{$IFDEF DEBUG}
AddDebugStringToLog('Exit to "ProcessKey"', -2);
{$ENDIF}
end;
exports
SetStartupInfo,
GetPluginInfo,
OpenPlugin,
ClosePlugin,
GetOpenPluginInfo,
GetFindData,
FreeFindData,
ProcessEvent,
ProcessKey;
// DeleteFiles;
{
flPlugOpen:=False;
}
Begin
End.