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