source: oup/current/FileClasses/_Extensions.pas@ 228

Last change on this file since 228 was 228, checked in by alloc, 17 years ago
File size: 1.4 KB
Line 
1unit _Extensions;
2
3interface
4
5type
6 TExtension = class
7 private
8 FConnectionID: Integer;
9 FFiles: array of Integer;
10 function GetFile(ID: Integer): Integer;
11 function GetFileCount: Integer;
12 public
13 constructor Create(ConnectionID: Integer; Ext: String); virtual;
14 procedure InitList;
15 property Files[ID: Integer]: Integer read GetFile;
16 property FileCount: Integer read GetFileCount;
17 end;
18
19
20implementation
21
22uses
23 Classes, StrUtils, SysUtils, ConnectionManager, TypeDefs;
24
25{ TExtension }
26
27constructor TExtension.Create(ConnectionID: Integer; Ext: String);
28var
29 files: TStrings;
30 i: Integer;
31 fid: Integer;
32 finfo: TFileInfo;
33begin
34 files := TStringList.Create;
35 files := ConManager.Connection[FConnectionID].GetFilesList(Ext, '', False, ST_NameAsc);
36 if files.Count > 0 then
37 begin
38 for i := 0 to files.Count - 1 do
39 begin
40 fid := StrToInt(MidStr(files.Strings[i], 1, 5));
41 finfo := ConManager.Connection[FConnectionID].GetFileInfo(fid);
42 if Length(finfo.Name) > 0 then
43 begin
44 SetLength(FFiles, Length(FFiles) + 1);
45 FFiles[High(FFiles)] := fid;
46 end;
47 end;
48 end;
49 files.Free;
50end;
51
52function TExtension.GetFile(ID: Integer): Integer;
53begin
54 Result := FFiles[ID];
55end;
56
57function TExtension.GetFileCount: Integer;
58begin
59 Result := Length(FFiles);
60end;
61
62procedure TExtension.InitList;
63begin
64Exit;
65end;
66
67end.
Note: See TracBrowser for help on using the repository browser.