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