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