Death Socket consists of three projects. They are a .Net Standard 2.0 library, a console program and a Test Centre. The purpose of this repository is to provide a way for people to add grids to images.
https://www.craigoates.net/Software/project/13
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.1 KiB
39 lines
1.1 KiB
module Validation |
|
|
|
open DeathSocket |
|
open System.Drawing |
|
open System |
|
|
|
let colourList = |
|
[ "blue", Brushes.AliceBlue |
|
"brown", Brushes.Brown |
|
"black", Brushes.Black |
|
"gray", Brushes.Gray |
|
"green", Brushes.Green |
|
"purple", Brushes.Purple |
|
"red", Brushes.Red |
|
"white", Brushes.White |
|
"yellow", Brushes.Yellow ] |
|
|> Map.ofList |
|
|
|
let isColourValid (colour: string) = |
|
colourList |
|
|> Map.containsKey (colour.ToLower()) |
|
|
|
let parseColour colour = |
|
match (isColourValid colour) with |
|
| true -> |
|
colourList |
|
|> Map.find (colour.ToLower()) |
|
| false -> |
|
invalidArg "Colour" |
|
(String.Concat("The colour specifed is invalid.\n", |
|
"Please use the 'list-colours' command to see what you can use.")) |
|
|
|
let buildSpec imgPath numRows numColumns pWidth colour newPath = |
|
{ originalPath = imgPath |
|
savePath = newPath |
|
colour = parseColour colour |
|
penWidth = pWidth |
|
rows = numRows |
|
columns = numColumns } |