-
Notifications
You must be signed in to change notification settings - Fork 0
/
uscanresult.pas
98 lines (77 loc) · 1.98 KB
/
uscanresult.pas
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
unit uscanresult;
interface
uses fgl;
type
TTimInfo = record
Magic: Byte;
Position: Integer;
Size: Integer;
Width: Integer;
Height: Integer;
BitMode: Byte;
Cluts: Integer;
Good: Boolean;
end;
type
TScanResult = class(TObject)
private
pScanFile: string;
pIsImage: Boolean;
pCount: Integer;
pTims: array of TTimInfo;
procedure fSetCount(Value: Integer);
function fGetTim(Index: Integer): TTimInfo;
procedure fSetTim(Index: Integer; Value: TTimInfo);
public
constructor Create;
destructor Destroy; override;
property ScanFile: string read pScanFile write pScanFile;
property IsImage: Boolean read pIsImage write pIsImage;
property Count: Integer read pCount write fSetCount;
property ScanTim[index: Integer]: TTimInfo read fGetTim write fSetTim;
end;
TScanResultList = specialize TFPGObjectList<TScanResult>;
PScanResultList = ^TScanResultList;
function CheckForFileOpened(ScanResults: PScanResultList; const FileName: string): boolean;
implementation
{ TScanResult }
constructor TScanResult.Create;
begin
inherited;
pScanFile := '';
pIsImage := False;
pCount := 0;
pTims := nil;
end;
destructor TScanResult.Destroy;
begin
SetLength(pTims, 0);
pTims := nil;
inherited;
end;
function TScanResult.fGetTim(Index: Integer): TTimInfo;
begin
Result := pTims[Index];
end;
procedure TScanResult.fSetCount(Value: Integer);
begin
pCount := Value;
SetLength(pTims, Value);
end;
procedure TScanResult.fSetTim(Index: Integer; Value: TTimInfo);
begin
pTims[Index] := Value;
end;
function CheckForFileOpened(ScanResults: PScanResultList; const FileName: string): boolean;
var
I: Integer;
begin
Result := False;
for I := 1 to ScanResults^.Count do
if ScanResults^[I - 1].ScanFile = FileName then
begin
Result := True;
Exit;
end;
end;
end.