Index: oup/current/Tools/Extractor.dfm
===================================================================
--- oup/current/Tools/Extractor.dfm	(revision 72)
+++ oup/current/Tools/Extractor.dfm	(revision 74)
@@ -1,8 +1,12 @@
 inherited Form_Extractor: TForm_Extractor
   Caption = 'Extractor'
+  ClientHeight = 491
+  ExplicitWidth = 500
+  ExplicitHeight = 518
   PixelsPerInch = 96
   TextHeight = 13
   inherited Splitter1: TSplitter
     Left = 483
+    Height = 491
     Align = alRight
     Visible = False
@@ -12,200 +16,198 @@
   end
   inherited panel_files: TPanel
-    Width = 184
-    Align = alClient
-    ExplicitWidth = 184
+    Width = 333
+    Height = 491
+    ExplicitWidth = 333
+    ExplicitHeight = 491
     inherited filelist: TListBox
-      Width = 184
-      ExplicitWidth = 184
+      Width = 333
+      Height = 362
+      ExplicitWidth = 333
+      ExplicitHeight = 362
     end
     inherited panel_extension: TPanel
-      Width = 184
-      ExplicitWidth = 184
+      Width = 333
+      ExplicitWidth = 333
       inherited combo_extension: TComboBox
-        Width = 176
-        ExplicitWidth = 176
+        Width = 325
+        ExplicitWidth = 325
+      end
+      inherited check_zerobyte: TCheckBox
+        Visible = False
       end
       inherited edit_filtername: TEdit
-        Width = 176
-        ExplicitWidth = 176
+        Width = 325
+        ExplicitWidth = 325
       end
     end
   end
   inherited content: TPanel
-    Left = 184
-    Width = 299
-    Align = alRight
-    ExplicitLeft = 184
-    ExplicitWidth = 299
+    Left = 333
+    Width = 150
+    Height = 491
+    ExplicitLeft = 333
+    ExplicitWidth = 150
+    ExplicitHeight = 491
     object group_extract: TGroupBox
-      Left = 3
-      Top = 0
-      Width = 296
-      Height = 423
-      Align = alRight
+      AlignWithMargins = True
+      Left = 6
+      Top = 3
+      Width = 138
+      Height = 374
+      Margins.Left = 6
+      Margins.Right = 6
+      Align = alClient
       Caption = '2. Select extract-method'
       TabOrder = 0
-      object group_singlefiles: TGroupBox
-        AlignWithMargins = True
+      DesignSize = (
+        138
+        374)
+      object label_export_sel: TLabel
+        Left = 7
+        Top = 18
+        Width = 62
+        Height = 20
+        AutoSize = False
+        Caption = 'Export ...'
+      end
+      object label_path: TLabel
+        Left = 7
+        Top = 136
+        Width = 30
+        Height = 18
+        AutoSize = False
+        Caption = 'Path:'
+      end
+      object check_dat: TCheckBox
+        Left = 7
+        Top = 75
+        Width = 121
+        Height = 18
+        Anchors = [akLeft, akTop, akRight]
+        Caption = 'Export .dat-entries'
+        Checked = True
+        State = cbChecked
+        TabOrder = 0
+      end
+      object check_raw: TCheckBox
+        Left = 7
+        Top = 94
+        Width = 121
+        Height = 18
+        Anchors = [akLeft, akTop, akRight]
+        Caption = 'Export .raw-entries'
+        TabOrder = 1
+      end
+      object check_convert: TCheckBox
+        Left = 7
+        Top = 112
+        Width = 121
+        Height = 18
+        Anchors = [akLeft, akTop, akRight]
+        Caption = 'Convert files'
+        TabOrder = 2
+      end
+      object radio_selected: TRadioButton
+        Left = 7
+        Top = 36
+        Width = 113
+        Height = 17
+        Caption = 'selected files'
+        Checked = True
+        TabOrder = 3
+        TabStop = True
+      end
+      object radio_all: TRadioButton
+        Left = 7
+        Top = 52
+        Width = 113
+        Height = 17
+        Caption = 'all files in list'
+        TabOrder = 4
+      end
+      object edit_path: TEdit
+        Left = 36
+        Top = 133
+        Width = 28
+        Height = 21
+        Anchors = [akLeft, akTop, akRight]
+        ReadOnly = True
+        TabOrder = 5
+        Text = 'C:\'
+        OnClick = btn_pathClick
+      end
+      object btn_path: TButton
+        Left = 70
+        Top = 133
+        Width = 62
+        Height = 21
+        Anchors = [akTop, akRight]
+        Caption = 'Select...'
+        TabOrder = 6
+        OnClick = btn_pathClick
+      end
+      object btn_export: TButton
+        Left = 7
+        Top = 180
+        Width = 75
+        Height = 25
+        Caption = 'Export!'
+        TabOrder = 7
+        OnClick = btn_exportClick
+      end
+    end
+    object group_progress: TGroupBox
+      AlignWithMargins = True
+      Left = 6
+      Top = 381
+      Width = 138
+      Height = 104
+      Margins.Left = 6
+      Margins.Top = 1
+      Margins.Right = 6
+      Margins.Bottom = 6
+      Align = alBottom
+      Caption = 'Progress ...'
+      TabOrder = 1
+      Visible = False
+      DesignSize = (
+        138
+        104)
+      object lbl_progress: TLabel
+        Left = 8
+        Top = 40
+        Width = 265
+        Height = 17
+        AutoSize = False
+        Caption = 'Files done: 0/0'
+      end
+      object lbl_estimated: TLabel
+        Left = 8
+        Top = 56
+        Width = 265
+        Height = 17
+        AutoSize = False
+        Caption = 'Estimated finishing time: 00:00:00'
+      end
+      object progress: TProgressBar
         Left = 8
         Top = 16
