| 17 |
|
|
| 18 |
|
procedure UpdateListCache; |
| 19 |
|
|
| 20 |
+ |
function GetLinksToFile(FileID: Integer): TLinks; |
| 21 |
+ |
function GetLinksFromFile(FileID: Integer): TLinks; |
| 22 |
+ |
|
| 23 |
|
function GetFileInfo(FileID: Integer): TFileInfo; override; |
| 24 |
|
function GetFilesList(Ext: String; Pattern: String; |
| 25 |
|
NoEmptyFiles: Boolean; SortType: TSortType): TStrings; override; |
| 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 GetRawList(FileID: Integer): TRawDataList; override; |
| 36 |
|
function GetRawInfo(FileID, DatOffset: Integer): TRawDataInfo; override; |
| 37 |
|
|
| 56 |
|
|
| 57 |
|
|
| 58 |
|
constructor TAccess_OUP_ADB.Create(DBFilename: String; ConnectionID: Integer; var Msg: TStatusMessages); |
| 55 |
– |
var |
| 56 |
– |
i: Integer; |
| 59 |
|
begin |
| 60 |
|
Msg := SM_UnknownError; |
| 61 |
|
if not FileExists(DBFilename) then |
| 104 |
|
Msg := SM_OK; |
| 105 |
|
FBackend := DB_ADB; |
| 106 |
|
|
| 107 |
+ |
FConnectionID := ConnectionID; |
| 108 |
|
FChangeRights := [CR_EditDat, CR_EditRaw, CR_ResizeDat, CR_ResizeRaw]; |
| 109 |
|
|
| 110 |
|
UpdateListCache; |
| 140 |
|
Fdat_files[i].Name := FQuery.FieldByName('name').AsString; |
| 141 |
|
Fdat_files[i].Extension := FQuery.FieldByName('extension').AsString; |
| 142 |
|
Fdat_files[i].Size := FQuery.FieldByName('size').AsInteger; |
| 143 |
< |
Fdat_files[i].FileType := HexToLong(FQuery.FieldByName('contenttype').AsString); |
| 143 |
> |
Fdat_files[i].FileType := StrToInt('$'+FQuery.FieldByName('contenttype').AsString); |
| 144 |
|
Fdat_files[i].DatAddr := 0; |
| 145 |
|
Inc(i); |
| 146 |
|
FQuery.Next; |
| 170 |
|
end; |
| 171 |
|
|
| 172 |
|
|
| 173 |
+ |
|
| 174 |
+ |
function TAccess_OUP_ADB.GetLinksToFile(FileID: Integer): TLinks; |
| 175 |
+ |
var |
| 176 |
+ |
i: Integer; |
| 177 |
+ |
begin |
| 178 |
+ |
SetLength(Result.ByName, 0); |
| 179 |
+ |
FQuery.SQL.Text := 'SELECT src_link_offset, src_id FROM linkmap WHERE target_id = ' + IntToStr(FileID) + ' ORDER BY src_id ASC;'; |
| 180 |
+ |
FQuery.Open; |
| 181 |
+ |
SetLength(Result.ByID, FQuery.RecordCount); |
| 182 |
+ |
if FQuery.RecordCount > 0 then |
| 183 |
+ |
begin |
| 184 |
+ |
i := 0; |
| 185 |
+ |
repeat |
| 186 |
+ |
Result.ByID[i].SrcOffset := FQuery.FieldByName('src_link_offset').AsInteger; |
| 187 |
+ |
Result.ByID[i].Destination := FQuery.FieldByName('src_id').AsInteger; |
| 188 |
+ |
Inc(i); |
| 189 |
+ |
FQuery.Next; |
| 190 |
+ |
until FQuery.EOF; |
| 191 |
+ |
end; |
| 192 |
+ |
FQuery.Close; |
| 193 |
+ |
end; |
| 194 |
+ |
|
| 195 |
+ |
function TAccess_OUP_ADB.GetLinksFromFile(FileID: Integer): TLinks; |
| 196 |
+ |
var |
| 197 |
+ |
i: Integer; |
| 198 |
+ |
begin |
| 199 |
+ |
SetLength(Result.ByName, 0); |
| 200 |
+ |
FQuery.SQL.Text := 'SELECT src_link_offset, target_id FROM linkmap WHERE src_id = ' + IntToStr(FileID) + ' ORDER BY target_id ASC;'; |
| 201 |
+ |
FQuery.Open; |
| 202 |
+ |
SetLength(Result.ByID, FQuery.RecordCount); |
| 203 |
+ |
if FQuery.RecordCount > 0 then |
| 204 |
+ |
begin |
| 205 |
+ |
i := 0; |
| 206 |
+ |
repeat |
| 207 |
+ |
Result.ByID[i].SrcOffset := FQuery.FieldByName('src_link_offset').AsInteger; |
| 208 |
+ |
Result.ByID[i].Destination := FQuery.FieldByName('target_id').AsInteger; |
| 209 |
+ |
Inc(i); |
| 210 |
+ |
FQuery.Next; |
| 211 |
+ |
until FQuery.EOF; |
| 212 |
+ |
end; |
| 213 |
+ |
FQuery.Close; |
| 214 |
+ |
end; |
| 215 |
+ |
|
| 216 |
+ |
|
| 217 |
+ |
|
| 218 |
|
function TAccess_OUP_ADB.GetFileInfo(fileid: Integer): TFileInfo; |
| 219 |
|
begin |
| 220 |
|
if fileid = -1 then |
| 260 |
|
name := fields.Strings[2]; |
| 261 |
|
extension := fields.Strings[0]; |
| 262 |
|
end; |
| 263 |
+ |
if SortType in [ST_ExtNameAsc, ST_ExtNameDesc] then |
| 264 |
+ |
begin |
| 265 |
+ |
id := fields.Strings[2]; |
| 266 |
+ |
name := fields.Strings[1]; |
| 267 |
+ |
extension := fields.Strings[0]; |
| 268 |
+ |
end; |
| 269 |
|
end; |
| 270 |
|
|
| 271 |
|
begin |
| 279 |
|
begin |
| 280 |
|
if (NoEmptyFiles = False) or ((Fdat_files[i].FileType and $02) = 0) then |
| 281 |
|
begin |
| 282 |
< |
if AppSettings.FilenumbersAsHex then |
| 229 |
< |
id := IntToHex(Fdat_files[i].ID, 4) |
| 230 |
< |
else |
| 231 |
< |
id := FormatNumber(Fdat_files[i].ID, 5, '0'); |
| 282 |
> |
id := FormatNumber(Fdat_files[i].ID, 5, '0'); |
| 283 |
|
name := Fdat_files[i].Name; |
| 284 |
|
extension := Fdat_files[i].Extension; |
| 285 |
|
|
| 287 |
|
ST_IDAsc, ST_IDDesc: list.Add(id + ';' + name + ';' + extension); |
| 288 |
|
ST_NameAsc, ST_NameDesc: list.Add(name + ';' + id + ';' + extension); |
| 289 |
|
ST_ExtAsc, ST_ExtDesc: list.Add(extension + ';' + id + ';' + name); |
| 290 |
+ |
ST_ExtNameAsc, ST_ExtNameDesc: list.Add(name + ';' + extension + ';' + id); |
| 291 |
|
end; |
| 292 |
|
end; |
| 293 |
|
end; |
| 294 |
|
end; |
| 295 |
< |
Result := TStringList.Create; |
| 295 |
> |
if not Assigned(Result) then |
| 296 |
> |
Result := TStringList.Create; |
| 297 |
|
if list.Count > 0 then |
| 298 |
|
begin |
| 299 |
|
fields := TStringList.Create; |
| 300 |
< |
if SortType in [ST_IDAsc, ST_NameAsc, ST_ExtAsc] then |
| 300 |
> |
if SortType in [ST_IDAsc, ST_NameAsc, ST_ExtAsc, ST_ExtNameAsc] then |
| 301 |
|
for i := 0 to list.Count - 1 do |
| 302 |
|
begin |
| 303 |
|
getfields; |
| 327 |
|
var |
| 328 |
|
i: Integer; |
| 329 |
|
begin |
| 330 |
< |
Result := TStringList.Create; |
| 330 |
> |
if not Assigned(Result) then |
| 331 |
> |
Result := TStringList.Create; |
| 332 |
> |
if Result is TStringList then |
| 333 |
> |
TStringList(Result).Sorted := True; |
| 334 |
|
for i := 0 to Length(Fdat_extensionsmap) - 1 do |
| 335 |
|
begin |
| 336 |
|
with Fdat_extensionsmap[i] do |