Index: Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/ProfilesImporter.cs
===================================================================
diff -u -r1bd759817ce35fd7ab4a8b96886d5cf8244f07fe -raf78b1626ac52972eb1fbd5a3fa598e2e3b00d2d
--- Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/ProfilesImporter.cs (.../ProfilesImporter.cs) (revision 1bd759817ce35fd7ab4a8b96886d5cf8244f07fe)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/ProfilesImporter.cs (.../ProfilesImporter.cs) (revision af78b1626ac52972eb1fbd5a3fa598e2e3b00d2d)
@@ -37,7 +37,7 @@
namespace Ringtoets.Common.IO.FileImporters
{
///
- /// Abstact class for profile importers, providing an implementation of importing point shapefiles
+ /// Abstract class for profile importers, providing an implementation of importing point shapefiles
/// containing dike profile locations and text files containing dike schematizations.
///
///
Index: Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/StructuresImporter.cs
===================================================================
diff -u -r57bd864138c692aba489b0715e12fff05708d544 -raf78b1626ac52972eb1fbd5a3fa598e2e3b00d2d
--- Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/StructuresImporter.cs (.../StructuresImporter.cs) (revision 57bd864138c692aba489b0715e12fff05708d544)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/StructuresImporter.cs (.../StructuresImporter.cs) (revision af78b1626ac52972eb1fbd5a3fa598e2e3b00d2d)
@@ -38,7 +38,7 @@
namespace Ringtoets.Common.IO.FileImporters
{
///
- /// Abstact class for structure importers, providing an implementation of importing point shapefiles
+ /// Abstract class for structure importers, providing an implementation of importing point shapefiles
/// containing structure locations and csv files containing structure schematizations.
///
public abstract class StructuresImporter : FileImporterBase
@@ -166,50 +166,51 @@
string csvFilePath = GetStructureDataCsvFilePath();
- var rowsReader = new StructuresCharacteristicsCsvReader(csvFilePath);
-
- int totalNumberOfRows;
- try
+ using (var rowsReader = new StructuresCharacteristicsCsvReader(csvFilePath))
{
- totalNumberOfRows = rowsReader.GetLineCount();
- }
- catch (CriticalFileReadException exception)
- {
- Log.Error(exception.Message);
- return new ReadResult(true);
- }
-
- var rows = new List();
-
- for (int i = 0; i < totalNumberOfRows; i++)
- {
- if (Canceled)
- {
- return new ReadResult(false);
- }
-
- NotifyProgress(Resources.StructuresImporter_ReadStructureParameterRowsData_reading_structuredata, i + 1, totalNumberOfRows);
-
+ int totalNumberOfRows;
try
{
- StructuresParameterRow row = rowsReader.ReadLine();
- rows.Add(row);
+ totalNumberOfRows = rowsReader.GetLineCount();
}
catch (CriticalFileReadException exception)
{
Log.Error(exception.Message);
return new ReadResult(true);
}
- catch (LineParseException exception)
+
+ var rows = new List();
+
+ for (int i = 0; i < totalNumberOfRows; i++)
{
- Log.Error(exception.Message);
+ if (Canceled)
+ {
+ return new ReadResult(false);
+ }
+
+ NotifyProgress(Resources.StructuresImporter_ReadStructureParameterRowsData_reading_structuredata, i + 1, totalNumberOfRows);
+
+ try
+ {
+ StructuresParameterRow row = rowsReader.ReadLine();
+ rows.Add(row);
+ }
+ catch (CriticalFileReadException exception)
+ {
+ Log.Error(exception.Message);
+ return new ReadResult(true);
+ }
+ catch (LineParseException exception)
+ {
+ Log.Error(exception.Message);
+ }
}
- }
- return new ReadResult(false)
- {
- ImportedItems = rows
- };
+ return new ReadResult(false)
+ {
+ ImportedItems = rows
+ };
+ }
}
private ReadResult ReadStructureLocations()