-        Width = 280
-        Height = 185
-        Margins.Left = 6
-        Margins.Top = 1
-        Margins.Right = 6
-        Align = alTop
-        Caption = 'Write data into single files'
+        Width = 122
+        Height = 17
+        Anchors = [akLeft, akTop, akRight]
+        Smooth = True
         TabOrder = 0
-        object btn_sel_dat: TButton
-          Left = 8
-          Top = 16
-          Width = 129
-          Height = 49
-          Caption = 'Selected files (dat contents only)'
-          TabOrder = 0
-          WordWrap = True
-          OnClick = Extract
-        end
-        object btn_sel_datraw: TButton
-          Left = 8
-          Top = 72
-          Width = 129
-          Height = 49
-          Caption = 'Selected files (dat+raw)'
-          TabOrder = 1
-          WordWrap = True
-          OnClick = Extract
-        end
-        object btn_sel_datraw_convert: TButton
-          Left = 8
-          Top = 128
-          Width = 129
-          Height = 49
-          Caption = 'Selected files (dat+raw) (with convert if possible)'
-          TabOrder = 2
-          WordWrap = True
-          OnClick = Extract
-        end
-        object btn_all_dat: TButton
-          Left = 144
-          Top = 16
-          Width = 129
-          Height = 49
-          Caption = 'All files in list (dat contents only)'
-          TabOrder = 3
-          WordWrap = True
-          OnClick = Extract
-        end
-        object btn_all_datraw: TButton
-          Left = 144
-          Top = 72
-          Width = 129
-          Height = 49
-          Caption = 'All files in list (dat+raw)'
-          TabOrder = 4
-          WordWrap = True
-          OnClick = Extract
-        end
-        object btn_all_datraw_convert: TButton
-          Left = 144
-          Top = 128
-          Width = 129
-          Height = 49
-          BiDiMode = bdLeftToRight
-          Caption = 'All files in list (dat+raw) (with convert if possible)'
-          ParentBiDiMode = False
-          TabOrder = 5
-          WordWrap = True
-          OnClick = Extract
-        end
-      end
-      object group_onefile: TGroupBox
-        AlignWithMargins = True
-        Left = 8
-        Top = 205
-        Width = 280
-        Height = 73
-        Margins.Left = 6
-        Margins.Top = 1
-        Margins.Right = 6
-        Align = alTop
-        Caption = 'Write data into one file'
+      end
+      object btn_abort: TButton
+        Left = 8
+        Top = 72
+        Width = 97
+        Height = 23
+        Caption = 'Abort'
+        Enabled = False
         TabOrder = 1
