[8] | 1 | UNIT Unit1_main;
|
---|
| 2 | INTERFACE
|
---|
| 3 | USES
|
---|
| 4 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
---|
| 5 | Dialogs, StdCtrls, StrUtils, Clipbrd, ExtCtrls, ComCtrls, Menus,
|
---|
| 6 | Unit2_functions, Unit3_data, Unit5_preview, Unit7_txmpreplace, Unit8_binedit;
|
---|
| 7 |
|
---|
| 8 | TYPE
|
---|
| 9 | TForm1 = Class(TForm)
|
---|
| 10 | panel_all: TPanel;
|
---|
| 11 | panel_left: TPanel;
|
---|
| 12 | Splitter1: TSplitter;
|
---|
| 13 | panel_files: TPanel;
|
---|
| 14 | btn_extractconvert: TButton;
|
---|
| 15 | list_files: TListBox;
|
---|
| 16 | list_extensions: TListBox;
|
---|
| 17 | Splitter2: TSplitter;
|
---|
| 18 | fopen: TOpenDialog;
|
---|
| 19 | group_progress: TGroupBox;
|
---|
| 20 | progress: TProgressBar;
|
---|
| 21 | lbl_progress: TLabel;
|
---|
| 22 | menu: TMainMenu;
|
---|
| 23 | menu_main: TMenuItem;
|
---|
| 24 | menu_exit: TMenuItem;
|
---|
| 25 | menu_preview: TMenuItem;
|
---|
| 26 | btn_extractcancel: TButton;
|
---|
| 27 | menu_tools: TMenuItem;
|
---|
| 28 | menu_txmpreplace: TMenuItem;
|
---|
| 29 | menu_extract: TMenuItem;
|
---|
| 30 | menu_extractfile: TMenuItem;
|
---|
| 31 | menu_extractlist: TMenuItem;
|
---|
| 32 | menu_extractall: TMenuItem;
|
---|
| 33 | menu_loaddat: TMenuItem;
|
---|
| 34 | menu_sep1: TMenuItem;
|
---|
| 35 | menu_binedit: TMenuItem;
|
---|
| 36 | statbar: TStatusBar;
|
---|
| 37 | panel_file: TPanel;
|
---|
| 38 | edit_data: TMemo;
|
---|
| 39 | lbl_fileinfo: TLabel;
|
---|
| 40 | PROCEDURE menu_extractallClick(Sender: TObject);
|
---|
| 41 | PROCEDURE menu_extractlistClick(Sender: TObject);
|
---|
| 42 | PROCEDURE menu_extractfileClick(Sender: TObject);
|
---|
| 43 | PROCEDURE menu_bineditClick(Sender: TObject);
|
---|
| 44 | PROCEDURE menu_loaddatClick(Sender: TObject);
|
---|
| 45 | PROCEDURE menu_txmpreplaceClick(Sender: TObject);
|
---|
| 46 | PROCEDURE menu_exitClick(Sender: TObject);
|
---|
| 47 | PROCEDURE btn_extractcancelClick(Sender: TObject);
|
---|
| 48 | PROCEDURE menu_previewClick(Sender: TObject);
|
---|
| 49 | PROCEDURE Splitter1Moved(Sender: TObject);
|
---|
| 50 | PROCEDURE FormClose(Sender: TObject; var Action: TCloseAction);
|
---|
| 51 | PROCEDURE btn_hexcopyClick(Sender: TObject);
|
---|
| 52 | PROCEDURE list_extensionsClick(Sender: TObject);
|
---|
| 53 | PROCEDURE FormResize(Sender: TObject);
|
---|
| 54 | PROCEDURE btn_extractconvertClick(Sender: TObject);
|
---|
| 55 | PROCEDURE FormCreate(Sender: TObject);
|
---|
| 56 | PROCEDURE list_filesDblClick(Sender: TObject);
|
---|
| 57 | PROCEDURE btn_loadClick(Sender: TObject);
|
---|
| 58 | PRIVATE
|
---|
| 59 | PUBLIC
|
---|
| 60 | END;
|
---|
| 61 |
|
---|
| 62 | VAR
|
---|
| 63 | Form1: TForm1;
|
---|
| 64 |
|
---|
| 65 | IMPLEMENTATION
|
---|
| 66 | {$R *.dfm}
|
---|
| 67 |
|
---|
| 68 | PROCEDURE DoAfterLoadOfADat;
|
---|
| 69 | VAR
|
---|
| 70 | i:LongWord;
|
---|
| 71 | txt:Text;
|
---|
| 72 | temp4:LongWord;
|
---|
| 73 | temp2:Word;
|
---|
| 74 | temp1:Byte;
|
---|
| 75 | BEGIN
|
---|
| 76 | IF NOT DirectoryExists(GetExtractPath) THEN
|
---|
| 77 | CreateDir(GetExtractPath);
|
---|
| 78 | AssignFile(txt,GetExtractPath+'\___TXMP-FILES___.TXT');
|
---|
| 79 | ReWrite(txt);
|
---|
| 80 | FOR i:=0 TO dat_header.Extensions-1 DO BEGIN
|
---|
| 81 | IF (dat_extensionsmap[i].Extension[3]='T') AND
|
---|
| 82 | (dat_extensionsmap[i].Extension[2]='X') AND
|
---|
| 83 | (dat_extensionsmap[i].Extension[1]='M') AND
|
---|
| 84 | (dat_extensionsmap[i].Extension[0]='P') THEN BEGIN
|
---|
| 85 | WriteLn(txt, FormatNumber(dat_extensionsmap[i].ExtCount,4,'0')+' TXMP-Files');
|
---|
| 86 | Break;
|
---|
| 87 | END;
|
---|
| 88 | END;
|
---|
| 89 | WriteLn(txt,'FileName'+#9+'MipMap'+#9+'Depth'+#9+'ImgX'+#9+'ImgY'+#9+'StoreT');
|
---|
| 90 | FOR i:=0 TO dat_header.Files-1 DO BEGIN
|
---|
| 91 | IF dat_files[i].Extension='TXMP' THEN BEGIN
|
---|
| 92 | Write(txt,dat_files[i].FileName+#9);
|
---|
| 93 | LoadDatFilePart(i,$88,1,@temp1);
|
---|
| 94 | Write(txt,IntToHex(temp1,2)+#9);
|
---|
| 95 | LoadDatFilePart(i,$89,1,@temp1);
|
---|
| 96 | Write(txt,IntToHex(temp1,2)+#9);
|
---|
| 97 | LoadDatFilePart(i,$8C,2,@temp2);
|
---|
| 98 | Write(txt,IntToHex(temp2,4)+#9);
|
---|
| 99 | LoadDatFilePart(i,$8E,2,@temp2);
|
---|
| 100 | Write(txt,IntToHex(temp2,4)+#9);
|
---|
| 101 | LoadDatFilePart(i,$90,1,@temp1);
|
---|
| 102 | Write(txt,IntToHex(temp1,2)+#9);
|
---|
| 103 | WriteLn(txt,'');
|
---|
| 104 | END;
|
---|
| 105 | END;
|
---|
| 106 | CloseFile(txt);
|
---|
| 107 |
|
---|
| 108 | IF NOT DirectoryExists(GetExtractPath) THEN
|
---|
| 109 | CreateDir(GetExtractPath);
|
---|
| 110 | AssignFile(txt,GetExtractPath+'\___TXAN-FILES___.TXT');
|
---|
| 111 | ReWrite(txt);
|
---|
| 112 | FOR i:=0 TO dat_header.Extensions-1 DO BEGIN
|
---|
| 113 | IF (dat_extensionsmap[i].Extension[3]='T') AND
|
---|
| 114 | (dat_extensionsmap[i].Extension[2]='X') AND
|
---|
| 115 | (dat_extensionsmap[i].Extension[1]='A') AND
|
---|
| 116 | (dat_extensionsmap[i].Extension[0]='N') THEN BEGIN
|
---|
| 117 | WriteLn(txt, FormatNumber(dat_extensionsmap[i].ExtCount,4,'0')+' TXAN-Files');
|
---|
| 118 | Break;
|
---|
| 119 | END;
|
---|
| 120 | END;
|
---|
| 121 | WriteLn(txt,'FileName'+#9+'Loopspeed'+#9+'Unknown'+#9+'Links');
|
---|
| 122 | FOR i:=0 TO dat_header.Files-1 DO BEGIN
|
---|
| 123 | IF dat_files[i].Extension='TXAN' THEN BEGIN
|
---|
| 124 | Write(txt,dat_files[i].FileName+#9);
|
---|
| 125 | LoadDatFilePart(i,$14,2,@temp2);
|
---|
| 126 | Write(txt,IntToHex(temp2,4)+#9);
|
---|
| 127 | LoadDatFilePart(i,$16,2,@temp2);
|
---|
| 128 | Write(txt,IntToHex(temp2,4)+#9);
|
---|
| 129 | LoadDatFilePart(i,$1C,4,@temp4);
|
---|
| 130 | Write(txt,IntToHex(temp4,8)+#9);
|
---|
| 131 | WriteLn(txt,'');
|
---|
| 132 | END;
|
---|
| 133 | END;
|
---|
| 134 | CloseFile(txt);
|
---|
| 135 | END;
|
---|
| 136 |
|
---|
| 137 | PROCEDURE LoadDat;
|
---|
| 138 | VAR i:LongWord;
|
---|
| 139 | BEGIN
|
---|
| 140 | Form1.fopen.InitialDir:=AppSettings.DatPath;
|
---|
| 141 | IF Form1.fopen.Execute THEN BEGIN
|
---|
| 142 | Form1.Caption:='Oni Un/Packer '+version+' ('+ExtractFileName(Form1.fopen.FileName)+')';
|
---|
| 143 | AppSettings.DatPath:=ExtractFilepath(Form1.fopen.FileName);
|
---|
| 144 | Form1.list_files.Items.Clear;
|
---|
| 145 | Form1.list_extensions.Items.Clear;
|
---|
| 146 | IF LoadDatInfos(Form1.fopen.FileName) THEN BEGIN
|
---|
| 147 | Form1.list_extensions.Items.Add('_All files: '+FormatNumber(dat_header.Files,4,' '));
|
---|
| 148 | FOR i:=0 TO dat_header.Extensions-1 DO BEGIN
|
---|
| 149 | WITH dat_extensionsmap[i] DO BEGIN
|
---|
| 150 | Form1.list_extensions.Items.Add(
|
---|
| 151 | Extension[3]+Extension[2]+Extension[1]+Extension[0]+': '+
|
---|
| 152 | FormatNumber(ExtCount,4,' '));{+' (Ident: 0x'+
|
---|
| 153 | IntToHex(Ident[7],2)+IntToHex(Ident[6],2)+IntToHex(Ident[5],2)+IntToHex(Ident[4],2)+IntToHex(Ident[3],2)+IntToHex(Ident[2],2)+IntToHex(Ident[1],2)+IntToHex(Ident[0],2)+')');}
|
---|
| 154 | END;
|
---|
| 155 | END;
|
---|
| 156 | Form1.list_extensions.ItemIndex:=0;
|
---|
| 157 | Form1.list_extensionsClick(Form1);
|
---|
| 158 | Form1.list_files.ItemIndex:=0;
|
---|
| 159 | Form1.list_filesDblClick(Form1);
|
---|
| 160 | Form1.statbar.Panels.Items[0].Text:='Current .dat: '+dat_FileName;
|
---|
| 161 | Form1.statbar.Panels.Items[1].Text:='Files: '+IntToStr(dat_header.Files);
|
---|
| 162 | Form1.statbar.Panels.Items[2].Text:='Extensions: '+IntToStr(dat_header.Extensions);
|
---|
| 163 | Form1.menu_tools.Enabled:=True;
|
---|
| 164 | Form1.menu_extract.Enabled:=True;
|
---|
| 165 | Form1.btn_extractconvert.Enabled:=True;
|
---|
| 166 |
|
---|
| 167 | Form7.RecreateTXMPlist;
|
---|
| 168 |
|
---|
| 169 | DoAfterLoadOfADat;
|
---|
| 170 |
|
---|
| 171 | END ELSE BEGIN
|
---|
| 172 | ShowMessage('Error while loading the file:'+CrLf+Form1.fopen.FileName+CrLf+'Perhaps not an Oni-.dat-file?');
|
---|
| 173 | END;
|
---|
| 174 | END;
|
---|
| 175 | END;
|
---|
| 176 |
|
---|
| 177 | PROCEDURE TForm1.btn_loadClick(Sender: TObject);
|
---|
| 178 | BEGIN
|
---|
| 179 | LoadDat;
|
---|
| 180 | END;
|
---|
| 181 |
|
---|
| 182 | PROCEDURE TForm1.list_filesDblClick(Sender: TObject);
|
---|
| 183 | VAR
|
---|
| 184 | id:LongWord;
|
---|
| 185 | temp:Tdata;
|
---|
| 186 | BEGIN
|
---|
| 187 | id:=StrToInt(MidStr(list_files.Items.Strings[list_files.ItemIndex],1,5));
|
---|
| 188 | lbl_fileinfo.Caption:=
|
---|
| 189 | 'Filename: '+dat_files[id].FileName+CrLf+
|
---|
| 190 | 'Size: '+FormatFileSize(dat_files[id].Size)+' ('+IntToStr(dat_files[id].Size)+' Bytes)'+CrLf+
|
---|
| 191 | 'Address in .dat: 0x'+IntTohex(dat_files[id].DatAddr,8);
|
---|
| 192 | IF (dat_files[id].FileType AND $02)=0 THEN BEGIN
|
---|
| 193 | temp:=LoadDatFile(id);
|
---|
| 194 | edit_data.Text:=CreateHexString(temp,False);
|
---|
| 195 | Form5.ShowPreview(id);
|
---|
| 196 | END ELSE BEGIN
|
---|
| 197 | edit_data.Text:='Zero byte file.'+CrLf+'Oni will take the data for this file of level0_final.dat/raw';
|
---|
| 198 | END;
|
---|
| 199 | END;
|
---|
| 200 |
|
---|
| 201 | PROCEDURE TForm1.FormCreate(Sender: TObject);
|
---|
| 202 | BEGIN
|
---|
| 203 | Form1.Caption:='Oni Un/Packer '+version;
|
---|
| 204 | Form1.FormResize(Form1);
|
---|
| 205 |
|
---|
| 206 | panel_all.Align:=alClient;
|
---|
| 207 |
|
---|
| 208 | IF FileExists(ExtractFilepath(Application.EXEname)+'\oniunpacker.ini') THEN BEGIN
|
---|
| 209 | AssignFile(AppSettingsFile,ExtractFilepath(Application.EXEname)+'\oniunpacker.ini');
|
---|
| 210 | Reset(AppSettingsFile);
|
---|
| 211 | Read(AppSettingsFile,AppSettings);
|
---|
| 212 | CloseFile(AppSettingsFile);
|
---|
| 213 | END ELSE BEGIN
|
---|
| 214 | AppSettings.DatPath:='D:\Spiele\Oni\GameDataFolder';
|
---|
| 215 | AppSettings.ExtractPath:='C:\Dokumente und Einstellungen\Administrator\Desktop';
|
---|
| 216 | END;
|
---|
| 217 | END;
|
---|
| 218 |
|
---|
| 219 | PROCEDURE TForm1.btn_extractconvertClick(Sender: TObject);
|
---|
| 220 | BEGIN
|
---|
| 221 | Form1.menu_extractfileClick(Form1);
|
---|
| 222 | END;
|
---|
| 223 |
|
---|
| 224 | PROCEDURE TForm1.FormResize(Sender: TObject);
|
---|
| 225 | CONST
|
---|
| 226 | MinWidth:Integer=750;
|
---|
| 227 | MinHeight:Integer=500;
|
---|
| 228 | BEGIN
|
---|
| 229 | IF NOT group_progress.Visible THEN BEGIN
|
---|
| 230 | IF Form1.Width<MinWidth THEN Form1.Width:=MinWidth;
|
---|
| 231 | IF Form1.Height<MinHeight THEN Form1.Height:=MinHeight;
|
---|
| 232 | Form1.statbar.Panels.Items[0].Width:=Form1.Width-200;
|
---|
| 233 | END ELSE BEGIN
|
---|
| 234 | Form1.Width:=400;
|
---|
| 235 | Form1.Height:=120;
|
---|
| 236 | END;
|
---|
| 237 | END;
|
---|
| 238 |
|
---|
| 239 | PROCEDURE TForm1.list_extensionsClick(Sender: TObject);
|
---|
| 240 | VAR
|
---|
| 241 | Extension:String[4];
|
---|
| 242 | i:LongWord;
|
---|
| 243 | BEGIN
|
---|
| 244 | Extension:=MidStr(list_extensions.Items.Strings[list_extensions.ItemIndex],1,4);
|
---|
| 245 | list_files.Items.Clear;
|
---|
| 246 | IF Extension='_All' THEN BEGIN
|
---|
| 247 | FOR i:=0 TO dat_header.Files-1 DO
|
---|
| 248 | list_files.Items.Add(dat_files[i].FileName);
|
---|
| 249 | END ELSE BEGIN
|
---|
| 250 | FOR i:=0 TO dat_header.Files-1 DO
|
---|
| 251 | IF dat_files[i].Extension=Extension THEN
|
---|
| 252 | list_files.Items.Add(dat_files[i].FileName);
|
---|
| 253 | END;
|
---|
| 254 | END;
|
---|
| 255 |
|
---|
| 256 | PROCEDURE TForm1.btn_hexcopyClick(Sender: TObject);
|
---|
| 257 | VAR
|
---|
| 258 | temp:Tdata;
|
---|
| 259 | BEGIN
|
---|
| 260 | temp:=LoadDatFile(StrToInt(MidStr(list_files.Items.Strings[list_files.ItemIndex],1,5)));
|
---|
| 261 | Clipboard.SetTextBuf(PChar(CreateHexString(temp,True)));
|
---|
| 262 | END;
|
---|
| 263 |
|
---|
| 264 | PROCEDURE TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
|
---|
| 265 | BEGIN
|
---|
| 266 | AssignFile(AppSettingsFile,ExtractFilepath(Application.EXEname)+'\oniunpacker.ini');
|
---|
| 267 | IF FileExists(ExtractFilepath(Application.EXEname)+'\oniunpacker.ini') THEN
|
---|
| 268 | Reset(AppSettingsFile)
|
---|
| 269 | ELSE
|
---|
| 270 | Rewrite(AppSettingsFile);
|
---|
| 271 | Write(AppSettingsFile,AppSettings);
|
---|
| 272 | CloseFile(AppSettingsFile);
|
---|
| 273 | END;
|
---|
| 274 |
|
---|
| 275 | PROCEDURE TForm1.Splitter1Moved(Sender: TObject);
|
---|
| 276 | BEGIN
|
---|
| 277 | Form1.list_files.Height:=Form1.Splitter1.Top-23;
|
---|
| 278 | Form1.btn_extractconvert.Top:=Form1.Splitter1.Top-21;
|
---|
| 279 | END;
|
---|
| 280 |
|
---|
| 281 | PROCEDURE TForm1.menu_previewClick(Sender: TObject);
|
---|
| 282 | BEGIN
|
---|
| 283 | Form5.Visible:=NOT Form5.Visible;
|
---|
| 284 | END;
|
---|
| 285 |
|
---|
| 286 | PROCEDURE TForm1.btn_extractcancelClick(Sender: TObject);
|
---|
| 287 | BEGIN
|
---|
| 288 | btn_extractcancel.Caption:='Cancel_';
|
---|
| 289 | END;
|
---|
| 290 |
|
---|
| 291 | PROCEDURE TForm1.menu_exitClick(Sender: TObject);
|
---|
| 292 | BEGIN
|
---|
| 293 | Form1.Close;
|
---|
| 294 | END;
|
---|
| 295 |
|
---|
| 296 | PROCEDURE TForm1.menu_txmpreplaceClick(Sender: TObject);
|
---|
| 297 | BEGIN
|
---|
| 298 | Form7.Visible:=NOT Form7.Visible;
|
---|
| 299 | END;
|
---|
| 300 |
|
---|
| 301 | PROCEDURE TForm1.menu_loaddatClick(Sender: TObject);
|
---|
| 302 | BEGIN
|
---|
| 303 | LoadDat;
|
---|
| 304 | END;
|
---|
| 305 |
|
---|
| 306 | PROCEDURE TForm1.menu_bineditClick(Sender: TObject);
|
---|
| 307 | BEGIN
|
---|
| 308 | Form8.Visible:=NOT Form8.Visible;
|
---|
| 309 | END;
|
---|
| 310 |
|
---|
| 311 | PROCEDURE TForm1.menu_extractfileClick(Sender: TObject);
|
---|
| 312 | VAR
|
---|
| 313 | result:Integer;
|
---|
| 314 | id:LongWord;
|
---|
| 315 | BEGIN
|
---|
| 316 | id:=StrToInt(MidStr(list_files.Items.Strings[list_files.ItemIndex],1,5));
|
---|
| 317 | result:=ExportFile(id,True);
|
---|
| 318 | CASE result OF
|
---|
| 319 | 0{export_noerror}: BEGIN END;
|
---|
| 320 | 1{export_nohandler}: ShowMessage('No export-handler for files with extension '+dat_files[id].Extension+'.');
|
---|
| 321 | 2{export_handlererror}: ShowMessage('Error while running data-handler for '+CrLf+dat_files[id].FileName);
|
---|
| 322 | 3{export_error}: ShowMessage('Error while exporting file '+CrLf+dat_files[id].FileName);
|
---|
| 323 | ELSE
|
---|
| 324 | ShowMessage('Couldn''t export file '+FormatNumber(id,5,'0')+CrLf+'(Unknown error)');
|
---|
| 325 | END;
|
---|
| 326 | Form1.list_files.SetFocus;
|
---|
| 327 | END;
|
---|
| 328 |
|
---|
| 329 | PROCEDURE TForm1.menu_extractlistClick(Sender: TObject);
|
---|
| 330 | VAR
|
---|
| 331 | i:LongWord;
|
---|
| 332 | errors:LongWord;
|
---|
| 333 | oldwidth,oldheight:Integer;
|
---|
| 334 | oldstate:TWindowState;
|
---|
| 335 | BEGIN
|
---|
| 336 | panel_all.Visible:=False;
|
---|
| 337 | group_progress.Visible:=True;
|
---|
| 338 | //FOR i:=0 TO menu.ComponentCount DO menu.Items.Items[i].Enabled:=False;
|
---|
| 339 | oldwidth:=Form1.Width;
|
---|
| 340 | oldheight:=Form1.Height;
|
---|
| 341 | oldstate:=Form1.WindowState;
|
---|
| 342 | Form1.WindowState:=wsNormal;
|
---|
| 343 | Form1.Width:=400;
|
---|
| 344 | Form1.Height:=120;
|
---|
| 345 | group_progress.Left:=0;
|
---|
| 346 | group_progress.Top:=0;
|
---|
| 347 | group_progress.Width:=Form1.Width-8;
|
---|
| 348 | progress.Width:=group_progress.Width-80;
|
---|
| 349 | progress.Max:=list_files.Items.Count;
|
---|
| 350 | btn_extractcancel.Left:=group_progress.Width-65;
|
---|
| 351 | btn_extractcancel.Caption:='Cancel';
|
---|
| 352 | btn_extractcancel.SetFocus;
|
---|
| 353 |
|
---|
| 354 | errors:=0;
|
---|
| 355 | FOR i:=0 TO progress.Max-1 DO BEGIN
|
---|
| 356 | IF ExportFile(StrToInt(MidStr(list_files.Items.Strings[i],1,5)),True)>0 THEN Inc(errors);
|
---|
| 357 | IF (i MOD 25)=0 THEN BEGIN
|
---|
| 358 | lbl_progress.Caption:=IntToStr(i)+'/'+IntToStr(progress.Max);
|
---|
| 359 | progress.Position:=i;
|
---|
| 360 | Application.ProcessMessages;
|
---|
| 361 | IF btn_extractcancel.Caption='Cancel_' THEN BEGIN
|
---|
| 362 | btn_extractcancel.Caption:='Cancel';
|
---|
| 363 | Break;
|
---|
| 364 | END;
|
---|
| 365 | END;
|
---|
| 366 | END;
|
---|
| 367 | IF errors>0 THEN
|
---|
| 368 | ShowMessage(IntToStr(errors)+' errors encountered.');
|
---|
| 369 |
|
---|
| 370 | group_progress.Visible:=False;
|
---|
| 371 | Form1.Width:=oldwidth;
|
---|
| 372 | Form1.Height:=oldheight;
|
---|
| 373 | Form1.WindowState:=oldstate;
|
---|
| 374 | //FOR i:=0 TO menu.ComponentCount DO menu.Items.Items[i].Enabled:=True;
|
---|
| 375 | panel_all.Visible:=True;
|
---|
| 376 | END;
|
---|
| 377 |
|
---|
| 378 | PROCEDURE TForm1.menu_extractallClick(Sender: TObject);
|
---|
| 379 | VAR
|
---|
| 380 | i:LongWord;
|
---|
| 381 | errors:LongWord;
|
---|
| 382 | oldwidth,oldheight:Integer;
|
---|
| 383 | oldstate:TWindowState;
|
---|
| 384 | BEGIN
|
---|
| 385 | panel_all.Visible:=False;
|
---|
| 386 | group_progress.Visible:=True;
|
---|
| 387 | //FOR i:=0 TO menu.ComponentCount DO menu.Items.Items[i].Enabled:=False;
|
---|
| 388 | oldwidth:=Form1.Width;
|
---|
| 389 | oldheight:=Form1.Height;
|
---|
| 390 | oldstate:=Form1.WindowState;
|
---|
| 391 | Form1.WindowState:=wsNormal;
|
---|
| 392 | Form1.Width:=400;
|
---|
| 393 | Form1.Height:=120;
|
---|
| 394 | group_progress.Left:=0;
|
---|
| 395 | group_progress.Top:=0;
|
---|
| 396 | group_progress.Width:=Form1.Width-8;
|
---|
| 397 | progress.Width:=group_progress.Width-80;
|
---|
| 398 | progress.Max:=dat_header.files;
|
---|
| 399 | btn_extractcancel.Left:=group_progress.Width-65;
|
---|
| 400 | btn_extractcancel.Caption:='Cancel';
|
---|
| 401 | btn_extractcancel.SetFocus;
|
---|
| 402 |
|
---|
| 403 | errors:=0;
|
---|
| 404 | FOR i:=0 TO High(dat_files) DO BEGIN
|
---|
| 405 | IF ExportFile(i,True)>0 THEN Inc(errors);
|
---|
| 406 | IF (i MOD 25)=0 THEN BEGIN
|
---|
| 407 | lbl_progress.Caption:=IntToStr(i)+'/'+IntToStr(dat_header.Files);
|
---|
| 408 | progress.Position:=i;
|
---|
| 409 | Application.ProcessMessages;
|
---|
| 410 | IF btn_extractcancel.Caption='Cancel_' THEN BEGIN
|
---|
| 411 | btn_extractcancel.Caption:='Cancel';
|
---|
| 412 | Break;
|
---|
| 413 | END;
|
---|
| 414 | END;
|
---|
| 415 | END;
|
---|
| 416 | IF errors>0 THEN
|
---|
| 417 | ShowMessage(IntToStr(errors)+' errors encountered.');
|
---|
| 418 |
|
---|
| 419 | group_progress.Visible:=False;
|
---|
| 420 | Form1.Width:=oldwidth;
|
---|
| 421 | Form1.Height:=oldheight;
|
---|
| 422 | Form1.WindowState:=oldstate;
|
---|
| 423 | //FOR i:=0 TO menu.ComponentCount DO menu.Items.Items[i].Enabled:=True;
|
---|
| 424 | panel_all.Visible:=True;
|
---|
| 425 | END;
|
---|
| 426 |
|
---|
| 427 | END.
|
---|