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