source: oup/releases/0.19a/Unit11_extractor.pas@ 864

Last change on this file since 864 was 21, checked in by alloc, 18 years ago
File size: 4.5 KB
Line 
1UNIT Unit11_extractor;
2INTERFACE
3USES
4 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
5 Dialogs, StdCtrls, ExtCtrls, StrUtils, ComCtrls;
6TYPE
7 TForm11 = Class(TForm)
8 group_select: TGroupBox;
9 panel_extension: TPanel;
10 combo_extension: TComboBox;
11 list: TListBox;
12 group_extract: TGroupBox;
13 group_singlefiles: TGroupBox;
14 btn_sel_dat: TButton;
15 btn_sel_datraw: TButton;
16 btn_sel_datraw_convert: TButton;
17 btn_all_dat: TButton;
18 btn_all_datraw: TButton;
19 btn_all_datraw_convert: TButton;
20 group_onefile: TGroupBox;
21 btn_sel_files_toone: TButton;
22 btn_all_files_toone: TButton;
23 group_progress: TGroupBox;
24 progress: TProgressBar;
25 Label1: TLabel;
26 Label2: TLabel;
27 PROCEDURE FormCreate(Sender: TObject);
28 PROCEDURE FormActivate(Sender: TObject);
29 PROCEDURE FormClose(Sender: TObject; var Action: TCloseAction);
30 PROCEDURE FormResize(Sender: TObject);
31 PROCEDURE combo_extensionClick(Sender: TObject);
32 PROCEDURE panel_extensionResize(Sender: TObject);
33 PROCEDURE Extract(Sender: TObject);
34 PRIVATE
35 PUBLIC
36 PROCEDURE Recreatelist;
37 END;
38
39VAR
40 Form11: TForm11;
41
42IMPLEMENTATION
43{$R *.dfm}
44USES Unit1_main, Unit2_functions, Unit3_data;
45
46PROCEDURE TForm11.Recreatelist;
47 VAR
48 i:LongWord;
49 BEGIN
50 combo_extension.Items.Clear;
51 combo_extension.Items.Add('_All files_ ('+IntToStr(dat_header.Files)+')');
52 FOR i:=0 TO dat_header.Extensions-1 DO BEGIN
53 WITH dat_extensionsmap[i] DO BEGIN
54 combo_extension.Items.Add(
55 Extension[3]+Extension[2]+Extension[1]+Extension[0]+' ('+
56 IntToStr(ExtCount)+')');
57 END;
58 END;
59 combo_extension.ItemIndex:=0;
60 combo_extensionClick(Self);
61 END;
62
63PROCEDURE TForm11.panel_extensionResize(Sender: TObject);
64 BEGIN
65 combo_extension.Width:=panel_extension.Width-5;
66 END;
67
68PROCEDURE TForm11.combo_extensionClick(Sender: TObject);
69 VAR
70 Extension:String[4];
71 i:LongWord;
72 BEGIN
73 Extension:=MidStr(combo_extension.Items.Strings[combo_extension.ItemIndex],1,4);
74 list.Items.Clear;
75 IF Extension='_All' THEN BEGIN
76 FOR i:=0 TO dat_header.Files-1 DO
77 IF (dat_files[i].FileType AND $02)=0 THEN
78 list.Items.Add(dat_files[i].FileName);
79 END ELSE BEGIN
80 FOR i:=0 TO dat_header.Files-1 DO
81 IF dat_files[i].Extension=Extension THEN
82 IF (dat_files[i].FileType AND $02)=0 THEN
83 list.Items.Add(dat_files[i].FileName);
84 END;
85 END;
86
87PROCEDURE TForm11.FormResize(Sender: TObject);
88 BEGIN
89 IF Self.Width>=450 THEN BEGIN
90 END ELSE Self.Width:=450;
91 IF Self.Height>=400 THEN BEGIN
92 group_progress.Height:=group_extract.Height-293;
93 END ELSE Self.Height:=400;
94 END;
95
96PROCEDURE TForm11.FormClose(Sender: TObject; var Action: TCloseAction);
97 BEGIN
98 Action:=caFree;
99 Form1.close_window(Self.Name);
100 END;
101
102PROCEDURE TForm11.FormActivate(Sender: TObject);
103 BEGIN
104 Form1.SetActiveWindow(Self.Name);
105 END;
106
107PROCEDURE TForm11.FormCreate(Sender: TObject);
108 BEGIN
109 btn_sel_dat.Caption:= 'Selected files'+CrLf+'(dat contents only)';
110 btn_sel_datraw.Caption:= 'Selected files'+CrLf+'(dat+raw contents)';
111 btn_sel_datraw_convert.Caption:='Selected files'+CrLf+'(dat+raw contents)'+CrLf+'(with convert if possible)';
112 btn_all_dat.Caption:= 'All files in list'+CrLf+'(dat contents only)';
113 btn_all_datraw.Caption:= 'All files in list'+CrLf+'(dat+raw contents)';
114 btn_all_datraw_convert.Caption:='All files in list'+CrLf+'(dat+raw contents)'+CrLf+'(with convert if possible)';
115 btn_sel_files_toone.Caption:= 'Selected files'+CrLf+'(dat contents only)';
116 btn_all_files_toone.Caption:= 'All files in list'+CrLf+'(dat contents only)';
117 END;
118
119PROCEDURE TForm11.Extract(Sender: TObject);
120 VAR
121 sel_only:Boolean;
122 dat_only:Boolean;
123 convert:Boolean;
124 one_file:Boolean;
125 files:LongWord;
126 i:LongWord;
127 fs:TFileStream;
128 ms:TMemoryStream;
129 BEGIN
130 sel_only:=Pos('sel',TButton(Sender).Name)>0;
131 dat_only:=NOT (Pos('datraw',TButton(Sender).Name)>0);
132 convert:=Pos('convert',TButton(Sender).Name)>0;
133 one_file:=Pos('toone',TButton(Sender).Name)>0;
134
135 IF sel_only THEN BEGIN
136 files:=list.SelCount;
137 FOR i:=0 TO list.Count-1 DO BEGIN
138 IF list.Selected[i] THEN BEGIN
139 BEGIN END;
140 END;
141 END;
142 END ELSE BEGIN
143 END;
144 END;
145
146END.
Note: See TracBrowser for help on using the repository browser.