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.

55 lines
1.8 KiB

// These DLL's must be built before you can use them in this script.
#r "bin/Debug/System.Drawing.Common.dll"
#r "bin/Debug/SmoulderingBeachBall.dll"
open System
open System.Drawing
open System.Reflection
open SmoulderingBeachBall.Domain
open SmoulderingBeachBall.Services
open System.Threading
(* Populating LoadingTestArea Folder Scripts
===============================================================================
The following scripts are to help you populate a test folder of images.
You can then use these images in LibraryTests.fs -- Property Tests.
The tests consists of loading images from LoadingTestArea, transforming them
and saving them in SavingTestArea. *)
let saveLocation = __SOURCE_DIRECTORY__ + "/LoadingTestArea"
let allColours =
let properties =
typeof<Brushes>.GetProperties(BindingFlags.Public ||| BindingFlags.Static)
seq { for prop in properties -> prop}
|> Seq.toArray
let randomBrush () =
let item = allColours.[Random().Next(allColours.Length)]
item.GetValue(null, null)
let populateSpec () =
{ width = (Random().Next(3000))
height = (Random().Next(3000))
colour = (randomBrush ()) :?> Brush
filePath = saveLocation
overlay = None }
let generateSpecs amount =
[for i in 1 .. amount do
Thread.Sleep 500
yield (populateSpec ()) ]
let generateImage spec =
printfn "[INFO.] Creating image [Width: %i] [Height: %i] ..." (spec.width) (spec.height)
makeImage spec
let populateLoadingTestArea () =
printfn "[INFO.] Populating LoadingTestArea..."
for spec in generateSpecs 100 do
generateImage spec
|> Async.RunSynchronously
printfn "[INFO.] Finishing populating /LoadingTestArea."
// You should only need this once you have passed the above into F# Interactive.
populateLoadingTestArea ()