Changeset 6963


Ignore:
Timestamp:
11/08/11 11:01:33 (11 years ago)
Author:
gkronber
Message:

#1671 implemented quick fix for CSV importer and improved the import data dialog.

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/DataAnalysisProblemView.Designer.cs

    r5832 r6963  
    8080      // openFileDialog
    8181      //
    82       this.openFileDialog.FileName = "openFileDialog";
     82      this.openFileDialog.Filter = "CSV files|*.csv|Text files|*.txt|All files|*.*";
     83      this.openFileDialog.Title = "Import data...";
    8384      //
    8485      // DataAnalysisProblemView
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/TableFileParser.cs

    r6776 r6963  
    156156        } else if (OccurrencesOf(charCounts, ',') > 10) {
    157157          // no points and many commas
    158           int countCommaNonDigitPairs = 0;
    159           for (int i = 0; i < charsRead - 1; i++) {
    160             if (buffer[i] == ',' && !Char.IsDigit(buffer[i + 1])) {
    161               countCommaNonDigitPairs++;
     158          // count the number of tokens (chains of only digits and commas) that contain multiple comma characters
     159          int tokensWithMultipleCommas = 0;
     160          for (int i = 0; i < charsRead; i++) {
     161            int nCommas = 0;
     162            while (i < charsRead && (buffer[i] == ',' || Char.IsDigit(buffer[i]))) {
     163              if (buffer[i] == ',') nCommas++;
     164              i++;
    162165            }
    163           }
    164           if (countCommaNonDigitPairs > 10) {
     166            if (nCommas > 2) tokensWithMultipleCommas++;
     167          }
     168          if (tokensWithMultipleCommas > 1) {
    165169            // English format (only integer values) with ',' as separator
    166170            numberFormat = NumberFormatInfo.InvariantInfo;
Note: See TracChangeset for help on using the changeset viewer.