Beispiel #1
0
 public static void Validate(Action <string[], string, string[]> setKeys)
 {
     if (setKeys == null)
     {
         throw new ArgumentNullException(SortHelpers.GetParameterName(new { setKeys }), "A setKeys function must be defined.");
     }
 }
Beispiel #2
0
 public static void Validate(string delimiter)
 {
     if (string.IsNullOrEmpty(delimiter))
     {
         throw new ArgumentNullException(SortHelpers.GetParameterName(new { delimiter }), "The delimiter can not be null or empty.");
     }
 }
Beispiel #3
0
 private static void ArgumentValidation(Action <MergePurgeParam> processData)
 {
     if (processData == null)
     {
         throw new ArgumentNullException(SortHelpers.GetParameterName(new { processData }), "The processData action method must be defined.");
     }
 }
Beispiel #4
0
 private static void ArgumentValidation <T>(DelimitedFileSource <T> delimitedFileSource)
 {
     if (string.IsNullOrWhiteSpace(delimitedFileSource.Delimiter))
     {
         throw new ArgumentNullException(SortHelpers.GetParameterName(new { delimitedFileSource.Delimiter }), "The delimiter can not be null or empty.");
     }
 }
Beispiel #5
0
 public static void Validate(string sourcefilePath, Action <string, string[]> setKeys, string destinationFolder)
 {
     if (setKeys == null)
     {
         throw new ArgumentNullException(SortHelpers.GetParameterName(new { setKeys }), "A setKeys function must be defined.");
     }
     Validate(sourcefilePath, destinationFolder);
 }
Beispiel #6
0
 public static void Validate <T>(string sourcefilePath, Func <string, T> getKey, string destinationFolder, int maxBatchSize)
 {
     if (getKey == null)
     {
         throw new ArgumentNullException(SortHelpers.GetParameterName(new { getKey }), "A GetKey function must be defined.");
     }
     Validate(sourcefilePath, destinationFolder);
     Validate(maxBatchSize);
 }
Beispiel #7
0
 public static void Validate(int maxBatchSize)
 {
     if (maxBatchSize <= 0)
     {
         throw new ArgumentNullException(SortHelpers.GetParameterName(new { maxBatchSize }), "The maxBatchSize must be greater than zero.");
     }
     else if (maxBatchSize > int.MaxValue)
     {
         throw new ArgumentNullException(SortHelpers.GetParameterName(new { maxBatchSize }), "The maxBatchSize can not be greater than integer maximum value.");
     }
 }
Beispiel #8
0
 private static void ArgumentValidation(IFileSource fileSource)
 {
     if (string.IsNullOrWhiteSpace(fileSource.SourceFilePath))
     {
         throw new ArgumentNullException(SortHelpers.GetParameterName(new { fileSource }), "The sourceFilePath cannot be null or empty.");
     }
     if (!File.Exists(fileSource.SourceFilePath))
     {
         throw new FileNotFoundException(string.Format("The sourceFilePath , {0} , does not exist.", fileSource.SourceFilePath));
     }
 }
Beispiel #9
0
 private static void ArgumentValidation <T>(FixedWidthFileSource <T> fixedWidthFileSource)
 {
     if (fixedWidthFileSource.FixedWidths == null)
     {
         throw new ArgumentNullException(SortHelpers.GetParameterName(new { fixedWidthFileSource.FixedWidths }), "The file source fixed widths can not be null.");
     }
     if (fixedWidthFileSource.FixedWidths.Length == 0)
     {
         throw new ArgumentException("The file source fixed widths cannot be empty.", SortHelpers.GetParameterName(new { fixedWidthFileSource.FixedWidths }));
     }
 }
Beispiel #10
0
 public static void Validate(string sourcefilePath, string destinationFolder)
 {
     if (string.IsNullOrWhiteSpace(sourcefilePath))
     {
         throw new ArgumentNullException(SortHelpers.GetParameterName(new { sourcefilePath }), "The sourceFilePath cannot be null or empty.");
     }
     if (!File.Exists(sourcefilePath))
     {
         throw new FileNotFoundException("The sourceFilePath , " + sourcefilePath + " , does not exist.");
     }
     if (destinationFolder != null && !Directory.Exists(destinationFolder))
     {
         throw new DirectoryNotFoundException("The destination folder, " + destinationFolder + " , does not exist.");
     }
 }