Changeset 7851
- Timestamp:
- 05/21/12 11:13:32 (13 years ago)
- Location:
- trunk/sources
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3
-
Property
svn:ignore
set to
Plugin.cs
obj
-
Property
svn:ignore
set to
-
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/ClassificationInstanceProvider.cs
r7849 r7851 23 23 using System.Collections; 24 24 using System.Collections.Generic; 25 using System.Globalization;26 25 using System.IO; 27 26 using System.Linq; … … 32 31 public abstract class ClassificationInstanceProvider : IProblemInstanceProvider<IClassificationProblemData> { 33 32 public IClassificationProblemData LoadData(string path) { 34 NumberFormatInfo numberFormat;35 DateTimeFormatInfo dateFormat;36 char separator;37 TableFileParser.DetermineFileFormat(new FileStream(path, FileMode.Open), out numberFormat, out dateFormat, out separator);38 39 IClassificationProblemData claData = LoadData(new FileStream(path, FileMode.Open), numberFormat, dateFormat, separator);40 int pos = path.LastIndexOf('\\');41 if (pos < 0)42 claData.Name = path;43 else {44 pos++;45 claData.Name = path.Substring(pos, path.Length - pos);46 }47 48 return claData;49 }50 51 protected IClassificationProblemData LoadData(Stream stream, NumberFormatInfo numberFormat, DateTimeFormatInfo dateFormat, char separator) {52 33 TableFileParser csvFileParser = new TableFileParser(); 53 34 54 csvFileParser.Parse( stream, numberFormat, dateFormat, separator);35 csvFileParser.Parse(path); 55 36 56 37 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values); … … 65 46 claData.TestPartition.Start = trainingPartEnd; 66 47 claData.TestPartition.End = csvFileParser.Rows; 48 int pos = path.LastIndexOf('\\'); 49 if (pos < 0) 50 claData.Name = path; 51 else { 52 pos++; 53 claData.Name = path.Substring(pos, path.Length - pos); 54 } 55 67 56 return claData; 68 57 } -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/ResourceClassificationInstanceProvider.cs
r7849 r7851 64 64 } 65 65 66 IClassificationProblemData claData;66 TableFileParser csvFileParser = new TableFileParser(); 67 67 using (Stream stream = instancesZipFile.GetInputStream(entry)) { 68 c laData = LoadData(stream, numberFormat, dateFormat, separator);68 csvFileParser.Parse(stream, numberFormat, dateFormat, separator); 69 69 } 70 71 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values); 72 string targetVar = csvFileParser.VariableNames.Last(); 73 IEnumerable<string> allowedInputVars = csvFileParser.VariableNames.Where(x => !x.Equals(targetVar)); 74 75 ClassificationProblemData claData = new ClassificationProblemData(dataset, allowedInputVars, targetVar); 76 77 int trainingPartEnd = csvFileParser.Rows * 2 / 3; 78 claData.TrainingPartition.Start = 0; 79 claData.TrainingPartition.End = trainingPartEnd; 80 claData.TestPartition.Start = trainingPartEnd; 81 claData.TestPartition.End = csvFileParser.Rows; 82 70 83 claData.Name = descriptor.Name; 71 84 claData.Description = descriptor.Description; -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Properties
-
Property
svn:ignore
set to
AssemblyInfo.cs
-
Property
svn:ignore
set to
-
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/RegressionInstanceProvider.cs
r7849 r7851 23 23 using System.Collections; 24 24 using System.Collections.Generic; 25 using System.Globalization;26 25 using System.IO; 27 26 using System.Linq; … … 33 32 34 33 public IRegressionProblemData LoadData(string path) { 35 NumberFormatInfo numberFormat; 36 DateTimeFormatInfo dateFormat; 37 char separator; 38 TableFileParser.DetermineFileFormat(path, out numberFormat, out dateFormat, out separator); 34 TableFileParser csvFileParser = new TableFileParser(); 35 csvFileParser.Parse(path); 39 36 40 IRegressionProblemData regData = LoadData(new FileStream(path, FileMode.Open), numberFormat, dateFormat, separator); 37 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values); 38 string targetVar = csvFileParser.VariableNames.Last(); 39 IEnumerable<string> allowedInputVars = csvFileParser.VariableNames.Where(x => !x.Equals(targetVar)); 40 41 IRegressionProblemData regData = new RegressionProblemData(dataset, allowedInputVars, targetVar); 42 43 int trainingPartEnd = csvFileParser.Rows * 2 / 3; 44 regData.TrainingPartition.Start = 0; 45 regData.TrainingPartition.End = trainingPartEnd; 46 regData.TestPartition.Start = trainingPartEnd; 47 regData.TestPartition.End = csvFileParser.Rows; 41 48 42 49 int pos = path.LastIndexOf('\\'); … … 47 54 regData.Name = path.Substring(pos, path.Length - pos); 48 55 } 49 return regData;50 }51 52 protected IRegressionProblemData LoadData(Stream stream, NumberFormatInfo numberFormat, DateTimeFormatInfo dateFormat, char separator) {53 TableFileParser csvFileParser = new TableFileParser();54 55 csvFileParser.Parse(stream, numberFormat, dateFormat, separator);56 57 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);58 string targetVar = csvFileParser.VariableNames.Last();59 IEnumerable<string> allowedInputVars = csvFileParser.VariableNames.Where(x => !x.Equals(targetVar));60 61 RegressionProblemData regData = new RegressionProblemData(dataset, allowedInputVars, targetVar);62 63 int trainingPartEnd = csvFileParser.Rows * 2 / 3;64 regData.TrainingPartition.Start = 0;65 regData.TrainingPartition.End = trainingPartEnd;66 regData.TestPartition.Start = trainingPartEnd;67 regData.TestPartition.End = csvFileParser.Rows;68 69 56 return regData; 70 57 } -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/ResourceRegressionInstanceProvider.cs
r7849 r7851 64 64 } 65 65 66 IRegressionProblemData regData;66 TableFileParser csvFileParser = new TableFileParser(); 67 67 using (Stream stream = instancesZipFile.GetInputStream(entry)) { 68 regData = LoadData(stream, numberFormat, dateFormat, separator);68 csvFileParser.Parse(stream, numberFormat, dateFormat, separator); 69 69 } 70 71 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values); 72 string targetVar = csvFileParser.VariableNames.Last(); 73 IEnumerable<string> allowedInputVars = csvFileParser.VariableNames.Where(x => !x.Equals(targetVar)); 74 75 IRegressionProblemData regData = new RegressionProblemData(dataset, allowedInputVars, targetVar); 76 77 int trainingPartEnd = csvFileParser.Rows * 2 / 3; 78 regData.TrainingPartition.Start = 0; 79 regData.TrainingPartition.End = trainingPartEnd; 80 regData.TestPartition.Start = trainingPartEnd; 81 regData.TestPartition.End = csvFileParser.Rows; 70 82 71 83 regData.Name = descriptor.Name; -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/TableFileParser.cs
r7849 r7851 75 75 } 76 76 77 /// <summary> 78 /// Parses a file and determines the format first 79 /// </summary> 80 /// <param name="fileName">file which is parsed</param> 81 public void Parse(string fileName) { 82 NumberFormatInfo numberFormat; 83 DateTimeFormatInfo dateTimeFormatInfo; 84 char separator; 85 DetermineFileFormat(new FileStream(fileName, FileMode.Open), out numberFormat, out dateTimeFormatInfo, out separator); 86 Parse(new FileStream(fileName, FileMode.Open), numberFormat, dateTimeFormatInfo, separator); 87 } 88 89 /// <summary> 90 /// Parses a file with the given formats 91 /// </summary> 92 /// <param name="fileName">file which is parsed</param> 93 /// <param name="numberFormat">Format of numbers</param> 94 /// <param name="dateTimeFormatInfo">Format of datetime</param> 95 /// <param name="separator">defines the separator</param> 77 96 public void Parse(string fileName, NumberFormatInfo numberFormat, DateTimeFormatInfo dateTimeFormatInfo, char separator) { 78 97 Parse(new FileStream(fileName, FileMode.Open), numberFormat, dateTimeFormatInfo, separator); 79 98 } 80 99 100 /// <summary> 101 /// Takes a Stream and parses it with default format. NumberFormatInfo.InvariantInfo, DateTimeFormatInfo.InvariantInfo and separator = ',' 102 /// </summary> 103 /// <param name="stream">stream which is parsed</param> 104 public void Parse(Stream stream) { 105 NumberFormatInfo numberFormat = NumberFormatInfo.InvariantInfo; 106 DateTimeFormatInfo dateTimeFormatInfo = DateTimeFormatInfo.InvariantInfo; 107 char separator = ','; 108 Parse(stream, numberFormat, dateTimeFormatInfo, separator); 109 } 110 111 /// <summary> 112 /// Parses a stream with the given formats. 113 /// </summary> 114 /// <param name="stream">Stream which is parsed</param> 115 /// <param name="numberFormat">Format of numbers</param> 116 /// <param name="dateTimeFormatInfo">Format of datetime</param> 117 /// <param name="separator">defines the separator</param> 81 118 public void Parse(Stream stream, NumberFormatInfo numberFormat, DateTimeFormatInfo dateTimeFormatInfo, char separator) { 82 119 using (StreamReader reader = new StreamReader(stream)) { -
trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis-3.4/TableFileParserTest.cs
r7849 r7851 21 21 22 22 using System; 23 using System.Globalization;24 23 using System.IO; 25 24 using HeuristicLab.Problems.Instances.DataAnalysis; … … 34 33 public void ParseCSV() { 35 34 string tempFileName = Path.GetTempFileName(); 36 NumberFormatInfo numberFormat;37 DateTimeFormatInfo dateFormatInfo;38 char separator;39 35 WriteToFile(tempFileName, 40 36 @"0.00, 0.00, 0.00, 3.14 … … 46 42 TableFileParser parser = new TableFileParser(); 47 43 try { 48 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 49 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 44 parser.Parse(tempFileName); 50 45 Assert.AreEqual(6, parser.Rows); 51 46 Assert.AreEqual(4, parser.Columns); … … 59 54 public void ParseCSVWithNames() { 60 55 string tempFileName = Path.GetTempFileName(); 61 NumberFormatInfo numberFormat;62 DateTimeFormatInfo dateFormatInfo;63 char separator;64 56 WriteToFile(tempFileName, 65 57 @"x01, x02, x03, x04 … … 72 64 TableFileParser parser = new TableFileParser(); 73 65 try { 74 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 75 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 66 parser.Parse(tempFileName); 76 67 Assert.AreEqual(6, parser.Rows); 77 68 Assert.AreEqual(4, parser.Columns); … … 86 77 public void ParseGermanCSV() { 87 78 string tempFileName = Path.GetTempFileName(); 88 NumberFormatInfo numberFormat;89 DateTimeFormatInfo dateFormatInfo;90 char separator;91 79 WriteToFile(tempFileName, 92 80 @"0,00; 0,00; 0,00; 3,14 … … 98 86 TableFileParser parser = new TableFileParser(); 99 87 try { 100 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 101 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 88 parser.Parse(tempFileName); 102 89 Assert.AreEqual(6, parser.Rows); 103 90 Assert.AreEqual(4, parser.Columns); … … 112 99 public void ParseGermanCSVWithNames() { 113 100 string tempFileName = Path.GetTempFileName(); 114 NumberFormatInfo numberFormat;115 DateTimeFormatInfo dateFormatInfo;116 char separator;117 101 WriteToFile(tempFileName, 118 102 @"x01; x02; x03; x04 … … 125 109 TableFileParser parser = new TableFileParser(); 126 110 try { 127 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 128 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 111 parser.Parse(tempFileName); 129 112 Assert.AreEqual(6, parser.Rows); 130 113 Assert.AreEqual(4, parser.Columns); … … 139 122 public void ParseGermanCSVWithoutCommas() { 140 123 string tempFileName = Path.GetTempFileName(); 141 NumberFormatInfo numberFormat;142 DateTimeFormatInfo dateFormatInfo;143 char separator;144 124 WriteToFile(tempFileName, 145 125 @"0; 0; 0; 3 … … 151 131 TableFileParser parser = new TableFileParser(); 152 132 try { 153 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 154 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 133 parser.Parse(tempFileName); 155 134 Assert.AreEqual(6, parser.Rows); 156 135 Assert.AreEqual(4, parser.Columns); … … 164 143 public void ParseGermanCSVWithoutCommasWithNames() { 165 144 string tempFileName = Path.GetTempFileName(); 166 NumberFormatInfo numberFormat;167 DateTimeFormatInfo dateFormatInfo;168 char separator;169 145 WriteToFile(tempFileName, 170 146 @"x01; x02; x03; x04 … … 177 153 TableFileParser parser = new TableFileParser(); 178 154 try { 179 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 180 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 155 parser.Parse(tempFileName); 181 156 Assert.AreEqual(6, parser.Rows); 182 157 Assert.AreEqual(4, parser.Columns); … … 191 166 public void ParseEnglishCSVWithoutCommas() { 192 167 string tempFileName = Path.GetTempFileName(); 193 NumberFormatInfo numberFormat;194 DateTimeFormatInfo dateFormatInfo;195 char separator;196 168 WriteToFile(tempFileName, 197 169 @"0, 0, 0, 3 … … 203 175 TableFileParser parser = new TableFileParser(); 204 176 try { 205 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 206 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 177 parser.Parse(tempFileName); 207 178 Assert.AreEqual(6, parser.Rows); 208 179 Assert.AreEqual(4, parser.Columns); … … 217 188 public void ParseEnglishCSVWithoutCommasWithoutSpace() { 218 189 string tempFileName = Path.GetTempFileName(); 219 NumberFormatInfo numberFormat;220 DateTimeFormatInfo dateFormatInfo;221 char separator;222 190 WriteToFile(tempFileName, 223 191 @"0,0,0,3 … … 229 197 TableFileParser parser = new TableFileParser(); 230 198 try { 231 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 232 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 199 parser.Parse(tempFileName); 233 200 Assert.AreEqual(6, parser.Rows); 234 201 Assert.AreEqual(4, parser.Columns); … … 243 210 public void ParseEnglishCSVWithoutCommasWithNames() { 244 211 string tempFileName = Path.GetTempFileName(); 245 NumberFormatInfo numberFormat;246 DateTimeFormatInfo dateFormatInfo;247 char separator;248 212 WriteToFile(tempFileName, 249 213 @"x01, x02, x03, x04 … … 256 220 TableFileParser parser = new TableFileParser(); 257 221 try { 258 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 259 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 222 parser.Parse(tempFileName); 260 223 Assert.AreEqual(6, parser.Rows); 261 224 Assert.AreEqual(4, parser.Columns); … … 270 233 public void ParseEnglishCSVWithoutCommasWithoutSpacesWithNames() { 271 234 string tempFileName = Path.GetTempFileName(); 272 NumberFormatInfo numberFormat;273 DateTimeFormatInfo dateFormatInfo;274 char separator;275 235 WriteToFile(tempFileName, 276 236 @"x01,x02,x03,x04 … … 283 243 TableFileParser parser = new TableFileParser(); 284 244 try { 285 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 286 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 245 parser.Parse(tempFileName); 287 246 Assert.AreEqual(6, parser.Rows); 288 247 Assert.AreEqual(4, parser.Columns); … … 298 257 public void ParseGermanTabSeparated() { 299 258 string tempFileName = Path.GetTempFileName(); 300 NumberFormatInfo numberFormat;301 DateTimeFormatInfo dateFormatInfo;302 char separator;303 259 WriteToFile(tempFileName, 304 260 "0,00\t 0,00\t 0,00\t 3,14" + Environment.NewLine + … … 310 266 TableFileParser parser = new TableFileParser(); 311 267 try { 312 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 313 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 268 parser.Parse(tempFileName); 314 269 Assert.AreEqual(6, parser.Rows); 315 270 Assert.AreEqual(4, parser.Columns); … … 324 279 public void ParseGermanTabSeparatedWithNames() { 325 280 string tempFileName = Path.GetTempFileName(); 326 NumberFormatInfo numberFormat;327 DateTimeFormatInfo dateFormatInfo;328 char separator;329 281 WriteToFile(tempFileName, 330 282 "x01\t x02\t x03\t x04" + Environment.NewLine + … … 337 289 TableFileParser parser = new TableFileParser(); 338 290 try { 339 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 340 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 291 parser.Parse(tempFileName); 341 292 Assert.AreEqual(6, parser.Rows); 342 293 Assert.AreEqual(4, parser.Columns); … … 351 302 public void ParseEnglishTabSeparated() { 352 303 string tempFileName = Path.GetTempFileName(); 353 NumberFormatInfo numberFormat;354 DateTimeFormatInfo dateFormatInfo;355 char separator;356 304 WriteToFile(tempFileName, 357 305 "0.00\t 0.00\t 0.00\t 3.14" + Environment.NewLine + … … 363 311 TableFileParser parser = new TableFileParser(); 364 312 try { 365 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 366 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 313 parser.Parse(tempFileName); 367 314 Assert.AreEqual(6, parser.Rows); 368 315 Assert.AreEqual(4, parser.Columns); … … 376 323 public void ParseEnglishTabSeparatedWithNames() { 377 324 string tempFileName = Path.GetTempFileName(); 378 NumberFormatInfo numberFormat;379 DateTimeFormatInfo dateFormatInfo;380 char separator;381 325 WriteToFile(tempFileName, 382 326 "x01\t x02\t x03\t x04" + Environment.NewLine + … … 389 333 TableFileParser parser = new TableFileParser(); 390 334 try { 391 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 392 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 335 parser.Parse(tempFileName); 393 336 Assert.AreEqual(6, parser.Rows); 394 337 Assert.AreEqual(4, parser.Columns); … … 403 346 public void ParseTabSeparatedWithoutCommas() { 404 347 string tempFileName = Path.GetTempFileName(); 405 NumberFormatInfo numberFormat;406 DateTimeFormatInfo dateFormatInfo;407 char separator;408 348 WriteToFile(tempFileName, 409 349 "0\t 0\t 0\t 3" + Environment.NewLine + … … 415 355 TableFileParser parser = new TableFileParser(); 416 356 try { 417 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 418 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 357 parser.Parse(tempFileName); 419 358 Assert.AreEqual(6, parser.Rows); 420 359 Assert.AreEqual(4, parser.Columns); … … 428 367 public void ParseTabSeparatedWithoutCommasWithNames() { 429 368 string tempFileName = Path.GetTempFileName(); 430 NumberFormatInfo numberFormat;431 DateTimeFormatInfo dateFormatInfo;432 char separator;433 369 WriteToFile(tempFileName, 434 370 "x01\t x02\t x03\t x04" + Environment.NewLine + … … 441 377 TableFileParser parser = new TableFileParser(); 442 378 try { 443 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 444 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 379 parser.Parse(tempFileName); 445 380 Assert.AreEqual(6, parser.Rows); 446 381 Assert.AreEqual(4, parser.Columns); … … 455 390 public void ParseWithEmtpyLines() { 456 391 string tempFileName = Path.GetTempFileName(); 457 NumberFormatInfo numberFormat;458 DateTimeFormatInfo dateFormatInfo;459 char separator;460 392 WriteToFile(tempFileName, 461 393 "x01\t x02\t x03\t x04" + Environment.NewLine + … … 468 400 TableFileParser parser = new TableFileParser(); 469 401 try { 470 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 471 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 402 parser.Parse(tempFileName); 472 403 Assert.AreEqual(4, parser.Rows); 473 404 Assert.AreEqual(4, parser.Columns); … … 481 412 public void ParseGermanSpaceSeparated() { 482 413 string tempFileName = Path.GetTempFileName(); 483 NumberFormatInfo numberFormat;484 DateTimeFormatInfo dateFormatInfo;485 char separator;486 414 WriteToFile(tempFileName, 487 415 @"0,00 0,00 0,00 3,14 … … 493 421 TableFileParser parser = new TableFileParser(); 494 422 try { 495 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 496 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 423 parser.Parse(tempFileName); 497 424 Assert.AreEqual(6, parser.Rows); 498 425 Assert.AreEqual(4, parser.Columns); … … 506 433 public void ParseGermanSpaceSeparatedWithNames() { 507 434 string tempFileName = Path.GetTempFileName(); 508 NumberFormatInfo numberFormat;509 DateTimeFormatInfo dateFormatInfo;510 char separator;511 435 WriteToFile(tempFileName, 512 436 @"x01 x02 x03 x04 … … 519 443 TableFileParser parser = new TableFileParser(); 520 444 try { 521 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 522 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 445 parser.Parse(tempFileName); 523 446 Assert.AreEqual(6, parser.Rows); 524 447 Assert.AreEqual(4, parser.Columns); … … 533 456 public void ParseEnglishSpaceSeparated() { 534 457 string tempFileName = Path.GetTempFileName(); 535 NumberFormatInfo numberFormat;536 DateTimeFormatInfo dateFormatInfo;537 char separator;538 458 WriteToFile(tempFileName, 539 459 @"0.00 0.00 0.00 3.14 … … 545 465 TableFileParser parser = new TableFileParser(); 546 466 try { 547 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 548 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 467 parser.Parse(tempFileName); 549 468 Assert.AreEqual(6, parser.Rows); 550 469 Assert.AreEqual(4, parser.Columns); … … 558 477 public void ParseEnglishSpaceSeparatedWithNames() { 559 478 string tempFileName = Path.GetTempFileName(); 560 NumberFormatInfo numberFormat;561 DateTimeFormatInfo dateFormatInfo;562 char separator;563 479 WriteToFile(tempFileName, 564 480 @"x01 x02 x03 x04 … … 571 487 TableFileParser parser = new TableFileParser(); 572 488 try { 573 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 574 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 489 parser.Parse(tempFileName); 575 490 Assert.AreEqual(6, parser.Rows); 576 491 Assert.AreEqual(4, parser.Columns); … … 585 500 public void ParseSpaceSeparatedWithoutCommas() { 586 501 string tempFileName = Path.GetTempFileName(); 587 NumberFormatInfo numberFormat;588 DateTimeFormatInfo dateFormatInfo;589 char separator;590 502 WriteToFile(tempFileName, 591 503 @"0 0 0 3 … … 597 509 TableFileParser parser = new TableFileParser(); 598 510 try { 599 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 600 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 511 parser.Parse(tempFileName); 601 512 Assert.AreEqual(6, parser.Rows); 602 513 Assert.AreEqual(4, parser.Columns); … … 610 521 public void ParseSpaceSeparatedWithoutCommasWithNames() { 611 522 string tempFileName = Path.GetTempFileName(); 612 NumberFormatInfo numberFormat;613 DateTimeFormatInfo dateFormatInfo;614 char separator;615 523 WriteToFile(tempFileName, 616 524 @"x01 x02 x03 x04 … … 623 531 TableFileParser parser = new TableFileParser(); 624 532 try { 625 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 626 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 533 parser.Parse(tempFileName); 627 534 Assert.AreEqual(6, parser.Rows); 628 535 Assert.AreEqual(4, parser.Columns);
Note: See TracChangeset
for help on using the changeset viewer.