-        object btn_sel_files_toone: TButton
-          Left = 8
-          Top = 16
-          Width = 129
-          Height = 49
-          Caption = 'Selected files (dat contents only)'
-          TabOrder = 0
-          WordWrap = True
-          OnClick = Extract
-        end
-        object btn_all_files_toone: TButton
-          Left = 144
-          Top = 16
-          Width = 129
-          Height = 49
-          Caption = 'All files in list (dat contents only)'
-          TabOrder = 1
-          WordWrap = True
-          OnClick = Extract
-        end
-      end
-      object group_progress: TGroupBox
-        AlignWithMargins = True
-        Left = 8
-        Top = 282
-        Width = 280
-        Height = 132
-        Margins.Left = 6
-        Margins.Top = 1
-        Margins.Right = 6
-        Margins.Bottom = 7
-        Align = alClient
-        Caption = 'Progress ...'
-        TabOrder = 2
-        Visible = False
-        object lbl_progress: TLabel
-          Left = 8
-          Top = 40
-          Width = 265
-          Height = 17
-          AutoSize = False
-          Caption = 'Files done: 0/0'
-        end
-        object lbl_estimated: TLabel
-          Left = 8
-          Top = 56
-          Width = 265
-          Height = 17
-          AutoSize = False
-          Caption = 'Estimated finishing time: 00:00:00'
-        end
-        object progress: TProgressBar
-          Left = 8
-          Top = 16
-          Width = 265
-          Height = 17
-          Smooth = True
-          TabOrder = 0
-        end
-        object btn_abort: TButton
-          Left = 8
-          Top = 72
-          Width = 97
-          Height = 23
-          Caption = 'Abort'
-          Enabled = False
-          TabOrder = 1
-          OnClick = btn_abortClick
-        end
-      end
-    end
-  end
-  object saved: TSaveDialog [3]
-    Left = 448
-    Top = 328
+        OnClick = btn_abortClick
+      end
+    end
   end
 end
Index: oup/current/Tools/Extractor.pas
===================================================================
--- oup/current/Tools/Extractor.pas	(revision 72)
+++ oup/current/Tools/Extractor.pas	(revision 74)
@@ -3,19 +3,19 @@
 uses
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
-  Dialogs, Template, StdCtrls, ExtCtrls, ComCtrls, Menus, Buttons;
+  Dialogs, Template, StdCtrls, ExtCtrls, ComCtrls, Menus, Buttons, StrUtils;
 
 type
   TForm_Extractor = class(TForm_ToolTemplate)
     group_extract: TGroupBox;
-    group_singlefiles: TGroupBox;
-    btn_sel_dat: TButton;
-    btn_sel_datraw: TButton;
-    btn_sel_datraw_convert: TButton;
-    btn_all_dat: TButton;
-    btn_all_datraw: TButton;
-    btn_all_datraw_convert: TButton;
-    btn_sel_files_toone: TButton;
-    btn_all_files_toone: TButton;
-    group_onefile: TGroupBox;
+    check_dat: TCheckBox;
+    check_raw: TCheckBox;
+    check_convert: TCheckBox;
+    radio_selected: TRadioButton;
+    label_export_sel: TLabel;
+    radio_all: TRadioButton;
+    label_path: TLabel;
+    edit_path: TEdit;
+    btn_path: TButton;
+    btn_export: TButton;
     group_progress: TGroupBox;
     lbl_progress: TLabel;
@@ -23,8 +23,8 @@
     progress: TProgressBar;
     btn_abort: TButton;
-    saved: TSaveDialog;
     procedure FormCreate(Sender: TObject);
-    procedure Extract(Sender: TObject);
     procedure btn_abortClick(Sender: TObject);
+    procedure btn_pathClick(Sender: TObject);
+    procedure btn_exportClick(Sender: TObject);
   private
   public
@@ -36,5 +36,6 @@
 implementation
 {$R *.dfm}
