| 1 | 
   | 
 unit Extractor; | 
 
 
 
 
 
 
 
 
 | 2 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 3 | 
   | 
 interface | 
 
 
 
 
 
 
 
 
 | 4 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 5 | 
   | 
 uses | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 6 | 
   | 
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, | 
 
 
 
 
 
 
 
 
 
 
 
 | 7 | 
 < | 
   Dialogs, Template, StdCtrls, ExtCtrls, ComCtrls, Menus, Buttons, StrUtils; | 
 
 
 
 
 
 
 
 
 
 | 7 | 
 > | 
   Dialogs, _TemplateFileList, Menus, StdCtrls, ExtCtrls, Buttons, ComCtrls; | 
 
 
 
 
 
 
 
 
 
 
 
 | 8 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 9 | 
   | 
 type | 
 
 
 
 
 
 
 
 
 
 
 
 | 10 | 
 < | 
   TForm_Extractor = class(TForm_ToolTemplate) | 
 
 
 
 
 
 
 
 
 
 | 10 | 
 > | 
   TForm_Extractor = class(TForm_TemplateFileList) | 
 
 
 
 
 
 
 
 
 
 
 
 | 11 | 
   | 
     group_extract: TGroupBox; | 
 
 
 
 
 
 
 
 
 | 12 | 
 + | 
     label_export_sel: TLabel; | 
 
 
 
 
 
 
 
 
 | 13 | 
 + | 
     label_path: TLabel; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 14 | 
   | 
     check_dat: TCheckBox; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 15 | 
   | 
     check_raw: TCheckBox; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 16 | 
   | 
     check_convert: TCheckBox; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 17 | 
   | 
     radio_selected: TRadioButton; | 
 
 
 
 
 
 
 
 
 
 | 14 | 
 – | 
     label_export_sel: TLabel; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 18 | 
   | 
     radio_all: TRadioButton; | 
 
 
 
 
 
 
 
 
 
 | 16 | 
 – | 
     label_path: TLabel; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 19 | 
   | 
     edit_path: TEdit; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 20 | 
   | 
     btn_path: TButton; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 21 | 
   | 
     btn_export: TButton; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 24 | 
   | 
     lbl_estimated: TLabel; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 25 | 
   | 
     progress: TProgressBar; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 26 | 
   | 
     btn_abort: TButton; | 
 
 
 
 
 
 
 
 
 
 | 25 | 
 – | 
     procedure FormCreate(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 27 | 
   | 
     procedure btn_abortClick(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 | 28 | 
 < | 
     procedure btn_pathClick(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 | 28 | 
 > | 
     procedure FormCreate(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 | 29 | 
   | 
     procedure btn_exportClick(Sender: TObject); | 
 
 
 
 
 
 
 
 
 | 30 | 
 + | 
     procedure btn_pathClick(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 31 | 
   | 
   private | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 32 | 
   | 
   public | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 33 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 34 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 | 33 | 
 – | 
 var | 
 
 
 
 
 
 
 
 
 
 | 34 | 
 – | 
   Form_Extractor: TForm_Extractor; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 35 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 36 | 
   | 
 implementation | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 37 | 
   | 
 {$R *.dfm} | 
 
 
 
 
 
 
 
 
 
 
 
 | 38 | 
 < | 
 uses Main, Functions, Data, OniDataClass, FolderBrowser, Exporters; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 38 | 
 > | 
 uses | 
 
 
 
 
 
 | 39 | 
 > | 
   Data, FolderBrowser, Exporters, _TemplateFile, ConnectionManager, Functions, | 
 
 
 
 
 
 | 40 | 
 > | 
   StrUtils; | 
 
 
 
 
 
 
 
 
 
 
 
 | 41 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 42 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 | 41 | 
 – | 
 procedure TForm_Extractor.FormCreate(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 | 42 | 
 – | 
 begin | 
 
 
 
 
 
 
 
 
 
 | 43 | 
 – | 
   inherited; | 
 
 
 
 
 
 
 
 
 
 | 44 | 
 – | 
   Self.AllowMultiSelect := True; | 
 
 
 
 
 
 
 
 
 
 | 45 | 
 – | 
   edit_path.Text := AppSettings.ExtractPath; | 
 
 
 
 
 
 
 
 
 
 | 46 | 
 – | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 43 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 44 | 
   | 
 procedure TForm_Extractor.btn_abortClick(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 45 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 46 | 
   | 
   ShowMessage('X'); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 47 | 
   | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 48 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 | 53 | 
 – | 
 procedure TForm_Extractor.btn_pathClick(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 | 54 | 
 – | 
 var | 
 
 
 
 
 
 
 
 
 
 | 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 | 
 – | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 49 | 
   | 
 procedure TForm_Extractor.btn_exportClick(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 50 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 51 | 
   | 
   begintime: Double; | 
 
 
 
 
 
 
 
 
 
 
 
 | 52 | 
 < | 
   files:     LongWord; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 53 | 
 < | 
   i, done:   LongWord; | 
 
 
 
 
 
 
 
 
 
 | 52 | 
 > | 
   files:     Integer; | 
 
 
 
 
 
 | 53 | 
 > | 
   i, done:   Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 | 54 | 
   | 
   selonly:   Boolean; | 
 
 
 
 
 
 
 
 
 
 
 
 | 55 | 
 < | 
   fileid:    LongWord; | 
 
 
 
 
 
 
 
 
 
 | 55 | 
 > | 
   fileid:    Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 | 56 | 
   | 
   filename:  String; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 57 | 
   | 
   path:      String; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 58 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 84 | 
   | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 85 | 
   | 
     if (selonly and filelist.Selected[i]) or not selonly then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 86 | 
   | 
     begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 87 | 
 < | 
       fileid := Connection.ExtractFileID(filelist.Items.Strings[i]); | 
 
 
 
 
 
 
 
 
 
 | 87 | 
 > | 
       fileid := ConManager.Connection[ConnectionID].ExtractFileIDOfName(filelist.Items.Strings[i]); | 
 
 
 
 
 
 
 
 
 
 
 
 | 88 | 
   | 
       filename := GetWinFilename(filelist.Items.Strings[i]); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 89 | 
   | 
       if check_dat.Checked then | 
 
 
 
 
 
 
 
 
 
 
 
 | 90 | 
 < | 
         ExportDatFile(Connection, fileid, path + filename); | 
 
 
 
 
 
 
 
 
 
 | 90 | 
 > | 
         ExportDatFile(ConnectionID, fileid, path + filename); | 
 
 
 
 
 
 
 
 
 
 
 
 | 91 | 
   | 
       if check_raw.Checked then | 
 
 
 
 
 
 
 
 
 
 
 
 | 92 | 
 < | 
         ExportRawFiles(Connection, fileid, path + filename); | 
 
 
 
 
 
 
 
 
 
 | 92 | 
 > | 
         ExportRawFiles(ConnectionID, fileid, path + filename); | 
 
 
 
 
 
 
 
 
 
 
 
 | 93 | 
   | 
       if check_convert.Checked then | 
 
 
 
 
 
 
 
 
 
 
 
 | 94 | 
 < | 
         ExportConverted(Connection, fileid, path + filename); | 
 
 
 
 
 
 
 
 
 
 | 94 | 
 > | 
         ExportConverted(ConnectionID, fileid, path + filename); | 
 
 
 
 
 
 
 
 
 
 
 
 | 95 | 
   | 
       Inc(done); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 96 | 
   | 
     end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 97 | 
   | 
     if ((done mod 10) = 0) and (done >= 50) then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 108 | 
   | 
   group_progress.Visible := False; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 109 | 
   | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 110 | 
   | 
  | 
 
 
 
 
 
 
 
 
 | 111 | 
 + | 
 procedure TForm_Extractor.btn_pathClick(Sender: TObject); | 
 
 
 
 
 
 
 
 
 | 112 | 
 + | 
 var | 
 
 
 
 
 
 
 
 
 | 113 | 
 + | 
   fb: TFolderBrowser; | 
 
 
 
 
 
 
 
 
 | 114 | 
 + | 
 begin | 
 
 
 
 
 
 
 
 
 | 115 | 
 + | 
   inherited; | 
 
 
 
 
 
 
 
 
 | 116 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 117 | 
 + | 
   fb := TFolderBrowser.Create(Handle, 'Please select a folder where you want ' + | 
 
 
 
 
 
 
 
 
 | 118 | 
 + | 
         'the files to be stored...', edit_path.Text, False, True); | 
 
 
 
 
 
 
 
 
 | 119 | 
 + | 
   if fb.Execute then | 
 
 
 
 
 
 
 
 
 | 120 | 
 + | 
   begin | 
 
 
 
 
 
 
 
 
 | 121 | 
 + | 
     edit_path.Text := fb.SelectedItem; | 
 
 
 
 
 
 
 
 
 | 122 | 
 + | 
     AppSettings.ExtractPath := edit_path.Text; | 
 
 
 
 
 
 
 
 
 | 123 | 
 + | 
   end; | 
 
 
 
 
 
 
 
 
 | 124 | 
 + | 
   fb.Free; | 
 
 
 
 
 
 
 
 
 | 125 | 
 + | 
 end; | 
 
 
 
 
 
 
 
 
 | 126 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 127 | 
 + | 
 procedure TForm_Extractor.FormCreate(Sender: TObject); | 
 
 
 
 
 
 
 
 
 | 128 | 
 + | 
 begin | 
 
 
 
 
 
 
 
 
 | 129 | 
 + | 
   inherited; | 
 
 
 
 
 
 
 
 
 | 130 | 
 + | 
   Self.AllowMultiSelect := True; | 
 
 
 
 
 
 
 
 
 | 131 | 
 + | 
   edit_path.Text := AppSettings.ExtractPath; | 
 
 
 
 
 
 
 
 
 | 132 | 
 + | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 133 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 134 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 135 | 
   | 
   AddToolListEntry('extractor', 'Extractor', ''); | 
 
 
 
 
 
 
 
 
 
 
 
 | 136 | 
 < | 
 end. | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 136 | 
 > | 
 end. | 
 
 
 
 
 
 | 137 | 
 > | 
  |