Add JSON input (#3)
Co-authored-by: Smaug123 <patrick+github@patrickstevens.co.uk> Reviewed-on: #3
This commit is contained in:
21
AnkiStatic.Test/Utils.fs
Normal file
21
AnkiStatic.Test/Utils.fs
Normal file
@@ -0,0 +1,21 @@
|
||||
namespace AnkiStatic.Test
|
||||
|
||||
open System
|
||||
open System.IO
|
||||
open System.Reflection
|
||||
|
||||
[<RequireQualifiedAccess>]
|
||||
module Utils =
|
||||
|
||||
let readResource (assembly : Assembly) (name : string) : string =
|
||||
let names =
|
||||
assembly.GetManifestResourceNames ()
|
||||
|> Seq.filter (fun s -> s.EndsWith (name, StringComparison.Ordinal))
|
||||
|
||||
use stream =
|
||||
names
|
||||
|> Seq.exactlyOne
|
||||
|> assembly.GetManifestResourceStream
|
||||
|> fun s -> new StreamReader (s)
|
||||
|
||||
stream.ReadToEnd ()
|
Reference in New Issue
Block a user