[43] | 1 | unit Helper_LevelDB;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
---|
| 7 | Dialogs, ComCtrls, StdCtrls, StrUtils;
|
---|
| 8 |
|
---|
| 9 | type
|
---|
| 10 | TForm_LevelDB = class(TForm)
|
---|
| 11 | group_progress: TGroupBox;
|
---|
| 12 | progress: TProgressBar;
|
---|
| 13 | lbl_progress: TLabel;
|
---|
| 14 | btn_abortok: TButton;
|
---|
| 15 | lbl_estimation: TLabel;
|
---|
| 16 | procedure btn_abortokClick(Sender: TObject);
|
---|
| 17 | private
|
---|
| 18 | procedure HandleFile(ext: String; fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 19 | procedure stop_convert;
|
---|
| 20 | public
|
---|
| 21 | procedure CreateDatabase(Source, target: String);
|
---|
| 22 | procedure CreateLevel(Source, target: String);
|
---|
| 23 | end;
|
---|
| 24 |
|
---|
| 25 |
|
---|
| 26 | var
|
---|
| 27 | Form_LevelDB: TForm_LevelDB;
|
---|
| 28 |
|
---|
| 29 | implementation
|
---|
| 30 |
|
---|
| 31 | {$R *.dfm}
|
---|
| 32 |
|
---|
[46] | 33 | uses ABSMain, ABSDecUtil, Main, Functions, Data,
|
---|
| 34 | OniImgClass, DataStructures, OniDataClass;
|
---|
[43] | 35 |
|
---|
| 36 | type
|
---|
| 37 | THandler = procedure(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 38 |
|
---|
| 39 | TConvertHandlers = record
|
---|
| 40 | Ext: String[4];
|
---|
| 41 | needed: Boolean;
|
---|
| 42 | Handler: THandler;
|
---|
| 43 | end;
|
---|
| 44 |
|
---|
| 45 | var
|
---|
| 46 | ConvertHandlers: array of TConvertHandlers;
|
---|
| 47 | loaded_filename: String;
|
---|
| 48 | converting: Boolean = False;
|
---|
| 49 | abort: Boolean = False;
|
---|
| 50 | DataBase: TABSDatabase;
|
---|
| 51 | Query: TABSQuery;
|
---|
| 52 | MimeCoder: TStringFormat_MIME64;
|
---|
| 53 |
|
---|
| 54 | var
|
---|
| 55 | DatHeader: THeader;
|
---|
| 56 | FilesHeader: TFilesMap;
|
---|
| 57 | NamedFilesHeader: TNamedFilesMap;
|
---|
| 58 | ExtensionsHeader: TExtensionsMap;
|
---|
| 59 | Stream_Body, Stream_Names: TMemoryStream;
|
---|
| 60 | Stream_Dat, Stream_Raw, Stream_Sep: TFileStream;
|
---|
[92] | 61 | OniDataConnection: TOniData;
|
---|
[43] | 62 |
|
---|
| 63 |
|
---|
| 64 |
|
---|
| 65 |
|
---|
| 66 | procedure TForm_LevelDB.CreateLevel(Source, target: String);
|
---|
| 67 | var
|
---|
| 68 | files: LongWord;
|
---|
| 69 |
|
---|
| 70 | i, j: LongWord;
|
---|
| 71 | temps, temps2: String;
|
---|
| 72 | Data, rawdata: Tdata;
|
---|
| 73 | absolutebegintime, begintime: Double;
|
---|
| 74 | step: Byte;
|
---|
| 75 | rawlist: TRawList;
|
---|
| 76 | extlist: TExtensionsMap;
|
---|
| 77 | fileinfo: TFileInfo;
|
---|
| 78 | datlinks: TDatLinks;
|
---|
| 79 | OniImage: TOniImage;
|
---|
| 80 | levelid: LongWord;
|
---|
[56] | 81 | timeformat: TFormatSettings;
|
---|
[86] | 82 |
|
---|
| 83 | conIndex: Integer;
|
---|
| 84 | connection: TOniData;
|
---|
[43] | 85 | const
|
---|
| 86 | steps: Byte = 3;
|
---|
| 87 |
|
---|
| 88 |
|
---|
| 89 |
|
---|
| 90 |
|
---|
| 91 | procedure DoStep(stepname: String);
|
---|
| 92 | begin
|
---|
| 93 | Inc(step);
|
---|
| 94 | if stepname <> 'FIN' then
|
---|
| 95 | group_progress.Caption :=
|
---|
| 96 | 'Creating Dat (Step ' + IntToStr(step) + '/' + IntToStr(steps) + ': ' + stepname + ')'
|
---|
| 97 | else
|
---|
| 98 | group_progress.Caption := 'Creating Dat (FINISHED)';
|
---|
| 99 | end;
|
---|
| 100 |
|
---|
| 101 | begin
|
---|
| 102 |
|
---|
| 103 | //
|
---|
| 104 | // FILE EXISTS CHECK FÜR DAT/RAW/SEP!!!
|
---|
| 105 | //
|
---|
| 106 |
|
---|
[85] | 107 | timeformat.ShortTimeFormat := 'hh:nn:ss';
|
---|
[56] | 108 | timeformat.LongTimeFormat := 'hh:nn:ss';
|
---|
| 109 | timeformat.TimeSeparator := ':';
|
---|
| 110 |
|
---|
[92] | 111 | connection := ConnectionExists(target);
|
---|
| 112 | if connection <> nil then
|
---|
| 113 | begin
|
---|
| 114 | ShowMessage('Destination-file is opened, close it in order to proceed conversion?');
|
---|
| 115 | Exit;
|
---|
| 116 | end;
|
---|
| 117 |
|
---|
| 118 | connection := ConnectionExists(source);
|
---|
| 119 | if connection <> nil then
|
---|
| 120 | begin
|
---|
| 121 | ShowMessage('Source-file is opened, close it in order to proceed conversion?');
|
---|
| 122 | Exit;
|
---|
| 123 | end;
|
---|
| 124 |
|
---|
| 125 |
|
---|
[86] | 126 | if CreateDataConnection(Source, ODB_ADB) = nil then
|
---|
[43] | 127 | begin
|
---|
| 128 | ShowMessage('Could not connect to .oldb-file');
|
---|
| 129 | Exit;
|
---|
| 130 | end;
|
---|
| 131 | levelid := OniDataConnection.LevelInfo.LevelNumber;
|
---|
| 132 | levelid := (levelid * 2) * 256 * 256 * 256 + $01;
|
---|
| 133 | OniImage := TOniImage.Create;
|
---|
| 134 |
|
---|
| 135 | absolutebegintime := Time;
|
---|
| 136 |
|
---|
| 137 | Self.Visible := True;
|
---|
| 138 | Form_Main.Visible := False;
|
---|
| 139 | step := 0;
|
---|
| 140 | converting := True;
|
---|
| 141 | abort := False;
|
---|
| 142 | btn_abortok.Caption := '&Abort...';
|
---|
| 143 | btn_abortok.Default := False;
|
---|
| 144 | absolutebegintime := Time;
|
---|
| 145 |
|
---|
| 146 | Stream_Body := TMemoryStream.Create;
|
---|
| 147 | Stream_Names := TMemoryStream.Create;
|
---|
| 148 | Stream_Dat := TFileStream.Create(target, fmCreate);
|
---|
| 149 | Stream_Raw := TFileStream.Create(AnsiReplaceStr(target, '.dat', '.raw'), fmCreate);
|
---|
| 150 | if OniDataConnection.OSisMac then
|
---|
| 151 | Stream_Sep := TFileStream.Create(AnsiReplaceStr(target, '.dat', '.sep'), fmCreate);
|
---|
| 152 |
|
---|
| 153 | DoStep('Creating header');
|
---|
| 154 | progress.Position := 0;
|
---|
| 155 | lbl_progress.Caption := '';
|
---|
| 156 | lbl_estimation.Caption := 'Estimated finishing time: unknown';
|
---|
| 157 | Application.ProcessMessages;
|
---|
| 158 |
|
---|
| 159 | NamedFilesHeader := TOniDataADB(OniDataConnection).GetNamedFilesMap;
|
---|
| 160 | extlist := OniDataConnection.GetExtendedExtensionsList;
|
---|
| 161 | for i := 0 to High(DatHeader.Ident) do
|
---|
| 162 | DatHeader.Ident[i] := OniDataConnection.LevelInfo.Ident[i];
|
---|
| 163 | DatHeader.Files := OniDataConnection.GetFilesCount;
|
---|
| 164 | DatHeader.NamedFiles := Length(NamedFilesHeader);
|
---|
| 165 | DatHeader.Extensions := Length(extlist);
|
---|
| 166 | DatHeader.DataAddr := 0;
|
---|
| 167 | DatHeader.DataSize := 0;
|
---|
| 168 | DatHeader.NamesAddr := 0;
|
---|
| 169 | DatHeader.NamesSize := 0;
|
---|
| 170 | for i := 0 to High(DatHeader.Ident2) do
|
---|
| 171 | DatHeader.Ident2[i] := 0;
|
---|
| 172 | SetLength(FilesHeader, DatHeader.Files);
|
---|
| 173 | SetLength(ExtensionsHeader, DatHeader.Extensions);
|
---|
| 174 |
|
---|
| 175 | DoStep('Writing extensions-header');
|
---|
| 176 | progress.Max := Length(OniDataConnection.GetExtensionsList);
|
---|
| 177 | Application.ProcessMessages;
|
---|
| 178 |
|
---|
| 179 | for i := 0 to High(ExtensionsHeader) do
|
---|
| 180 | begin
|
---|
| 181 | ExtensionsHeader[i].Ident := extlist[i].Ident;
|
---|
| 182 | ExtensionsHeader[i].Extension := extlist[i].Extension;
|
---|
| 183 | SetLength(temps, 4);
|
---|
| 184 | for j := 0 to 3 do
|
---|
| 185 | temps[j + 1] := ExtensionsHeader[i].Extension[3 - j];
|
---|
| 186 | ExtensionsHeader[i].ExtCount :=
|
---|
[46] | 187 | Length(OniDataConnection.GetFilesList(temps, '', False, stIDAsc));
|
---|
[43] | 188 | progress.Position := i + 1;
|
---|
| 189 | lbl_progress.Caption := 'Extensions done: ' + IntToStr(i + 1) + '/' +
|
---|
| 190 | IntToStr(Length(extlist));
|
---|
| 191 | Application.ProcessMessages;
|
---|
| 192 | end;
|
---|
| 193 |
|
---|
| 194 | DoStep('Storing files-data');
|
---|
| 195 | progress.Position := 0;
|
---|
| 196 | progress.Max := DatHeader.Files;
|
---|
| 197 | lbl_progress.Caption := '';
|
---|
| 198 | lbl_estimation.Caption := 'Estimated finishing time: unknown';
|
---|
| 199 | Application.ProcessMessages;
|
---|
| 200 |
|
---|
| 201 | begintime := Time;
|
---|
| 202 | for i := 0 to DatHeader.Files - 1 do
|
---|
| 203 | begin
|
---|
| 204 | fileinfo := OniDataConnection.GetFileInfo(i);
|
---|
| 205 | for j := 0 to 3 do
|
---|
| 206 | FilesHeader[i].Extension[j] := fileinfo.Extension[4 - j];
|
---|
| 207 | if fileinfo.Size > 0 then
|
---|
| 208 | begin
|
---|
| 209 | // DatLinks:=;
|
---|
| 210 | FilesHeader[i].DataAddr := Stream_Body.Size + 8;
|
---|
| 211 | Data := OniDataConnection.LoadDatFile(i);
|
---|
| 212 | Data[4] := (levelid) and $FF;
|
---|
| 213 | Data[5] := (levelid shr 8) and $FF;
|
---|
| 214 | Data[6] := (levelid shr 16) and $FF;
|
---|
| 215 | Data[7] := (levelid shr 24) and $FF;
|
---|
| 216 |
|
---|
| 217 | if (Pos(UpperCase(fileinfo.Extension), UpperCase(raws)) mod 4) = 1 then
|
---|
| 218 | begin
|
---|
| 219 | rawlist := OniDataConnection.GetRawList(i);
|
---|
| 220 | if Length(rawlist) > 0 then
|
---|
| 221 | begin
|
---|
| 222 | for j := 0 to High(rawlist) do
|
---|
| 223 | begin
|
---|
| 224 | if rawlist[j].raw_size > 0 then
|
---|
| 225 | begin
|
---|
| 226 | if (UpperCase(fileinfo.Extension) = 'TXMP') and
|
---|
| 227 | ((Data[$88] and $01) > 0) then
|
---|
| 228 | begin
|
---|
[86] | 229 | OniImage.LoadFromTXMP(Connection, i);
|
---|
[43] | 230 | OniImage.GetMipMappedImage(rawdata);
|
---|
| 231 | rawlist[j].raw_size := OniImage.GetImageDataSize(True);
|
---|
| 232 | Data[$90] := $08;
|
---|
| 233 | Data[$89] := 32;
|
---|
| 234 | { if data[$90]<>OniImage.StoreType then begin
|
---|
| 235 | data[$90]:=OniImage.StoreType;
|
---|
| 236 | data[$89]:=(data[$89] and $CF) or $20;
|
---|
| 237 | end;
|
---|
| 238 | } end
|
---|
| 239 | else
|
---|
| 240 | begin
|
---|
| 241 | SetLength(rawdata, rawlist[j].raw_size);
|
---|
| 242 | OniDataConnection.LoadRawFile(i, rawlist[j].src_offset, @rawdata[0]);
|
---|
| 243 | end;
|
---|
| 244 | // data[$88]:=data[$88] and $FE;
|
---|
| 245 |
|
---|
| 246 | if rawlist[j].loc_sep then
|
---|
| 247 | begin
|
---|
| 248 | rawlist[j].raw_addr := Stream_Sep.Size;
|
---|
| 249 | Stream_Sep.Write(rawdata[0], Length(rawdata));
|
---|
| 250 | end
|
---|
| 251 | else
|
---|
| 252 | begin
|
---|
| 253 | rawlist[j].raw_addr := Stream_Raw.Size;
|
---|
| 254 | Stream_Raw.Write(rawdata[0], Length(rawdata));
|
---|
| 255 | end;
|
---|
| 256 | end
|
---|
| 257 | else
|
---|
| 258 | rawlist[j].raw_addr := 0;
|
---|
| 259 | Data[rawlist[j].src_offset + 0] := (rawlist[j].raw_addr) and $FF;
|
---|
| 260 | Data[rawlist[j].src_offset + 1] := (rawlist[j].raw_addr shr 8) and $FF;
|
---|
| 261 | Data[rawlist[j].src_offset + 2] := (rawlist[j].raw_addr shr 16) and $FF;
|
---|
| 262 | Data[rawlist[j].src_offset + 3] := (rawlist[j].raw_addr shr 24) and $FF;
|
---|
| 263 | end;
|
---|
| 264 | end;
|
---|
| 265 | end;
|
---|
| 266 |
|
---|
| 267 | Stream_Body.Write(Data[0], Length(Data));
|
---|
| 268 | //
|
---|
| 269 | end
|
---|
| 270 | else
|
---|
| 271 | FilesHeader[i].DataAddr := 0;
|
---|
| 272 | if Length(fileinfo.Name) > 0 then
|
---|
| 273 | begin
|
---|
| 274 | FilesHeader[i].NameAddr := Stream_Names.Size;
|
---|
| 275 | temps := fileinfo.Extension + fileinfo.Name + Chr(0);
|
---|
| 276 | Stream_Names.Write(temps[1], Length(temps));
|
---|
| 277 | end
|
---|
| 278 | else
|
---|
| 279 | FilesHeader[i].NameAddr := 0;
|
---|
| 280 | FilesHeader[i].FileSize := fileinfo.Size;
|
---|
| 281 | FilesHeader[i].FileType := fileinfo.FileType;
|
---|
| 282 |
|
---|
[58] | 283 | if ((i mod 10) = 0) and (i >= 100) then
|
---|
| 284 | lbl_estimation.Caption := 'Estimated time left: ' + TimeToStr(
|
---|
[81] | 285 | (Time - begintime) / i * (progress.Max - i + 1) * 1.1, timeformat );
|
---|
[43] | 286 | progress.Position := i + 1;
|
---|
| 287 | lbl_progress.Caption := 'Files done: ' + IntToStr(i + 1) + '/' + IntToStr(progress.Max);
|
---|
| 288 | Application.ProcessMessages;
|
---|
| 289 | end;
|
---|
| 290 |
|
---|
| 291 | Stream_Dat.Write(DatHeader, SizeOf(DatHeader));
|
---|
| 292 | for i := 0 to High(FilesHeader) do
|
---|
| 293 | Stream_Dat.Write(FilesHeader[i], SizeOf(FilesHeader[i]));
|
---|
| 294 | for i := 0 to High(NamedFilesHeader) do
|
---|
| 295 | Stream_Dat.Write(NamedFilesHeader[i], SizeOf(NamedFilesHeader[i]));
|
---|
| 296 | for i := 0 to High(ExtensionsHeader) do
|
---|
| 297 | Stream_Dat.Write(ExtensionsHeader[i], SizeOf(ExtensionsHeader[i]));
|
---|
| 298 |
|
---|
| 299 | DatHeader.DataSize := Stream_Body.Size;
|
---|
| 300 | DatHeader.NamesSize := Stream_Names.Size;
|
---|
| 301 | DatHeader.DataAddr := Stream_Dat.Size;
|
---|
| 302 | Stream_Body.Seek(0, soFromBeginning);
|
---|
| 303 | Stream_Dat.CopyFrom(Stream_Body, Stream_Body.Size);
|
---|
| 304 | DatHeader.NamesAddr := Stream_Dat.Size;
|
---|
| 305 | Stream_Names.Seek(0, soFromBeginning);
|
---|
| 306 | Stream_Dat.CopyFrom(Stream_Names, Stream_Names.Size);
|
---|
| 307 |
|
---|
| 308 | Stream_Dat.Seek(0, soFromBeginning);
|
---|
| 309 | Stream_Dat.Write(DatHeader, SizeOf(DatHeader));
|
---|
| 310 |
|
---|
| 311 | Stream_Dat.Free;
|
---|
| 312 | Stream_Body.Free;
|
---|
| 313 | Stream_Names.Free;
|
---|
| 314 | Stream_Raw.Free;
|
---|
| 315 | if OniDataConnection.OSisMac then
|
---|
| 316 | Stream_Sep.Free;
|
---|
| 317 |
|
---|
| 318 | progress.Position := progress.Max;
|
---|
| 319 | lbl_progress.Caption := 'Files done: ' + IntToStr(progress.Max) + '/' +
|
---|
| 320 | IntToStr(progress.Max);
|
---|
[56] | 321 | lbl_estimation.Caption := 'FINISHED (duration: ' + TimeToStr(Time - absolutebegintime, timeformat) + ')';
|
---|
[43] | 322 |
|
---|
| 323 | DoStep('FIN');
|
---|
| 324 | btn_abortok.Caption := '&OK';
|
---|
| 325 | btn_abortok.Default := True;
|
---|
| 326 |
|
---|
| 327 | OniImage.Free;
|
---|
| 328 |
|
---|
| 329 | converting := False;
|
---|
| 330 |
|
---|
[86] | 331 | CloseDataConnection(DataConnections[conIndex]);
|
---|
[43] | 332 | end;
|
---|
| 333 |
|
---|
| 334 |
|
---|
| 335 |
|
---|
| 336 |
|
---|
| 337 | procedure TForm_LevelDB.HandleFile;
|
---|
| 338 | var
|
---|
| 339 | i: Byte;
|
---|
| 340 | begin
|
---|
| 341 | for i := 1 to Length(ConvertHandlers) do
|
---|
| 342 | if UpperCase(ConvertHandlers[i].Ext) = UpperCase(ext) then
|
---|
| 343 | if ConvertHandlers[i].needed then
|
---|
| 344 | begin
|
---|
| 345 | ConvertHandlers[i].Handler(fileid, dir_dat2db);
|
---|
| 346 | Break;
|
---|
| 347 | end
|
---|
| 348 | else
|
---|
| 349 | Break;
|
---|
| 350 | end;
|
---|
| 351 |
|
---|
| 352 |
|
---|
| 353 |
|
---|
| 354 |
|
---|
| 355 | procedure TForm_LevelDB.CreateDatabase(Source, target: String);
|
---|
| 356 | var
|
---|
| 357 | i, j: LongWord;
|
---|
| 358 | temps, temps2: String;
|
---|
| 359 | Data: Tdata;
|
---|
| 360 | absolutebegintime, begintime: Double;
|
---|
| 361 | step: Byte;
|
---|
| 362 | rawlist: TRawList;
|
---|
| 363 | extlist: TExtensionsMap;
|
---|
| 364 | fileinfo: TFileInfo;
|
---|
[56] | 365 | timeformat: TFormatSettings;
|
---|
[86] | 366 |
|
---|
| 367 | conIndex: Integer;
|
---|
[43] | 368 | const
|
---|
| 369 | steps: Byte = 4;
|
---|
| 370 |
|
---|
| 371 |
|
---|
| 372 |
|
---|
| 373 |
|
---|
| 374 | procedure DoStep(stepname: String);
|
---|
| 375 | begin
|
---|
| 376 | Inc(step);
|
---|
| 377 | if stepname <> 'FIN' then
|
---|
| 378 | group_progress.Caption :=
|
---|
| 379 | 'Creating DB (Step ' + IntToStr(step) + '/' + IntToStr(steps) + ': ' + stepname + ')'
|
---|
| 380 | else
|
---|
| 381 | group_progress.Caption := 'Creating DB (FINISHED)';
|
---|
| 382 | end;
|
---|
| 383 |
|
---|
| 384 | begin
|
---|
[86] | 385 | if CreateDataConnection(Source, ODB_Dat) = nil then
|
---|
[43] | 386 | begin
|
---|
| 387 | ShowMessage('Could not connect to .dat-file');
|
---|
| 388 | Exit;
|
---|
| 389 | end
|
---|
| 390 | else
|
---|
| 391 | begin
|
---|
| 392 | TOniDataDat(OniDataConnection).UnloadWhenUnused := False;
|
---|
| 393 | end;
|
---|
| 394 |
|
---|
[85] | 395 | timeformat.LongTimeFormat := 'hh:nn:ss';
|
---|
| 396 | timeformat.ShortTimeFormat := 'hh:nn:ss';
|
---|
| 397 | timeformat.TimeSeparator := ':';
|
---|
| 398 |
|
---|
[43] | 399 | Self.Visible := True;
|
---|
| 400 | Form_Main.Visible := False;
|
---|
| 401 | step := 0;
|
---|
| 402 | converting := True;
|
---|
| 403 | abort := False;
|
---|
| 404 | btn_abortok.Caption := '&Abort...';
|
---|
| 405 | btn_abortok.Default := False;
|
---|
| 406 | loaded_filename := target;
|
---|
| 407 |
|
---|
| 408 | absolutebegintime := Time;
|
---|
| 409 |
|
---|
| 410 | DataBase := TABSDatabase.Create(Self);
|
---|
| 411 | DataBase.DatabaseName := 'OLDB';
|
---|
| 412 | DataBase.DatabaseFileName := target;
|
---|
| 413 | DataBase.CreateDatabase;
|
---|
| 414 |
|
---|
| 415 | DoStep('Creating tables');
|
---|
| 416 | progress.Position := 0;
|
---|
| 417 | lbl_progress.Caption := '';
|
---|
| 418 | lbl_estimation.Caption := 'Estimated finishing time: unknown';
|
---|
| 419 | Application.ProcessMessages;
|
---|
| 420 |
|
---|
| 421 | Query := TABSQuery.Create(Self);
|
---|
| 422 | Query.DatabaseName := 'OLDB';
|
---|
| 423 | Query.SQL.Text :=
|
---|
| 424 | 'CREATE TABLE globals ( id AUTOINC PRIMARY KEY, name STRING(128), value STRING(128) );';
|
---|
| 425 | Query.ExecSQL;
|
---|
| 426 | Query.SQL.Text :=
|
---|
| 427 | 'CREATE TABLE linkmap ( id AUTOINC PRIMARY KEY, src_id INTEGER, src_link_offset INTEGER, target_id INTEGER );';
|
---|
| 428 | Query.ExecSQL;
|
---|
| 429 | Query.SQL.Text :=
|
---|
| 430 | 'CREATE TABLE rawmap ( id AUTOINC PRIMARY KEY, src_id INTEGER, src_link_offset INTEGER, sep BOOLEAN, size INTEGER, data BLOB BlobCompressionMode 9 BlobBlockSize 1024 BlobCompressionAlgorithm ZLib );';
|
---|
| 431 | // Query.SQL.Text:='CREATE TABLE rawmap ( id AUTOINC PRIMARY KEY, src_id INTEGER, src_link_offset INTEGER, size INTEGER, data BLOB BlobCompressionAlgorithm None );';
|
---|
| 432 | Query.ExecSQL;
|
---|
| 433 | Query.SQL.Text :=
|
---|
| 434 | 'CREATE TABLE datfiles ( id INTEGER PRIMARY KEY, extension CHAR(4), name STRING(128), contenttype INTEGER, size INTEGER, data BLOB BlobCompressionMode 9 BlobBlockSize 1024 BlobCompressionAlgorithm ZLib );';
|
---|
| 435 | // Query.SQL.Text:='CREATE TABLE datfiles ( id INTEGER PRIMARY KEY, extension CHAR(4), name STRING(128), contenttype INTEGER, size INTEGER, data BLOB BlobCompressionAlgorithm None );';
|
---|
| 436 | Query.ExecSQL;
|
---|
| 437 | Query.SQL.Text :=
|
---|
| 438 | 'CREATE TABLE extlist ( id AUTOINC PRIMARY KEY, ext CHAR(4), ident CHAR(16) );';
|
---|
| 439 | Query.ExecSQL;
|
---|
| 440 |
|
---|
| 441 | Query.SQL.Text := 'INSERT INTO globals (name,value) VALUES ("dbversion","' +
|
---|
| 442 | dbversion + '");';
|
---|
| 443 | Query.ExecSQL;
|
---|
| 444 | SetLength(Data, Length(OniDataConnection.LevelInfo.Ident));
|
---|
| 445 | for i := 0 to High(OniDataConnection.LevelInfo.Ident) do
|
---|
| 446 | Data[i] := OniDataConnection.LevelInfo.Ident[i];
|
---|
| 447 | temps := CreateHexString(Data, True);
|
---|
| 448 | Query.SQL.Text := 'INSERT INTO globals (name,value) VALUES ("ident","' + temps + '");';
|
---|
| 449 | Query.ExecSQL;
|
---|
| 450 | Query.SQL.Text := 'INSERT INTO globals (name,value) VALUES ("lvl","' +
|
---|
| 451 | IntToStr(OniDataConnection.LevelInfo.LevelNumber) + '");';
|
---|
| 452 | Query.ExecSQL;
|
---|
| 453 | if OniDataConnection.OSisMAC then
|
---|
| 454 | Query.SQL.Text := 'INSERT INTO globals (name,value) VALUES ("os","MAC");'
|
---|
| 455 | else
|
---|
| 456 | Query.SQL.Text := 'INSERT INTO globals (name,value) VALUES ("os","PC");';
|
---|
| 457 | Query.ExecSQL;
|
---|
| 458 |
|
---|
| 459 | DoStep('Writing extensionslist');
|
---|
| 460 | progress.Max := Length(OniDataConnection.GetExtensionsList);
|
---|
| 461 | Application.ProcessMessages;
|
---|
| 462 |
|
---|
| 463 | extlist := OniDataConnection.GetExtendedExtensionsList;
|
---|
| 464 | for i := 0 to High(extlist) do
|
---|
| 465 | begin
|
---|
| 466 | SetLength(Data, Length(extlist[i].Ident));
|
---|
| 467 | for j := 0 to High(extlist[i].Ident) do
|
---|
| 468 | Data[j] := extlist[i].Ident[j];
|
---|
| 469 | temps := CreateHexString(Data, True);
|
---|
| 470 | temps2 := extlist[i].Extension[3] + extlist[i].Extension[2] +
|
---|
| 471 | extlist[i].Extension[1] + extlist[i].Extension[0];
|
---|
| 472 | Query.SQL.Text := 'INSERT INTO extlist (ext,ident) VALUES ("' +
|
---|
| 473 | temps2 + '","' + temps + '");';
|
---|
| 474 | Query.ExecSQL;
|
---|
| 475 | progress.Position := i;
|
---|
| 476 | lbl_progress.Caption := 'Extensions done: ' + IntToStr(i) + '/' +
|
---|
| 477 | IntToStr(Length(extlist));
|
---|
| 478 | Application.ProcessMessages;
|
---|
| 479 | if abort then
|
---|
| 480 | begin
|
---|
| 481 | stop_convert;
|
---|
| 482 | Exit;
|
---|
| 483 | end;
|
---|
| 484 | end;
|
---|
| 485 | lbl_progress.Caption := '';
|
---|
| 486 |
|
---|
| 487 | progress.Position := 0;
|
---|
| 488 | lbl_progress.Caption := 'Files done: ' + IntToStr(0) + '/' + IntToStr(
|
---|
| 489 | OniDataConnection.GetFilesCount);
|
---|
| 490 | lbl_estimation.Caption := 'Estimated finishing time: unknown';
|
---|
| 491 |
|
---|
| 492 | DoStep('Loading .dat into memory');
|
---|
| 493 | Application.ProcessMessages;
|
---|
| 494 |
|
---|
| 495 | progress.Max := OniDataConnection.GetFilesCount;
|
---|
| 496 | begintime := Time;
|
---|
| 497 | DoStep('Writing .dat-fileslist');
|
---|
| 498 | Application.ProcessMessages;
|
---|
| 499 |
|
---|
| 500 | Database.StartTransaction;
|
---|
| 501 | for i := 0 to OniDataConnection.GetFilesCount - 1 do
|
---|
| 502 | begin
|
---|
| 503 | fileinfo := OniDataConnection.GetFileInfo(i);
|
---|
| 504 | if (fileinfo.FileType and $02) = 0 then
|
---|
| 505 | begin
|
---|
| 506 | mimecoder := TStringFormat_MIME64.Create;
|
---|
| 507 | Data := OniDataConnection.LoadDatFile(i);
|
---|
| 508 | Query.SQL.Text :=
|
---|
| 509 | 'INSERT INTO datfiles (id,extension,name,contenttype,size,data) VALUES (' +
|
---|
| 510 | IntToStr(i) + ',"' + fileinfo.Extension + '","' + fileinfo.Name + '","' + IntToHex(
|
---|
| 511 | fileinfo.FileType, 8) + '",' + IntToStr(fileinfo.Size) + ',MimeToBin("' +
|
---|
| 512 | MimeCoder.StrTo(@Data[0], Length(Data)) + '") );';
|
---|
| 513 | Query.ExecSQL;
|
---|
| 514 | mimecoder.Free;
|
---|
| 515 |
|
---|
| 516 | rawlist := OniDataConnection.GetRawList(i);
|
---|
| 517 | if Length(rawlist) > 0 then
|
---|
| 518 | begin
|
---|
| 519 | for j := 0 to High(rawlist) do
|
---|
| 520 | begin
|
---|
| 521 | if rawlist[j].raw_size > 0 then
|
---|
| 522 | begin
|
---|
| 523 | SetLength(Data, rawlist[j].raw_size);
|
---|
| 524 | OniDataConnection.LoadRawFile(i, rawlist[j].src_offset, Data);
|
---|
| 525 | mimecoder := TStringFormat_MIME64.Create;
|
---|
| 526 | Query.SQL.Text :=
|
---|
| 527 | 'INSERT INTO rawmap (src_id,src_link_offset,sep,size,data) VALUES (' +
|
---|
| 528 | IntToStr(i) + ',' + IntToStr(rawlist[j].src_offset) + ',' + BoolToStr(
|
---|
| 529 | rawlist[j].loc_sep) + ',' + IntToStr(rawlist[j].raw_size) + ',MimeToBin("' +
|
---|
| 530 | MimeCoder.StrTo(@Data[0], rawlist[j].raw_size) + '") );';
|
---|
| 531 | Query.ExecSQL;
|
---|
| 532 | mimecoder.Free;
|
---|
| 533 | end
|
---|
| 534 | else
|
---|
| 535 | begin
|
---|
| 536 | Query.SQL.Text :=
|
---|
| 537 | 'INSERT INTO rawmap (src_id,src_link_offset,sep,size) VALUES (' +
|
---|
| 538 | IntToStr(i) + ',' + IntToStr(rawlist[j].src_offset) + ',' + BoolToStr(rawlist[j].loc_sep) + ',0);';
|
---|
| 539 | Query.ExecSQL;
|
---|
| 540 | end;
|
---|
| 541 | end;
|
---|
| 542 | end;
|
---|
| 543 |
|
---|
| 544 | HandleFile(fileinfo.Extension, i, True);
|
---|
| 545 | end
|
---|
| 546 | else
|
---|
| 547 | begin
|
---|
| 548 | Query.SQL.Text :=
|
---|
| 549 | 'INSERT INTO datfiles (id,extension,name,contenttype,size) VALUES (' +
|
---|
| 550 | IntToStr(i) + ',"' + fileinfo.Extension + '","' + fileinfo.Name + '","' + IntToHex(
|
---|
| 551 | fileinfo.FileType, 8) + '",0);';
|
---|
| 552 | Query.ExecSQL;
|
---|
| 553 | end;
|
---|
| 554 | if ((i mod 100) = 0) and (i > 0) then
|
---|
| 555 | begin
|
---|
| 556 | Database.Commit(False);
|
---|
| 557 | Database.StartTransaction;
|
---|
| 558 | end;
|
---|
[58] | 559 | if ((i mod 10) = 0) and (i >= 100) then
|
---|
| 560 | lbl_estimation.Caption := 'Estimated time left: ' + TimeToStr(
|
---|
[81] | 561 | (Time - begintime) / i * (progress.Max - i + 1) * 1.1, timeformat );
|
---|
[43] | 562 | progress.Position := i;
|
---|
| 563 | lbl_progress.Caption := 'Files done: ' + IntToStr(i) + '/' + IntToStr(progress.Max);
|
---|
| 564 | Application.ProcessMessages;
|
---|
| 565 | if abort then
|
---|
| 566 | begin
|
---|
| 567 | stop_convert;
|
---|
| 568 | Exit;
|
---|
| 569 | end;
|
---|
| 570 | end;
|
---|
| 571 | Database.Commit(False);
|
---|
| 572 | progress.Position := progress.Max;
|
---|
| 573 | lbl_progress.Caption := 'Files done: ' + IntToStr(progress.Max) + '/' +
|
---|
| 574 | IntToStr(progress.Max);
|
---|
| 575 |
|
---|
[56] | 576 | lbl_estimation.Caption := 'FINISHED (duration: ' + TimeToStr(Time - absolutebegintime, timeformat) + ')';
|
---|
| 577 |
|
---|
[43] | 578 | DoStep('FIN');
|
---|
| 579 | btn_abortok.Caption := '&OK';
|
---|
| 580 | btn_abortok.Default := True;
|
---|
| 581 |
|
---|
| 582 | converting := False;
|
---|
| 583 |
|
---|
| 584 | database.Close;
|
---|
| 585 | database.Free;
|
---|
| 586 |
|
---|
[86] | 587 | CloseDataConnection(DataConnections[conIndex]);
|
---|
[43] | 588 | end;
|
---|
| 589 |
|
---|
| 590 |
|
---|
| 591 |
|
---|
| 592 |
|
---|
| 593 | procedure TForm_LevelDB.stop_convert;
|
---|
| 594 | begin
|
---|
| 595 | btn_abortok.Caption := '&Close';
|
---|
| 596 | btn_abortok.Default := True;
|
---|
| 597 | converting := False;
|
---|
| 598 | lbl_estimation.Caption := 'ABORTED';
|
---|
| 599 | group_progress.Caption := 'Creating DB (ABORTED)';
|
---|
| 600 | DataBase.Close;
|
---|
| 601 | if MessageBox(Self.Handle, PChar('Delete the unfinished DB-file?'),
|
---|
| 602 | PChar('Delete file?'), MB_YESNO) = idYes then
|
---|
| 603 | begin
|
---|
| 604 | DeleteFile(loaded_filename);
|
---|
| 605 | end;
|
---|
| 606 | end;
|
---|
| 607 |
|
---|
| 608 |
|
---|
| 609 |
|
---|
| 610 |
|
---|
| 611 | procedure TForm_LevelDB.btn_abortokClick(Sender: TObject);
|
---|
| 612 | begin
|
---|
| 613 | if converting then
|
---|
| 614 | begin
|
---|
| 615 | if MessageBox(Self.Handle,
|
---|
| 616 | PChar('Do you really want to cancel the convert-progress?'),
|
---|
| 617 | PChar('Warning: Converting'), MB_YESNO) = idYes then
|
---|
| 618 | abort := True;
|
---|
| 619 | end
|
---|
| 620 | else
|
---|
| 621 | begin
|
---|
| 622 | Self.Visible := False;
|
---|
| 623 | Form_Main.Visible := True;
|
---|
| 624 | end;
|
---|
| 625 | end;
|
---|
| 626 |
|
---|
| 627 |
|
---|
| 628 |
|
---|
| 629 |
|
---|
| 630 | procedure InsertDatLinkToDB(fileid: LongWord; offset: LongWord);
|
---|
| 631 | var
|
---|
| 632 | link: LongWord;
|
---|
| 633 | begin
|
---|
| 634 | OniDataConnection.LoadDatFilePart(fileid, offset, 4, @link);
|
---|
| 635 | if link = 0 then
|
---|
| 636 | link := $FFFFFFFF
|
---|
| 637 | else
|
---|
| 638 | link := link div 256;
|
---|
| 639 | Query.SQL.Text := 'INSERT INTO linkmap (src_id,src_link_offset,target_id) VALUES (' +
|
---|
| 640 | IntToStr(fileid) + ',' + IntToStr(offset) + ',' + IntToStr(link) + ');';
|
---|
| 641 | Query.ExecSQL;
|
---|
| 642 | end;
|
---|
| 643 |
|
---|
| 644 |
|
---|
| 645 |
|
---|
| 646 |
|
---|
| 647 | procedure AISA(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 648 | var
|
---|
| 649 | packages: Word;
|
---|
| 650 | i: LongWord;
|
---|
| 651 | begin
|
---|
| 652 | if dir_dat2db then
|
---|
| 653 | begin
|
---|
| 654 | OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
|
---|
| 655 | if packages > 0 then
|
---|
| 656 | begin
|
---|
| 657 | for i := 0 to packages - 1 do
|
---|
| 658 | InsertDatLinkToDB(fileid, $20 + i * $160 + $28);
|
---|
| 659 | for i := 0 to packages - 1 do
|
---|
| 660 | InsertDatLinkToDB(fileid, $20 + i * $160 + $150);
|
---|
| 661 | end;
|
---|
| 662 | end
|
---|
| 663 | else
|
---|
| 664 | begin
|
---|
| 665 | end;
|
---|
| 666 | end;
|
---|
| 667 |
|
---|
| 668 |
|
---|
| 669 |
|
---|
| 670 |
|
---|
| 671 | procedure AKEV(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 672 | var
|
---|
| 673 | i: LongWord;
|
---|
| 674 | begin
|
---|
| 675 | if dir_dat2db then
|
---|
| 676 | begin
|
---|
| 677 | for i := 0 to 16 do
|
---|
| 678 | InsertDatLinkToDB(fileid, $8 + i * 4);
|
---|
| 679 | end
|
---|
| 680 | else
|
---|
| 681 | begin
|
---|
| 682 | end;
|
---|
| 683 | end;
|
---|
| 684 |
|
---|
| 685 |
|
---|
| 686 |
|
---|
| 687 |
|
---|
| 688 | procedure AKOT(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 689 | var
|
---|
| 690 | i: LongWord;
|
---|
| 691 | begin
|
---|
| 692 | if dir_dat2db then
|
---|
| 693 | begin
|
---|
| 694 | for i := 0 to 4 do
|
---|
| 695 | InsertDatLinkToDB(fileid, $8 + i * 4);
|
---|
| 696 | end
|
---|
| 697 | else
|
---|
| 698 | begin
|
---|
| 699 | end;
|
---|
| 700 | end;
|
---|
| 701 |
|
---|
| 702 |
|
---|
| 703 |
|
---|
| 704 |
|
---|
| 705 | procedure CBPI(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 706 | var
|
---|
| 707 | i: LongWord;
|
---|
| 708 | begin
|
---|
| 709 | if dir_dat2db then
|
---|
| 710 | begin
|
---|
| 711 | for i := 0 to 56 do
|
---|
| 712 | InsertDatLinkToDB(fileid, $8 + i * 4);
|
---|
| 713 | end
|
---|
| 714 | else
|
---|
| 715 | begin
|
---|
| 716 | end;
|
---|
| 717 | end;
|
---|
| 718 |
|
---|
| 719 |
|
---|
| 720 |
|
---|
| 721 |
|
---|
| 722 | procedure CBPM(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 723 | var
|
---|
| 724 | i: LongWord;
|
---|
| 725 | begin
|
---|
| 726 | if dir_dat2db then
|
---|
| 727 | begin
|
---|
| 728 | for i := 0 to 18 do
|
---|
| 729 | InsertDatLinkToDB(fileid, $8 + i * 4);
|
---|
| 730 | end
|
---|
| 731 | else
|
---|
| 732 | begin
|
---|
| 733 | end;
|
---|
| 734 | end;
|
---|
| 735 |
|
---|
| 736 |
|
---|
| 737 |
|
---|
| 738 |
|
---|
| 739 | procedure CONS(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 740 | var
|
---|
| 741 | i: LongWord;
|
---|
| 742 | begin
|
---|
| 743 | if dir_dat2db then
|
---|
| 744 | begin
|
---|
| 745 | for i := 0 to 1 do
|
---|
| 746 | InsertDatLinkToDB(fileid, $24 + i * 4);
|
---|
| 747 | end
|
---|
| 748 | else
|
---|
| 749 | begin
|
---|
| 750 | end;
|
---|
| 751 | end;
|
---|
| 752 |
|
---|
| 753 |
|
---|
| 754 |
|
---|
| 755 |
|
---|
| 756 | procedure CRSA(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 757 | var
|
---|
| 758 | packages: LongWord;
|
---|
| 759 | i: LongWord;
|
---|
| 760 | begin
|
---|
| 761 | if dir_dat2db then
|
---|
| 762 | begin
|
---|
| 763 | OniDataConnection.LoadDatFilePart(fileid, $14, 4, @packages);
|
---|
| 764 | if packages > 0 then
|
---|
| 765 | for i := 0 to packages - 1 do
|
---|
| 766 | InsertDatLinkToDB(fileid, $20 + i * 1100 + $A0);
|
---|
| 767 | end
|
---|
| 768 | else
|
---|
| 769 | begin
|
---|
| 770 | end;
|
---|
| 771 | end;
|
---|
| 772 |
|
---|
| 773 |
|
---|
| 774 |
|
---|
| 775 |
|
---|
| 776 | procedure DOOR(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 777 | begin
|
---|
| 778 | if dir_dat2db then
|
---|
| 779 | begin
|
---|
| 780 | InsertDatLinkToDB(fileid, $08);
|
---|
[102] | 781 | InsertDatLinkToDB(fileid, $0C);
|
---|
[43] | 782 | InsertDatLinkToDB(fileid, $10);
|
---|
| 783 | end
|
---|
| 784 | else
|
---|
| 785 | begin
|
---|
| 786 | end;
|
---|
| 787 | end;
|
---|
| 788 |
|
---|
| 789 |
|
---|
| 790 |
|
---|
| 791 |
|
---|
| 792 | procedure DPGE(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 793 | begin
|
---|
| 794 | if dir_dat2db then
|
---|
| 795 | begin
|
---|
| 796 | InsertDatLinkToDB(fileid, $40);
|
---|
| 797 | end
|
---|
| 798 | else
|
---|
| 799 | begin
|
---|
| 800 | end;
|
---|
| 801 | end;
|
---|
| 802 |
|
---|
| 803 |
|
---|
| 804 |
|
---|
| 805 |
|
---|
| 806 | procedure HPGE(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 807 | begin
|
---|
| 808 | if dir_dat2db then
|
---|
| 809 | begin
|
---|
| 810 | InsertDatLinkToDB(fileid, $0C);
|
---|
| 811 | end
|
---|
| 812 | else
|
---|
| 813 | begin
|
---|
| 814 | end;
|
---|
| 815 | end;
|
---|
| 816 |
|
---|
| 817 |
|
---|
| 818 |
|
---|
| 819 |
|
---|
| 820 | procedure IGHH(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 821 | begin
|
---|
| 822 | if dir_dat2db then
|
---|
| 823 | begin
|
---|
| 824 | InsertDatLinkToDB(fileid, $24);
|
---|
| 825 | InsertDatLinkToDB(fileid, $28);
|
---|
| 826 | end
|
---|
| 827 | else
|
---|
| 828 | begin
|
---|
| 829 | end;
|
---|
| 830 | end;
|
---|
| 831 |
|
---|
| 832 |
|
---|
| 833 |
|
---|
| 834 |
|
---|
| 835 | procedure IGPA(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 836 | var
|
---|
| 837 | links: LongWord;
|
---|
| 838 | i: LongWord;
|
---|
| 839 | begin
|
---|
| 840 | if dir_dat2db then
|
---|
| 841 | begin
|
---|
| 842 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @links);
|
---|
| 843 | if links > 0 then
|
---|
| 844 | for i := 0 to links - 1 do
|
---|
| 845 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 846 | end
|
---|
| 847 | else
|
---|
| 848 | begin
|
---|
| 849 | end;
|
---|
| 850 | end;
|
---|
| 851 |
|
---|
| 852 |
|
---|
| 853 |
|
---|
| 854 |
|
---|
| 855 | procedure IGPG(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 856 | var
|
---|
| 857 | i: LongWord;
|
---|
| 858 | begin
|
---|
| 859 | if dir_dat2db then
|
---|
| 860 | begin
|
---|
| 861 | for i := 0 to 1 do
|
---|
| 862 | InsertDatLinkToDB(fileid, $1C + i * 4);
|
---|
| 863 | end
|
---|
| 864 | else
|
---|
| 865 | begin
|
---|
| 866 | end;
|
---|
| 867 | end;
|
---|
| 868 |
|
---|
| 869 |
|
---|
| 870 |
|
---|
| 871 |
|
---|
| 872 | procedure IGSA(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 873 | var
|
---|
| 874 | links: LongWord;
|
---|
| 875 | i: LongWord;
|
---|
| 876 | begin
|
---|
| 877 | if dir_dat2db then
|
---|
| 878 | begin
|
---|
| 879 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @links);
|
---|
| 880 | if links > 0 then
|
---|
| 881 | for i := 0 to links - 1 do
|
---|
| 882 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 883 | end
|
---|
| 884 | else
|
---|
| 885 | begin
|
---|
| 886 | end;
|
---|
| 887 | end;
|
---|
| 888 |
|
---|
| 889 |
|
---|
| 890 |
|
---|
| 891 |
|
---|
| 892 | procedure IMPT(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 893 | begin
|
---|
| 894 | if dir_dat2db then
|
---|
| 895 | begin
|
---|
| 896 | InsertDatLinkToDB(fileid, $10);
|
---|
| 897 | end
|
---|
| 898 | else
|
---|
| 899 | begin
|
---|
| 900 | end;
|
---|
| 901 | end;
|
---|
| 902 |
|
---|
| 903 |
|
---|
| 904 |
|
---|
| 905 |
|
---|
| 906 | procedure IPGE(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 907 | begin
|
---|
| 908 | if dir_dat2db then
|
---|
| 909 | begin
|
---|
| 910 | InsertDatLinkToDB(fileid, $0C);
|
---|
| 911 | end
|
---|
| 912 | else
|
---|
| 913 | begin
|
---|
| 914 | end;
|
---|
| 915 | end;
|
---|
| 916 |
|
---|
| 917 |
|
---|
| 918 |
|
---|
| 919 |
|
---|
| 920 | procedure KEYI(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 921 | var
|
---|
| 922 | i: LongWord;
|
---|
| 923 | begin
|
---|
| 924 | if dir_dat2db then
|
---|
| 925 | begin
|
---|
| 926 | for i := 0 to 9 do
|
---|
| 927 | InsertDatLinkToDB(fileid, $08 + i * 4);
|
---|
| 928 | end
|
---|
| 929 | else
|
---|
| 930 | begin
|
---|
| 931 | end;
|
---|
| 932 | end;
|
---|
| 933 |
|
---|
| 934 |
|
---|
| 935 |
|
---|
| 936 |
|
---|
| 937 | procedure M3GA(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 938 | var
|
---|
| 939 | links: LongWord;
|
---|
| 940 | i: LongWord;
|
---|
| 941 | begin
|
---|
| 942 | if dir_dat2db then
|
---|
| 943 | begin
|
---|
| 944 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @links);
|
---|
| 945 | if links > 0 then
|
---|
| 946 | for i := 0 to links - 1 do
|
---|
| 947 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 948 | end
|
---|
| 949 | else
|
---|
| 950 | begin
|
---|
| 951 | end;
|
---|
| 952 | end;
|
---|
| 953 |
|
---|
| 954 |
|
---|
| 955 |
|
---|
| 956 |
|
---|
| 957 | procedure M3GM(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 958 | var
|
---|
| 959 | i: LongWord;
|
---|
| 960 | begin
|
---|
| 961 | if dir_dat2db then
|
---|
| 962 | begin
|
---|
| 963 | for i := 0 to 6 do
|
---|
| 964 | InsertDatLinkToDB(fileid, $0C + i * 4);
|
---|
| 965 | end
|
---|
| 966 | else
|
---|
| 967 | begin
|
---|
| 968 | end;
|
---|
| 969 | end;
|
---|
| 970 |
|
---|
| 971 |
|
---|
| 972 |
|
---|
| 973 |
|
---|
| 974 | procedure MTRL(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 975 | begin
|
---|
| 976 | if dir_dat2db then
|
---|
| 977 | begin
|
---|
| 978 | InsertDatLinkToDB(fileid, $10);
|
---|
| 979 | end
|
---|
| 980 | else
|
---|
| 981 | begin
|
---|
| 982 | end;
|
---|
| 983 | end;
|
---|
| 984 |
|
---|
| 985 |
|
---|
| 986 |
|
---|
| 987 |
|
---|
| 988 | procedure OBDC(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 989 | var
|
---|
| 990 | packages: Word;
|
---|
| 991 | i: LongWord;
|
---|
| 992 | begin
|
---|
| 993 | if dir_dat2db then
|
---|
| 994 | begin
|
---|
| 995 | OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
|
---|
| 996 | if packages > 0 then
|
---|
| 997 | for i := 0 to packages - 1 do
|
---|
| 998 | InsertDatLinkToDB(fileid, $20 + i * $18 + $4);
|
---|
| 999 | end
|
---|
| 1000 | else
|
---|
| 1001 | begin
|
---|
| 1002 | end;
|
---|
| 1003 | end;
|
---|
| 1004 |
|
---|
| 1005 |
|
---|
| 1006 |
|
---|
| 1007 |
|
---|
| 1008 | procedure OBOA(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1009 | var
|
---|
| 1010 | packages: Word;
|
---|
| 1011 | i: LongWord;
|
---|
| 1012 | begin
|
---|
| 1013 | if dir_dat2db then
|
---|
| 1014 | begin
|
---|
| 1015 | OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
|
---|
| 1016 | if packages > 0 then
|
---|
| 1017 | for i := 0 to packages - 1 do
|
---|
| 1018 | begin
|
---|
| 1019 | InsertDatLinkToDB(fileid, $20 + i * 240 + $0);
|
---|
| 1020 | InsertDatLinkToDB(fileid, $20 + i * 240 + $4);
|
---|
| 1021 | InsertDatLinkToDB(fileid, $20 + i * 240 + $8);
|
---|
| 1022 | end;
|
---|
| 1023 | end
|
---|
| 1024 | else
|
---|
| 1025 | begin
|
---|
| 1026 | end;
|
---|
| 1027 | end;
|
---|
| 1028 |
|
---|
| 1029 |
|
---|
| 1030 |
|
---|
| 1031 |
|
---|
| 1032 | procedure OFGA(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1033 | var
|
---|
| 1034 | packages: LongWord;
|
---|
| 1035 | i: LongWord;
|
---|
| 1036 | begin
|
---|
| 1037 | if dir_dat2db then
|
---|
| 1038 | begin
|
---|
| 1039 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
|
---|
| 1040 | if packages > 0 then
|
---|
| 1041 | for i := 0 to packages - 1 do
|
---|
| 1042 | InsertDatLinkToDB(fileid, $20 + i * 12 + $04);
|
---|
| 1043 | end
|
---|
| 1044 | else
|
---|
| 1045 | begin
|
---|
| 1046 | end;
|
---|
| 1047 | end;
|
---|
| 1048 |
|
---|
| 1049 |
|
---|
| 1050 |
|
---|
| 1051 |
|
---|
| 1052 | procedure ONCC(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1053 | var
|
---|
| 1054 | i: LongWord;
|
---|
| 1055 | begin
|
---|
| 1056 | if dir_dat2db then
|
---|
| 1057 | begin
|
---|
| 1058 | InsertDatLinkToDB(fileid, $28);
|
---|
| 1059 | InsertDatLinkToDB(fileid, $434);
|
---|
| 1060 | InsertDatLinkToDB(fileid, $438);
|
---|
| 1061 | InsertDatLinkToDB(fileid, $43C);
|
---|
| 1062 | InsertDatLinkToDB(fileid, $C3C);
|
---|
| 1063 | InsertDatLinkToDB(fileid, $C40);
|
---|
| 1064 | InsertDatLinkToDB(fileid, $C44);
|
---|
| 1065 | InsertDatLinkToDB(fileid, $C48);
|
---|
| 1066 | InsertDatLinkToDB(fileid, $C88);
|
---|
| 1067 | InsertDatLinkToDB(fileid, $C8C);
|
---|
| 1068 | end
|
---|
| 1069 | else
|
---|
| 1070 | begin
|
---|
| 1071 | end;
|
---|
| 1072 | end;
|
---|
| 1073 |
|
---|
| 1074 |
|
---|
| 1075 |
|
---|
| 1076 |
|
---|
| 1077 | procedure ONCV(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1078 | begin
|
---|
| 1079 | if dir_dat2db then
|
---|
| 1080 | begin
|
---|
| 1081 | InsertDatLinkToDB(fileid, $08);
|
---|
| 1082 | end
|
---|
| 1083 | else
|
---|
| 1084 | begin
|
---|
| 1085 | end;
|
---|
| 1086 | end;
|
---|
| 1087 |
|
---|
| 1088 |
|
---|
| 1089 |
|
---|
| 1090 |
|
---|
| 1091 | procedure ONLV(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1092 | var
|
---|
| 1093 | i: LongWord;
|
---|
| 1094 | begin
|
---|
| 1095 | if dir_dat2db then
|
---|
| 1096 | begin
|
---|
| 1097 | for i := 0 to 5 do
|
---|
| 1098 | InsertDatLinkToDB(fileid, $48 + i * 4);
|
---|
| 1099 | for i := 0 to 5 do
|
---|
| 1100 | InsertDatLinkToDB(fileid, $64 + i * 4);
|
---|
| 1101 | InsertDatLinkToDB(fileid, $300);
|
---|
| 1102 | end
|
---|
| 1103 | else
|
---|
| 1104 | begin
|
---|
| 1105 | end;
|
---|
| 1106 | end;
|
---|
| 1107 |
|
---|
| 1108 |
|
---|
| 1109 |
|
---|
| 1110 |
|
---|
| 1111 | procedure ONOA(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1112 | var
|
---|
| 1113 | packages: LongWord;
|
---|
| 1114 | i: LongWord;
|
---|
| 1115 | begin
|
---|
| 1116 | if dir_dat2db then
|
---|
| 1117 | begin
|
---|
| 1118 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
|
---|
| 1119 | if packages > 0 then
|
---|
| 1120 | for i := 0 to packages - 1 do
|
---|
| 1121 | InsertDatLinkToDB(fileid, $20 + i * 8 + $04);
|
---|
| 1122 | end
|
---|
| 1123 | else
|
---|
| 1124 | begin
|
---|
| 1125 | end;
|
---|
| 1126 | end;
|
---|
| 1127 |
|
---|
| 1128 |
|
---|
| 1129 |
|
---|
| 1130 |
|
---|
| 1131 | procedure ONSK(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1132 | begin
|
---|
| 1133 | if dir_dat2db then
|
---|
| 1134 | begin
|
---|
| 1135 | InsertDatLinkToDB(fileid, $08);
|
---|
| 1136 | InsertDatLinkToDB(fileid, $0C);
|
---|
| 1137 | InsertDatLinkToDB(fileid, $10);
|
---|
| 1138 | InsertDatLinkToDB(fileid, $14);
|
---|
| 1139 | InsertDatLinkToDB(fileid, $18);
|
---|
| 1140 | InsertDatLinkToDB(fileid, $20);
|
---|
| 1141 | InsertDatLinkToDB(fileid, $44);
|
---|
| 1142 | end
|
---|
| 1143 | else
|
---|
| 1144 | begin
|
---|
| 1145 | end;
|
---|
| 1146 | end;
|
---|
| 1147 |
|
---|
| 1148 |
|
---|
| 1149 |
|
---|
| 1150 |
|
---|
| 1151 | procedure ONVL(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1152 | var
|
---|
| 1153 | packages: LongWord;
|
---|
| 1154 | i: LongWord;
|
---|
| 1155 | begin
|
---|
| 1156 | if dir_dat2db then
|
---|
| 1157 | begin
|
---|
| 1158 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
|
---|
| 1159 | if packages > 0 then
|
---|
| 1160 | for i := 0 to packages - 1 do
|
---|
| 1161 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 1162 | end
|
---|
| 1163 | else
|
---|
| 1164 | begin
|
---|
| 1165 | end;
|
---|
| 1166 | end;
|
---|
| 1167 |
|
---|
| 1168 |
|
---|
| 1169 |
|
---|
| 1170 |
|
---|
| 1171 | procedure ONWC(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1172 | begin
|
---|
| 1173 | if dir_dat2db then
|
---|
| 1174 | begin
|
---|
| 1175 | InsertDatLinkToDB(fileid, $28);
|
---|
| 1176 | InsertDatLinkToDB(fileid, $34);
|
---|
| 1177 | InsertDatLinkToDB(fileid, $40);
|
---|
| 1178 | InsertDatLinkToDB(fileid, $54);
|
---|
| 1179 | InsertDatLinkToDB(fileid, $58);
|
---|
| 1180 | InsertDatLinkToDB(fileid, $5C);
|
---|
| 1181 | InsertDatLinkToDB(fileid, $60);
|
---|
| 1182 | InsertDatLinkToDB(fileid, $6FC);
|
---|
| 1183 | InsertDatLinkToDB(fileid, $700);
|
---|
| 1184 | end
|
---|
| 1185 | else
|
---|
| 1186 | begin
|
---|
| 1187 | end;
|
---|
| 1188 | end;
|
---|
| 1189 |
|
---|
| 1190 |
|
---|
| 1191 |
|
---|
| 1192 |
|
---|
| 1193 | procedure OPGE(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1194 | begin
|
---|
| 1195 | if dir_dat2db then
|
---|
| 1196 | begin
|
---|
| 1197 | InsertDatLinkToDB(fileid, $0C);
|
---|
| 1198 | end
|
---|
| 1199 | else
|
---|
| 1200 | begin
|
---|
| 1201 | end;
|
---|
| 1202 | end;
|
---|
| 1203 |
|
---|
| 1204 |
|
---|
| 1205 |
|
---|
| 1206 |
|
---|
| 1207 | procedure PSPC(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1208 | begin
|
---|
| 1209 | if dir_dat2db then
|
---|
| 1210 | begin
|
---|
| 1211 | InsertDatLinkToDB(fileid, $50);
|
---|
| 1212 | end
|
---|
| 1213 | else
|
---|
| 1214 | begin
|
---|
| 1215 | end;
|
---|
| 1216 | end;
|
---|
| 1217 |
|
---|
| 1218 |
|
---|
| 1219 |
|
---|
| 1220 |
|
---|
| 1221 | procedure PSPL(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1222 | var
|
---|
| 1223 | packages: LongWord;
|
---|
| 1224 | i: LongWord;
|
---|
| 1225 | begin
|
---|
| 1226 | if dir_dat2db then
|
---|
| 1227 | begin
|
---|
| 1228 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
|
---|
| 1229 | if packages > 0 then
|
---|
| 1230 | for i := 0 to packages - 1 do
|
---|
| 1231 | InsertDatLinkToDB(fileid, $20 + i * 8 + $4);
|
---|
| 1232 | end
|
---|
| 1233 | else
|
---|
| 1234 | begin
|
---|
| 1235 | end;
|
---|
| 1236 | end;
|
---|
| 1237 |
|
---|
| 1238 |
|
---|
| 1239 |
|
---|
| 1240 |
|
---|
| 1241 | procedure PSUI(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1242 | var
|
---|
| 1243 | i: LongWord;
|
---|
| 1244 | begin
|
---|
| 1245 | if dir_dat2db then
|
---|
| 1246 | begin
|
---|
| 1247 | for i := 0 to 43 do
|
---|
| 1248 | InsertDatLinkToDB(fileid, $08 + i * 4);
|
---|
| 1249 | end
|
---|
| 1250 | else
|
---|
| 1251 | begin
|
---|
| 1252 | end;
|
---|
| 1253 | end;
|
---|
| 1254 |
|
---|
| 1255 |
|
---|
| 1256 |
|
---|
| 1257 |
|
---|
| 1258 | procedure STNA(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1259 | var
|
---|
| 1260 | packages: Word;
|
---|
| 1261 | i: LongWord;
|
---|
| 1262 | begin
|
---|
| 1263 | if dir_dat2db then
|
---|
| 1264 | begin
|
---|
| 1265 | OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
|
---|
| 1266 | if packages > 0 then
|
---|
| 1267 | for i := 0 to packages - 1 do
|
---|
| 1268 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 1269 | end
|
---|
| 1270 | else
|
---|
| 1271 | begin
|
---|
| 1272 | end;
|
---|
| 1273 | end;
|
---|
| 1274 |
|
---|
| 1275 |
|
---|
| 1276 |
|
---|
| 1277 |
|
---|
| 1278 | procedure TRAC(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1279 | var
|
---|
| 1280 | packages: Word;
|
---|
| 1281 | i: LongWord;
|
---|
| 1282 | begin
|
---|
| 1283 | if dir_dat2db then
|
---|
| 1284 | begin
|
---|
| 1285 | InsertDatLinkToDB(fileid, $18);
|
---|
| 1286 | OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
|
---|
| 1287 | if packages > 0 then
|
---|
| 1288 | for i := 0 to packages - 1 do
|
---|
| 1289 | InsertDatLinkToDB(fileid, $20 + i * 12 + 8);
|
---|
| 1290 | end
|
---|
| 1291 | else
|
---|
| 1292 | begin
|
---|
| 1293 | end;
|
---|
| 1294 | end;
|
---|
| 1295 |
|
---|
| 1296 |
|
---|
| 1297 |
|
---|
| 1298 |
|
---|
| 1299 | procedure TRAM(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1300 | begin
|
---|
| 1301 | if dir_dat2db then
|
---|
| 1302 | begin
|
---|
| 1303 | InsertDatLinkToDB(fileid, $40);
|
---|
| 1304 | InsertDatLinkToDB(fileid, $44);
|
---|
| 1305 | end
|
---|
| 1306 | else
|
---|
| 1307 | begin
|
---|
| 1308 | end;
|
---|
| 1309 | end;
|
---|
| 1310 |
|
---|
| 1311 |
|
---|
| 1312 |
|
---|
| 1313 |
|
---|
| 1314 | procedure TRAS(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1315 | begin
|
---|
| 1316 | if dir_dat2db then
|
---|
| 1317 | begin
|
---|
| 1318 | InsertDatLinkToDB(fileid, $08);
|
---|
| 1319 | end
|
---|
| 1320 | else
|
---|
| 1321 | begin
|
---|
| 1322 | end;
|
---|
| 1323 | end;
|
---|
| 1324 |
|
---|
| 1325 |
|
---|
| 1326 |
|
---|
| 1327 |
|
---|
| 1328 | procedure TRBS(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1329 | var
|
---|
| 1330 | i: LongWord;
|
---|
| 1331 | begin
|
---|
| 1332 | if dir_dat2db then
|
---|
| 1333 | begin
|
---|
| 1334 | for i := 0 to 4 do
|
---|
| 1335 | InsertDatLinkToDB(fileid, $08 + i * 4);
|
---|
| 1336 | end
|
---|
| 1337 | else
|
---|
| 1338 | begin
|
---|
| 1339 | end;
|
---|
| 1340 | end;
|
---|
| 1341 |
|
---|
| 1342 |
|
---|
| 1343 |
|
---|
| 1344 |
|
---|
| 1345 | procedure TRCM(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1346 | var
|
---|
| 1347 | i: LongWord;
|
---|
| 1348 | begin
|
---|
| 1349 | if dir_dat2db then
|
---|
| 1350 | begin
|
---|
| 1351 | for i := 0 to 2 do
|
---|
| 1352 | InsertDatLinkToDB(fileid, $5C + i * 4);
|
---|
| 1353 | end
|
---|
| 1354 | else
|
---|
| 1355 | begin
|
---|
| 1356 | end;
|
---|
| 1357 | end;
|
---|
| 1358 |
|
---|
| 1359 |
|
---|
| 1360 |
|
---|
| 1361 |
|
---|
| 1362 | procedure TRGA(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1363 | var
|
---|
| 1364 | i: LongWord;
|
---|
| 1365 | packages: Word;
|
---|
| 1366 | begin
|
---|
| 1367 | if dir_dat2db then
|
---|
| 1368 | begin
|
---|
| 1369 | OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
|
---|
| 1370 | if packages > 0 then
|
---|
| 1371 | for i := 0 to packages - 1 do
|
---|
| 1372 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 1373 | end
|
---|
| 1374 | else
|
---|
| 1375 | begin
|
---|
| 1376 | end;
|
---|
| 1377 | end;
|
---|
| 1378 |
|
---|
| 1379 |
|
---|
| 1380 |
|
---|
| 1381 |
|
---|
| 1382 | procedure TRGE(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1383 | begin
|
---|
| 1384 | if dir_dat2db then
|
---|
| 1385 | begin
|
---|
| 1386 | InsertDatLinkToDB(fileid, $20);
|
---|
| 1387 | end
|
---|
| 1388 | else
|
---|
| 1389 | begin
|
---|
| 1390 | end;
|
---|
| 1391 | end;
|
---|
| 1392 |
|
---|
| 1393 |
|
---|
| 1394 |
|
---|
| 1395 |
|
---|
| 1396 | procedure TRIG(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1397 | begin
|
---|
| 1398 | if dir_dat2db then
|
---|
| 1399 | begin
|
---|
| 1400 | InsertDatLinkToDB(fileid, $18);
|
---|
| 1401 | InsertDatLinkToDB(fileid, $24);
|
---|
| 1402 | InsertDatLinkToDB(fileid, $28);
|
---|
| 1403 | end
|
---|
| 1404 | else
|
---|
| 1405 | begin
|
---|
| 1406 | end;
|
---|
| 1407 | end;
|
---|
| 1408 |
|
---|
| 1409 |
|
---|
| 1410 |
|
---|
| 1411 |
|
---|
| 1412 | procedure TRMA(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1413 | var
|
---|
| 1414 | i: LongWord;
|
---|
| 1415 | packages: Word;
|
---|
| 1416 | begin
|
---|
| 1417 | if dir_dat2db then
|
---|
| 1418 | begin
|
---|
| 1419 | OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
|
---|
| 1420 | if packages > 0 then
|
---|
| 1421 | for i := 0 to packages - 1 do
|
---|
| 1422 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 1423 | end
|
---|
| 1424 | else
|
---|
| 1425 | begin
|
---|
| 1426 | end;
|
---|
| 1427 | end;
|
---|
| 1428 |
|
---|
| 1429 |
|
---|
| 1430 |
|
---|
| 1431 |
|
---|
| 1432 | procedure TRSC(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1433 | var
|
---|
| 1434 | i: LongWord;
|
---|
| 1435 | packages: Word;
|
---|
| 1436 | begin
|
---|
| 1437 | if dir_dat2db then
|
---|
| 1438 | begin
|
---|
| 1439 | OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
|
---|
| 1440 | if packages > 0 then
|
---|
| 1441 | for i := 0 to packages - 1 do
|
---|
| 1442 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 1443 | end
|
---|
| 1444 | else
|
---|
| 1445 | begin
|
---|
| 1446 | end;
|
---|
| 1447 | end;
|
---|
| 1448 |
|
---|
| 1449 |
|
---|
| 1450 |
|
---|
| 1451 |
|
---|
| 1452 | procedure TSFF(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1453 | var
|
---|
| 1454 | i: LongWord;
|
---|
| 1455 | packages: LongWord;
|
---|
| 1456 | begin
|
---|
| 1457 | if dir_dat2db then
|
---|
| 1458 | begin
|
---|
| 1459 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
|
---|
| 1460 | if packages > 0 then
|
---|
| 1461 | for i := 0 to packages - 1 do
|
---|
| 1462 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 1463 | end
|
---|
| 1464 | else
|
---|
| 1465 | begin
|
---|
| 1466 | end;
|
---|
| 1467 | end;
|
---|
| 1468 |
|
---|
| 1469 |
|
---|
| 1470 |
|
---|
| 1471 |
|
---|
| 1472 | procedure TSFT(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1473 | begin
|
---|
| 1474 | if dir_dat2db then
|
---|
| 1475 | begin
|
---|
| 1476 | InsertDatLinkToDB(fileid, $1C);
|
---|
| 1477 | end
|
---|
| 1478 | else
|
---|
| 1479 | begin
|
---|
| 1480 | end;
|
---|
| 1481 | end;
|
---|
| 1482 |
|
---|
| 1483 |
|
---|
| 1484 |
|
---|
| 1485 |
|
---|
| 1486 | procedure TURR(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1487 | begin
|
---|
| 1488 | if dir_dat2db then
|
---|
| 1489 | begin
|
---|
| 1490 | InsertDatLinkToDB(fileid, $60);
|
---|
| 1491 | InsertDatLinkToDB(fileid, $6C);
|
---|
| 1492 | InsertDatLinkToDB(fileid, $74);
|
---|
| 1493 | end
|
---|
| 1494 | else
|
---|
| 1495 | begin
|
---|
| 1496 | end;
|
---|
| 1497 | end;
|
---|
| 1498 |
|
---|
| 1499 |
|
---|
| 1500 |
|
---|
| 1501 |
|
---|
| 1502 | procedure TXAN(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1503 | var
|
---|
| 1504 | i: LongWord;
|
---|
| 1505 | packages: LongWord;
|
---|
| 1506 | begin
|
---|
| 1507 | if dir_dat2db then
|
---|
| 1508 | begin
|
---|
| 1509 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
|
---|
| 1510 | if packages > 0 then
|
---|
| 1511 | for i := 0 to packages - 1 do
|
---|
| 1512 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 1513 | end
|
---|
| 1514 | else
|
---|
| 1515 | begin
|
---|
| 1516 | end;
|
---|
| 1517 | end;
|
---|
| 1518 |
|
---|
| 1519 |
|
---|
| 1520 |
|
---|
| 1521 |
|
---|
| 1522 | procedure TXMA(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1523 | var
|
---|
| 1524 | i: LongWord;
|
---|
| 1525 | packages: LongWord;
|
---|
| 1526 | begin
|
---|
| 1527 | if dir_dat2db then
|
---|
| 1528 | begin
|
---|
| 1529 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
|
---|
| 1530 | if packages > 0 then
|
---|
| 1531 | for i := 0 to packages - 1 do
|
---|
| 1532 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 1533 | end
|
---|
| 1534 | else
|
---|
| 1535 | begin
|
---|
| 1536 | end;
|
---|
| 1537 | end;
|
---|
| 1538 |
|
---|
| 1539 |
|
---|
| 1540 |
|
---|
| 1541 |
|
---|
| 1542 | procedure TXMB(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1543 | var
|
---|
| 1544 | i: LongWord;
|
---|
| 1545 | packages: LongWord;
|
---|
| 1546 | begin
|
---|
| 1547 | if dir_dat2db then
|
---|
| 1548 | begin
|
---|
| 1549 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
|
---|
| 1550 | if packages > 0 then
|
---|
| 1551 | for i := 0 to packages - 1 do
|
---|
| 1552 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 1553 | end
|
---|
| 1554 | else
|
---|
| 1555 | begin
|
---|
| 1556 | end;
|
---|
| 1557 | end;
|
---|
| 1558 |
|
---|
| 1559 |
|
---|
| 1560 |
|
---|
| 1561 |
|
---|
| 1562 | procedure TXMP(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1563 | begin
|
---|
| 1564 | if dir_dat2db then
|
---|
| 1565 | begin
|
---|
| 1566 | InsertDatLinkToDB(fileid, $94);
|
---|
| 1567 | InsertDatLinkToDB(fileid, $98);
|
---|
| 1568 | end
|
---|
| 1569 | else
|
---|
| 1570 | begin
|
---|
| 1571 | end;
|
---|
| 1572 | end;
|
---|
| 1573 |
|
---|
| 1574 |
|
---|
| 1575 |
|
---|
| 1576 |
|
---|
| 1577 | procedure TXTC(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1578 | begin
|
---|
| 1579 | if dir_dat2db then
|
---|
| 1580 | begin
|
---|
| 1581 | InsertDatLinkToDB(fileid, $08);
|
---|
| 1582 | end
|
---|
| 1583 | else
|
---|
| 1584 | begin
|
---|
| 1585 | end;
|
---|
| 1586 | end;
|
---|
| 1587 |
|
---|
| 1588 |
|
---|
| 1589 |
|
---|
| 1590 |
|
---|
| 1591 | procedure WMCL(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1592 | var
|
---|
| 1593 | i: LongWord;
|
---|
| 1594 | packages: LongWord;
|
---|
| 1595 | begin
|
---|
| 1596 | if dir_dat2db then
|
---|
| 1597 | begin
|
---|
| 1598 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
|
---|
| 1599 | if packages > 0 then
|
---|
| 1600 | for i := 0 to packages - 1 do
|
---|
| 1601 | InsertDatLinkToDB(fileid, $20 + i * 8 + $4);
|
---|
| 1602 | end
|
---|
| 1603 | else
|
---|
| 1604 | begin
|
---|
| 1605 | end;
|
---|
| 1606 | end;
|
---|
| 1607 |
|
---|
| 1608 |
|
---|
| 1609 |
|
---|
| 1610 |
|
---|
| 1611 | procedure WMDD(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1612 | var
|
---|
| 1613 | i: LongWord;
|
---|
| 1614 | packages: LongWord;
|
---|
| 1615 | begin
|
---|
| 1616 | if dir_dat2db then
|
---|
| 1617 | begin
|
---|
| 1618 | OniDataConnection.LoadDatFilePart(fileid, $11C, 4, @packages);
|
---|
| 1619 | if packages > 0 then
|
---|
| 1620 | for i := 0 to packages - 1 do
|
---|
| 1621 | InsertDatLinkToDB(fileid, $120 + i * $124 + $114);
|
---|
| 1622 | end
|
---|
| 1623 | else
|
---|
| 1624 | begin
|
---|
| 1625 | end;
|
---|
| 1626 | end;
|
---|
| 1627 |
|
---|
| 1628 |
|
---|
| 1629 |
|
---|
| 1630 |
|
---|
| 1631 | procedure WMMB(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1632 | var
|
---|
| 1633 | i: LongWord;
|
---|
| 1634 | packages: LongWord;
|
---|
| 1635 | begin
|
---|
| 1636 | if dir_dat2db then
|
---|
| 1637 | begin
|
---|
| 1638 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
|
---|
| 1639 | if packages > 0 then
|
---|
| 1640 | for i := 0 to packages - 1 do
|
---|
| 1641 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 1642 | end
|
---|
| 1643 | else
|
---|
| 1644 | begin
|
---|
| 1645 | end;
|
---|
| 1646 | end;
|
---|
| 1647 |
|
---|
| 1648 |
|
---|
| 1649 |
|
---|
| 1650 |
|
---|
| 1651 | procedure WPGE(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1652 | begin
|
---|
| 1653 | if dir_dat2db then
|
---|
| 1654 | begin
|
---|
| 1655 | InsertDatLinkToDB(fileid, $08);
|
---|
| 1656 | InsertDatLinkToDB(fileid, $0C);
|
---|
| 1657 | end
|
---|
| 1658 | else
|
---|
| 1659 | begin
|
---|
| 1660 | end;
|
---|
| 1661 | end;
|
---|
| 1662 |
|
---|
| 1663 |
|
---|
| 1664 |
|
---|
| 1665 |
|
---|
| 1666 | procedure InsertHandler(ext: String; needed: Boolean; handler: THandler);
|
---|
| 1667 | begin
|
---|
| 1668 | SetLength(ConvertHandlers, Length(ConvertHandlers) + 1);
|
---|
| 1669 | ConvertHandlers[High(ConvertHandlers)].Ext := ext;
|
---|
| 1670 | ConvertHandlers[High(ConvertHandlers)].needed := needed;
|
---|
| 1671 | ConvertHandlers[High(ConvertHandlers)].handler := handler;
|
---|
| 1672 | end;
|
---|
| 1673 |
|
---|
| 1674 | begin
|
---|
| 1675 | InsertHandler('ABNA', False, nil);
|
---|
| 1676 | // InsertHandler('AGDB',True,AGDB);
|
---|
| 1677 | InsertHandler('AGDB', False, nil);
|
---|
| 1678 | InsertHandler('AGQC', False, nil);
|
---|
| 1679 | InsertHandler('AGQG', False, nil);
|
---|
| 1680 | InsertHandler('AGQR', False, nil);
|
---|
| 1681 | InsertHandler('AISA', True, AISA);
|
---|
| 1682 | InsertHandler('AITR', False, nil);
|
---|
| 1683 | InsertHandler('AKAA', False, nil);
|
---|
| 1684 | InsertHandler('AKBA', False, nil);
|
---|
| 1685 | InsertHandler('AKBP', False, nil);
|
---|
| 1686 | InsertHandler('AKDA', False, nil);
|
---|
| 1687 | InsertHandler('AKEV', True, AKEV);
|
---|
| 1688 | InsertHandler('AKOT', True, AKOT);
|
---|
| 1689 | InsertHandler('AKVA', False, nil);
|
---|
| 1690 | InsertHandler('BINA', False, nil);
|
---|
| 1691 | InsertHandler('CBPI', True, CBPI);
|
---|
| 1692 | InsertHandler('CBPM', True, CBPM);
|
---|
| 1693 | InsertHandler('CONS', True, CONS);
|
---|
| 1694 | InsertHandler('CRSA', True, CRSA);
|
---|
| 1695 | InsertHandler('DOOR', True, DOOR);
|
---|
| 1696 | InsertHandler('DPGE', True, DPGE);
|
---|
| 1697 | InsertHandler('ENVP', False, nil);
|
---|
| 1698 | InsertHandler('FILM', False, nil);
|
---|
| 1699 | InsertHandler('HPGE', True, HPGE);
|
---|
| 1700 | InsertHandler('IDXA', False, nil);
|
---|
| 1701 | InsertHandler('IGHH', True, IGHH);
|
---|
| 1702 | InsertHandler('IGPA', True, IGPA);
|
---|
| 1703 | InsertHandler('IGPG', True, IGPG);
|
---|
| 1704 | InsertHandler('IGSA', True, IGSA);
|
---|
| 1705 | InsertHandler('IMPT', True, IMPT);
|
---|
| 1706 | InsertHandler('IPGE', True, IPGE);
|
---|
| 1707 | InsertHandler('KEYI', True, KEYI);
|
---|
| 1708 | InsertHandler('M3GA', True, M3GA);
|
---|
| 1709 | InsertHandler('M3GM', True, M3GM);
|
---|
| 1710 | InsertHandler('MTRL', True, MTRL);
|
---|
| 1711 | InsertHandler('OBAN', False, nil);
|
---|
| 1712 | InsertHandler('OBDC', True, OBDC);
|
---|
| 1713 | InsertHandler('OBOA', True, OBOA);
|
---|
| 1714 | InsertHandler('OFGA', True, OFGA);
|
---|
| 1715 | InsertHandler('ONCC', True, ONCC);
|
---|
| 1716 | InsertHandler('ONCP', False, nil);
|
---|
| 1717 | InsertHandler('ONCV', True, ONCV);
|
---|
| 1718 | InsertHandler('ONFA', False, nil);
|
---|
| 1719 | InsertHandler('ONGS', False, nil);
|
---|
| 1720 | InsertHandler('ONIA', False, nil);
|
---|
| 1721 | InsertHandler('ONLD', False, nil);
|
---|
| 1722 | InsertHandler('ONLV', True, ONLV);
|
---|
| 1723 | InsertHandler('ONMA', False, nil);
|
---|
| 1724 | InsertHandler('ONOA', True, ONOA);
|
---|
| 1725 | InsertHandler('ONSA', False, nil);
|
---|
| 1726 | InsertHandler('ONSK', True, ONSK);
|
---|
| 1727 | InsertHandler('ONTA', False, nil);
|
---|
| 1728 | InsertHandler('ONVL', True, ONVL);
|
---|
| 1729 | InsertHandler('ONWC', True, ONWC);
|
---|
| 1730 | InsertHandler('OPGE', True, OPGE);
|
---|
| 1731 | InsertHandler('OSBD', False, nil);
|
---|
| 1732 | InsertHandler('OTIT', False, nil);
|
---|
| 1733 | InsertHandler('OTLF', False, nil);
|
---|
| 1734 | InsertHandler('PLEA', False, nil);
|
---|
| 1735 | InsertHandler('PNTA', False, nil);
|
---|
| 1736 | InsertHandler('PSPC', True, PSPC);
|
---|
| 1737 | InsertHandler('PSPL', True, PSPL);
|
---|
| 1738 | InsertHandler('PSUI', True, PSUI);
|
---|
| 1739 | InsertHandler('QTNA', False, nil);
|
---|
| 1740 | InsertHandler('SNDD', False, nil);
|
---|
| 1741 | InsertHandler('STNA', True, STNA);
|
---|
| 1742 | InsertHandler('SUBT', False, nil);
|
---|
| 1743 | InsertHandler('TRAC', True, TRAC);
|
---|
| 1744 | InsertHandler('TRAM', True, TRAM);
|
---|
| 1745 | InsertHandler('TRAS', True, TRAS);
|
---|
| 1746 | InsertHandler('TRBS', True, TRBS);
|
---|
| 1747 | InsertHandler('TRCM', True, TRCM);
|
---|
| 1748 | InsertHandler('TRGA', True, TRGA);
|
---|
| 1749 | InsertHandler('TRGE', True, TRGE);
|
---|
| 1750 | InsertHandler('TRIA', False, nil);
|
---|
| 1751 | InsertHandler('TRIG', True, TRIG);
|
---|
| 1752 | InsertHandler('TRMA', True, TRMA);
|
---|
| 1753 | InsertHandler('TRSC', True, TRSC);
|
---|
| 1754 | InsertHandler('TRTA', False, nil);
|
---|
| 1755 | InsertHandler('TSFF', True, TSFF);
|
---|
| 1756 | InsertHandler('TSFL', False, nil);
|
---|
| 1757 | InsertHandler('TSFT', True, TSFT);
|
---|
| 1758 | InsertHandler('TSGA', False, nil);
|
---|
| 1759 | InsertHandler('TSTR', False, nil);
|
---|
| 1760 | InsertHandler('TURR', True, TURR);
|
---|
| 1761 | InsertHandler('TXAN', True, TXAN);
|
---|
| 1762 | InsertHandler('TXCA', False, nil);
|
---|
| 1763 | InsertHandler('TXMA', True, TXMA);
|
---|
| 1764 | InsertHandler('TXMB', True, TXMB);
|
---|
| 1765 | InsertHandler('TXMP', True, TXMP);
|
---|
| 1766 | InsertHandler('TXTC', True, TXTC);
|
---|
| 1767 | InsertHandler('VCRA', False, nil);
|
---|
| 1768 | InsertHandler('WMCL', True, WMCL);
|
---|
| 1769 | InsertHandler('WMDD', True, WMDD);
|
---|
| 1770 | InsertHandler('WMM_', False, nil);
|
---|
| 1771 | InsertHandler('WMMB', True, WMMB);
|
---|
| 1772 | InsertHandler('WPGE', True, WPGE);
|
---|
| 1773 | end.
|
---|