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