Rev | Line | |
---|
[228] | 1 | unit _Extensions;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | type
|
---|
| 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 |
|
---|
| 20 | implementation
|
---|
| 21 |
|
---|
| 22 | uses
|
---|
| 23 | Classes, StrUtils, SysUtils, ConnectionManager, TypeDefs;
|
---|
| 24 |
|
---|
| 25 | { TExtension }
|
---|
| 26 |
|
---|
| 27 | constructor TExtension.Create(ConnectionID: Integer; Ext: String);
|
---|
| 28 | var
|
---|
| 29 | files: TStrings;
|
---|
| 30 | i: Integer;
|
---|
| 31 | fid: Integer;
|
---|
| 32 | finfo: TFileInfo;
|
---|
| 33 | begin
|
---|
| 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;
|
---|
| 50 | end;
|
---|
| 51 |
|
---|
| 52 | function TExtension.GetFile(ID: Integer): Integer;
|
---|
| 53 | begin
|
---|
| 54 | Result := FFiles[ID];
|
---|
| 55 | end;
|
---|
| 56 |
|
---|
| 57 | function TExtension.GetFileCount: Integer;
|
---|
| 58 | begin
|
---|
| 59 | Result := Length(FFiles);
|
---|
| 60 | end;
|
---|
| 61 |
|
---|
| 62 | procedure TExtension.InitList;
|
---|
| 63 | begin
|
---|
| 64 | Exit;
|
---|
| 65 | end;
|
---|
| 66 |
|
---|
| 67 | end.
|
---|
Note:
See
TracBrowser
for help on using the repository browser.