Index: src/Plugins/Wti/Wti.IO/PipingSurfaceLinesCsvReader.cs =================================================================== diff -u -rfe0228504fc61d6af56be4c0f6a8fc28690f9064 -r8fe3ae6f129251f98795abd491315924ca707a76 --- src/Plugins/Wti/Wti.IO/PipingSurfaceLinesCsvReader.cs (.../PipingSurfaceLinesCsvReader.cs) (revision fe0228504fc61d6af56be4c0f6a8fc28690f9064) +++ src/Plugins/Wti/Wti.IO/PipingSurfaceLinesCsvReader.cs (.../PipingSurfaceLinesCsvReader.cs) (revision 8fe3ae6f129251f98795abd491315924ca707a76) @@ -27,13 +27,35 @@ /// and opens a given file path. /// /// The path to the file to be read. + /// is invalid. public PipingSurfaceLinesCsvReader(string path) { + CheckIfPathIsValid(path); + + filePath = path; + } + + private void CheckIfPathIsValid(string path) + { if (string.IsNullOrWhiteSpace(path)) { throw new ArgumentException(Resources.Error_PathMustBeSpecified); } - filePath = path; + + string name; + try + { + name = Path.GetFileName(path); + } + catch (ArgumentException e) + { + throw new ArgumentException(String.Format(Resources.Error_PathCannotContainCharacters_0_, + String.Join(", ", Path.GetInvalidFileNameChars())), e); + } + if (string.Empty == name) + { + throw new ArgumentException(Resources.Error_PathMustNotPointToFolder); + } } public void Dispose() @@ -54,6 +76,7 @@ /// The specified path is invalid, such as being on an unmapped drive. /// Filepath includes an incorrect or invalid syntax for file name, directory name, or volume label. /// There is insufficient memory to allocate a buffer for the returned string. + /// The file in not properly formatted. public int GetSurfaceLinesCount() { var count = 0; @@ -84,6 +107,8 @@ /// The specified path is invalid, such as being on an unmapped drive. /// Filepath includes an incorrect or invalid syntax for file name, directory name, or volume label. /// There is insufficient memory to allocate a buffer for the returned string. + /// A coordinate value does not represent a number in a valid format or the line is incorrectly formatted. + /// A coordinate value represents a number that is less than or greater than . public PipingSurfaceLine ReadLine() { if (fileReader == null)