1 | UNIT Unit10_leveldb;
|
---|
2 | INTERFACE
|
---|
3 | USES
|
---|
4 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
---|
5 | Dialogs, ComCtrls, StdCtrls, StrUtils;
|
---|
6 |
|
---|
7 | TYPE
|
---|
8 | TForm10 = 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:LongWord; dir_dat2db:Boolean);
|
---|
17 | PROCEDURE stop_convert;
|
---|
18 | PUBLIC
|
---|
19 | PROCEDURE CreateDatabase(source,target:String);
|
---|
20 | PROCEDURE CreateLevel(source,target:String);
|
---|
21 | END;
|
---|
22 |
|
---|
23 |
|
---|
24 | VAR
|
---|
25 | Form10: TForm10;
|
---|
26 |
|
---|
27 | IMPLEMENTATION
|
---|
28 | {$R *.dfm}
|
---|
29 | USES ABSMain, ABSDecUtil, Unit1_main, Unit2_functions, Unit3_data, Unit6_imgfuncs, Unit9_data_structures, Unit15_Classes;
|
---|
30 |
|
---|
31 | TYPE
|
---|
32 | THandler=PROCEDURE(fileid:LongWord; dir_dat2db:Boolean);
|
---|
33 | TConvertHandlers=RECORD
|
---|
34 | Ext:String[4];
|
---|
35 | needed:Boolean;
|
---|
36 | Handler:THandler;
|
---|
37 | END;
|
---|
38 | VAR
|
---|
39 | ConvertHandlers:Array OF TConvertHandlers;
|
---|
40 | loaded_filename:String;
|
---|
41 | converting:Boolean=False;
|
---|
42 | abort:Boolean=False;
|
---|
43 | DataBase:TABSDatabase;
|
---|
44 | Query:TABSQuery;
|
---|
45 | MimeCoder: TStringFormat_MIME64;
|
---|
46 | VAR
|
---|
47 | DatHeader:THeader;
|
---|
48 | FilesHeader:TFilesMap;
|
---|
49 | NamedFilesHeader:TNamedFilesMap;
|
---|
50 | ExtensionsHeader:TExtensionsMap;
|
---|
51 | Stream_Body,Stream_Names:TMemoryStream;
|
---|
52 | Stream_Dat,Stream_Raw,Stream_Sep:TFileStream;
|
---|
53 |
|
---|
54 | PROCEDURE TForm10.CreateLevel(source,target:String);
|
---|
55 | VAR
|
---|
56 | files:LongWord;
|
---|
57 |
|
---|
58 | i,j:LongWord;
|
---|
59 | temps,temps2:String;
|
---|
60 | data,rawdata:Tdata;
|
---|
61 | absolutebegintime,begintime:Double;
|
---|
62 | step:Byte;
|
---|
63 | rawlist:TRawList;
|
---|
64 | extlist:TExtensionsMap;
|
---|
65 | fileinfo:TFileInfo;
|
---|
66 | datlinks:TDatLinks;
|
---|
67 | OniImage:TOniImage;
|
---|
68 | levelid:LongWord;
|
---|
69 | CONST
|
---|
70 | steps:Byte=3;
|
---|
71 | PROCEDURE DoStep(stepname:String);
|
---|
72 | BEGIN
|
---|
73 | Inc(step);
|
---|
74 | IF stepname<>'FIN' THEN
|
---|
75 | group_progress.Caption:='Creating Dat (Step '+IntToStr(step)+'/'+IntToStr(steps)+': '+stepname+')'
|
---|
76 | ELSE
|
---|
77 | group_progress.Caption:='Creating Dat (FINISHED)';
|
---|
78 | END;
|
---|
79 | BEGIN
|
---|
80 |
|
---|
81 | //
|
---|
82 | // FILE EXISTS CHECK FÜR DAT/RAW/SEP!!!
|
---|
83 | //
|
---|
84 |
|
---|
85 | IF NOT CreateDataConnection(source,ODB_ADB) THEN BEGIN
|
---|
86 | ShowMessage('Could not connect to .oldb-file');
|
---|
87 | Exit;
|
---|
88 | END;
|
---|
89 | levelid:=OniDataConnection.LevelInfo.LevelNumber;
|
---|
90 | levelid:=(levelid*2) SHR (3*8) + $01;
|
---|
91 | OniImage:=TOniImage.Create;
|
---|
92 |
|
---|
93 | absolutebegintime:=Time;
|
---|
94 |
|
---|
95 | Form10.Visible:=True;
|
---|
96 | Form1.Visible:=False;
|
---|
97 | step:=0;
|
---|
98 | converting:=True;
|
---|
99 | abort:=False;
|
---|
100 | btn_abortok.Caption:='&Abort...';
|
---|
101 | btn_abortok.Default:=False;
|
---|
102 | absolutebegintime:=Time;
|
---|
103 |
|
---|
104 | Stream_Body:=TMemoryStream.Create;
|
---|
105 | Stream_Names:=TMemoryStream.Create;
|
---|
106 | Stream_Dat:=TFileStream.Create(target,fmCreate);
|
---|
107 | Stream_Raw:=TFileStream.Create(AnsiReplaceStr(target,'.dat','.raw'),fmCreate);
|
---|
108 | IF OniDataConnection.OSisMac THEN
|
---|
109 | Stream_Sep:=TFileStream.Create(AnsiReplaceStr(target,'.dat','.sep'),fmCreate);
|
---|
110 |
|
---|
111 | DoStep('Creating header');
|
---|
112 | progress.Position:=0;
|
---|
113 | lbl_progress.Caption:='';
|
---|
114 | lbl_estimation.Caption:='Estimated finishing time: unknown';
|
---|
115 | Application.ProcessMessages;
|
---|
116 |
|
---|
117 | NamedFilesHeader:=TOniDataADB(OniDataConnection).GetNamedFilesMap;
|
---|
118 | extlist:=OniDataConnection.GetExtendedExtensionsList;
|
---|
119 | FOR i:=0 TO High(DatHeader.Ident) DO
|
---|
120 | DatHeader.Ident[i]:=OniDataConnection.LevelInfo.Ident[i];
|
---|
121 | DatHeader.Files:=OniDataConnection.GetFilesCount;
|
---|
122 | DatHeader.NamedFiles:=Length(NamedFilesHeader);
|
---|
123 | DatHeader.Extensions:=Length(extlist);
|
---|
124 | DatHeader.DataAddr:=0;
|
---|
125 | DatHeader.DataSize:=0;
|
---|
126 | DatHeader.NamesAddr:=0;
|
---|
127 | DatHeader.NamesSize:=0;
|
---|
128 | FOR i:=0 TO High(DatHeader.Ident2) DO
|
---|
129 | DatHeader.Ident2[i]:=0;
|
---|
130 | SetLength(FilesHeader, DatHeader.Files);
|
---|
131 | SetLength(ExtensionsHeader, DatHeader.Extensions);
|
---|
132 |
|
---|
133 | DoStep('Writing extensions-header');
|
---|
134 | progress.Max:=Length(OniDataConnection.GetExtensionsList);
|
---|
135 | Application.ProcessMessages;
|
---|
136 |
|
---|
137 | FOR i:=0 TO High(ExtensionsHeader) DO BEGIN
|
---|
138 | ExtensionsHeader[i].Ident:=extlist[i].Ident;
|
---|
139 | ExtensionsHeader[i].Extension:=extlist[i].Extension;
|
---|
140 | SetLength(temps,4);
|
---|
141 | FOR j:=0 TO 3 DO
|
---|
142 | temps[j+1]:=ExtensionsHeader[i].Extension[3-j];
|
---|
143 | ExtensionsHeader[i].ExtCount:=Length(OniDataConnection.GetFilesList(temps,'',False));
|
---|
144 | progress.Position:=i+1;
|
---|
145 | lbl_progress.Caption:='Extensions done: '+IntToStr(i+1)+'/'+IntToStr(Length(extlist));
|
---|
146 | Application.ProcessMessages;
|
---|
147 | END;
|
---|
148 |
|
---|
149 | DoStep('Storing files-data');
|
---|
150 | progress.Position:=0;
|
---|
151 | progress.Max:=DatHeader.Files;
|
---|
152 | lbl_progress.Caption:='';
|
---|
153 | lbl_estimation.Caption:='Estimated finishing time: unknown';
|
---|
154 | Application.ProcessMessages;
|
---|
155 |
|
---|
156 | begintime:=Time;
|
---|
157 | FOR i:=0 TO DatHeader.Files-1 DO BEGIN
|
---|
158 | fileinfo:=OniDataConnection.GetFileInfo(i);
|
---|
159 | FOR j:=0 TO 3 DO
|
---|
160 | FilesHeader[i].Extension[j]:=fileinfo.Extension[4-j];
|
---|
161 | IF fileinfo.Size>0 THEN BEGIN
|
---|
162 | // DatLinks:=;
|
---|
163 | FilesHeader[i].DataAddr:=Stream_Body.Size+8;
|
---|
164 | data:=OniDataConnection.LoadDatFile(i);
|
---|
165 |
|
---|
166 |
|
---|
167 | IF (Pos(UpperCase(fileinfo.Extension),UpperCase(raws)) MOD 4)=1 THEN BEGIN
|
---|
168 | rawlist:=OniDataConnection.GetRawList(i);
|
---|
169 | IF Length(rawlist)>0 THEN BEGIN
|
---|
170 | FOR j:=0 TO High(rawlist) DO BEGIN
|
---|
171 | IF rawlist[j].raw_size>0 THEN BEGIN
|
---|
172 | IF (UpperCase(fileinfo.Extension)='TXMP') AND ((data[$88] AND $01)>0) THEN BEGIN
|
---|
173 | OniImage.LoadFromTXMP(i);
|
---|
174 | OniImage.GetMipMappedImage(rawdata);
|
---|
175 | rawlist[j].raw_size:=OniImage.GetImageDataSize(true);
|
---|
176 | data[$90]:=08;
|
---|
177 | END ELSE BEGIN
|
---|
178 | SetLength(rawdata,rawlist[j].raw_size);
|
---|
179 | OniDataConnection.LoadRawFile(i,rawlist[j].src_offset,@rawdata[0]);
|
---|
180 | END;
|
---|
181 |
|
---|
182 | IF rawlist[j].loc_sep THEN BEGIN
|
---|
183 | rawlist[j].raw_addr:=Stream_Sep.Size;
|
---|
184 | Stream_Sep.Write(rawdata[0],Length(rawdata));
|
---|
185 | END ELSE BEGIN
|
---|
186 | rawlist[j].raw_addr:=Stream_Raw.Size;
|
---|
187 | Stream_Raw.Write(rawdata[0],Length(rawdata));
|
---|
188 | END;
|
---|
189 | END ELSE rawlist[j].raw_addr:=0;
|
---|
190 | data[rawlist[j].src_offset+0]:=(rawlist[j].raw_addr ) AND $FF;
|
---|
191 | data[rawlist[j].src_offset+1]:=(rawlist[j].raw_addr SHR 8) AND $FF;
|
---|
192 | data[rawlist[j].src_offset+2]:=(rawlist[j].raw_addr SHR 16) AND $FF;
|
---|
193 | data[rawlist[j].src_offset+3]:=(rawlist[j].raw_addr SHR 24) AND $FF;
|
---|
194 | END;
|
---|
195 | END;
|
---|
196 | END;
|
---|
197 |
|
---|
198 | Stream_Body.Write(data[0],Length(data));
|
---|
199 | //
|
---|
200 | END ELSE
|
---|
201 | FilesHeader[i].DataAddr:=0;
|
---|
202 | IF Length(fileinfo.Name)>0 THEN BEGIN
|
---|
203 | FilesHeader[i].NameAddr:=Stream_Names.Size;
|
---|
204 | temps:=fileinfo.Extension+fileinfo.Name+Chr(0);
|
---|
205 | Stream_Names.Write(temps[1],Length(temps));
|
---|
206 | END ELSE
|
---|
207 | FilesHeader[i].NameAddr:=0;
|
---|
208 | FilesHeader[i].FileSize:=fileinfo.Size;
|
---|
209 | FilesHeader[i].FileType:=fileinfo.FileType;
|
---|
210 |
|
---|
211 | IF ( (i MOD 25)=0 ) AND (i>=100) THEN
|
---|
212 | lbl_estimation.Caption:='Estimated finishing time: '+TimeToStr((Time-begintime)/i*progress.Max+begintime);
|
---|
213 | progress.Position:=i+1;
|
---|
214 | lbl_progress.Caption:='Files done: '+IntToStr(i+1)+'/'+IntToStr(progress.Max);
|
---|
215 | Application.ProcessMessages;
|
---|
216 | END;
|
---|
217 |
|
---|
218 | Stream_Dat.Write(DatHeader,SizeOf(DatHeader));
|
---|
219 | FOR i:=0 TO High(FilesHeader) DO
|
---|
220 | Stream_Dat.Write(FilesHeader[i],SizeOf(FilesHeader[i]));
|
---|
221 | FOR i:=0 TO High(NamedFilesHeader) DO
|
---|
222 | Stream_Dat.Write(NamedFilesHeader[i],SizeOf(NamedFilesHeader[i]));
|
---|
223 | FOR i:=0 TO High(ExtensionsHeader) DO
|
---|
224 | Stream_Dat.Write(ExtensionsHeader[i],SizeOf(ExtensionsHeader[i]));
|
---|
225 |
|
---|
226 | DatHeader.DataSize:=Stream_Body.Size;
|
---|
227 | DatHeader.NamesSize:=Stream_Names.Size;
|
---|
228 | DatHeader.DataAddr:=Stream_Dat.Size;
|
---|
229 | Stream_Body.Seek(0,soFromBeginning);
|
---|
230 | Stream_Dat.CopyFrom(Stream_Body,Stream_Body.Size);
|
---|
231 | DatHeader.NamesAddr:=Stream_Dat.Size;
|
---|
232 | Stream_Names.Seek(0,soFromBeginning);
|
---|
233 | Stream_Dat.CopyFrom(Stream_Names,Stream_Names.Size);
|
---|
234 |
|
---|
235 | Stream_Dat.Seek(0,soFromBeginning);
|
---|
236 | Stream_Dat.Write(DatHeader,SizeOf(DatHeader));
|
---|
237 |
|
---|
238 | Stream_Dat.Free;
|
---|
239 | Stream_Body.Free;
|
---|
240 | Stream_Names.Free;
|
---|
241 | Stream_Raw.Free;
|
---|
242 | IF OniDataConnection.OSisMac THEN
|
---|
243 | Stream_Sep.Free;
|
---|
244 |
|
---|
245 | progress.Position:=progress.Max;
|
---|
246 | lbl_progress.Caption:='Files done: '+IntToStr(progress.Max)+'/'+IntToStr(progress.Max);
|
---|
247 | lbl_estimation.Caption:='FINISHED (duration: '+TimeToStr(Time-absolutebegintime)+')';
|
---|
248 |
|
---|
249 | DoStep('FIN');
|
---|
250 | btn_abortok.Caption:='&OK';
|
---|
251 | btn_abortok.Default:=True;
|
---|
252 |
|
---|
253 | OniImage.Free;
|
---|
254 |
|
---|
255 | converting:=False;
|
---|
256 |
|
---|
257 | CloseDataConnection;
|
---|
258 | END;
|
---|
259 |
|
---|
260 | PROCEDURE TForm10.HandleFile;
|
---|
261 | VAR
|
---|
262 | i:Byte;
|
---|
263 | BEGIN
|
---|
264 | FOR i:=1 TO Length(ConvertHandlers) DO
|
---|
265 | IF UpperCase(ConvertHandlers[i].Ext)=UpperCase(ext) THEN
|
---|
266 | IF ConvertHandlers[i].needed THEN BEGIN
|
---|
267 | ConvertHandlers[i].Handler(fileid, dir_dat2db);
|
---|
268 | Break;
|
---|
269 | END ELSE
|
---|
270 | Break;
|
---|
271 | END;
|
---|
272 |
|
---|
273 | PROCEDURE TForm10.CreateDatabase(source,target:String);
|
---|
274 | VAR
|
---|
275 | i,j:LongWord;
|
---|
276 | temps,temps2:String;
|
---|
277 | data:Tdata;
|
---|
278 | absolutebegintime,begintime:Double;
|
---|
279 | step:Byte;
|
---|
280 | rawlist:TRawList;
|
---|
281 | extlist:TExtensionsMap;
|
---|
282 | fileinfo:TFileInfo;
|
---|
283 | CONST
|
---|
284 | steps:Byte=4;
|
---|
285 | PROCEDURE DoStep(stepname:String);
|
---|
286 | BEGIN
|
---|
287 | Inc(step);
|
---|
288 | IF stepname<>'FIN' THEN
|
---|
289 | group_progress.Caption:='Creating DB (Step '+IntToStr(step)+'/'+IntToStr(steps)+': '+stepname+')'
|
---|
290 | ELSE
|
---|
291 | group_progress.Caption:='Creating DB (FINISHED)';
|
---|
292 | END;
|
---|
293 | BEGIN
|
---|
294 | IF NOT CreateDataConnection(source,ODB_Dat) THEN BEGIN
|
---|
295 | ShowMessage('Could not connect to .dat-file');
|
---|
296 | Exit;
|
---|
297 | END ELSE BEGIN
|
---|
298 | TOniDataDat(OniDataConnection).UnloadWhenUnused:=False;
|
---|
299 | END;
|
---|
300 |
|
---|
301 | Form10.Visible:=True;
|
---|
302 | Form1.Visible:=False;
|
---|
303 | step:=0;
|
---|
304 | converting:=True;
|
---|
305 | abort:=False;
|
---|
306 | btn_abortok.Caption:='&Abort...';
|
---|
307 | btn_abortok.Default:=False;
|
---|
308 | loaded_filename:=target;
|
---|
309 |
|
---|
310 | absolutebegintime:=Time;
|
---|
311 |
|
---|
312 | DataBase:=TABSDatabase.Create(Self);
|
---|
313 | DataBase.DatabaseName:='OLDB';
|
---|
314 | DataBase.DatabaseFileName:=target;
|
---|
315 | DataBase.CreateDatabase;
|
---|
316 |
|
---|
317 | DoStep('Creating tables');
|
---|
318 | progress.Position:=0;
|
---|
319 | lbl_progress.Caption:='';
|
---|
320 | lbl_estimation.Caption:='Estimated finishing time: unknown';
|
---|
321 | Application.ProcessMessages;
|
---|
322 |
|
---|
323 | Query:=TABSQuery.Create(Self);
|
---|
324 | Query.DatabaseName:='OLDB';
|
---|
325 | Query.SQL.Text:='CREATE TABLE globals ( id AUTOINC PRIMARY KEY, name STRING(128), value STRING(128) );';
|
---|
326 | Query.ExecSQL;
|
---|
327 | Query.SQL.Text:='CREATE TABLE linkmap ( id AUTOINC PRIMARY KEY, src_id INTEGER, src_link_offset INTEGER, target_id INTEGER );';
|
---|
328 | Query.ExecSQL;
|
---|
329 | Query.SQL.Text:='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 );';
|
---|
330 | // Query.SQL.Text:='CREATE TABLE rawmap ( id AUTOINC PRIMARY KEY, src_id INTEGER, src_link_offset INTEGER, size INTEGER, data BLOB BlobCompressionAlgorithm None );';
|
---|
331 | Query.ExecSQL;
|
---|
332 | Query.SQL.Text:='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 );';
|
---|
333 | // Query.SQL.Text:='CREATE TABLE datfiles ( id INTEGER PRIMARY KEY, extension CHAR(4), name STRING(128), contenttype INTEGER, size INTEGER, data BLOB BlobCompressionAlgorithm None );';
|
---|
334 | Query.ExecSQL;
|
---|
335 | Query.SQL.Text:='CREATE TABLE extlist ( id AUTOINC PRIMARY KEY, ext CHAR(4), ident CHAR(16) );';
|
---|
336 | Query.ExecSQL;
|
---|
337 |
|
---|
338 | Query.SQL.Text:='INSERT INTO globals (name,value) VALUES ("dbversion","'+dbversion+'");';
|
---|
339 | Query.ExecSQL;
|
---|
340 | SetLength(data,Length(OniDataConnection.LevelInfo.Ident));
|
---|
341 | FOR i:=0 TO High(OniDataConnection.LevelInfo.Ident) DO data[i]:=OniDataConnection.LevelInfo.Ident[i];
|
---|
342 | temps:=CreateHexString(data,True);
|
---|
343 | Query.SQL.Text:='INSERT INTO globals (name,value) VALUES ("ident","'+temps+'");';
|
---|
344 | Query.ExecSQL;
|
---|
345 | Query.SQL.Text:='INSERT INTO globals (name,value) VALUES ("lvl","'+IntToStr(OniDataConnection.LevelInfo.LevelNumber)+'");';
|
---|
346 | Query.ExecSQL;
|
---|
347 | IF OniDataConnection.OSisMAC THEN
|
---|
348 | Query.SQL.Text:='INSERT INTO globals (name,value) VALUES ("os","MAC");'
|
---|
349 | ELSE
|
---|
350 | Query.SQL.Text:='INSERT INTO globals (name,value) VALUES ("os","PC");';
|
---|
351 | Query.ExecSQL;
|
---|
352 |
|
---|
353 | DoStep('Writing extensionslist');
|
---|
354 | progress.Max:=Length(OniDataConnection.GetExtensionsList);
|
---|
355 | Application.ProcessMessages;
|
---|
356 |
|
---|
357 | extlist:=OniDataConnection.GetExtendedExtensionsList;
|
---|
358 | FOR i:=0 TO High(extlist) DO BEGIN
|
---|
359 | SetLength(data,Length(extlist[i].Ident));
|
---|
360 | FOR j:=0 TO High(extlist[i].Ident) DO data[j]:=extlist[i].Ident[j];
|
---|
361 | temps:=CreateHexString(data,True);
|
---|
362 | temps2:=extlist[i].Extension[3]+extlist[i].Extension[2]+extlist[i].Extension[1]+extlist[i].Extension[0];
|
---|
363 | Query.SQL.Text:='INSERT INTO extlist (ext,ident) VALUES ("'+temps2+'","'+temps+'");';
|
---|
364 | Query.ExecSQL;
|
---|
365 | progress.Position:=i;
|
---|
366 | lbl_progress.Caption:='Extensions done: '+IntToStr(i)+'/'+IntToStr(Length(extlist));
|
---|
367 | Application.ProcessMessages;
|
---|
368 | IF abort THEN BEGIN
|
---|
369 | stop_convert;
|
---|
370 | Exit;
|
---|
371 | END;
|
---|
372 | END;
|
---|
373 | lbl_progress.Caption:='';
|
---|
374 |
|
---|
375 | progress.Position:=0;
|
---|
376 | lbl_progress.Caption:='Files done: '+IntToStr(0)+'/'+IntToStr(OniDataConnection.GetFilesCount);
|
---|
377 | lbl_estimation.Caption:='Estimated finishing time: unknown';
|
---|
378 |
|
---|
379 | DoStep('Loading .dat into memory');
|
---|
380 | Application.ProcessMessages;
|
---|
381 |
|
---|
382 | progress.Max:=OniDataConnection.GetFilesCount;
|
---|
383 | begintime:=Time;
|
---|
384 | DoStep('Writing .dat-fileslist');
|
---|
385 | Application.ProcessMessages;
|
---|
386 |
|
---|
387 | Database.StartTransaction;
|
---|
388 | FOR i:=0 TO OniDataConnection.GetFilesCount-1 DO BEGIN
|
---|
389 | fileinfo:=OniDataConnection.GetFileInfo(i);
|
---|
390 | IF (fileinfo.FileType AND $02)=0 THEN BEGIN
|
---|
391 | mimecoder:=TStringFormat_MIME64.Create;
|
---|
392 | data:=OniDataConnection.LoadDatFile(i);
|
---|
393 | Query.SQL.Text:='INSERT INTO datfiles (id,extension,name,contenttype,size,data) VALUES ('+IntToStr(i)+',"'+fileinfo.Extension+'","'+fileinfo.Name+'","'+IntToHex(fileinfo.FileType,8)+'",'+IntToStr(fileinfo.Size)+',MimeToBin("'+MimeCoder.StrTo(@data[0], Length(data))+'") );';
|
---|
394 | Query.ExecSQL;
|
---|
395 | mimecoder.Free;
|
---|
396 |
|
---|
397 | rawlist:=OniDataConnection.GetRawList(i);
|
---|
398 | IF Length(rawlist)>0 THEN BEGIN
|
---|
399 | FOR j:=0 TO High(rawlist) DO BEGIN
|
---|
400 | IF rawlist[j].raw_size>0 THEN BEGIN
|
---|
401 | SetLength(data, rawlist[j].raw_size);
|
---|
402 | OniDataConnection.LoadRawFile(i,rawlist[j].src_offset,data);
|
---|
403 | mimecoder:=TStringFormat_MIME64.Create;
|
---|
404 | Query.SQL.Text:='INSERT INTO rawmap (src_id,src_link_offset,sep,size,data) VALUES ('+IntToStr(i)+','+IntToStr(rawlist[j].src_offset)+','+BoolToStr(rawlist[j].loc_sep)+','+IntToStr(rawlist[j].raw_size)+',MimeToBin("'+MimeCoder.StrTo(@data[0], rawlist[j].raw_size)+'") );';
|
---|
405 | Query.ExecSQL;
|
---|
406 | mimecoder.Free;
|
---|
407 | END ELSE BEGIN
|
---|
408 | Query.SQL.Text:='INSERT INTO rawmap (src_id,src_link_offset,sep,size) VALUES ('+IntToStr(i)+','+IntToStr(rawlist[j].src_offset)+','+BoolToStr(rawlist[j].loc_sep)+',0);';
|
---|
409 | Query.ExecSQL;
|
---|
410 | END;
|
---|
411 | END;
|
---|
412 | END;
|
---|
413 |
|
---|
414 | HandleFile(fileinfo.Extension,i,True);
|
---|
415 | END ELSE BEGIN
|
---|
416 | Query.SQL.Text:='INSERT INTO datfiles (id,extension,name,contenttype,size) VALUES ('+IntToStr(i)+',"'+fileinfo.Extension+'","'+fileinfo.Name+'","'+IntToHex(fileinfo.FileType,8)+'",0);';
|
---|
417 | Query.ExecSQL;
|
---|
418 | END;
|
---|
419 | IF ( (i MOD 100)=0 ) AND (i>0) THEN BEGIN
|
---|
420 | Database.Commit(False);
|
---|
421 | Database.StartTransaction;
|
---|
422 | END;
|
---|
423 | IF ( (i MOD 25)=0 ) AND (i>=100) THEN
|
---|
424 | lbl_estimation.Caption:='Estimated finishing time: '+TimeToStr((Time-begintime)/i*progress.Max+begintime);
|
---|
425 | progress.Position:=i;
|
---|
426 | lbl_progress.Caption:='Files done: '+IntToStr(i)+'/'+IntToStr(progress.Max);
|
---|
427 | Application.ProcessMessages;
|
---|
428 | IF abort THEN BEGIN
|
---|
429 | stop_convert;
|
---|
430 | Exit;
|
---|
431 | END;
|
---|
432 | END;
|
---|
433 | Database.Commit(False);
|
---|
434 | progress.Position:=progress.Max;
|
---|
435 | lbl_progress.Caption:='Files done: '+IntToStr(progress.Max)+'/'+IntToStr(progress.Max);
|
---|
436 | lbl_estimation.Caption:='FINISHED (duration: '+TimeToStr(Time-absolutebegintime)+')';
|
---|
437 |
|
---|
438 | DoStep('FIN');
|
---|
439 | btn_abortok.Caption:='&OK';
|
---|
440 | btn_abortok.Default:=True;
|
---|
441 |
|
---|
442 | converting:=False;
|
---|
443 |
|
---|
444 | database.Close;
|
---|
445 | database.Free;
|
---|
446 |
|
---|
447 | CloseDataConnection;
|
---|
448 | END;
|
---|
449 |
|
---|
450 | PROCEDURE TForm10.stop_convert;
|
---|
451 | BEGIN
|
---|
452 | btn_abortok.Caption:='&Close';
|
---|
453 | btn_abortok.Default:=True;
|
---|
454 | converting:=False;
|
---|
455 | lbl_estimation.Caption:='ABORTED';
|
---|
456 | group_progress.Caption:='Creating DB (ABORTED)';
|
---|
457 | DataBase.Close;
|
---|
458 | IF MessageBox(Self.Handle, PChar('Delete the unfinished DB-file?'), PChar('Delete file?'), MB_YESNO)=IDYES THEN BEGIN
|
---|
459 | DeleteFile(loaded_filename);
|
---|
460 | END;
|
---|
461 | END;
|
---|
462 |
|
---|
463 | PROCEDURE TForm10.btn_abortokClick(Sender: TObject);
|
---|
464 | BEGIN
|
---|
465 | IF converting THEN BEGIN
|
---|
466 | IF MessageBox(Self.Handle, PChar('Do you really want to cancel the convert-progress?'), PChar('Warning: Converting'), MB_YESNO)=IDYES THEN
|
---|
467 | abort:=True;
|
---|
468 | END ELSE BEGIN
|
---|
469 | Form10.Visible:=False;
|
---|
470 | Form1.Visible:=True;
|
---|
471 | END;
|
---|
472 | END;
|
---|
473 |
|
---|
474 | PROCEDURE InsertDatLinkToDB(fileid:LongWord; offset:LongWord);
|
---|
475 | VAR
|
---|
476 | link:LongWord;
|
---|
477 | BEGIN
|
---|
478 | OniDataConnection.LoadDatFilePart(fileid,offset,4,@link);
|
---|
479 | IF link=0 THEN
|
---|
480 | link:=$FFFFFFFF
|
---|
481 | ELSE
|
---|
482 | link:=link DIV 256;
|
---|
483 | Query.SQL.Text:='INSERT INTO linkmap (src_id,src_link_offset,target_id) VALUES ('+IntToStr(fileid)+','+IntToStr(offset)+','+IntToStr(link)+');';
|
---|
484 | Query.ExecSQL;
|
---|
485 | END;
|
---|
486 |
|
---|
487 | PROCEDURE AISA(fileid:LongWord; dir_dat2db:Boolean);
|
---|
488 | VAR
|
---|
489 | packages:Word;
|
---|
490 | i:LongWord;
|
---|
491 | BEGIN
|
---|
492 | IF dir_dat2db THEN BEGIN
|
---|
493 | OniDataConnection.LoadDatFilePart(fileid,$1E,2,@packages);
|
---|
494 | IF packages>0 THEN BEGIN
|
---|
495 | FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*$160+$28);
|
---|
496 | FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*$160+$150);
|
---|
497 | END;
|
---|
498 | END ELSE BEGIN
|
---|
499 | END;
|
---|
500 | END;
|
---|
501 | PROCEDURE AKEV(fileid:LongWord; dir_dat2db:Boolean);
|
---|
502 | VAR
|
---|
503 | i:LongWord;
|
---|
504 | BEGIN
|
---|
505 | IF dir_dat2db THEN BEGIN
|
---|
506 | FOR i:=0 TO 16 DO InsertDatLinkToDB(fileid,$8+i*4);
|
---|
507 | END ELSE BEGIN
|
---|
508 | END;
|
---|
509 | END;
|
---|
510 | PROCEDURE AKOT(fileid:LongWord; dir_dat2db:Boolean);
|
---|
511 | VAR
|
---|
512 | i:LongWord;
|
---|
513 | BEGIN
|
---|
514 | IF dir_dat2db THEN BEGIN
|
---|
515 | FOR i:=0 TO 4 DO InsertDatLinkToDB(fileid,$8+i*4);
|
---|
516 | END ELSE BEGIN
|
---|
517 | END;
|
---|
518 | END;
|
---|
519 | PROCEDURE CBPI(fileid:LongWord; dir_dat2db:Boolean);
|
---|
520 | VAR
|
---|
521 | i:LongWord;
|
---|
522 | BEGIN
|
---|
523 | IF dir_dat2db THEN BEGIN
|
---|
524 | FOR i:=0 TO 56 DO InsertDatLinkToDB(fileid,$8+i*4);
|
---|
525 | END ELSE BEGIN
|
---|
526 | END;
|
---|
527 | END;
|
---|
528 | PROCEDURE CBPM(fileid:LongWord; dir_dat2db:Boolean);
|
---|
529 | VAR
|
---|
530 | i:LongWord;
|
---|
531 | BEGIN
|
---|
532 | IF dir_dat2db THEN BEGIN
|
---|
533 | FOR i:=0 TO 18 DO InsertDatLinkToDB(fileid,$8+i*4);
|
---|
534 | END ELSE BEGIN
|
---|
535 | END;
|
---|
536 | END;
|
---|
537 | PROCEDURE CONS(fileid:LongWord; dir_dat2db:Boolean);
|
---|
538 | VAR
|
---|
539 | i:LongWord;
|
---|
540 | BEGIN
|
---|
541 | IF dir_dat2db THEN BEGIN
|
---|
542 | FOR i:=0 TO 1 DO InsertDatLinkToDB(fileid,$24+i*4);
|
---|
543 | END ELSE BEGIN
|
---|
544 | END;
|
---|
545 | END;
|
---|
546 | PROCEDURE CRSA(fileid:LongWord; dir_dat2db:Boolean);
|
---|
547 | VAR
|
---|
548 | packages:LongWord;
|
---|
549 | i:LongWord;
|
---|
550 | BEGIN
|
---|
551 | IF dir_dat2db THEN BEGIN
|
---|
552 | OniDataConnection.LoadDatFilePart(fileid,$14,4,@packages);
|
---|
553 | IF packages>0 THEN
|
---|
554 | FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*1100+$A0);
|
---|
555 | END ELSE BEGIN
|
---|
556 | END;
|
---|
557 | END;
|
---|
558 | PROCEDURE DOOR(fileid:LongWord; dir_dat2db:Boolean);
|
---|
559 | BEGIN
|
---|
560 | IF dir_dat2db THEN BEGIN
|
---|
561 | InsertDatLinkToDB(fileid,$08);
|
---|
562 | InsertDatLinkToDB(fileid,$10);
|
---|
563 | END ELSE BEGIN
|
---|
564 | END;
|
---|
565 | END;
|
---|
566 | PROCEDURE DPGE(fileid:LongWord; dir_dat2db:Boolean);
|
---|
567 | BEGIN
|
---|
568 | IF dir_dat2db THEN BEGIN
|
---|
569 | InsertDatLinkToDB(fileid,$40);
|
---|
570 | END ELSE BEGIN
|
---|
571 | END;
|
---|
572 | END;
|
---|
573 | PROCEDURE HPGE(fileid:LongWord; dir_dat2db:Boolean);
|
---|
574 | BEGIN
|
---|
575 | IF dir_dat2db THEN BEGIN
|
---|
576 | InsertDatLinkToDB(fileid,$0C);
|
---|
577 | END ELSE BEGIN
|
---|
578 | END;
|
---|
579 | END;
|
---|
580 | PROCEDURE IGHH(fileid:LongWord; dir_dat2db:Boolean);
|
---|
581 | BEGIN
|
---|
582 | IF dir_dat2db THEN BEGIN
|
---|
583 | InsertDatLinkToDB(fileid,$24);
|
---|
584 | InsertDatLinkToDB(fileid,$28);
|
---|
585 | END ELSE BEGIN
|
---|
586 | END;
|
---|
587 | END;
|
---|
588 | PROCEDURE IGPA(fileid:LongWord; dir_dat2db:Boolean);
|
---|
589 | VAR
|
---|
590 | links:LongWord;
|
---|
591 | i:LongWord;
|
---|
592 | BEGIN
|
---|
593 | IF dir_dat2db THEN BEGIN
|
---|
594 | OniDataConnection.LoadDatFilePart(fileid,$1C,4,@links);
|
---|
595 | IF links>0 THEN
|
---|
596 | FOR i:=0 TO links-1 DO InsertDatLinkToDB(fileid,$20+i*4);
|
---|
597 | END ELSE BEGIN
|
---|
598 | END;
|
---|
599 | END;
|
---|
600 | PROCEDURE IGPG(fileid:LongWord; dir_dat2db:Boolean);
|
---|
601 | VAR
|
---|
602 | i:LongWord;
|
---|
603 | BEGIN
|
---|
604 | IF dir_dat2db THEN BEGIN
|
---|
605 | FOR i:=0 TO 1 DO InsertDatLinkToDB(fileid,$1C+i*4);
|
---|
606 | END ELSE BEGIN
|
---|
607 | END;
|
---|
608 | END;
|
---|
609 | PROCEDURE IGSA(fileid:LongWord; dir_dat2db:Boolean);
|
---|
610 | VAR
|
---|
611 | links:LongWord;
|
---|
612 | i:LongWord;
|
---|
613 | BEGIN
|
---|
614 | IF dir_dat2db THEN BEGIN
|
---|
615 | OniDataConnection.LoadDatFilePart(fileid,$1C,4,@links);
|
---|
616 | IF links>0 THEN
|
---|
617 | FOR i:=0 TO links-1 DO InsertDatLinkToDB(fileid,$20+i*4);
|
---|
618 | END ELSE BEGIN
|
---|
619 | END;
|
---|
620 | END;
|
---|
621 | PROCEDURE IMPT(fileid:LongWord; dir_dat2db:Boolean);
|
---|
622 | BEGIN
|
---|
623 | IF dir_dat2db THEN BEGIN
|
---|
624 | InsertDatLinkToDB(fileid,$10);
|
---|
625 | END ELSE BEGIN
|
---|
626 | END;
|
---|
627 | END;
|
---|
628 | PROCEDURE IPGE(fileid:LongWord; dir_dat2db:Boolean);
|
---|
629 | BEGIN
|
---|
630 | IF dir_dat2db THEN BEGIN
|
---|
631 | InsertDatLinkToDB(fileid,$0C);
|
---|
632 | END ELSE BEGIN
|
---|
633 | END;
|
---|
634 | END;
|
---|
635 | PROCEDURE KEYI(fileid:LongWord; dir_dat2db:Boolean);
|
---|
636 | VAR
|
---|
637 | i:LongWord;
|
---|
638 | BEGIN
|
---|
639 | IF dir_dat2db THEN BEGIN
|
---|
640 | FOR i:=0 TO 9 DO InsertDatLinkToDB(fileid,$08+i*4);
|
---|
641 | END ELSE BEGIN
|
---|
642 | END;
|
---|
643 | END;
|
---|
644 | PROCEDURE M3GA(fileid:LongWord; dir_dat2db:Boolean);
|
---|
645 | VAR
|
---|
646 | links:LongWord;
|
---|
647 | i:LongWord;
|
---|
648 | BEGIN
|
---|
649 | IF dir_dat2db THEN BEGIN
|
---|
650 | OniDataConnection.LoadDatFilePart(fileid,$1C,4,@links);
|
---|
651 | IF links>0 THEN
|
---|
652 | FOR i:=0 TO links-1 DO InsertDatLinkToDB(fileid,$20+i*4);
|
---|
653 | END ELSE BEGIN
|
---|
654 | END;
|
---|
655 | END;
|
---|
656 | PROCEDURE M3GM(fileid:LongWord; dir_dat2db:Boolean);
|
---|
657 | VAR
|
---|
658 | i:LongWord;
|
---|
659 | BEGIN
|
---|
660 | IF dir_dat2db THEN BEGIN
|
---|
661 | FOR i:=0 TO 6 DO InsertDatLinkToDB(fileid,$0C+i*4);
|
---|
662 | END ELSE BEGIN
|
---|
663 | END;
|
---|
664 | END;
|
---|
665 | PROCEDURE MTRL(fileid:LongWord; dir_dat2db:Boolean);
|
---|
666 | BEGIN
|
---|
667 | IF dir_dat2db THEN BEGIN
|
---|
668 | InsertDatLinkToDB(fileid,$10);
|
---|
669 | END ELSE BEGIN
|
---|
670 | END;
|
---|
671 | END;
|
---|
672 | PROCEDURE OBDC(fileid:LongWord; dir_dat2db:Boolean);
|
---|
673 | VAR
|
---|
674 | packages:Word;
|
---|
675 | i:LongWord;
|
---|
676 | BEGIN
|
---|
677 | IF dir_dat2db THEN BEGIN
|
---|
678 | OniDataConnection.LoadDatFilePart(fileid,$1E,2,@packages);
|
---|
679 | IF packages>0 THEN
|
---|
680 | FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*$18+$4);
|
---|
681 | END ELSE BEGIN
|
---|
682 | END;
|
---|
683 | END;
|
---|
684 | PROCEDURE OBOA(fileid:LongWord; dir_dat2db:Boolean);
|
---|
685 | VAR
|
---|
686 | packages:Word;
|
---|
687 | i:LongWord;
|
---|
688 | BEGIN
|
---|
689 | IF dir_dat2db THEN BEGIN
|
---|
690 | OniDataConnection.LoadDatFilePart(fileid,$1E,2,@packages);
|
---|
691 | IF packages>0 THEN
|
---|
692 | FOR i:=0 TO packages-1 DO BEGIN
|
---|
693 | InsertDatLinkToDB(fileid,$20+i*240+$0);
|
---|
694 | InsertDatLinkToDB(fileid,$20+i*240+$4);
|
---|
695 | InsertDatLinkToDB(fileid,$20+i*240+$8);
|
---|
696 | END;
|
---|
697 | END ELSE BEGIN
|
---|
698 | END;
|
---|
699 | END;
|
---|
700 | PROCEDURE OFGA(fileid:LongWord; dir_dat2db:Boolean);
|
---|
701 | VAR
|
---|
702 | packages:LongWord;
|
---|
703 | i:LongWord;
|
---|
704 | BEGIN
|
---|
705 | IF dir_dat2db THEN BEGIN
|
---|
706 | OniDataConnection.LoadDatFilePart(fileid,$1C,4,@packages);
|
---|
707 | IF packages>0 THEN
|
---|
708 | FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*12+$04);
|
---|
709 | END ELSE BEGIN
|
---|
710 | END;
|
---|
711 | END;
|
---|
712 | PROCEDURE ONCC(fileid:LongWord; dir_dat2db:Boolean);
|
---|
713 | VAR
|
---|
714 | i:LongWord;
|
---|
715 | BEGIN
|
---|
716 | IF dir_dat2db THEN BEGIN
|
---|
717 | InsertDatLinkToDB(fileid,$28);
|
---|
718 | InsertDatLinkToDB(fileid,$434);
|
---|
719 | InsertDatLinkToDB(fileid,$438);
|
---|
720 | InsertDatLinkToDB(fileid,$43C);
|
---|
721 | InsertDatLinkToDB(fileid,$C3C);
|
---|
722 | InsertDatLinkToDB(fileid,$C40);
|
---|
723 | InsertDatLinkToDB(fileid,$C44);
|
---|
724 | InsertDatLinkToDB(fileid,$C48);
|
---|
725 | InsertDatLinkToDB(fileid,$C88);
|
---|
726 | InsertDatLinkToDB(fileid,$C8C);
|
---|
727 | END ELSE BEGIN
|
---|
728 | END;
|
---|
729 | END;
|
---|
730 | PROCEDURE ONCV(fileid:LongWord; dir_dat2db:Boolean);
|
---|
731 | BEGIN
|
---|
732 | IF dir_dat2db THEN BEGIN
|
---|
733 | InsertDatLinkToDB(fileid,$08);
|
---|
734 | END ELSE BEGIN
|
---|
735 | END;
|
---|
736 | END;
|
---|
737 | PROCEDURE ONLV(fileid:LongWord; dir_dat2db:Boolean);
|
---|
738 | VAR
|
---|
739 | i:LongWord;
|
---|
740 | BEGIN
|
---|
741 | IF dir_dat2db THEN BEGIN
|
---|
742 | FOR i:=0 TO 5 DO InsertDatLinkToDB(fileid,$48+i*4);
|
---|
743 | FOR i:=0 TO 5 DO InsertDatLinkToDB(fileid,$64+i*4);
|
---|
744 | InsertDatLinkToDB(fileid,$300);
|
---|
745 | END ELSE BEGIN
|
---|
746 | END;
|
---|
747 | END;
|
---|
748 | PROCEDURE ONOA(fileid:LongWord; dir_dat2db:Boolean);
|
---|
749 | VAR
|
---|
750 | packages:LongWord;
|
---|
751 | i:LongWord;
|
---|
752 | BEGIN
|
---|
753 | IF dir_dat2db THEN BEGIN
|
---|
754 | OniDataConnection.LoadDatFilePart(fileid,$1C,4,@packages);
|
---|
755 | IF packages>0 THEN
|
---|
756 | FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*8+$04);
|
---|
757 | END ELSE BEGIN
|
---|
758 | END;
|
---|
759 | END;
|
---|
760 | PROCEDURE ONSK(fileid:LongWord; dir_dat2db:Boolean);
|
---|
761 | BEGIN
|
---|
762 | IF dir_dat2db THEN BEGIN
|
---|
763 | InsertDatLinkToDB(fileid,$08);
|
---|
764 | InsertDatLinkToDB(fileid,$0C);
|
---|
765 | InsertDatLinkToDB(fileid,$10);
|
---|
766 | InsertDatLinkToDB(fileid,$14);
|
---|
767 | InsertDatLinkToDB(fileid,$18);
|
---|
768 | InsertDatLinkToDB(fileid,$20);
|
---|
769 | InsertDatLinkToDB(fileid,$44);
|
---|
770 | END ELSE BEGIN
|
---|
771 | END;
|
---|
772 | END;
|
---|
773 | PROCEDURE ONVL(fileid:LongWord; dir_dat2db:Boolean);
|
---|
774 | VAR
|
---|
775 | packages:LongWord;
|
---|
776 | i:LongWord;
|
---|
777 | BEGIN
|
---|
778 | IF dir_dat2db THEN BEGIN
|
---|
779 | OniDataConnection.LoadDatFilePart(fileid,$1C,4,@packages);
|
---|
780 | IF packages>0 THEN
|
---|
781 | FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*4);
|
---|
782 | END ELSE BEGIN
|
---|
783 | END;
|
---|
784 | END;
|
---|
785 | PROCEDURE ONWC(fileid:LongWord; dir_dat2db:Boolean);
|
---|
786 | BEGIN
|
---|
787 | IF dir_dat2db THEN BEGIN
|
---|
788 | InsertDatLinkToDB(fileid,$28);
|
---|
789 | InsertDatLinkToDB(fileid,$34);
|
---|
790 | InsertDatLinkToDB(fileid,$40);
|
---|
791 | InsertDatLinkToDB(fileid,$54);
|
---|
792 | InsertDatLinkToDB(fileid,$58);
|
---|
793 | InsertDatLinkToDB(fileid,$5C);
|
---|
794 | InsertDatLinkToDB(fileid,$60);
|
---|
795 | InsertDatLinkToDB(fileid,$6FC);
|
---|
796 | InsertDatLinkToDB(fileid,$700);
|
---|
797 | END ELSE BEGIN
|
---|
798 | END;
|
---|
799 | END;
|
---|
800 | PROCEDURE OPGE(fileid:LongWord; dir_dat2db:Boolean);
|
---|
801 | BEGIN
|
---|
802 | IF dir_dat2db THEN BEGIN
|
---|
803 | InsertDatLinkToDB(fileid,$0C);
|
---|
804 | END ELSE BEGIN
|
---|
805 | END;
|
---|
806 | END;
|
---|
807 | PROCEDURE PSPC(fileid:LongWord; dir_dat2db:Boolean);
|
---|
808 | BEGIN
|
---|
809 | IF dir_dat2db THEN BEGIN
|
---|
810 | InsertDatLinkToDB(fileid,$50);
|
---|
811 | END ELSE BEGIN
|
---|
812 | END;
|
---|
813 | END;
|
---|
814 | PROCEDURE PSPL(fileid:LongWord; dir_dat2db:Boolean);
|
---|
815 | VAR
|
---|
816 | packages:LongWord;
|
---|
817 | i:LongWord;
|
---|
818 | BEGIN
|
---|
819 | IF dir_dat2db THEN BEGIN
|
---|
820 | OniDataConnection.LoadDatFilePart(fileid,$1C,4,@packages);
|
---|
821 | IF packages>0 THEN
|
---|
822 | FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*8+$4);
|
---|
823 | END ELSE BEGIN
|
---|
824 | END;
|
---|
825 | END;
|
---|
826 | PROCEDURE PSUI(fileid:LongWord; dir_dat2db:Boolean);
|
---|
827 | VAR
|
---|
828 | i:LongWord;
|
---|
829 | BEGIN
|
---|
830 | IF dir_dat2db THEN BEGIN
|
---|
831 | FOR i:=0 TO 43 DO InsertDatLinkToDB(fileid,$08+i*4);
|
---|
832 | END ELSE BEGIN
|
---|
833 | END;
|
---|
834 | END;
|
---|
835 | PROCEDURE STNA(fileid:LongWord; dir_dat2db:Boolean);
|
---|
836 | VAR
|
---|
837 | packages:Word;
|
---|
838 | i:LongWord;
|
---|
839 | BEGIN
|
---|
840 | IF dir_dat2db THEN BEGIN
|
---|
841 | OniDataConnection.LoadDatFilePart(fileid,$1E,2,@packages);
|
---|
842 | IF packages>0 THEN
|
---|
843 | FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*4);
|
---|
844 | END ELSE BEGIN
|
---|
845 | END;
|
---|
846 | END;
|
---|
847 | PROCEDURE TRAC(fileid:LongWord; dir_dat2db:Boolean);
|
---|
848 | VAR
|
---|
849 | packages:Word;
|
---|
850 | i:LongWord;
|
---|
851 | BEGIN
|
---|
852 | IF dir_dat2db THEN BEGIN
|
---|
853 | InsertDatLinkToDB(fileid,$18);
|
---|
854 | OniDataConnection.LoadDatFilePart(fileid,$1E,2,@packages);
|
---|
855 | IF packages>0 THEN
|
---|
856 | FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*12+8);
|
---|
857 | END ELSE BEGIN
|
---|
858 | END;
|
---|
859 | END;
|
---|
860 | PROCEDURE TRAM(fileid:LongWord; dir_dat2db:Boolean);
|
---|
861 | BEGIN
|
---|
862 | IF dir_dat2db THEN BEGIN
|
---|
863 | InsertDatLinkToDB(fileid,$40);
|
---|
864 | InsertDatLinkToDB(fileid,$44);
|
---|
865 | END ELSE BEGIN
|
---|
866 | END;
|
---|
867 | END;
|
---|
868 | PROCEDURE TRAS(fileid:LongWord; dir_dat2db:Boolean);
|
---|
869 | BEGIN
|
---|
870 | IF dir_dat2db THEN BEGIN
|
---|
871 | InsertDatLinkToDB(fileid,$08);
|
---|
872 | END ELSE BEGIN
|
---|
873 | END;
|
---|
874 | END;
|
---|
875 | PROCEDURE TRBS(fileid:LongWord; dir_dat2db:Boolean);
|
---|
876 | VAR
|
---|
877 | i:LongWord;
|
---|
878 | BEGIN
|
---|
879 | IF dir_dat2db THEN BEGIN
|
---|
880 | FOR i:=0 TO 4 DO InsertDatLinkToDB(fileid,$08+i*4);
|
---|
881 | END ELSE BEGIN
|
---|
882 | END;
|
---|
883 | END;
|
---|
884 | PROCEDURE TRCM(fileid:LongWord; dir_dat2db:Boolean);
|
---|
885 | VAR
|
---|
886 | i:LongWord;
|
---|
887 | BEGIN
|
---|
888 | IF dir_dat2db THEN BEGIN
|
---|
889 | FOR i:=0 TO 2 DO InsertDatLinkToDB(fileid,$5C+i*4);
|
---|
890 | END ELSE BEGIN
|
---|
891 | END;
|
---|
892 | END;
|
---|
893 | PROCEDURE TRGA(fileid:LongWord; dir_dat2db:Boolean);
|
---|
894 | VAR
|
---|
895 | i:LongWord;
|
---|
896 | packages:Word;
|
---|
897 | BEGIN
|
---|
898 | IF dir_dat2db THEN BEGIN
|
---|
899 | OniDataConnection.LoadDatFilePart(fileid,$1E,2,@packages);
|
---|
900 | IF packages>0 THEN
|
---|
901 | FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*4);
|
---|
902 | END ELSE BEGIN
|
---|
903 | END;
|
---|
904 | END;
|
---|
905 | PROCEDURE TRGE(fileid:LongWord; dir_dat2db:Boolean);
|
---|
906 | BEGIN
|
---|
907 | IF dir_dat2db THEN BEGIN
|
---|
908 | InsertDatLinkToDB(fileid,$20);
|
---|
909 | END ELSE BEGIN
|
---|
910 | END;
|
---|
911 | END;
|
---|
912 | PROCEDURE TRIG(fileid:LongWord; dir_dat2db:Boolean);
|
---|
913 | BEGIN
|
---|
914 | IF dir_dat2db THEN BEGIN
|
---|
915 | InsertDatLinkToDB(fileid,$18);
|
---|
916 | InsertDatLinkToDB(fileid,$24);
|
---|
917 | InsertDatLinkToDB(fileid,$28);
|
---|
918 | END ELSE BEGIN
|
---|
919 | END;
|
---|
920 | END;
|
---|
921 | PROCEDURE TRMA(fileid:LongWord; dir_dat2db:Boolean);
|
---|
922 | VAR
|
---|
923 | i:LongWord;
|
---|
924 | packages:Word;
|
---|
925 | BEGIN
|
---|
926 | IF dir_dat2db THEN BEGIN
|
---|
927 | OniDataConnection.LoadDatFilePart(fileid,$1E,2,@packages);
|
---|
928 | IF packages>0 THEN
|
---|
929 | FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*4);
|
---|
930 | END ELSE BEGIN
|
---|
931 | END;
|
---|
932 | END;
|
---|
933 | PROCEDURE TRSC(fileid:LongWord; dir_dat2db:Boolean);
|
---|
934 | VAR
|
---|
935 | i:LongWord;
|
---|
936 | packages:Word;
|
---|
937 | BEGIN
|
---|
938 | IF dir_dat2db THEN BEGIN
|
---|
939 | OniDataConnection.LoadDatFilePart(fileid,$1E,2,@packages);
|
---|
940 | IF packages>0 THEN
|
---|
941 | FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*4);
|
---|
942 | END ELSE BEGIN
|
---|
943 | END;
|
---|
944 | END;
|
---|
945 | PROCEDURE TSFF(fileid:LongWord; dir_dat2db:Boolean);
|
---|
946 | VAR
|
---|
947 | i:LongWord;
|
---|
948 | packages:LongWord;
|
---|
949 | BEGIN
|
---|
950 | IF dir_dat2db THEN BEGIN
|
---|
951 | OniDataConnection.LoadDatFilePart(fileid,$1C,4,@packages);
|
---|
952 | IF packages>0 THEN
|
---|
953 | FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*4);
|
---|
954 | END ELSE BEGIN
|
---|
955 | END;
|
---|
956 | END;
|
---|
957 | PROCEDURE TSFT(fileid:LongWord; dir_dat2db:Boolean);
|
---|
958 | BEGIN
|
---|
959 | IF dir_dat2db THEN BEGIN
|
---|
960 | InsertDatLinkToDB(fileid,$1C);
|
---|
961 | END ELSE BEGIN
|
---|
962 | END;
|
---|
963 | END;
|
---|
964 | PROCEDURE TURR(fileid:LongWord; dir_dat2db:Boolean);
|
---|
965 | BEGIN
|
---|
966 | IF dir_dat2db THEN BEGIN
|
---|
967 | InsertDatLinkToDB(fileid,$60);
|
---|
968 | InsertDatLinkToDB(fileid,$6C);
|
---|
969 | InsertDatLinkToDB(fileid,$74);
|
---|
970 | END ELSE BEGIN
|
---|
971 | END;
|
---|
972 | END;
|
---|
973 | PROCEDURE TXAN(fileid:LongWord; dir_dat2db:Boolean);
|
---|
974 | VAR
|
---|
975 | i:LongWord;
|
---|
976 | packages:LongWord;
|
---|
977 | BEGIN
|
---|
978 | IF dir_dat2db THEN BEGIN
|
---|
979 | OniDataConnection.LoadDatFilePart(fileid,$1C,4,@packages);
|
---|
980 | IF packages>0 THEN
|
---|
981 | FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*4);
|
---|
982 | END ELSE BEGIN
|
---|
983 | END;
|
---|
984 | END;
|
---|
985 | PROCEDURE TXMA(fileid:LongWord; dir_dat2db:Boolean);
|
---|
986 | VAR
|
---|
987 | i:LongWord;
|
---|
988 | packages:LongWord;
|
---|
989 | BEGIN
|
---|
990 | IF dir_dat2db THEN BEGIN
|
---|
991 | OniDataConnection.LoadDatFilePart(fileid,$1C,4,@packages);
|
---|
992 | IF packages>0 THEN
|
---|
993 | FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*4);
|
---|
994 | END ELSE BEGIN
|
---|
995 | END;
|
---|
996 | END;
|
---|
997 | PROCEDURE TXMB(fileid:LongWord; dir_dat2db:Boolean);
|
---|
998 | VAR
|
---|
999 | i:LongWord;
|
---|
1000 | packages:LongWord;
|
---|
1001 | BEGIN
|
---|
1002 | IF dir_dat2db THEN BEGIN
|
---|
1003 | OniDataConnection.LoadDatFilePart(fileid,$1C,4,@packages);
|
---|
1004 | IF packages>0 THEN
|
---|
1005 | FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*4);
|
---|
1006 | END ELSE BEGIN
|
---|
1007 | END;
|
---|
1008 | END;
|
---|
1009 | PROCEDURE TXMP(fileid:LongWord; dir_dat2db:Boolean);
|
---|
1010 | BEGIN
|
---|
1011 | IF dir_dat2db THEN BEGIN
|
---|
1012 | InsertDatLinkToDB(fileid,$94);
|
---|
1013 | InsertDatLinkToDB(fileid,$98);
|
---|
1014 | END ELSE BEGIN
|
---|
1015 | END;
|
---|
1016 | END;
|
---|
1017 | PROCEDURE TXTC(fileid:LongWord; dir_dat2db:Boolean);
|
---|
1018 | BEGIN
|
---|
1019 | IF dir_dat2db THEN BEGIN
|
---|
1020 | InsertDatLinkToDB(fileid,$08);
|
---|
1021 | END ELSE BEGIN
|
---|
1022 | END;
|
---|
1023 | END;
|
---|
1024 | PROCEDURE WMCL(fileid:LongWord; dir_dat2db:Boolean);
|
---|
1025 | VAR
|
---|
1026 | i:LongWord;
|
---|
1027 | packages:LongWord;
|
---|
1028 | BEGIN
|
---|
1029 | IF dir_dat2db THEN BEGIN
|
---|
1030 | OniDataConnection.LoadDatFilePart(fileid,$1C,4,@packages);
|
---|
1031 | IF packages>0 THEN
|
---|
1032 | FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*8+$4);
|
---|
1033 | END ELSE BEGIN
|
---|
1034 | END;
|
---|
1035 | END;
|
---|
1036 | PROCEDURE WMDD(fileid:LongWord; dir_dat2db:Boolean);
|
---|
1037 | VAR
|
---|
1038 | i:LongWord;
|
---|
1039 | packages:LongWord;
|
---|
1040 | BEGIN
|
---|
1041 | IF dir_dat2db THEN BEGIN
|
---|
1042 | OniDataConnection.LoadDatFilePart(fileid,$11C,4,@packages);
|
---|
1043 | IF packages>0 THEN
|
---|
1044 | FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$120+i*$124+$114);
|
---|
1045 | END ELSE BEGIN
|
---|
1046 | END;
|
---|
1047 | END;
|
---|
1048 | PROCEDURE WMMB(fileid:LongWord; dir_dat2db:Boolean);
|
---|
1049 | VAR
|
---|
1050 | i:LongWord;
|
---|
1051 | packages:LongWord;
|
---|
1052 | BEGIN
|
---|
1053 | IF dir_dat2db THEN BEGIN
|
---|
1054 | OniDataConnection.LoadDatFilePart(fileid,$1C,4,@packages);
|
---|
1055 | IF packages>0 THEN
|
---|
1056 | FOR i:=0 TO packages-1 DO InsertDatLinkToDB(fileid,$20+i*4);
|
---|
1057 | END ELSE BEGIN
|
---|
1058 | END;
|
---|
1059 | END;
|
---|
1060 | PROCEDURE WPGE(fileid:LongWord; dir_dat2db:Boolean);
|
---|
1061 | BEGIN
|
---|
1062 | IF dir_dat2db THEN BEGIN
|
---|
1063 | InsertDatLinkToDB(fileid,$08);
|
---|
1064 | InsertDatLinkToDB(fileid,$0C);
|
---|
1065 | END ELSE BEGIN
|
---|
1066 | END;
|
---|
1067 | END;
|
---|
1068 |
|
---|
1069 | PROCEDURE InsertHandler(ext:String; needed:Boolean; handler:THandler);
|
---|
1070 | BEGIN
|
---|
1071 | SetLength(ConvertHandlers,Length(ConvertHandlers)+1);
|
---|
1072 | ConvertHandlers[High(ConvertHandlers)].Ext:=ext;
|
---|
1073 | ConvertHandlers[High(ConvertHandlers)].needed:=needed;
|
---|
1074 | ConvertHandlers[High(ConvertHandlers)].handler:=handler;
|
---|
1075 | END;
|
---|
1076 |
|
---|
1077 | BEGIN
|
---|
1078 | InsertHandler('ABNA',False,NIL);
|
---|
1079 | // InsertHandler('AGDB',True,AGDB);
|
---|
1080 | InsertHandler('AGDB',False,NIL);
|
---|
1081 | InsertHandler('AGQC',False,NIL);
|
---|
1082 | InsertHandler('AGQG',False,NIL);
|
---|
1083 | InsertHandler('AGQR',False,NIL);
|
---|
1084 | InsertHandler('AISA',True,AISA);
|
---|
1085 | InsertHandler('AITR',False,NIL);
|
---|
1086 | InsertHandler('AKAA',False,NIL);
|
---|
1087 | InsertHandler('AKBA',False,NIL);
|
---|
1088 | InsertHandler('AKBP',False,NIL);
|
---|
1089 | InsertHandler('AKDA',False,NIL);
|
---|
1090 | InsertHandler('AKEV',True,AKEV);
|
---|
1091 | InsertHandler('AKOT',True,AKOT);
|
---|
1092 | InsertHandler('AKVA',False,NIL);
|
---|
1093 | InsertHandler('BINA',False,NIL);
|
---|
1094 | InsertHandler('CBPI',True,CBPI);
|
---|
1095 | InsertHandler('CBPM',True,CBPM);
|
---|
1096 | InsertHandler('CONS',True,CONS);
|
---|
1097 | InsertHandler('CRSA',True,CRSA);
|
---|
1098 | InsertHandler('DOOR',True,DOOR);
|
---|
1099 | InsertHandler('DPGE',True,DPGE);
|
---|
1100 | InsertHandler('ENVP',False,NIL);
|
---|
1101 | InsertHandler('FILM',False,NIL);
|
---|
1102 | InsertHandler('HPGE',True,HPGE);
|
---|
1103 | InsertHandler('IDXA',False,NIL);
|
---|
1104 | InsertHandler('IGHH',True,IGHH);
|
---|
1105 | InsertHandler('IGPA',True,IGPA);
|
---|
1106 | InsertHandler('IGPG',True,IGPG);
|
---|
1107 | InsertHandler('IGSA',True,IGSA);
|
---|
1108 | InsertHandler('IMPT',True,IMPT);
|
---|
1109 | InsertHandler('IPGE',True,IPGE);
|
---|
1110 | InsertHandler('KEYI',True,KEYI);
|
---|
1111 | InsertHandler('M3GA',True,M3GA);
|
---|
1112 | InsertHandler('M3GM',True,M3GM);
|
---|
1113 | InsertHandler('MTRL',True,MTRL);
|
---|
1114 | InsertHandler('OBAN',False,NIL);
|
---|
1115 | InsertHandler('OBDC',True,OBDC);
|
---|
1116 | InsertHandler('OBOA',True,OBOA);
|
---|
1117 | InsertHandler('OFGA',True,OFGA);
|
---|
1118 | InsertHandler('ONCC',True,ONCC);
|
---|
1119 | InsertHandler('ONCP',False,NIL);
|
---|
1120 | InsertHandler('ONCV',True,ONCV);
|
---|
1121 | InsertHandler('ONFA',False,NIL);
|
---|
1122 | InsertHandler('ONGS',False,NIL);
|
---|
1123 | InsertHandler('ONIA',False,NIL);
|
---|
1124 | InsertHandler('ONLD',False,NIL);
|
---|
1125 | InsertHandler('ONLV',True,ONLV);
|
---|
1126 | InsertHandler('ONMA',False,NIL);
|
---|
1127 | InsertHandler('ONOA',True,ONOA);
|
---|
1128 | InsertHandler('ONSA',False,NIL);
|
---|
1129 | InsertHandler('ONSK',True,ONSK);
|
---|
1130 | InsertHandler('ONTA',False,NIL);
|
---|
1131 | InsertHandler('ONVL',True,ONVL);
|
---|
1132 | InsertHandler('ONWC',True,ONWC);
|
---|
1133 | InsertHandler('OPGE',True,OPGE);
|
---|
1134 | InsertHandler('OSBD',False,NIL);
|
---|
1135 | InsertHandler('OTIT',False,NIL);
|
---|
1136 | InsertHandler('OTLF',False,NIL);
|
---|
1137 | InsertHandler('PLEA',False,NIL);
|
---|
1138 | InsertHandler('PNTA',False,NIL);
|
---|
1139 | InsertHandler('PSPC',True,PSPC);
|
---|
1140 | InsertHandler('PSPL',True,PSPL);
|
---|
1141 | InsertHandler('PSUI',True,PSUI);
|
---|
1142 | InsertHandler('QTNA',False,NIL);
|
---|
1143 | InsertHandler('SNDD',False,NIL);
|
---|
1144 | InsertHandler('STNA',True,STNA);
|
---|
1145 | InsertHandler('SUBT',False,NIL);
|
---|
1146 | InsertHandler('TRAC',True,TRAC);
|
---|
1147 | InsertHandler('TRAM',True,TRAM);
|
---|
1148 | InsertHandler('TRAS',True,TRAS);
|
---|
1149 | InsertHandler('TRBS',True,TRBS);
|
---|
1150 | InsertHandler('TRCM',True,TRCM);
|
---|
1151 | InsertHandler('TRGA',True,TRGA);
|
---|
1152 | InsertHandler('TRGE',True,TRGE);
|
---|
1153 | InsertHandler('TRIA',False,NIL);
|
---|
1154 | InsertHandler('TRIG',True,TRIG);
|
---|
1155 | InsertHandler('TRMA',True,TRMA);
|
---|
1156 | InsertHandler('TRSC',True,TRSC);
|
---|
1157 | InsertHandler('TRTA',False,NIL);
|
---|
1158 | InsertHandler('TSFF',True,TSFF);
|
---|
1159 | InsertHandler('TSFL',False,NIL);
|
---|
1160 | InsertHandler('TSFT',True,TSFT);
|
---|
1161 | InsertHandler('TSGA',False,NIL);
|
---|
1162 | InsertHandler('TSTR',False,NIL);
|
---|
1163 | InsertHandler('TURR',True,TURR);
|
---|
1164 | InsertHandler('TXAN',True,TXAN);
|
---|
1165 | InsertHandler('TXCA',False,NIL);
|
---|
1166 | InsertHandler('TXMA',True,TXMA);
|
---|
1167 | InsertHandler('TXMB',True,TXMB);
|
---|
1168 | InsertHandler('TXMP',True,TXMP);
|
---|
1169 | InsertHandler('TXTC',True,TXTC);
|
---|
1170 | InsertHandler('VCRA',False,NIL);
|
---|
1171 | InsertHandler('WMCL',True,WMCL);
|
---|
1172 | InsertHandler('WMDD',True,WMDD);
|
---|
1173 | InsertHandler('WMM_',False,NIL);
|
---|
1174 | InsertHandler('WMMB',True,WMMB);
|
---|
1175 | InsertHandler('WPGE',True,WPGE);
|
---|
1176 | END.
|
---|