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