Index: Ringtoets/Common/src/Ringtoets.Common.IO/AssessmentSectionSettingsReader.cs =================================================================== diff -u -r5253591e2ead1fb1e5e23dc0506f62c661be023c -r74099cffbe88647dbc4c81a3935d12cf5959b858 --- Ringtoets/Common/src/Ringtoets.Common.IO/AssessmentSectionSettingsReader.cs (.../AssessmentSectionSettingsReader.cs) (revision 5253591e2ead1fb1e5e23dc0506f62c661be023c) +++ Ringtoets/Common/src/Ringtoets.Common.IO/AssessmentSectionSettingsReader.cs (.../AssessmentSectionSettingsReader.cs) (revision 74099cffbe88647dbc4c81a3935d12cf5959b858) @@ -24,11 +24,12 @@ using System.IO; using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.IO.Properties; namespace Ringtoets.Common.IO { /// - /// Reads the settings file defined at level. + /// Reads the settings defined at level. /// public class AssessmentSectionSettingsReader { @@ -38,44 +39,21 @@ private const string duneAssessmentSectionFlag = "Duin"; /// - /// Reads the settings. + /// Reads the settings from . /// - /// The file path. - /// - /// When is null. - /// When is an empty string. - /// When points - /// to a file that doesn't exist. - /// When is invalid. - /// When either - /// - /// includes an incorrect - /// or invalid syntax for file name, directory name, or volume label. - /// When an I/O error occurs while reading the file. - /// - /// When there is insufficient memory to allocate - /// a buffer to a line in the file. - /// When reading a line that does not have - /// at least 2 columns or when the line doesn't have columns aren't separated by a ';'. - /// When reading a line where the second column text - /// doesn't represent a number. - /// When reading a line where the second column text - /// represents a number that is too big or too small to be stored in a . - public AssessmentSectionSettings[] ReadSettings(string filePath) + /// The fully initialized settings. + public AssessmentSectionSettings[] ReadSettings() { - using (var reader = new StreamReader(filePath)) + string[] ihwFileLines = Resources.IHW_filecontents.Split(new[] { - reader.ReadLine();// Skip header - - var list = new List(); - string currentLine; - while (null != (currentLine = reader.ReadLine())) - { - AssessmentSectionSettings settingsDefinition = ReadAssessmentSectionSettings(currentLine); - list.Add(settingsDefinition); - } - return list.ToArray(); + Environment.NewLine + }, StringSplitOptions.None); + var resultArray = new AssessmentSectionSettings[ihwFileLines.Length - 1]; + for (int i = 1; i < ihwFileLines.Length; i++) + { + resultArray[i-1] = ReadAssessmentSectionSettings(ihwFileLines[i]); } + return resultArray; } ///