| 34 |
|
function GetDatLink(FileID, DatOffset: Integer): TDatLink; override; |
| 35 |
|
function GetRawList(FileID: Integer): TRawDataList; override; |
| 36 |
|
function GetRawInfo(FileID, DatOffset: Integer): TRawDataInfo; override; |
| 37 |
+ |
function GetRawsForType(RawType: String): TRawDataList; override; |
| 38 |
|
|
| 39 |
|
procedure LoadRawFile(FileID, DatOffset: Integer; var Target: TStream); overload; override; |
| 40 |
|
procedure UpdateRawFile(FileID, DatOffset: Integer; Src: TStream); overload; override; |
| 91 |
|
end; |
| 92 |
|
if FQuery.FieldByName('name').AsString = 'lvl' then |
| 93 |
|
FLevelNumber := StrToInt(FQuery.FieldByName('value').AsString); |
| 94 |
< |
if FQuery.FieldByName('name').AsString = 'DataOS' then |
| 94 |
> |
if FQuery.FieldByName('name').AsString = 'os' then |
| 95 |
|
begin |
| 96 |
|
if FQuery.FieldByName('value').AsString = 'WIN' then |
| 97 |
|
FDataOS := DOS_WIN |
| 113 |
|
FChangeRights := [CR_EditDat, CR_EditRaw, CR_ResizeDat, CR_ResizeRaw]; |
| 114 |
|
|
| 115 |
|
UpdateListCache; |
| 116 |
+ |
|
| 117 |
+ |
inherited; |
| 118 |
|
end; |
| 119 |
|
|
| 120 |
|
|
| 216 |
|
|
| 217 |
|
|
| 218 |
|
|
| 219 |
+ |
function CompareItems(List: TStringList; I1, I2: Integer): Integer; |
| 220 |
+ |
var |
| 221 |
+ |
s1, s2: String; |
| 222 |
+ |
begin |
| 223 |
+ |
s1 := MidStr(List[I1], 1, PosEx(';', List[I1], 6) - 1); |
| 224 |
+ |
s2 := MidStr(List[I2], 1, PosEx(';', List[I2], 6) - 1); |
| 225 |
+ |
Result := CompareStr(s1, s2); |
| 226 |
+ |
end; |
| 227 |
+ |
|
| 228 |
|
function TAccess_OUP_ADB.GetFilesList(ext: String; pattern: String; |
| 229 |
|
NoEmptyFiles: Boolean; SortType: TSortType): TStrings; |
| 230 |
|
var |
| 263 |
|
end; |
| 264 |
|
|
| 265 |
|
begin |
| 266 |
< |
if not (SortType in [ST_ExtNameAsc, ST_ExtNameDesc]) then |
| 267 |
< |
begin |
| 268 |
< |
list := TStringList.Create; |
| 266 |
> |
list := TStringList.Create; |
| 267 |
> |
if SortType in [ST_ExtNameAsc, ST_ExtNameDesc] then |
| 268 |
> |
list.Sorted := False |
| 269 |
> |
else |
| 270 |
|
list.Sorted := True; |
| 271 |
< |
for i := 0 to GetFileCount - 1 do |
| 271 |
> |
if ext = '*' then |
| 272 |
> |
ext := ''; |
| 273 |
> |
for i := 0 to GetFileCount - 1 do |
| 274 |
> |
begin |
| 275 |
> |
if ((Length(ext) = 0) or (Pos(Fdat_files[i].Extension, ext) > 0)) and |
| 276 |
> |
((Length(pattern) = 0) or |
| 277 |
> |
(Pos(UpperCase(pattern), UpperCase(Fdat_files[i].Name)) > 0)) then |
| 278 |
|
begin |
| 279 |
< |
if ((Length(ext) = 0) or (Pos(Fdat_files[i].Extension, ext) > 0)) and |
| 261 |
< |
((Length(pattern) = 0) or |
| 262 |
< |
(Pos(UpperCase(pattern), UpperCase(Fdat_files[i].Name)) > 0)) then |
| 279 |
> |
if (NoEmptyFiles = False) or ((Fdat_files[i].FileType and $02) = 0) then |
| 280 |
|
begin |
| 281 |
< |
if (NoEmptyFiles = False) or ((Fdat_files[i].FileType and $02) = 0) then |
| 282 |
< |
begin |
| 283 |
< |
id := FormatNumber(Fdat_files[i].ID, 5, '0'); |
| 284 |
< |
name := Fdat_files[i].Name; |
| 285 |
< |
extension := Fdat_files[i].Extension; |
| 286 |
< |
|
| 287 |
< |
case SortType of |
| 288 |
< |
ST_IDAsc, ST_IDDesc: list.Add(id + ';' + name + ';' + extension); |
| 289 |
< |
ST_NameAsc, ST_NameDesc: list.Add(name + ';' + id + ';' + extension); |
| 273 |
< |
ST_ExtAsc, ST_ExtDesc: list.Add(extension + ';' + id + ';' + name); |
| 274 |
< |
ST_ExtNameAsc, ST_ExtNameDesc: list.Add(extension + ';' + name + ';' + id); |
| 275 |
< |
end; |
| 281 |
> |
id := FormatNumber(Fdat_files[i].ID, 5, '0'); |
| 282 |
> |
name := Fdat_files[i].Name; |
| 283 |
> |
extension := Fdat_files[i].Extension; |
| 284 |
> |
|
| 285 |
> |
case SortType of |
| 286 |
> |
ST_IDAsc, ST_IDDesc: list.Add(id + ';' + name + ';' + extension); |
| 287 |
> |
ST_NameAsc, ST_NameDesc: list.Add(name + ';' + id + ';' + extension); |
| 288 |
> |
ST_ExtAsc, ST_ExtDesc: list.Add(extension + ';' + id + ';' + name); |
| 289 |
> |
ST_ExtNameAsc, ST_ExtNameDesc: list.Add(extension + ';' + name + ';' + id); |
| 290 |
|
end; |
| 291 |
|
end; |
| 292 |
|
end; |
| 293 |
< |
if not Assigned(Result) then |
| 294 |
< |
Result := TStringList.Create; |
| 295 |
< |
if list.Count > 0 then |
| 296 |
< |
begin |
| 297 |
< |
fields := TStringList.Create; |
| 298 |
< |
if SortType in [ST_IDAsc, ST_NameAsc, ST_ExtAsc, ST_ExtNameAsc] then |
| 285 |
< |
for i := 0 to list.Count - 1 do |
| 286 |
< |
begin |
| 287 |
< |
getfields; |
| 288 |
< |
Result.Add(id + '-' + name + '.' + extension); |
| 289 |
< |
end |
| 290 |
< |
else |
| 291 |
< |
for i := list.Count - 1 downto 0 do |
| 292 |
< |
begin |
| 293 |
< |
getfields; |
| 294 |
< |
Result.Add(id + '-' + name + '.' + extension); |
| 295 |
< |
end; |
| 296 |
< |
fields.Free; |
| 297 |
< |
end; |
| 298 |
< |
list.Free; |
| 299 |
< |
end |
| 300 |
< |
else |
| 293 |
> |
end; |
| 294 |
> |
if SortType in [ST_ExtNameAsc, ST_ExtNameDesc] then |
| 295 |
> |
list.CustomSort(CompareItems); |
| 296 |
> |
if not Assigned(Result) then |
| 297 |
> |
Result := TStringList.Create; |
| 298 |
> |
if list.Count > 0 then |
| 299 |
|
begin |
| 300 |
< |
FQuery.SQL.Text := 'SELECT id, name, extension FROM datfiles ' + |
| 301 |
< |
'WHERE Length(name) > 0 ORDER BY extension ASC, name ASC;'; |
| 302 |
< |
FQuery.Open; |
| 303 |
< |
if not Assigned(Result) then |
| 304 |
< |
Result := TStringList.Create; |
| 305 |
< |
if FQuery.RecordCount > 0 then |
| 306 |
< |
begin |
| 307 |
< |
FQuery.First; |
| 308 |
< |
repeat |
| 309 |
< |
name := FormatNumber(FQuery.FieldByName('id').AsInteger, 5, '0') + |
| 310 |
< |
'-' + FQuery.FieldByName('name').AsString + '.' + |
| 311 |
< |
FQuery.FieldByName('extension').AsString; |
| 312 |
< |
if SortType = ST_ExtNameAsc then |
| 313 |
< |
Result.Add(name) |
| 316 |
< |
else |
| 317 |
< |
Result.Insert(0, name); |
| 318 |
< |
FQuery.Next; |
| 319 |
< |
until FQuery.EOF; |
| 320 |
< |
end; |
| 321 |
< |
FQuery.Close; |
| 300 |
> |
fields := TStringList.Create; |
| 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; |
| 305 |
> |
Result.Add(id + '-' + name + '.' + extension); |
| 306 |
> |
end |
| 307 |
> |
else |
| 308 |
> |
for i := list.Count - 1 downto 0 do |
| 309 |
> |
begin |
| 310 |
> |
getfields; |
| 311 |
> |
Result.Add(id + '-' + name + '.' + extension); |
| 312 |
> |
end; |
| 313 |
> |
fields.Free; |
| 314 |
|
end; |
| 315 |
+ |
list.Free; |
| 316 |
|
end; |
| 317 |
|
|
| 318 |
|
|
| 492 |
|
i: Integer; |
| 493 |
|
begin |
| 494 |
|
SetLength(Result, 0); |
| 495 |
< |
FQuery.SQL.Text := 'SELECT [src_link_offset],[size],[sep] FROM rawmap WHERE [src_id]=' + |
| 495 |
> |
FQuery.SQL.Text := 'SELECT [src_link_offset],[name],[size],[sep],[type] FROM rawmap WHERE [src_id]=' + |
| 496 |
|
IntToStr(fileid) + ' ORDER BY src_link_offset ASC;'; |
| 497 |
|
FQuery.Open; |
| 498 |
|
if FQuery.RecordCount > 0 then |
| 501 |
|
SetLength(Result, FQuery.RecordCount); |
| 502 |
|
i := 0; |
| 503 |
|
repeat |
| 504 |
+ |
Result[i].Name := FQuery.FieldByName('name').AsString; |
| 505 |
|
Result[i].SrcID := fileid; |
| 506 |
|
Result[i].SrcOffset := FQuery.FieldByName('src_link_offset').AsInteger; |
| 507 |
|
Result[i].RawAddr := 0; |
| 508 |
|
Result[i].RawSize := FQuery.FieldByName('size').AsInteger; |
| 509 |
|
Result[i].LocSep := FQuery.FieldByName('sep').AsBoolean; |
| 510 |
+ |
Result[i].RawType := FQuery.FieldByName('type').AsString; |
| 511 |
|
Inc(i); |
| 512 |
|
FQuery.Next; |
| 513 |
|
until FQuery.EOF; |
| 530 |
|
if i < Length(rawlist) then |
| 531 |
|
Result := rawlist[i] |
| 532 |
|
else begin |
| 533 |
+ |
Result.Name := ''; |
| 534 |
|
Result.SrcID := -1; |
| 535 |
|
Result.SrcOffset := -1; |
| 536 |
|
Result.RawAddr := -1; |
| 537 |
|
Result.RawSize := -1; |
| 538 |
+ |
Result.RawType := ''; |
| 539 |
|
end; |
| 540 |
|
end; |
| 541 |
|
end; |
| 542 |
|
|
| 543 |
|
|
| 544 |
+ |
function TAccess_OUP_ADB.GetRawsForType(RawType: String): TRawDataList; |
| 545 |
+ |
var |
| 546 |
+ |
i: Integer; |
| 547 |
+ |
begin |
| 548 |
+ |
SetLength(Result, 0); |
| 549 |
+ |
FQuery.SQL.Text := 'SELECT [src_id],[src_link_offset],[name],[size],[sep] FROM rawmap ' + |
| 550 |
+ |
'WHERE [type]="' + RawType + '" and [size]>0 ORDER BY src_id ASC, src_link_offset ASC;'; |
| 551 |
+ |
FQuery.Open; |
| 552 |
+ |
if FQuery.RecordCount > 0 then |
| 553 |
+ |
begin |
| 554 |
+ |
FQuery.First; |
| 555 |
+ |
SetLength(Result, FQuery.RecordCount); |
| 556 |
+ |
i := 0; |
| 557 |
+ |
repeat |
| 558 |
+ |
Result[i].Name := FQuery.FieldByName('name').AsString; |
| 559 |
+ |
Result[i].SrcID := FQuery.FieldByName('src_id').AsInteger; |
| 560 |
+ |
Result[i].SrcOffset := FQuery.FieldByName('src_link_offset').AsInteger; |
| 561 |
+ |
Result[i].RawAddr := 0; |
| 562 |
+ |
Result[i].RawSize := FQuery.FieldByName('size').AsInteger; |
| 563 |
+ |
Result[i].LocSep := FQuery.FieldByName('sep').AsBoolean; |
| 564 |
+ |
Result[i].RawType := RawType; |
| 565 |
+ |
Inc(i); |
| 566 |
+ |
FQuery.Next; |
| 567 |
+ |
until FQuery.EOF; |
| 568 |
+ |
end; |
| 569 |
+ |
FQuery.Close; |
| 570 |
+ |
end; |
| 571 |
+ |
|
| 572 |
+ |
|
| 573 |
+ |
|
| 574 |
|
|
| 575 |
|
procedure TAccess_OUP_ADB.LoadRawFile(FileID, DatOffset: Integer; var Target: TStream); |
| 576 |
|
var |