8 changed files with 131 additions and 42 deletions
@ -1,23 +1,24 @@ |
|||||||
namespace DeathSocket |
namespace DeathSocket |
||||||
|
|
||||||
|
/// The domain types used by Death Socket. |
||||||
[<AutoOpen>] |
[<AutoOpen>] |
||||||
module Domain = |
module Domain = |
||||||
|
|
||||||
open System.Drawing |
open System.Drawing |
||||||
open System.Drawing.Imaging |
|
||||||
|
|
||||||
|
/// <summary> |
||||||
|
/// The specification used by Death Socket when adding a grid to an image. |
||||||
|
/// </summary> |
||||||
type ImageSpec = |
type ImageSpec = |
||||||
{ originalPath: string; |
{ /// The original path of the image which the grid is being added to. |
||||||
savePath: string; |
originalPath: string |
||||||
colour: Brush; |
/// The location of the new gridded image. |
||||||
penWidth: float32 |
savePath: string |
||||||
rows: int; |
/// The (System.Drawing) brush used to draw the grid. This determines the colour. |
||||||
columns: int } |
colour: Brush |
||||||
|
/// The thickness of the line on the grid. |
||||||
type StreamSpec = |
penWidth: float32 |
||||||
{ imagePath: string; |
/// The number of rows the grid will have. |
||||||
format: ImageFormat; |
rows: int |
||||||
colour: Brush; |
///The number of columns the grid will have. |
||||||
penWidth: float32 |
|
||||||
rows: int; |
|
||||||
columns: int } |
columns: int } |
@ -1,9 +1,20 @@ |
|||||||
module internal Validation |
module internal Validation |
||||||
|
|
||||||
open System.IO |
open System.IO |
||||||
|
|
||||||
let validateFilePath path = |
let validateFilePath path = |
||||||
match File.Exists path with |
match File.Exists path with |
||||||
| true -> () |
| true -> () |
||||||
| false -> raise (new FileNotFoundException (path + " could not be found.")) |
| false -> raise (new FileNotFoundException (path + " could not be found.")) |
||||||
|
|
||||||
|
let validatFileType file = |
||||||
|
match Path.GetExtension file with |
||||||
|
| ".bmp" -> () |
||||||
|
| ".BMP" -> () |
||||||
|
| ".jpg" -> () |
||||||
|
| ".JPG" -> () |
||||||
|
| ".png" -> () |
||||||
|
| ".PNG" -> () |
||||||
|
| ".tif" -> () |
||||||
|
| ".TIF" -> () |
||||||
|
| _ -> invalidArg "savePath" "The file type must be a .bmp, .jpg, .png or .tif file." |
Loading…
Reference in new issue