[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);
|
---|
| 781 | InsertDatLinkToDB(fileid, $10);
|
---|
| 782 | end
|
---|
| 783 | else
|
---|
| 784 | begin
|
---|
| 785 | end;
|
---|
| 786 | end;
|
---|
| 787 |
|
---|
| 788 |
|
---|
| 789 |
|
---|
| 790 |
|
---|
| 791 | procedure DPGE(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 792 | begin
|
---|
| 793 | if dir_dat2db then
|
---|
| 794 | begin
|
---|
| 795 | InsertDatLinkToDB(fileid, $40);
|
---|
| 796 | end
|
---|
| 797 | else
|
---|
| 798 | begin
|
---|
| 799 | end;
|
---|
| 800 | end;
|
---|
| 801 |
|
---|
| 802 |
|
---|
| 803 |
|
---|
| 804 |
|
---|
| 805 | procedure HPGE(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 806 | begin
|
---|
| 807 | if dir_dat2db then
|
---|
| 808 | begin
|
---|
| 809 | InsertDatLinkToDB(fileid, $0C);
|
---|
| 810 | end
|
---|
| 811 | else
|
---|
| 812 | begin
|
---|
| 813 | end;
|
---|
| 814 | end;
|
---|
| 815 |
|
---|
| 816 |
|
---|
| 817 |
|
---|
| 818 |
|
---|
| 819 | procedure IGHH(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 820 | begin
|
---|
| 821 | if dir_dat2db then
|
---|
| 822 | begin
|
---|
| 823 | InsertDatLinkToDB(fileid, $24);
|
---|
| 824 | InsertDatLinkToDB(fileid, $28);
|
---|
| 825 | end
|
---|
| 826 | else
|
---|
| 827 | begin
|
---|
| 828 | end;
|
---|
| 829 | end;
|
---|
| 830 |
|
---|
| 831 |
|
---|
| 832 |
|
---|
| 833 |
|
---|
| 834 | procedure IGPA(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 835 | var
|
---|
| 836 | links: LongWord;
|
---|
| 837 | i: LongWord;
|
---|
| 838 | begin
|
---|
| 839 | if dir_dat2db then
|
---|
| 840 | begin
|
---|
| 841 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @links);
|
---|
| 842 | if links > 0 then
|
---|
| 843 | for i := 0 to links - 1 do
|
---|
| 844 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 845 | end
|
---|
| 846 | else
|
---|
| 847 | begin
|
---|
| 848 | end;
|
---|
| 849 | end;
|
---|
| 850 |
|
---|
| 851 |
|
---|
| 852 |
|
---|
| 853 |
|
---|
| 854 | procedure IGPG(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 855 | var
|
---|
| 856 | i: LongWord;
|
---|
| 857 | begin
|
---|
| 858 | if dir_dat2db then
|
---|
| 859 | begin
|
---|
| 860 | for i := 0 to 1 do
|
---|
| 861 | InsertDatLinkToDB(fileid, $1C + i * 4);
|
---|
| 862 | end
|
---|
| 863 | else
|
---|
| 864 | begin
|
---|
| 865 | end;
|
---|
| 866 | end;
|
---|
| 867 |
|
---|
| 868 |
|
---|
| 869 |
|
---|
| 870 |
|
---|
| 871 | procedure IGSA(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 872 | var
|
---|
| 873 | links: LongWord;
|
---|
| 874 | i: LongWord;
|
---|
| 875 | begin
|
---|
| 876 | if dir_dat2db then
|
---|
| 877 | begin
|
---|
| 878 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @links);
|
---|
| 879 | if links > 0 then
|
---|
| 880 | for i := 0 to links - 1 do
|
---|
| 881 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 882 | end
|
---|
| 883 | else
|
---|
| 884 | begin
|
---|
| 885 | end;
|
---|
| 886 | end;
|
---|
| 887 |
|
---|
| 888 |
|
---|
| 889 |
|
---|
| 890 |
|
---|
| 891 | procedure IMPT(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 892 | begin
|
---|
| 893 | if dir_dat2db then
|
---|
| 894 | begin
|
---|
| 895 | InsertDatLinkToDB(fileid, $10);
|
---|
| 896 | end
|
---|
| 897 | else
|
---|
| 898 | begin
|
---|
| 899 | end;
|
---|
| 900 | end;
|
---|
| 901 |
|
---|
| 902 |
|
---|
| 903 |
|
---|
| 904 |
|
---|
| 905 | procedure IPGE(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 906 | begin
|
---|
| 907 | if dir_dat2db then
|
---|
| 908 | begin
|
---|
| 909 | InsertDatLinkToDB(fileid, $0C);
|
---|
| 910 | end
|
---|
| 911 | else
|
---|
| 912 | begin
|
---|
| 913 | end;
|
---|
| 914 | end;
|
---|
| 915 |
|
---|
| 916 |
|
---|
| 917 |
|
---|
| 918 |
|
---|
| 919 | procedure KEYI(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 920 | var
|
---|
| 921 | i: LongWord;
|
---|
| 922 | begin
|
---|
| 923 | if dir_dat2db then
|
---|
| 924 | begin
|
---|
| 925 | for i := 0 to 9 do
|
---|
| 926 | InsertDatLinkToDB(fileid, $08 + i * 4);
|
---|
| 927 | end
|
---|
| 928 | else
|
---|
| 929 | begin
|
---|
| 930 | end;
|
---|
| 931 | end;
|
---|
| 932 |
|
---|
| 933 |
|
---|
| 934 |
|
---|
| 935 |
|
---|
| 936 | procedure M3GA(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 937 | var
|
---|
| 938 | links: LongWord;
|
---|
| 939 | i: LongWord;
|
---|
| 940 | begin
|
---|
| 941 | if dir_dat2db then
|
---|
| 942 | begin
|
---|
| 943 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @links);
|
---|
| 944 | if links > 0 then
|
---|
| 945 | for i := 0 to links - 1 do
|
---|
| 946 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 947 | end
|
---|
| 948 | else
|
---|
| 949 | begin
|
---|
| 950 | end;
|
---|
| 951 | end;
|
---|
| 952 |
|
---|
| 953 |
|
---|
| 954 |
|
---|
| 955 |
|
---|
| 956 | procedure M3GM(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 957 | var
|
---|
| 958 | i: LongWord;
|
---|
| 959 | begin
|
---|
| 960 | if dir_dat2db then
|
---|
| 961 | begin
|
---|
| 962 | for i := 0 to 6 do
|
---|
| 963 | InsertDatLinkToDB(fileid, $0C + i * 4);
|
---|
| 964 | end
|
---|
| 965 | else
|
---|
| 966 | begin
|
---|
| 967 | end;
|
---|
| 968 | end;
|
---|
| 969 |
|
---|
| 970 |
|
---|
| 971 |
|
---|
| 972 |
|
---|
| 973 | procedure MTRL(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 974 | begin
|
---|
| 975 | if dir_dat2db then
|
---|
| 976 | begin
|
---|
| 977 | InsertDatLinkToDB(fileid, $10);
|
---|
| 978 | end
|
---|
| 979 | else
|
---|
| 980 | begin
|
---|
| 981 | end;
|
---|
| 982 | end;
|
---|
| 983 |
|
---|
| 984 |
|
---|
| 985 |
|
---|
| 986 |
|
---|
| 987 | procedure OBDC(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 988 | var
|
---|
| 989 | packages: Word;
|
---|
| 990 | i: LongWord;
|
---|
| 991 | begin
|
---|
| 992 | if dir_dat2db then
|
---|
| 993 | begin
|
---|
| 994 | OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
|
---|
| 995 | if packages > 0 then
|
---|
| 996 | for i := 0 to packages - 1 do
|
---|
| 997 | InsertDatLinkToDB(fileid, $20 + i * $18 + $4);
|
---|
| 998 | end
|
---|
| 999 | else
|
---|
| 1000 | begin
|
---|
| 1001 | end;
|
---|
| 1002 | end;
|
---|
| 1003 |
|
---|
| 1004 |
|
---|
| 1005 |
|
---|
| 1006 |
|
---|
| 1007 | procedure OBOA(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1008 | var
|
---|
| 1009 | packages: Word;
|
---|
| 1010 | i: LongWord;
|
---|
| 1011 | begin
|
---|
| 1012 | if dir_dat2db then
|
---|
| 1013 | begin
|
---|
| 1014 | OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
|
---|
| 1015 | if packages > 0 then
|
---|
| 1016 | for i := 0 to packages - 1 do
|
---|
| 1017 | begin
|
---|
| 1018 | InsertDatLinkToDB(fileid, $20 + i * 240 + $0);
|
---|
| 1019 | InsertDatLinkToDB(fileid, $20 + i * 240 + $4);
|
---|
| 1020 | InsertDatLinkToDB(fileid, $20 + i * 240 + $8);
|
---|
| 1021 | end;
|
---|
| 1022 | end
|
---|
| 1023 | else
|
---|
| 1024 | begin
|
---|
| 1025 | end;
|
---|
| 1026 | end;
|
---|
| 1027 |
|
---|
| 1028 |
|
---|
| 1029 |
|
---|
| 1030 |
|
---|
| 1031 | procedure OFGA(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1032 | var
|
---|
| 1033 | packages: LongWord;
|
---|
| 1034 | i: LongWord;
|
---|
| 1035 | begin
|
---|
| 1036 | if dir_dat2db then
|
---|
| 1037 | begin
|
---|
| 1038 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
|
---|
| 1039 | if packages > 0 then
|
---|
| 1040 | for i := 0 to packages - 1 do
|
---|
| 1041 | InsertDatLinkToDB(fileid, $20 + i * 12 + $04);
|
---|
| 1042 | end
|
---|
| 1043 | else
|
---|
| 1044 | begin
|
---|
| 1045 | end;
|
---|
| 1046 | end;
|
---|
| 1047 |
|
---|
| 1048 |
|
---|
| 1049 |
|
---|
| 1050 |
|
---|
| 1051 | procedure ONCC(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1052 | var
|
---|
| 1053 | i: LongWord;
|
---|
| 1054 | begin
|
---|
| 1055 | if dir_dat2db then
|
---|
| 1056 | begin
|
---|
| 1057 | InsertDatLinkToDB(fileid, $28);
|
---|
| 1058 | InsertDatLinkToDB(fileid, $434);
|
---|
| 1059 | InsertDatLinkToDB(fileid, $438);
|
---|
| 1060 | InsertDatLinkToDB(fileid, $43C);
|
---|
| 1061 | InsertDatLinkToDB(fileid, $C3C);
|
---|
| 1062 | InsertDatLinkToDB(fileid, $C40);
|
---|
| 1063 | InsertDatLinkToDB(fileid, $C44);
|
---|
| 1064 | InsertDatLinkToDB(fileid, $C48);
|
---|
| 1065 | InsertDatLinkToDB(fileid, $C88);
|
---|
| 1066 | InsertDatLinkToDB(fileid, $C8C);
|
---|
| 1067 | end
|
---|
| 1068 | else
|
---|
| 1069 | begin
|
---|
| 1070 | end;
|
---|
| 1071 | end;
|
---|
| 1072 |
|
---|
| 1073 |
|
---|
| 1074 |
|
---|
| 1075 |
|
---|
| 1076 | procedure ONCV(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1077 | begin
|
---|
| 1078 | if dir_dat2db then
|
---|
| 1079 | begin
|
---|
| 1080 | InsertDatLinkToDB(fileid, $08);
|
---|
| 1081 | end
|
---|
| 1082 | else
|
---|
| 1083 | begin
|
---|
| 1084 | end;
|
---|
| 1085 | end;
|
---|
| 1086 |
|
---|
| 1087 |
|
---|
| 1088 |
|
---|
| 1089 |
|
---|
| 1090 | procedure ONLV(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1091 | var
|
---|
| 1092 | i: LongWord;
|
---|
| 1093 | begin
|
---|
| 1094 | if dir_dat2db then
|
---|
| 1095 | begin
|
---|
| 1096 | for i := 0 to 5 do
|
---|
| 1097 | InsertDatLinkToDB(fileid, $48 + i * 4);
|
---|
| 1098 | for i := 0 to 5 do
|
---|
| 1099 | InsertDatLinkToDB(fileid, $64 + i * 4);
|
---|
| 1100 | InsertDatLinkToDB(fileid, $300);
|
---|
| 1101 | end
|
---|
| 1102 | else
|
---|
| 1103 | begin
|
---|
| 1104 | end;
|
---|
| 1105 | end;
|
---|
| 1106 |
|
---|
| 1107 |
|
---|
| 1108 |
|
---|
| 1109 |
|
---|
| 1110 | procedure ONOA(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1111 | var
|
---|
| 1112 | packages: LongWord;
|
---|
| 1113 | i: LongWord;
|
---|
| 1114 | begin
|
---|
| 1115 | if dir_dat2db then
|
---|
| 1116 | begin
|
---|
| 1117 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
|
---|
| 1118 | if packages > 0 then
|
---|
| 1119 | for i := 0 to packages - 1 do
|
---|
| 1120 | InsertDatLinkToDB(fileid, $20 + i * 8 + $04);
|
---|
| 1121 | end
|
---|
| 1122 | else
|
---|
| 1123 | begin
|
---|
| 1124 | end;
|
---|
| 1125 | end;
|
---|
| 1126 |
|
---|
| 1127 |
|
---|
| 1128 |
|
---|
| 1129 |
|
---|
| 1130 | procedure ONSK(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1131 | begin
|
---|
| 1132 | if dir_dat2db then
|
---|
| 1133 | begin
|
---|
| 1134 | InsertDatLinkToDB(fileid, $08);
|
---|
| 1135 | InsertDatLinkToDB(fileid, $0C);
|
---|
| 1136 | InsertDatLinkToDB(fileid, $10);
|
---|
| 1137 | InsertDatLinkToDB(fileid, $14);
|
---|
| 1138 | InsertDatLinkToDB(fileid, $18);
|
---|
| 1139 | InsertDatLinkToDB(fileid, $20);
|
---|
| 1140 | InsertDatLinkToDB(fileid, $44);
|
---|
| 1141 | end
|
---|
| 1142 | else
|
---|
| 1143 | begin
|
---|
| 1144 | end;
|
---|
| 1145 | end;
|
---|
| 1146 |
|
---|
| 1147 |
|
---|
| 1148 |
|
---|
| 1149 |
|
---|
| 1150 | procedure ONVL(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1151 | var
|
---|
| 1152 | packages: LongWord;
|
---|
| 1153 | i: LongWord;
|
---|
| 1154 | begin
|
---|
| 1155 | if dir_dat2db then
|
---|
| 1156 | begin
|
---|
| 1157 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
|
---|
| 1158 | if packages > 0 then
|
---|
| 1159 | for i := 0 to packages - 1 do
|
---|
| 1160 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 1161 | end
|
---|
| 1162 | else
|
---|
| 1163 | begin
|
---|
| 1164 | end;
|
---|
| 1165 | end;
|
---|
| 1166 |
|
---|
| 1167 |
|
---|
| 1168 |
|
---|
| 1169 |
|
---|
| 1170 | procedure ONWC(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1171 | begin
|
---|
| 1172 | if dir_dat2db then
|
---|
| 1173 | begin
|
---|
| 1174 | InsertDatLinkToDB(fileid, $28);
|
---|
| 1175 | InsertDatLinkToDB(fileid, $34);
|
---|
| 1176 | InsertDatLinkToDB(fileid, $40);
|
---|
| 1177 | InsertDatLinkToDB(fileid, $54);
|
---|
| 1178 | InsertDatLinkToDB(fileid, $58);
|
---|
| 1179 | InsertDatLinkToDB(fileid, $5C);
|
---|
| 1180 | InsertDatLinkToDB(fileid, $60);
|
---|
| 1181 | InsertDatLinkToDB(fileid, $6FC);
|
---|
| 1182 | InsertDatLinkToDB(fileid, $700);
|
---|
| 1183 | end
|
---|
| 1184 | else
|
---|
| 1185 | begin
|
---|
| 1186 | end;
|
---|
| 1187 | end;
|
---|
| 1188 |
|
---|
| 1189 |
|
---|
| 1190 |
|
---|
| 1191 |
|
---|
| 1192 | procedure OPGE(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1193 | begin
|
---|
| 1194 | if dir_dat2db then
|
---|
| 1195 | begin
|
---|
| 1196 | InsertDatLinkToDB(fileid, $0C);
|
---|
| 1197 | end
|
---|
| 1198 | else
|
---|
| 1199 | begin
|
---|
| 1200 | end;
|
---|
| 1201 | end;
|
---|
| 1202 |
|
---|
| 1203 |
|
---|
| 1204 |
|
---|
| 1205 |
|
---|
| 1206 | procedure PSPC(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1207 | begin
|
---|
| 1208 | if dir_dat2db then
|
---|
| 1209 | begin
|
---|
| 1210 | InsertDatLinkToDB(fileid, $50);
|
---|
| 1211 | end
|
---|
| 1212 | else
|
---|
| 1213 | begin
|
---|
| 1214 | end;
|
---|
| 1215 | end;
|
---|
| 1216 |
|
---|
| 1217 |
|
---|
| 1218 |
|
---|
| 1219 |
|
---|
| 1220 | procedure PSPL(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1221 | var
|
---|
| 1222 | packages: LongWord;
|
---|
| 1223 | i: LongWord;
|
---|
| 1224 | begin
|
---|
| 1225 | if dir_dat2db then
|
---|
| 1226 | begin
|
---|
| 1227 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
|
---|
| 1228 | if packages > 0 then
|
---|
| 1229 | for i := 0 to packages - 1 do
|
---|
| 1230 | InsertDatLinkToDB(fileid, $20 + i * 8 + $4);
|
---|
| 1231 | end
|
---|
| 1232 | else
|
---|
| 1233 | begin
|
---|
| 1234 | end;
|
---|
| 1235 | end;
|
---|
| 1236 |
|
---|
| 1237 |
|
---|
| 1238 |
|
---|
| 1239 |
|
---|
| 1240 | procedure PSUI(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1241 | var
|
---|
| 1242 | i: LongWord;
|
---|
| 1243 | begin
|
---|
| 1244 | if dir_dat2db then
|
---|
| 1245 | begin
|
---|
| 1246 | for i := 0 to 43 do
|
---|
| 1247 | InsertDatLinkToDB(fileid, $08 + i * 4);
|
---|
| 1248 | end
|
---|
| 1249 | else
|
---|
| 1250 | begin
|
---|
| 1251 | end;
|
---|
| 1252 | end;
|
---|
| 1253 |
|
---|
| 1254 |
|
---|
| 1255 |
|
---|
| 1256 |
|
---|
| 1257 | procedure STNA(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1258 | var
|
---|
| 1259 | packages: Word;
|
---|
| 1260 | i: LongWord;
|
---|
| 1261 | begin
|
---|
| 1262 | if dir_dat2db then
|
---|
| 1263 | begin
|
---|
| 1264 | OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
|
---|
| 1265 | if packages > 0 then
|
---|
| 1266 | for i := 0 to packages - 1 do
|
---|
| 1267 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 1268 | end
|
---|
| 1269 | else
|
---|
| 1270 | begin
|
---|
| 1271 | end;
|
---|
| 1272 | end;
|
---|
| 1273 |
|
---|
| 1274 |
|
---|
| 1275 |
|
---|
| 1276 |
|
---|
| 1277 | procedure TRAC(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1278 | var
|
---|
| 1279 | packages: Word;
|
---|
| 1280 | i: LongWord;
|
---|
| 1281 | begin
|
---|
| 1282 | if dir_dat2db then
|
---|
| 1283 | begin
|
---|
| 1284 | InsertDatLinkToDB(fileid, $18);
|
---|
| 1285 | OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
|
---|
| 1286 | if packages > 0 then
|
---|
| 1287 | for i := 0 to packages - 1 do
|
---|
| 1288 | InsertDatLinkToDB(fileid, $20 + i * 12 + 8);
|
---|
| 1289 | end
|
---|
| 1290 | else
|
---|
| 1291 | begin
|
---|
| 1292 | end;
|
---|
| 1293 | end;
|
---|
| 1294 |
|
---|
| 1295 |
|
---|
| 1296 |
|
---|
| 1297 |
|
---|
| 1298 | procedure TRAM(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1299 | begin
|
---|
| 1300 | if dir_dat2db then
|
---|
| 1301 | begin
|
---|
| 1302 | InsertDatLinkToDB(fileid, $40);
|
---|
| 1303 | InsertDatLinkToDB(fileid, $44);
|
---|
| 1304 | end
|
---|
| 1305 | else
|
---|
| 1306 | begin
|
---|
| 1307 | end;
|
---|
| 1308 | end;
|
---|
| 1309 |
|
---|
| 1310 |
|
---|
| 1311 |
|
---|
| 1312 |
|
---|
| 1313 | procedure TRAS(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1314 | begin
|
---|
| 1315 | if dir_dat2db then
|
---|
| 1316 | begin
|
---|
| 1317 | InsertDatLinkToDB(fileid, $08);
|
---|
| 1318 | end
|
---|
| 1319 | else
|
---|
| 1320 | begin
|
---|
| 1321 | end;
|
---|
| 1322 | end;
|
---|
| 1323 |
|
---|
| 1324 |
|
---|
| 1325 |
|
---|
| 1326 |
|
---|
| 1327 | procedure TRBS(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1328 | var
|
---|
| 1329 | i: LongWord;
|
---|
| 1330 | begin
|
---|
| 1331 | if dir_dat2db then
|
---|
| 1332 | begin
|
---|
| 1333 | for i := 0 to 4 do
|
---|
| 1334 | InsertDatLinkToDB(fileid, $08 + i * 4);
|
---|
| 1335 | end
|
---|
| 1336 | else
|
---|
| 1337 | begin
|
---|
| 1338 | end;
|
---|
| 1339 | end;
|
---|
| 1340 |
|
---|
| 1341 |
|
---|
| 1342 |
|
---|
| 1343 |
|
---|
| 1344 | procedure TRCM(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1345 | var
|
---|
| 1346 | i: LongWord;
|
---|
| 1347 | begin
|
---|
| 1348 | if dir_dat2db then
|
---|
| 1349 | begin
|
---|
| 1350 | for i := 0 to 2 do
|
---|
| 1351 | InsertDatLinkToDB(fileid, $5C + i * 4);
|
---|
| 1352 | end
|
---|
| 1353 | else
|
---|
| 1354 | begin
|
---|
| 1355 | end;
|
---|
| 1356 | end;
|
---|
| 1357 |
|
---|
| 1358 |
|
---|
| 1359 |
|
---|
| 1360 |
|
---|
| 1361 | procedure TRGA(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1362 | var
|
---|
| 1363 | i: LongWord;
|
---|
| 1364 | packages: Word;
|
---|
| 1365 | begin
|
---|
| 1366 | if dir_dat2db then
|
---|
| 1367 | begin
|
---|
| 1368 | OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
|
---|
| 1369 | if packages > 0 then
|
---|
| 1370 | for i := 0 to packages - 1 do
|
---|
| 1371 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 1372 | end
|
---|
| 1373 | else
|
---|
| 1374 | begin
|
---|
| 1375 | end;
|
---|
| 1376 | end;
|
---|
| 1377 |
|
---|
| 1378 |
|
---|
| 1379 |
|
---|
| 1380 |
|
---|
| 1381 | procedure TRGE(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1382 | begin
|
---|
| 1383 | if dir_dat2db then
|
---|
| 1384 | begin
|
---|
| 1385 | InsertDatLinkToDB(fileid, $20);
|
---|
| 1386 | end
|
---|
| 1387 | else
|
---|
| 1388 | begin
|
---|
| 1389 | end;
|
---|
| 1390 | end;
|
---|
| 1391 |
|
---|
| 1392 |
|
---|
| 1393 |
|
---|
| 1394 |
|
---|
| 1395 | procedure TRIG(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1396 | begin
|
---|
| 1397 | if dir_dat2db then
|
---|
| 1398 | begin
|
---|
| 1399 | InsertDatLinkToDB(fileid, $18);
|
---|
| 1400 | InsertDatLinkToDB(fileid, $24);
|
---|
| 1401 | InsertDatLinkToDB(fileid, $28);
|
---|
| 1402 | end
|
---|
| 1403 | else
|
---|
| 1404 | begin
|
---|
| 1405 | end;
|
---|
| 1406 | end;
|
---|
| 1407 |
|
---|
| 1408 |
|
---|
| 1409 |
|
---|
| 1410 |
|
---|
| 1411 | procedure TRMA(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1412 | var
|
---|
| 1413 | i: LongWord;
|
---|
| 1414 | packages: Word;
|
---|
| 1415 | begin
|
---|
| 1416 | if dir_dat2db then
|
---|
| 1417 | begin
|
---|
| 1418 | OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
|
---|
| 1419 | if packages > 0 then
|
---|
| 1420 | for i := 0 to packages - 1 do
|
---|
| 1421 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 1422 | end
|
---|
| 1423 | else
|
---|
| 1424 | begin
|
---|
| 1425 | end;
|
---|
| 1426 | end;
|
---|
| 1427 |
|
---|
| 1428 |
|
---|
| 1429 |
|
---|
| 1430 |
|
---|
| 1431 | procedure TRSC(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1432 | var
|
---|
| 1433 | i: LongWord;
|
---|
| 1434 | packages: Word;
|
---|
| 1435 | begin
|
---|
| 1436 | if dir_dat2db then
|
---|
| 1437 | begin
|
---|
| 1438 | OniDataConnection.LoadDatFilePart(fileid, $1E, 2, @packages);
|
---|
| 1439 | if packages > 0 then
|
---|
| 1440 | for i := 0 to packages - 1 do
|
---|
| 1441 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 1442 | end
|
---|
| 1443 | else
|
---|
| 1444 | begin
|
---|
| 1445 | end;
|
---|
| 1446 | end;
|
---|
| 1447 |
|
---|
| 1448 |
|
---|
| 1449 |
|
---|
| 1450 |
|
---|
| 1451 | procedure TSFF(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1452 | var
|
---|
| 1453 | i: LongWord;
|
---|
| 1454 | packages: LongWord;
|
---|
| 1455 | begin
|
---|
| 1456 | if dir_dat2db then
|
---|
| 1457 | begin
|
---|
| 1458 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
|
---|
| 1459 | if packages > 0 then
|
---|
| 1460 | for i := 0 to packages - 1 do
|
---|
| 1461 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 1462 | end
|
---|
| 1463 | else
|
---|
| 1464 | begin
|
---|
| 1465 | end;
|
---|
| 1466 | end;
|
---|
| 1467 |
|
---|
| 1468 |
|
---|
| 1469 |
|
---|
| 1470 |
|
---|
| 1471 | procedure TSFT(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1472 | begin
|
---|
| 1473 | if dir_dat2db then
|
---|
| 1474 | begin
|
---|
| 1475 | InsertDatLinkToDB(fileid, $1C);
|
---|
| 1476 | end
|
---|
| 1477 | else
|
---|
| 1478 | begin
|
---|
| 1479 | end;
|
---|
| 1480 | end;
|
---|
| 1481 |
|
---|
| 1482 |
|
---|
| 1483 |
|
---|
| 1484 |
|
---|
| 1485 | procedure TURR(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1486 | begin
|
---|
| 1487 | if dir_dat2db then
|
---|
| 1488 | begin
|
---|
| 1489 | InsertDatLinkToDB(fileid, $60);
|
---|
| 1490 | InsertDatLinkToDB(fileid, $6C);
|
---|
| 1491 | InsertDatLinkToDB(fileid, $74);
|
---|
| 1492 | end
|
---|
| 1493 | else
|
---|
| 1494 | begin
|
---|
| 1495 | end;
|
---|
| 1496 | end;
|
---|
| 1497 |
|
---|
| 1498 |
|
---|
| 1499 |
|
---|
| 1500 |
|
---|
| 1501 | procedure TXAN(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1502 | var
|
---|
| 1503 | i: LongWord;
|
---|
| 1504 | packages: LongWord;
|
---|
| 1505 | begin
|
---|
| 1506 | if dir_dat2db then
|
---|
| 1507 | begin
|
---|
| 1508 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
|
---|
| 1509 | if packages > 0 then
|
---|
| 1510 | for i := 0 to packages - 1 do
|
---|
| 1511 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 1512 | end
|
---|
| 1513 | else
|
---|
| 1514 | begin
|
---|
| 1515 | end;
|
---|
| 1516 | end;
|
---|
| 1517 |
|
---|
| 1518 |
|
---|
| 1519 |
|
---|
| 1520 |
|
---|
| 1521 | procedure TXMA(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1522 | var
|
---|
| 1523 | i: LongWord;
|
---|
| 1524 | packages: LongWord;
|
---|
| 1525 | begin
|
---|
| 1526 | if dir_dat2db then
|
---|
| 1527 | begin
|
---|
| 1528 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
|
---|
| 1529 | if packages > 0 then
|
---|
| 1530 | for i := 0 to packages - 1 do
|
---|
| 1531 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 1532 | end
|
---|
| 1533 | else
|
---|
| 1534 | begin
|
---|
| 1535 | end;
|
---|
| 1536 | end;
|
---|
| 1537 |
|
---|
| 1538 |
|
---|
| 1539 |
|
---|
| 1540 |
|
---|
| 1541 | procedure TXMB(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1542 | var
|
---|
| 1543 | i: LongWord;
|
---|
| 1544 | packages: LongWord;
|
---|
| 1545 | begin
|
---|
| 1546 | if dir_dat2db then
|
---|
| 1547 | begin
|
---|
| 1548 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
|
---|
| 1549 | if packages > 0 then
|
---|
| 1550 | for i := 0 to packages - 1 do
|
---|
| 1551 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 1552 | end
|
---|
| 1553 | else
|
---|
| 1554 | begin
|
---|
| 1555 | end;
|
---|
| 1556 | end;
|
---|
| 1557 |
|
---|
| 1558 |
|
---|
| 1559 |
|
---|
| 1560 |
|
---|
| 1561 | procedure TXMP(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1562 | begin
|
---|
| 1563 | if dir_dat2db then
|
---|
| 1564 | begin
|
---|
| 1565 | InsertDatLinkToDB(fileid, $94);
|
---|
| 1566 | InsertDatLinkToDB(fileid, $98);
|
---|
| 1567 | end
|
---|
| 1568 | else
|
---|
| 1569 | begin
|
---|
| 1570 | end;
|
---|
| 1571 | end;
|
---|
| 1572 |
|
---|
| 1573 |
|
---|
| 1574 |
|
---|
| 1575 |
|
---|
| 1576 | procedure TXTC(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1577 | begin
|
---|
| 1578 | if dir_dat2db then
|
---|
| 1579 | begin
|
---|
| 1580 | InsertDatLinkToDB(fileid, $08);
|
---|
| 1581 | end
|
---|
| 1582 | else
|
---|
| 1583 | begin
|
---|
| 1584 | end;
|
---|
| 1585 | end;
|
---|
| 1586 |
|
---|
| 1587 |
|
---|
| 1588 |
|
---|
| 1589 |
|
---|
| 1590 | procedure WMCL(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1591 | var
|
---|
| 1592 | i: LongWord;
|
---|
| 1593 | packages: LongWord;
|
---|
| 1594 | begin
|
---|
| 1595 | if dir_dat2db then
|
---|
| 1596 | begin
|
---|
| 1597 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
|
---|
| 1598 | if packages > 0 then
|
---|
| 1599 | for i := 0 to packages - 1 do
|
---|
| 1600 | InsertDatLinkToDB(fileid, $20 + i * 8 + $4);
|
---|
| 1601 | end
|
---|
| 1602 | else
|
---|
| 1603 | begin
|
---|
| 1604 | end;
|
---|
| 1605 | end;
|
---|
| 1606 |
|
---|
| 1607 |
|
---|
| 1608 |
|
---|
| 1609 |
|
---|
| 1610 | procedure WMDD(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1611 | var
|
---|
| 1612 | i: LongWord;
|
---|
| 1613 | packages: LongWord;
|
---|
| 1614 | begin
|
---|
| 1615 | if dir_dat2db then
|
---|
| 1616 | begin
|
---|
| 1617 | OniDataConnection.LoadDatFilePart(fileid, $11C, 4, @packages);
|
---|
| 1618 | if packages > 0 then
|
---|
| 1619 | for i := 0 to packages - 1 do
|
---|
| 1620 | InsertDatLinkToDB(fileid, $120 + i * $124 + $114);
|
---|
| 1621 | end
|
---|
| 1622 | else
|
---|
| 1623 | begin
|
---|
| 1624 | end;
|
---|
| 1625 | end;
|
---|
| 1626 |
|
---|
| 1627 |
|
---|
| 1628 |
|
---|
| 1629 |
|
---|
| 1630 | procedure WMMB(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1631 | var
|
---|
| 1632 | i: LongWord;
|
---|
| 1633 | packages: LongWord;
|
---|
| 1634 | begin
|
---|
| 1635 | if dir_dat2db then
|
---|
| 1636 | begin
|
---|
| 1637 | OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @packages);
|
---|
| 1638 | if packages > 0 then
|
---|
| 1639 | for i := 0 to packages - 1 do
|
---|
| 1640 | InsertDatLinkToDB(fileid, $20 + i * 4);
|
---|
| 1641 | end
|
---|
| 1642 | else
|
---|
| 1643 | begin
|
---|
| 1644 | end;
|
---|
| 1645 | end;
|
---|
| 1646 |
|
---|
| 1647 |
|
---|
| 1648 |
|
---|
| 1649 |
|
---|
| 1650 | procedure WPGE(fileid: LongWord; dir_dat2db: Boolean);
|
---|
| 1651 | begin
|
---|
| 1652 | if dir_dat2db then
|
---|
| 1653 | begin
|
---|
| 1654 | InsertDatLinkToDB(fileid, $08);
|
---|
| 1655 | InsertDatLinkToDB(fileid, $0C);
|
---|
| 1656 | end
|
---|
| 1657 | else
|
---|
| 1658 | begin
|
---|
| 1659 | end;
|
---|
| 1660 | end;
|
---|
| 1661 |
|
---|
| 1662 |
|
---|
| 1663 |
|
---|
| 1664 |
|
---|
| 1665 | procedure InsertHandler(ext: String; needed: Boolean; handler: THandler);
|
---|
| 1666 | begin
|
---|
| 1667 | SetLength(ConvertHandlers, Length(ConvertHandlers) + 1);
|
---|
| 1668 | ConvertHandlers[High(ConvertHandlers)].Ext := ext;
|
---|
| 1669 | ConvertHandlers[High(ConvertHandlers)].needed := needed;
|
---|
| 1670 | ConvertHandlers[High(ConvertHandlers)].handler := handler;
|
---|
| 1671 | end;
|
---|
| 1672 |
|
---|
| 1673 | begin
|
---|
| 1674 | InsertHandler('ABNA', False, nil);
|
---|
| 1675 | // InsertHandler('AGDB',True,AGDB);
|
---|
| 1676 | InsertHandler('AGDB', False, nil);
|
---|
| 1677 | InsertHandler('AGQC', False, nil);
|
---|
| 1678 | InsertHandler('AGQG', False, nil);
|
---|
| 1679 | InsertHandler('AGQR', False, nil);
|
---|
| 1680 | InsertHandler('AISA', True, AISA);
|
---|
| 1681 | InsertHandler('AITR', False, nil);
|
---|
| 1682 | InsertHandler('AKAA', False, nil);
|
---|
| 1683 | InsertHandler('AKBA', False, nil);
|
---|
| 1684 | InsertHandler('AKBP', False, nil);
|
---|
| 1685 | InsertHandler('AKDA', False, nil);
|
---|
| 1686 | InsertHandler('AKEV', True, AKEV);
|
---|
| 1687 | InsertHandler('AKOT', True, AKOT);
|
---|
| 1688 | InsertHandler('AKVA', False, nil);
|
---|
| 1689 | InsertHandler('BINA', False, nil);
|
---|
| 1690 | InsertHandler('CBPI', True, CBPI);
|
---|
| 1691 | InsertHandler('CBPM', True, CBPM);
|
---|
| 1692 | InsertHandler('CONS', True, CONS);
|
---|
| 1693 | InsertHandler('CRSA', True, CRSA);
|
---|
| 1694 | InsertHandler('DOOR', True, DOOR);
|
---|
| 1695 | InsertHandler('DPGE', True, DPGE);
|
---|
| 1696 | InsertHandler('ENVP', False, nil);
|
---|
| 1697 | InsertHandler('FILM', False, nil);
|
---|
| 1698 | InsertHandler('HPGE', True, HPGE);
|
---|
| 1699 | InsertHandler('IDXA', False, nil);
|
---|
| 1700 | InsertHandler('IGHH', True, IGHH);
|
---|
| 1701 | InsertHandler('IGPA', True, IGPA);
|
---|
| 1702 | InsertHandler('IGPG', True, IGPG);
|
---|
| 1703 | InsertHandler('IGSA', True, IGSA);
|
---|
| 1704 | InsertHandler('IMPT', True, IMPT);
|
---|
| 1705 | InsertHandler('IPGE', True, IPGE);
|
---|
| 1706 | InsertHandler('KEYI', True, KEYI);
|
---|
| 1707 | InsertHandler('M3GA', True, M3GA);
|
---|
| 1708 | InsertHandler('M3GM', True, M3GM);
|
---|
| 1709 | InsertHandler('MTRL', True, MTRL);
|
---|
| 1710 | InsertHandler('OBAN', False, nil);
|
---|
| 1711 | InsertHandler('OBDC', True, OBDC);
|
---|
| 1712 | InsertHandler('OBOA', True, OBOA);
|
---|
| 1713 | InsertHandler('OFGA', True, OFGA);
|
---|
| 1714 | InsertHandler('ONCC', True, ONCC);
|
---|
| 1715 | InsertHandler('ONCP', False, nil);
|
---|
| 1716 | InsertHandler('ONCV', True, ONCV);
|
---|
| 1717 | InsertHandler('ONFA', False, nil);
|
---|
| 1718 | InsertHandler('ONGS', False, nil);
|
---|
| 1719 | InsertHandler('ONIA', False, nil);
|
---|
| 1720 | InsertHandler('ONLD', False, nil);
|
---|
| 1721 | InsertHandler('ONLV', True, ONLV);
|
---|
| 1722 | InsertHandler('ONMA', False, nil);
|
---|
| 1723 | InsertHandler('ONOA', True, ONOA);
|
---|
| 1724 | InsertHandler('ONSA', False, nil);
|
---|
| 1725 | InsertHandler('ONSK', True, ONSK);
|
---|
| 1726 | InsertHandler('ONTA', False, nil);
|
---|
| 1727 | InsertHandler('ONVL', True, ONVL);
|
---|
| 1728 | InsertHandler('ONWC', True, ONWC);
|
---|
| 1729 | InsertHandler('OPGE', True, OPGE);
|
---|
| 1730 | InsertHandler('OSBD', False, nil);
|
---|
| 1731 | InsertHandler('OTIT', False, nil);
|
---|
| 1732 | InsertHandler('OTLF', False, nil);
|
---|
| 1733 | InsertHandler('PLEA', False, nil);
|
---|
| 1734 | InsertHandler('PNTA', False, nil);
|
---|
| 1735 | InsertHandler('PSPC', True, PSPC);
|
---|
| 1736 | InsertHandler('PSPL', True, PSPL);
|
---|
| 1737 | InsertHandler('PSUI', True, PSUI);
|
---|
| 1738 | InsertHandler('QTNA', False, nil);
|
---|
| 1739 | InsertHandler('SNDD', False, nil);
|
---|
| 1740 | InsertHandler('STNA', True, STNA);
|
---|
| 1741 | InsertHandler('SUBT', False, nil);
|
---|
| 1742 | InsertHandler('TRAC', True, TRAC);
|
---|
| 1743 | InsertHandler('TRAM', True, TRAM);
|
---|
| 1744 | InsertHandler('TRAS', True, TRAS);
|
---|
| 1745 | InsertHandler('TRBS', True, TRBS);
|
---|
| 1746 | InsertHandler('TRCM', True, TRCM);
|
---|
| 1747 | InsertHandler('TRGA', True, TRGA);
|
---|
| 1748 | InsertHandler('TRGE', True, TRGE);
|
---|
| 1749 | InsertHandler('TRIA', False, nil);
|
---|
| 1750 | InsertHandler('TRIG', True, TRIG);
|
---|
| 1751 | InsertHandler('TRMA', True, TRMA);
|
---|
| 1752 | InsertHandler('TRSC', True, TRSC);
|
---|
| 1753 | InsertHandler('TRTA', False, nil);
|
---|
| 1754 | InsertHandler('TSFF', True, TSFF);
|
---|
| 1755 | InsertHandler('TSFL', False, nil);
|
---|
| 1756 | InsertHandler('TSFT', True, TSFT);
|
---|
| 1757 | InsertHandler('TSGA', False, nil);
|
---|
| 1758 | InsertHandler('TSTR', False, nil);
|
---|
| 1759 | InsertHandler('TURR', True, TURR);
|
---|
| 1760 | InsertHandler('TXAN', True, TXAN);
|
---|
| 1761 | InsertHandler('TXCA', False, nil);
|
---|
| 1762 | InsertHandler('TXMA', True, TXMA);
|
---|
| 1763 | InsertHandler('TXMB', True, TXMB);
|
---|
| 1764 | InsertHandler('TXMP', True, TXMP);
|
---|
| 1765 | InsertHandler('TXTC', True, TXTC);
|
---|
| 1766 | InsertHandler('VCRA', False, nil);
|
---|
| 1767 | InsertHandler('WMCL', True, WMCL);
|
---|
| 1768 | InsertHandler('WMDD', True, WMDD);
|
---|
| 1769 | InsertHandler('WMM_', False, nil);
|
---|
| 1770 | InsertHandler('WMMB', True, WMMB);
|
---|
| 1771 | InsertHandler('WPGE', True, WPGE);
|
---|
| 1772 | end.
|
---|