Craig Oates
5 years ago
5 changed files with 5 additions and 44 deletions
@ -1,39 +0,0 @@
|
||||
module internal Validation |
||||
|
||||
open System.IO |
||||
open DeathSocket |
||||
|
||||
let validateFilePath path = |
||||
match File.Exists path with |
||||
| true -> () |
||||
| false -> raise (new FileNotFoundException ("No file found at " + path)) |
||||
|
||||
let validateSaveFileType file = |
||||
match Path.GetExtension file with |
||||
| ".jpg" -> () |
||||
| ".JPG" -> () |
||||
| ".png" -> () |
||||
| ".PNG" -> () |
||||
| _ -> invalidArg "savePath" "The file type must be a .jpg or .png file." |
||||
|
||||
let validateIO iPath oPath = |
||||
validateFilePath iPath |
||||
validateSaveFileType oPath |
||||
|
||||
let validateDimensions dimensions = |
||||
match dimensions with |
||||
| (0, _) -> invalidArg "Width" "Width must be greater than 0." |
||||
| (_, 0) -> invalidArg "Height" "Height must be greater than 0." |
||||
| (_, _) -> () |
||||
|
||||
let validateLineThickness thickness = |
||||
match thickness with |
||||
| thickness when thickness <= 0.0 -> invalidArg "LineThickness" "LineThickness must be greater than 0." |
||||
| _ -> () |
||||
|
||||
let validateLongestDimension pDims aDims = |
||||
let width = (fst pDims) - (fst aDims) |
||||
let height = (snd pDims) - (snd aDims) |
||||
match width >= height with |
||||
| true -> Width |
||||
| false -> Height |
Loading…
Reference in new issue