Craig Oates
6 years ago
3 changed files with 28 additions and 39 deletions
@ -1,37 +1,15 @@
|
||||
// Learn more about F# at http://fsharp.org |
||||
// See the 'F# Tutorial' project for more help. |
||||
open System.IO |
||||
|
||||
#load "ConsoleTests.fs" |
||||
#load "LibraryTests.fs" |
||||
let saveLocation = __SOURCE_DIRECTORY__ + "/SavingTestArea/" |
||||
|
||||
open ConsoleTests |
||||
open LibraryTests |
||||
open System.Drawing |
||||
open System.Reflection |
||||
open System |
||||
let resetSavingTestArea () = |
||||
let files = Directory.GetFileSystemEntries(saveLocation) |
||||
match files.Length with |
||||
| 0 -> () |
||||
| _ -> |
||||
files |
||||
|> Array.iter (fun f -> File.Delete(f)) |
||||
|
||||
// Define your library scripting code here |
||||
|
||||
let allBrushColours = |
||||
let properties = |
||||
Color().GetType().GetProperties() |
||||
let names = |
||||
seq { for prop in properties do |
||||
yield prop.Name } |
||||
|> Seq.toList |
||||
names |
||||
|
||||
let allBrushes = |
||||
let properties = |
||||
typeof<Brushes>.GetProperties(BindingFlags.Public|||BindingFlags.Static) |
||||
let colours = |
||||
seq { for prop in properties -> prop} |
||||
|> Seq.toArray |
||||
colours |
||||
|
||||
let randomColour () = |
||||
let item = allBrushes.[Random().Next (allBrushes.Length)] |
||||
item.GetValue(null, null) |
||||
|
||||
printfn "%A" allBrushes |
||||
printfn "%A" (randomColour ()) |
||||
resetSavingTestArea () |
Loading…
Reference in new issue