Index: DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.StiFileCreator/StiFileCreator.cs
===================================================================
diff -u -r3093 -r3099
--- DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.StiFileCreator/StiFileCreator.cs (.../StiFileCreator.cs) (revision 3093)
+++ DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.StiFileCreator/StiFileCreator.cs (.../StiFileCreator.cs) (revision 3099)
@@ -19,18 +19,50 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
+using System.IO;
+
namespace Deltares.LayerOnSlopeTool.StiFileCreator
{
/// Class for creating a *.sti file with DGSMStabDam.dll
public class StiFileCreator
{
- /// Createng a new .sti file based on the defined input.
+ /// Create a new .sti file based on the defined input.
/// The sti file creator input.
/// The output filename.
- public void ProcessFile(StiFileCreatorInput stiFileCreatorInput, string outputFilename)
+ public static void ProcessFile(StiFileCreatorInput stiFileCreatorInput, string outputFilename)
{
+ ValidateInput(stiFileCreatorInput);
// TODO process file
- throw new System.NotImplementedException();
}
+
+ private static void ValidateInput(StiFileCreatorInput stiFileCreatorInput)
+ {
+ if (stiFileCreatorInput == null)
+ {
+ throw new ArgumentNullException("StiFileCreatorInput");
+ }
+
+ if (String.IsNullOrWhiteSpace(stiFileCreatorInput.InputFilename))
+ {
+ throw new ArgumentException("No input filename specified in StiFileCreatorInput");
+ }
+
+ if (!File.Exists(stiFileCreatorInput.InputFilename))
+ {
+ throw new ArgumentException(String.Format("File '{0}' not found", stiFileCreatorInput.InputFilename));
+ }
+
+ if (stiFileCreatorInput.SurfaceLine == null)
+ {
+ throw new ArgumentException("Invalid surfaceline in StiFileCreatorInput");
+ }
+
+ if (String.IsNullOrWhiteSpace(stiFileCreatorInput.DikeMaterialName))
+ {
+ throw new ArgumentException("No dike material name specified in StiFileCreatorInput");
+ }
+
+ }
}
}
\ No newline at end of file