1 |
|
unit OniDataClass; |
2 |
|
interface |
3 |
< |
uses Data, DataStructures, Classes, SysUtils, StrUtils, |
3 |
> |
uses Data, Classes, SysUtils, StrUtils, |
4 |
|
Dialogs, ABSDecUtil, ABSMain, DB, Windows; |
5 |
|
|
6 |
|
type |
20 |
|
constructor Create(filename: String; var Result: Boolean); virtual; abstract; |
21 |
|
procedure Close; virtual; abstract; |
22 |
|
|
23 |
< |
function GetFileInfo(fileid: LongWord): TFileInfo; virtual; abstract; |
23 |
> |
function GetFileInfo(fileid: Integer): TFileInfo; virtual; |
24 |
|
function GetFilesList(ext: String; pattern: String; |
25 |
|
NoEmptyFiles: Boolean; sort: TSortType): TStringArray; virtual; abstract; |
26 |
|
function GetFilesCount: LongWord; virtual; abstract; |
72 |
|
constructor Create(DatFilename: String; var Result: Boolean); override; |
73 |
|
procedure Close; override; |
74 |
|
|
75 |
< |
function GetFileInfo(fileid: LongWord): TFileInfo; override; |
75 |
> |
function GetFileInfo(fileid: Integer): TFileInfo; override; |
76 |
|
function GetFilesList(ext: String; pattern: String; |
77 |
|
NoEmptyFiles: Boolean; sort: TSortType): TStringArray; override; |
78 |
|
function GetFilesCount: LongWord; override; |
111 |
|
|
112 |
|
procedure UpdateListCache; |
113 |
|
// function GetDatLinks(srcid:LongWord):TDatLinks; |
114 |
< |
function GetFileInfo(fileid: LongWord): TFileInfo; override; |
114 |
> |
function GetFileInfo(fileid: Integer): TFileInfo; override; |
115 |
|
function GetFilesList(ext: String; pattern: String; |
116 |
|
NoEmptyFiles: Boolean; sort: TSortType): TStringArray; override; |
117 |
|
function GetFilesCount: LongWord; override; |
141 |
|
public |
142 |
|
constructor Create(OLDBFilename: String; var Result: Boolean); override; |
143 |
|
procedure Close; override; |
144 |
< |
{ |
145 |
< |
procedure UpdateListCache; |
146 |
< |
// function GetDatLinks(srcid:LongWord):TDatLinks; |
147 |
< |
function GetFileInfo(fileid: LongWord): TFileInfo; override; |
148 |
< |
function GetFilesList(ext: String; pattern: String; |
149 |
< |
NoEmptyFiles: Boolean; sort: TSortType): TStringArray; override; |
150 |
< |
function GetFilesCount: LongWord; override; |
151 |
< |
function GetExtensionsList: TStringArray; override; |
152 |
< |
function GetExtendedExtensionsList: TExtensionsMap; override; |
153 |
< |
function GetNamedFilesMap: TNamedFilesMap; |
154 |
< |
|
155 |
< |
function LoadDatFile(fileid: LongWord): Tdata; override; |
156 |
< |
procedure UpdateDatFile(fileid: LongWord; Data: Tdata); override; |
157 |
< |
procedure LoadDatFilePart(fileid, offset, size: LongWord; target: Pointer); override; |
158 |
< |
procedure UpdateDatFilePart(fileid, offset, size: LongWord; target: Pointer); override; |
159 |
< |
|
160 |
< |
function GetRawList(fileid: LongWord): TRawList; override; |
161 |
< |
procedure LoadRawFile(fileid, dat_offset: LongWord; target: Pointer); override; |
162 |
< |
procedure UpdateRawFile(fileid, dat_offset: LongWord; size: LongWord; |
163 |
< |
target: Pointer); override; |
164 |
< |
procedure LoadRawFilePart(fileid, dat_offset: LongWord; |
165 |
< |
offset, size: LongWord; target: Pointer); override; |
166 |
< |
procedure UpdateRawFilePart(fileid, dat_offset: LongWord; |
167 |
< |
offset, size: LongWord; target: Pointer); override; |
168 |
< |
} published |
144 |
> |
published |
145 |
|
end; |
146 |
|
|
147 |
|
const |
156 |
|
|
157 |
|
function CreateDataConnection(filename: String; backend: Integer): TOniData; |
158 |
|
procedure CloseDataConnection(connection: TOniData); |
159 |
+ |
function GetEmptyFileInfo: TFileInfo; |
160 |
|
|
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
implementation |
166 |
< |
uses Functions; |
166 |
> |
uses DataStructures, Functions; |
167 |
|
|
168 |
|
|
169 |
|
|
228 |
|
|
229 |
|
|
230 |
|
|
231 |
+ |
function TOniData.GetFileInfo(fileid: Integer): TFileInfo; |
232 |
+ |
begin |
233 |
+ |
Result.ID := -1; |
234 |
+ |
Result.FileName := ''; |
235 |
+ |
Result.FileNameHex := ''; |
236 |
+ |
Result.Extension := ''; |
237 |
+ |
Result.Name := ''; |
238 |
+ |
Result.Size := 0; |
239 |
+ |
Result.FileType := 0; |
240 |
+ |
Result.DatAddr := 0; |
241 |
+ |
Result.opened := False; |
242 |
+ |
end; |
243 |
|
|
244 |
|
|
245 |
|
|
366 |
|
|
367 |
|
|
368 |
|
|
369 |
< |
function TOniDataDat.GetFileInfo(fileid: LongWord): TFileInfo; |
369 |
> |
function TOniDataDat.GetFileInfo(fileid: Integer): TFileInfo; |
370 |
|
begin |
371 |
+ |
if fileid = -1 then |
372 |
+ |
begin |
373 |
+ |
Result := inherited GetFileInfo(fileid); |
374 |
+ |
Exit; |
375 |
+ |
end; |
376 |
|
if fileid < Self.GetFilesCount then |
377 |
|
Result := Fdat_files[fileid] |
378 |
|
else |
585 |
|
if UpperCase(RawListHandlers[i].Ext) = UpperCase(Fdat_files[fileid].extension) then |
586 |
|
if RawListHandlers[i].needed then |
587 |
|
begin |
588 |
< |
Result := RawListHandlers[i].Handler(fileid); |
588 |
> |
Result := RawListHandlers[i].Handler(Self, fileid); |
589 |
|
Break; |
590 |
|
end |
591 |
|
else |
954 |
|
end; |
955 |
|
|
956 |
|
|
957 |
< |
function TOniDataADB.GetFileInfo(fileid: LongWord): TFileInfo; |
957 |
> |
function TOniDataADB.GetFileInfo(fileid: Integer): TFileInfo; |
958 |
|
var |
959 |
|
i: Integer; |
960 |
|
begin |
961 |
+ |
if fileid = -1 then |
962 |
+ |
begin |
963 |
+ |
Result := inherited GetFileInfo(fileid); |
964 |
+ |
Exit; |
965 |
+ |
end; |
966 |
|
if fileid < Self.GetFilesCount then |
967 |
|
begin |
968 |
|
for i := 0 to High(Fdat_files) do |
1482 |
|
if DataConnections[i] = connection then |
1483 |
|
begin |
1484 |
|
DataConnections[i].Close; |
1485 |
< |
DataConnections[i].Free; |
1485 |
> |
// DataConnections[i].Free; |
1486 |
|
DataConnections[i] := nil; |
1487 |
|
found := True; |
1488 |
|
end; |
1498 |
|
end; |
1499 |
|
|
1500 |
|
|
1501 |
+ |
function GetEmptyFileInfo: TFileInfo; |
1502 |
+ |
begin |
1503 |
+ |
Result.ID := -1; |
1504 |
+ |
Result.FileName := ''; |
1505 |
+ |
Result.FileNameHex := ''; |
1506 |
+ |
Result.Extension := ''; |
1507 |
+ |
Result.Name := ''; |
1508 |
+ |
Result.Size := 0; |
1509 |
+ |
Result.FileType := 0; |
1510 |
+ |
Result.DatAddr := 0; |
1511 |
+ |
Result.opened := False; |
1512 |
+ |
end; |
1513 |
+ |
|
1514 |
+ |
|
1515 |
|
|
1516 |
|
|
1517 |
|
constructor TOniDataEmpty.Create(OLDBFilename: String; var Result: Boolean); |