Changeset 74 for oup/current/Tools
- Timestamp:
- Jan 11, 2007, 11:45:20 PM (18 years ago)
- Location:
- oup/current/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
oup/current/Tools/Extractor.dfm
r46 r74 1 1 inherited Form_Extractor: TForm_Extractor 2 2 Caption = 'Extractor' 3 ClientHeight = 491 4 ExplicitWidth = 500 5 ExplicitHeight = 518 3 6 PixelsPerInch = 96 4 7 TextHeight = 13 5 8 inherited Splitter1: TSplitter 6 9 Left = 483 10 Height = 491 7 11 Align = alRight 8 12 Visible = False … … 12 16 end 13 17 inherited panel_files: TPanel 14 Width = 184 15 Align = alClient 16 ExplicitWidth = 184 18 Width = 333 19 Height = 491 20 ExplicitWidth = 333 21 ExplicitHeight = 491 17 22 inherited filelist: TListBox 18 Width = 184 19 ExplicitWidth = 184 23 Width = 333 24 Height = 362 25 ExplicitWidth = 333 26 ExplicitHeight = 362 20 27 end 21 28 inherited panel_extension: TPanel 22 Width = 18423 ExplicitWidth = 18429 Width = 333 30 ExplicitWidth = 333 24 31 inherited combo_extension: TComboBox 25 Width = 176 26 ExplicitWidth = 176 32 Width = 325 33 ExplicitWidth = 325 34 end 35 inherited check_zerobyte: TCheckBox 36 Visible = False 27 37 end 28 38 inherited edit_filtername: TEdit 29 Width = 17630 ExplicitWidth = 17639 Width = 325 40 ExplicitWidth = 325 31 41 end 32 42 end 33 43 end 34 44 inherited content: TPanel 35 Left = 184 36 Width = 299 37 Align = alRight 38 ExplicitLeft = 184 39 ExplicitWidth = 299 45 Left = 333 46 Width = 150 47 Height = 491 48 ExplicitLeft = 333 49 ExplicitWidth = 150 50 ExplicitHeight = 491 40 51 object group_extract: TGroupBox 41 Left = 3 42 Top = 0 43 Width = 296 44 Height = 423 45 Align = alRight 52 AlignWithMargins = True 53 Left = 6 54 Top = 3 55 Width = 138 56 Height = 374 57 Margins.Left = 6 58 Margins.Right = 6 59 Align = alClient 46 60 Caption = '2. Select extract-method' 47 61 TabOrder = 0 48 object group_singlefiles: TGroupBox 49 AlignWithMargins = True 62 DesignSize = ( 63 138 64 374) 65 object label_export_sel: TLabel 66 Left = 7 67 Top = 18 68 Width = 62 69 Height = 20 70 AutoSize = False 71 Caption = 'Export ...' 72 end 73 object label_path: TLabel 74 Left = 7 75 Top = 136 76 Width = 30 77 Height = 18 78 AutoSize = False 79 Caption = 'Path:' 80 end 81 object check_dat: TCheckBox 82 Left = 7 83 Top = 75 84 Width = 121 85 Height = 18 86 Anchors = [akLeft, akTop, akRight] 87 Caption = 'Export .dat-entries' 88 Checked = True 89 State = cbChecked 90 TabOrder = 0 91 end 92 object check_raw: TCheckBox 93 Left = 7 94 Top = 94 95 Width = 121 96 Height = 18 97 Anchors = [akLeft, akTop, akRight] 98 Caption = 'Export .raw-entries' 99 TabOrder = 1 100 end 101 object check_convert: TCheckBox 102 Left = 7 103 Top = 112 104 Width = 121 105 Height = 18 106 Anchors = [akLeft, akTop, akRight] 107 Caption = 'Convert files' 108 TabOrder = 2 109 end 110 object radio_selected: TRadioButton 111 Left = 7 112 Top = 36 113 Width = 113 114 Height = 17 115 Caption = 'selected files' 116 Checked = True 117 TabOrder = 3 118 TabStop = True 119 end 120 object radio_all: TRadioButton 121 Left = 7 122 Top = 52 123 Width = 113 124 Height = 17 125 Caption = 'all files in list' 126 TabOrder = 4 127 end 128 object edit_path: TEdit 129 Left = 36 130 Top = 133 131 Width = 28 132 Height = 21 133 Anchors = [akLeft, akTop, akRight] 134 ReadOnly = True 135 TabOrder = 5 136 Text = 'C:\' 137 OnClick = btn_pathClick 138 end 139 object btn_path: TButton 140 Left = 70 141 Top = 133 142 Width = 62 143 Height = 21 144 Anchors = [akTop, akRight] 145 Caption = 'Select...' 146 TabOrder = 6 147 OnClick = btn_pathClick 148 end 149 object btn_export: TButton 150 Left = 7 151 Top = 180 152 Width = 75 153 Height = 25 154 Caption = 'Export!' 155 TabOrder = 7 156 OnClick = btn_exportClick 157 end 158 end 159 object group_progress: TGroupBox 160 AlignWithMargins = True 161 Left = 6 162 Top = 381 163 Width = 138 164 Height = 104 165 Margins.Left = 6 166 Margins.Top = 1 167 Margins.Right = 6 168 Margins.Bottom = 6 169 Align = alBottom 170 Caption = 'Progress ...' 171 TabOrder = 1 172 Visible = False 173 DesignSize = ( 174 138 175 104) 176 object lbl_progress: TLabel 177 Left = 8 178 Top = 40 179 Width = 265 180 Height = 17 181 AutoSize = False 182 Caption = 'Files done: 0/0' 183 end 184 object lbl_estimated: TLabel 185 Left = 8 186 Top = 56 187 Width = 265 188 Height = 17 189 AutoSize = False 190 Caption = 'Estimated finishing time: 00:00:00' 191 end 192 object progress: TProgressBar 50 193 Left = 8 51 194 Top = 16 52 Width = 280 53 Height = 185 54 Margins.Left = 6 55 Margins.Top = 1 56 Margins.Right = 6 57 Align = alTop 58 Caption = 'Write data into single files' 195 Width = 122 196 Height = 17 197 Anchors = [akLeft, akTop, akRight] 198 Smooth = True 59 199 TabOrder = 0 60 object btn_sel_dat: TButton 61 Left = 8 62 Top = 16 63 Width = 129 64 Height = 49 65 Caption = 'Selected files (dat contents only)' 66 TabOrder = 0 67 WordWrap = True 68 OnClick = Extract 69 end 70 object btn_sel_datraw: TButton 71 Left = 8 72 Top = 72 73 Width = 129 74 Height = 49 75 Caption = 'Selected files (dat+raw)' 76 TabOrder = 1 77 WordWrap = True 78 OnClick = Extract 79 end 80 object btn_sel_datraw_convert: TButton 81 Left = 8 82 Top = 128 83 Width = 129 84 Height = 49 85 Caption = 'Selected files (dat+raw) (with convert if possible)' 86 TabOrder = 2 87 WordWrap = True 88 OnClick = Extract 89 end 90 object btn_all_dat: TButton 91 Left = 144 92 Top = 16 93 Width = 129 94 Height = 49 95 Caption = 'All files in list (dat contents only)' 96 TabOrder = 3 97 WordWrap = True 98 OnClick = Extract 99 end 100 object btn_all_datraw: TButton 101 Left = 144 102 Top = 72 103 Width = 129 104 Height = 49 105 Caption = 'All files in list (dat+raw)' 106 TabOrder = 4 107 WordWrap = True 108 OnClick = Extract 109 end 110 object btn_all_datraw_convert: TButton 111 Left = 144 112 Top = 128 113 Width = 129 114 Height = 49 115 BiDiMode = bdLeftToRight 116 Caption = 'All files in list (dat+raw) (with convert if possible)' 117 ParentBiDiMode = False 118 TabOrder = 5 119 WordWrap = True 120 OnClick = Extract 121 end 122 end 123 object group_onefile: TGroupBox 124 AlignWithMargins = True 125 Left = 8 126 Top = 205 127 Width = 280 128 Height = 73 129 Margins.Left = 6 130 Margins.Top = 1 131 Margins.Right = 6 132 Align = alTop 133 Caption = 'Write data into one file' 200 end 201 object btn_abort: TButton 202 Left = 8 203 Top = 72 204 Width = 97 205 Height = 23 206 Caption = 'Abort' 207 Enabled = False 134 208 TabOrder = 1 135 object btn_sel_files_toone: TButton 136 Left = 8 137 Top = 16 138 Width = 129 139 Height = 49 140 Caption = 'Selected files (dat contents only)' 141 TabOrder = 0 142 WordWrap = True 143 OnClick = Extract 144 end 145 object btn_all_files_toone: TButton 146 Left = 144 147 Top = 16 148 Width = 129 149 Height = 49 150 Caption = 'All files in list (dat contents only)' 151 TabOrder = 1 152 WordWrap = True 153 OnClick = Extract 154 end 155 end 156 object group_progress: TGroupBox 157 AlignWithMargins = True 158 Left = 8 159 Top = 282 160 Width = 280 161 Height = 132 162 Margins.Left = 6 163 Margins.Top = 1 164 Margins.Right = 6 165 Margins.Bottom = 7 166 Align = alClient 167 Caption = 'Progress ...' 168 TabOrder = 2 169 Visible = False 170 object lbl_progress: TLabel 171 Left = 8 172 Top = 40 173 Width = 265 174 Height = 17 175 AutoSize = False 176 Caption = 'Files done: 0/0' 177 end 178 object lbl_estimated: TLabel 179 Left = 8 180 Top = 56 181 Width = 265 182 Height = 17 183 AutoSize = False 184 Caption = 'Estimated finishing time: 00:00:00' 185 end 186 object progress: TProgressBar 187 Left = 8 188 Top = 16 189 Width = 265 190 Height = 17 191 Smooth = True 192 TabOrder = 0 193 end 194 object btn_abort: TButton 195 Left = 8 196 Top = 72 197 Width = 97 198 Height = 23 199 Caption = 'Abort' 200 Enabled = False 201 TabOrder = 1 202 OnClick = btn_abortClick 203 end 204 end 205 end 206 end 207 object saved: TSaveDialog [3] 208 Left = 448 209 Top = 328 209 OnClick = btn_abortClick 210 end 211 end 210 212 end 211 213 end -
oup/current/Tools/Extractor.pas
r46 r74 3 3 uses 4 4 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 5 Dialogs, Template, StdCtrls, ExtCtrls, ComCtrls, Menus, Buttons ;5 Dialogs, Template, StdCtrls, ExtCtrls, ComCtrls, Menus, Buttons, StrUtils; 6 6 7 7 type 8 8 TForm_Extractor = class(TForm_ToolTemplate) 9 9 group_extract: TGroupBox; 10 group_singlefiles: TGroupBox;11 btn_sel_dat: TButton;12 btn_sel_datraw: TButton;13 btn_sel_datraw_convert: TButton;14 btn_all_dat: TButton;15 btn_all_datraw: TButton;16 btn_all_datraw_convert: TButton;17 btn_sel_files_toone: TButton;18 btn_ all_files_toone: TButton;19 group_onefile: TGroupBox;10 check_dat: TCheckBox; 11 check_raw: TCheckBox; 12 check_convert: TCheckBox; 13 radio_selected: TRadioButton; 14 label_export_sel: TLabel; 15 radio_all: TRadioButton; 16 label_path: TLabel; 17 edit_path: TEdit; 18 btn_path: TButton; 19 btn_export: TButton; 20 20 group_progress: TGroupBox; 21 21 lbl_progress: TLabel; … … 23 23 progress: TProgressBar; 24 24 btn_abort: TButton; 25 saved: TSaveDialog;26 25 procedure FormCreate(Sender: TObject); 27 procedure Extract(Sender: TObject);28 26 procedure btn_abortClick(Sender: TObject); 27 procedure btn_pathClick(Sender: TObject); 28 procedure btn_exportClick(Sender: TObject); 29 29 private 30 30 public … … 36 36 implementation 37 37 {$R *.dfm} 38 uses Main, Functions, Data, OniDataClass; 38 uses Main, Functions, Data, OniDataClass, FolderBrowser, Exporters; 39 39 40 40 41 procedure TForm_Extractor.FormCreate(Sender: TObject); … … 42 43 inherited; 43 44 Self.AllowMultiSelect := True; 44 45 btn_sel_dat.Caption := 'Selected files' + CrLf + '(dat contents only)'; 46 btn_sel_datraw.Caption := 'Selected files' + CrLf + '(dat+raw contents)'; 47 btn_sel_datraw_convert.Caption := 48 'Selected files' + CrLf + '(dat+raw contents)' + CrLf + '(with convert if possible)'; 49 btn_all_dat.Caption := 'All files in list' + CrLf + '(dat contents only)'; 50 btn_all_datraw.Caption := 'All files in list' + CrLf + '(dat+raw contents)'; 51 btn_all_datraw_convert.Caption := 52 'All files in list' + CrLf + '(dat+raw contents)' + CrLf + '(with convert if possible)'; 53 btn_sel_files_toone.Caption := 'Selected files' + CrLf + '(dat contents only)'; 54 btn_all_files_toone.Caption := 'All files in list' + CrLf + '(dat contents only)'; 45 edit_path.Text := AppSettings.ExtractPath; 55 46 end; 56 47 … … 60 51 end; 61 52 62 procedure TForm_Extractor. Extract(Sender: TObject);53 procedure TForm_Extractor.btn_pathClick(Sender: TObject); 63 54 var 64 sel_only: Boolean; 65 dat_only: Boolean; 66 convert: Boolean; 67 one_file: Boolean; 68 settings: TExportSet; 55 fb: TFolderBrowser; 56 begin 57 inherited; 58 59 fb := TFolderBrowser.Create(Handle, 'Please select a folder where you want ' + 60 'the files to be stored...', edit_path.Text, False, True); 61 if fb.Execute then 62 begin 63 edit_path.Text := fb.SelectedItem; 64 AppSettings.ExtractPath := edit_path.Text; 65 end; 66 fb.Free; 67 end; 68 69 procedure TForm_Extractor.btn_exportClick(Sender: TObject); 70 var 71 begintime: Double; 69 72 files: LongWord; 70 73 i, done: LongWord; 71 begintime: Double; 74 selonly: Boolean; 75 fileid: LongWord; 76 filename: String; 77 path: String; 72 78 begin 73 sel_only := Pos('sel', TButton(Sender).Name) > 0; 74 dat_only := not (Pos('datraw', TButton(Sender).Name) > 0); 75 convert := Pos('convert', TButton(Sender).Name) > 0; 76 one_file := Pos('toone', TButton(Sender).Name) > 0; 77 if dat_only then 78 settings := [DO_dat] 79 else 80 settings := [DO_dat, DO_raw]; 81 if convert then 82 settings := settings + [DO_convert]; 83 if one_file then 84 settings := settings + [DO_toone]; 79 inherited; 80 panel_files.Enabled := False; 81 group_extract.Enabled := False; 82 group_progress.Visible := True; 83 84 path := edit_path.Text; 85 if not EndsText('\', path) then 86 path := path + '\'; 87 88 begintime := Time; 89 lbl_estimated.Caption := 'Estimated finishing time: unknown'; 85 90 progress.Position := 0; 86 91 87 if saved.Execute then 92 selonly := radio_selected.Checked; 93 94 if selonly then 95 files := filelist.SelCount 96 else 97 files := filelist.Count; 98 99 lbl_progress.Caption := 'Files done: 0/' + IntToStr(files); 100 progress.Max := files; 101 done := 0; 102 103 for i := 0 to filelist.Count - 1 do 88 104 begin 89 begintime := Time; 90 group_progress.Visible := True; 91 panel_files.Enabled := False; 92 group_singlefiles.Enabled := False; 93 group_onefile.Enabled := False; 94 lbl_estimated.Caption := 'Estimated finishing time: unknown'; 95 if one_file then 105 if (selonly and filelist.Selected[i]) or not selonly then 96 106 begin 97 if FileExists(saved.FileName) then 98 begin 99 if MessageBox(Self.Handle, PChar( 100 'File already exists. Do you want to overwrite it?'), PChar('Warning!'), MB_YESNO) = 101 ID_YES then 102 begin 103 DeleteFile(saved.FileName); 104 end 105 else 106 begin 107 group_progress.Visible := False; 108 panel_files.Enabled := True; 109 group_singlefiles.Enabled := True; 110 group_onefile.Enabled := True; 111 Exit; 112 end; 113 end; 114 i := FileCreate(saved.FileName); 115 FileClose(i); 116 i := 0; 107 fileid := OniDataConnection.ExtractFileID(filelist.Items.Strings[i]); 108 filename := GetWinFilename(filelist.Items.Strings[i]); 109 if check_dat.Checked then 110 ExportDatFile(fileid, path + filename); 111 if check_raw.Checked then 112 ExportRawFiles(fileid, path + filename); 113 if check_convert.Checked then 114 ExportConverted(fileid, path + filename); 115 Inc(done); 117 116 end; 118 if sel_only then 119 begin 120 files := filelist.SelCount; 121 lbl_progress.Caption := 'Files done: 0/' + IntToStr(files); 122 progress.Max := files; 123 done := 0; 124 for i := 0 to filelist.Count - 1 do 125 begin 126 if filelist.Selected[i] then 127 begin 128 if one_file then 129 begin 130 ExportFile(OniDataConnection.ExtractFileID( 131 filelist.Items.Strings[filelist.ItemIndex]), ExtractFileName(saved.FileName), 132 settings, ExtractFileDir(saved.FileName)); 133 end 134 else 135 begin 136 ExportFile(OniDataConnection.ExtractFileID( 137 filelist.Items.Strings[filelist.ItemIndex]), filelist.Items.Strings[i], settings, 'D:'); 138 end; 139 Inc(done); 140 end; 141 if ((done mod 10) = 0) and (done >= 50) then 142 lbl_estimated.Caption := 'Estimated finishing time: ' + TimeToStr( 117 if ((done mod 10) = 0) and (done >= 50) then 118 lbl_estimated.Caption := 'Estimated finishing time: ' + TimeToStr( 143 119 (Time - begintime) / done * files + begintime); 144 if (i mod 10) = 0 then 145 begin 146 progress.Position := done; 147 lbl_progress.Caption := 'Files done: ' + IntToStr(done) + '/' + IntToStr(files); 148 Application.ProcessMessages; 149 end; 150 end; 151 end 152 else 153 begin 154 files := filelist.Count; 155 lbl_progress.Caption := 'Files done: 0/' + IntToStr(files); 156 progress.Max := files; 157 for i := 0 to filelist.Count - 1 do 158 begin 159 if one_file then 160 begin 161 ExportFile(OniDataConnection.ExtractFileID( 162 filelist.Items.Strings[filelist.ItemIndex]), ExtractFileName(saved.FileName), 163 settings, ExtractFileDir(saved.FileName)); 164 end 165 else 166 begin 167 ExportFile(OniDataConnection.ExtractFileID( 168 filelist.Items.Strings[filelist.ItemIndex]), filelist.Items.Strings[i], settings, 'D:'); 169 end; 170 if ((i mod 10) = 0) and (i >= 50) then 171 lbl_estimated.Caption := 'Estimated finishing time: ' + TimeToStr( 172 (Time - begintime) / i * files + begintime); 173 if (i mod 5) = 0 then 174 begin 175 progress.Position := i; 176 lbl_progress.Caption := 'Files done: ' + IntToStr(i) + '/' + IntToStr(files); 177 Application.ProcessMessages; 178 end; 179 end; 180 end; 181 group_progress.Visible := False; 182 panel_files.Enabled := True; 183 group_singlefiles.Enabled := True; 184 group_onefile.Enabled := True; 120 121 progress.Position := done; 122 lbl_progress.Caption := 'Files done: ' + IntToStr(done) + '/' + IntToStr(files); 123 Application.ProcessMessages; 185 124 end; 125 126 panel_files.Enabled := True; 127 group_extract.Enabled := True; 128 group_progress.Visible := False; 186 129 end; 130 187 131 188 132 begin
Note:
See TracChangeset
for help on using the changeset viewer.