| 31 |
|
procedure LoadDatFilePart(FileID, Offset, Size: Integer; var Target: TStream); overload; override; |
| 32 |
|
procedure UpdateDatFilePart(FileID, Offset, Size: Integer; Src: TStream); overload; override; |
| 33 |
|
|
| 34 |
+ |
function GetDatLinks(FileID: Integer): TDatLinkList; override; |
| 35 |
+ |
function GetDatLink(FileID, DatOffset: Integer): TDatLink; override; |
| 36 |
|
function GetRawList(FileID: Integer): TRawDataList; override; |
| 37 |
|
function GetRawInfo(FileID, DatOffset: Integer): TRawDataInfo; override; |
| 38 |
|
|
| 47 |
|
implementation |
| 48 |
|
|
| 49 |
|
uses |
| 50 |
< |
SysUtils, Data, Functions, ABSDecUtil, DB; |
| 50 |
> |
SysUtils, Data, Functions, ABSDecUtil, DB, DatLinks; |
| 51 |
|
|
| 52 |
|
|
| 53 |
|
(* |
| 57 |
|
|
| 58 |
|
|
| 59 |
|
constructor TAccess_OUP_ADB.Create(DBFilename: String; ConnectionID: Integer; var Msg: TStatusMessages); |
| 58 |
– |
var |
| 59 |
– |
i: Integer; |
| 60 |
|
begin |
| 61 |
|
Msg := SM_UnknownError; |
| 62 |
|
if not FileExists(DBFilename) then |
| 141 |
|
Fdat_files[i].Name := FQuery.FieldByName('name').AsString; |
| 142 |
|
Fdat_files[i].Extension := FQuery.FieldByName('extension').AsString; |
| 143 |
|
Fdat_files[i].Size := FQuery.FieldByName('size').AsInteger; |
| 144 |
< |
Fdat_files[i].FileType := HexToLong(FQuery.FieldByName('contenttype').AsString); |
| 144 |
> |
Fdat_files[i].FileType := StrToInt('$'+FQuery.FieldByName('contenttype').AsString); |
| 145 |
|
Fdat_files[i].DatAddr := 0; |
| 146 |
|
Inc(i); |
| 147 |
|
FQuery.Next; |
| 261 |
|
name := fields.Strings[2]; |
| 262 |
|
extension := fields.Strings[0]; |
| 263 |
|
end; |
| 264 |
+ |
if SortType in [ST_ExtNameAsc, ST_ExtNameDesc] then |
| 265 |
+ |
begin |
| 266 |
+ |
id := fields.Strings[2]; |
| 267 |
+ |
name := fields.Strings[1]; |
| 268 |
+ |
extension := fields.Strings[0]; |
| 269 |
+ |
end; |
| 270 |
|
end; |
| 271 |
|
|
| 272 |
|
begin |
| 280 |
|
begin |
| 281 |
|
if (NoEmptyFiles = False) or ((Fdat_files[i].FileType and $02) = 0) then |
| 282 |
|
begin |
| 283 |
< |
if AppSettings.FilenumbersAsHex then |
| 278 |
< |
id := IntToHex(Fdat_files[i].ID, 4) |
| 279 |
< |
else |
| 280 |
< |
id := FormatNumber(Fdat_files[i].ID, 5, '0'); |
| 283 |
> |
id := FormatNumber(Fdat_files[i].ID, 5, '0'); |
| 284 |
|
name := Fdat_files[i].Name; |
| 285 |
|
extension := Fdat_files[i].Extension; |
| 286 |
|
|
| 288 |
|
ST_IDAsc, ST_IDDesc: list.Add(id + ';' + name + ';' + extension); |
| 289 |
|
ST_NameAsc, ST_NameDesc: list.Add(name + ';' + id + ';' + extension); |
| 290 |
|
ST_ExtAsc, ST_ExtDesc: list.Add(extension + ';' + id + ';' + name); |
| 291 |
+ |
ST_ExtNameAsc, ST_ExtNameDesc: list.Add(name + ';' + extension + ';' + id); |
| 292 |
|
end; |
| 293 |
|
end; |
| 294 |
|
end; |
| 295 |
|
end; |
| 296 |
< |
Result := TStringList.Create; |
| 296 |
> |
if not Assigned(Result) then |
| 297 |
> |
Result := TStringList.Create; |
| 298 |
|
if list.Count > 0 then |
| 299 |
|
begin |
| 300 |
|
fields := TStringList.Create; |
| 301 |
< |
if SortType in [ST_IDAsc, ST_NameAsc, ST_ExtAsc] then |
| 301 |
> |
if SortType in [ST_IDAsc, ST_NameAsc, ST_ExtAsc, ST_ExtNameAsc] then |
| 302 |
|
for i := 0 to list.Count - 1 do |
| 303 |
|
begin |
| 304 |
|
getfields; |
| 328 |
|
var |
| 329 |
|
i: Integer; |
| 330 |
|
begin |
| 331 |
< |
Result := TStringList.Create; |
| 331 |
> |
if not Assigned(Result) then |
| 332 |
> |
Result := TStringList.Create; |
| 333 |
> |
if Result is TStringList then |
| 334 |
> |
TStringList(Result).Sorted := True; |
| 335 |
|
for i := 0 to Length(Fdat_extensionsmap) - 1 do |
| 336 |
|
begin |
| 337 |
|
with Fdat_extensionsmap[i] do |
| 444 |
|
end; |
| 445 |
|
end; |
| 446 |
|
|
| 447 |
+ |
|
| 448 |
+ |
|
| 449 |
+ |
function TAccess_OUP_ADB.GetDatLink(FileID, DatOffset: Integer): TDatLink; |
| 450 |
+ |
begin |
| 451 |
+ |
Result := DatLinksManager.GetDatLink(FConnectionID, FileID, DatOffset); |
| 452 |
+ |
FQuery.SQL.Text := 'SELECT target_id FROM linkmap WHERE src_id = ' + IntToStr(FileID) + ' and src_link_offset = ' + IntToStr(DatOffset) + ';'; |
| 453 |
+ |
FQuery.Open; |
| 454 |
+ |
if FQuery.RecordCount > 0 then |
| 455 |
+ |
Result.DestID := FQuery.FieldByName('target_id').AsInteger; |
| 456 |
+ |
FQuery.Close; |
| 457 |
+ |
end; |
| 458 |
+ |
|
| 459 |
+ |
|
| 460 |
+ |
function TAccess_OUP_ADB.GetDatLinks(FileID: Integer): TDatLinkList; |
| 461 |
+ |
var |
| 462 |
+ |
i: Integer; |
| 463 |
+ |
SrcOffset, DestID: Integer; |
| 464 |
+ |
begin |
| 465 |
+ |
Result := DatLinksManager.GetDatLinks(FConnectionID, FileID); |
| 466 |
+ |
if Length(Result) > 0 then |
| 467 |
+ |
begin |
| 468 |
+ |
FQuery.SQL.Text := 'SELECT src_link_offset, target_id FROM linkmap WHERE src_id = ' + IntToStr(FileID) + ' ORDER BY src_link_offset ASC;'; |
| 469 |
+ |
FQuery.Open; |
| 470 |
+ |
if FQuery.RecordCount > 0 then |
| 471 |
+ |
begin |
| 472 |
+ |
repeat |
| 473 |
+ |
SrcOffset := FQuery.FieldByName('src_link_offset').AsInteger; |
| 474 |
+ |
DestID := FQuery.FieldByName('target_id').AsInteger; |
| 475 |
+ |
for i := 0 to High(Result) do |
| 476 |
+ |
if Result[i].SrcOffset = SrcOffset then |
| 477 |
+ |
Break; |
| 478 |
+ |
if i < Length(Result) then |
| 479 |
+ |
Result[i].DestID := DestID |
| 480 |
+ |
else |
| 481 |
+ |
Result[i].DestID := -1; |
| 482 |
+ |
FQuery.Next; |
| 483 |
+ |
until FQuery.EOF; |
| 484 |
+ |
end; |
| 485 |
+ |
FQuery.Close; |
| 486 |
+ |
end; |
| 487 |
+ |
end; |
| 488 |
+ |
|
| 489 |
|
|
| 490 |
|
function TAccess_OUP_ADB.GetRawList(FileID: Integer): TRawDataList; |
| 491 |
|
var |