-uses Main, Functions, Data, OniDataClass;
+uses Main, Functions, Data, OniDataClass, FolderBrowser, Exporters;
+
 
 procedure TForm_Extractor.FormCreate(Sender: TObject);
@@ -42,15 +43,5 @@
   inherited;
   Self.AllowMultiSelect := True;
-
-  btn_sel_dat.Caption    := 'Selected files' + CrLf + '(dat contents only)';
-  btn_sel_datraw.Caption := 'Selected files' + CrLf + '(dat+raw contents)';
-  btn_sel_datraw_convert.Caption :=
-    'Selected files' + CrLf + '(dat+raw contents)' + CrLf + '(with convert if possible)';
-  btn_all_dat.Caption    := 'All files in list' + CrLf + '(dat contents only)';
-  btn_all_datraw.Caption := 'All files in list' + CrLf + '(dat+raw contents)';
-  btn_all_datraw_convert.Caption :=
-    'All files in list' + CrLf + '(dat+raw contents)' + CrLf + '(with convert if possible)';
-  btn_sel_files_toone.Caption := 'Selected files' + CrLf + '(dat contents only)';
-  btn_all_files_toone.Caption := 'All files in list' + CrLf + '(dat contents only)';
+  edit_path.Text := AppSettings.ExtractPath;
 end;
 
@@ -60,129 +51,82 @@
 end;
 
-procedure TForm_Extractor.Extract(Sender: TObject);
+procedure TForm_Extractor.btn_pathClick(Sender: TObject);
 var
-  sel_only:  Boolean;
-  dat_only:  Boolean;
-  convert:   Boolean;
-  one_file:  Boolean;
-  settings:  TExportSet;
+  fb: TFolderBrowser;
+begin
+  inherited;
+
+  fb := TFolderBrowser.Create(Handle, 'Please select a folder where you want ' +
+        'the files to be stored...', edit_path.Text, False, True);
+  if fb.Execute then
+  begin
+    edit_path.Text := fb.SelectedItem;
+    AppSettings.ExtractPath := edit_path.Text;
+  end;
+  fb.Free;
+end;
+
+procedure TForm_Extractor.btn_exportClick(Sender: TObject);
+var
+  begintime: Double;
   files:     LongWord;
   i, done:   LongWord;
-  begintime: Double;
+  selonly:   Boolean;
+  fileid:    LongWord;
+  filename:  String;
+  path:      String;
 begin
