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.
|
|
|
module internal Validation
|
|
|
|
|
|
|
|
open System.Drawing
|
|
|
|
open SmoulderingBeachBall.Domain.DomainTypes
|
|
|
|
|
|
|
|
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" "The colour specifed is invalid."
|
|
|
|
// "Please use the ListAvailableColours command for a list"?
|
|
|
|
|
|
|
|
let buildBasicSpec iWidth iHeight mainColour path =
|
|
|
|
let brush = (parseColour mainColour)
|
|
|
|
let spec =
|
|
|
|
{ width = iWidth;
|
|
|
|
height = iHeight;
|
|
|
|
colour = brush
|
|
|
|
filePath = path
|
|
|
|
overlay = None }
|
|
|
|
spec
|