-  sel_only := Pos('sel', TButton(Sender).Name) > 0;
-  dat_only := not (Pos('datraw', TButton(Sender).Name) > 0);
-  convert  := Pos('convert', TButton(Sender).Name) > 0;
-  one_file := Pos('toone', TButton(Sender).Name) > 0;
-  if dat_only then
-    settings := [DO_dat]
-  else
-    settings := [DO_dat, DO_raw];
-  if convert then
-    settings := settings + [DO_convert];
-  if one_file then
-    settings := settings + [DO_toone];
+  inherited;
+  panel_files.Enabled := False;
+  group_extract.Enabled := False;
+  group_progress.Visible := True;
+
+  path := edit_path.Text;
+  if not EndsText('\', path) then
+    path := path + '\';
+
+  begintime := Time;
+  lbl_estimated.Caption := 'Estimated finishing time: unknown';
   progress.Position := 0;
 
-  if saved.Execute then
+  selonly := radio_selected.Checked;
+
+  if selonly then
+    files := filelist.SelCount
+  else
+    files := filelist.Count;
+
+  lbl_progress.Caption := 'Files done: 0/' + IntToStr(files);
+  progress.Max := files;
+  done  := 0;
+
+  for i := 0 to filelist.Count - 1 do
   begin
-    begintime := Time;
-    group_progress.Visible := True;
-    panel_files.Enabled := False;
-    group_singlefiles.Enabled := False;
-    group_onefile.Enabled := False;
-    lbl_estimated.Caption := 'Estimated finishing time: unknown';
-    if one_file then
+    if (selonly and filelist.Selected[i]) or not selonly then
     begin
-      if FileExists(saved.FileName) then
-      begin
-        if MessageBox(Self.Handle, PChar(
-          'File already exists. Do you want to overwrite it?'), PChar('Warning!'), MB_YESNO) =
-          ID_YES then
-        begin
-          DeleteFile(saved.FileName);
-        end
-        else
-        begin
-          group_progress.Visible    := False;
-          panel_files.Enabled      := True;
-          group_singlefiles.Enabled := True;
-          group_onefile.Enabled     := True;
-          Exit;
-        end;
-      end;
-      i := FileCreate(saved.FileName);
-      FileClose(i);
-      i := 0;
+      fileid := OniDataConnection.ExtractFileID(filelist.Items.Strings[i]);
+      filename := GetWinFilename(filelist.Items.Strings[i]);
+      if check_dat.Checked then
+        ExportDatFile(fileid, path + filename);
+      if check_raw.Checked then
+        ExportRawFiles(fileid, path + filename);
+      if check_convert.Checked then
+        ExportConverted(fileid, path + filename);
+      Inc(done);
     end;
-    if sel_only then
-    begin
-      files := filelist.SelCount;
-      lbl_progress.Caption := 'Files done: 0/' + IntToStr(files);
-      progress.Max := files;
-      done  := 0;
-      for i := 0 to filelist.Count - 1 do
-      begin
-        if filelist.Selected[i] then
-        begin
-          if one_file then
-          begin
-            ExportFile(OniDataConnection.ExtractFileID(
-              filelist.Items.Strings[filelist.ItemIndex]), ExtractFileName(saved.FileName),
-              settings, ExtractFileDir(saved.FileName));
-          end
-          else
-          begin
-            ExportFile(OniDataConnection.ExtractFileID(
-              filelist.Items.Strings[filelist.ItemIndex]), filelist.Items.Strings[i], settings, 'D:');
-          end;
-          Inc(done);
-        end;
-        if ((done mod 10) = 0) and (done >= 50) then
-          lbl_estimated.Caption := 'Estimated finishing time: ' + TimeToStr(
+    if ((done mod 10) = 0) and (done >= 50) then
+      lbl_estimated.Caption := 'Estimated finishing time: ' + TimeToStr(
             (Time - begintime) / done * files + begintime);
-        if (i mod 10) = 0 then
-        begin
-          progress.Position    := done;
-          lbl_progress.Caption := 'Files done: ' + IntToStr(done) + '/' + IntToStr(files);
-          Application.ProcessMessages;
-        end;
-      end;
-    end
-    else
-    begin
-      files := filelist.Count;
-      lbl_progress.Caption := 'Files done: 0/' + IntToStr(files);
-      progress.Max := files;
-      for i := 0 to filelist.Count - 1 do
-      begin
-        if one_file then
-        begin
-          ExportFile(OniDataConnection.ExtractFileID(
-            filelist.Items.Strings[filelist.ItemIndex]), ExtractFileName(saved.FileName),
-            settings, ExtractFileDir(saved.FileName));
-        end
-        else
-        begin
-          ExportFile(OniDataConnection.ExtractFileID(
-            filelist.Items.Strings[filelist.ItemIndex]), filelist.Items.Strings[i], settings, 'D:');
-        end;
-        if ((i mod 10) = 0) and (i >= 50) then
-          lbl_estimated.Caption := 'Estimated finishing time: ' + TimeToStr(
-            (Time - begintime) / i * files + begintime);
-        if (i mod 5) = 0 then
-        begin
-          progress.Position    := i;
-          lbl_progress.Caption := 'Files done: ' + IntToStr(i) + '/' + IntToStr(files);
-          Application.ProcessMessages;
-        end;
-      end;
-    end;
-    group_progress.Visible    := False;
-    panel_files.Enabled      := True;
-    group_singlefiles.Enabled := True;
-    group_onefile.Enabled     := True;
+
+    progress.Position    := done;
+    lbl_progress.Caption := 'Files done: ' + IntToStr(done) + '/' + IntToStr(files);
+    Application.ProcessMessages;
   end;
+
+  panel_files.Enabled := True;
+  group_extract.Enabled := True;
+  group_progress.Visible := False;
 end;
+
 
 begin
