Browse Source

Added RequestAllTestFiles function.

Tested in just the script file at the moment,
master
Craig Oates 6 years ago
parent
commit
64f0ee1de1
  1. 9
      WetPancake/ProductServices.fs
  2. 4
      WetPancake/Script.fsx
  3. 1
      WetPancakeCLI/ConsoleCommands.cs

9
WetPancake/ProductServices.fs

@ -37,6 +37,15 @@ module Pancake =
|> GenerateMap
return GenerateMarkovText sentences data
}
let RequestAllTextFiles () =
async {
let files =
ListSampleFiles
|> Array.toList
return files
}
// Add Checks to make sure the client is passing in a .txt file?
// Leave for the client to check?
// Give the client a function to check (and throw) if not handed a .txt file?

4
WetPancake/Script.fsx

@ -121,7 +121,7 @@ let dss_sentences = GenerateMarkovText 2 dss_text
printfn "Text: %A" dss_sentences
// (WetPancake) Pancake
// Product Services (Pancake)
[<Literal>]
let DesktopClock = __SOURCE_DIRECTORY__ + @"\TextFiles\desktop-clock-info.txt"
[<Literal>]
@ -144,3 +144,5 @@ p_result3 |> Async.RunSynchronously
p_result4 |> Async.RunSynchronously
p_result5 |> Async.RunSynchronously
p_result6 |> Async.RunSynchronously
let p_files = Pancake.RequestAllTextFiles () |> Async.RunSynchronously

1
WetPancakeCLI/ConsoleCommands.cs

@ -75,6 +75,7 @@ namespace WetPancakeCLI
[Usage("> GenerateTextFromFile 3 6 C:/yourfile.txt")]
public static string GenerateTextFromFile(int gibberishLevel, int sentences, string filePath)
{
// Should these checks be moved into the main library? How are people going to now to add these themselves when they are new to the project?
if (gibberishLevel < 2 || gibberishLevel > 20) throw new ArgumentException("Invalid argument. Must be between 2 and 20 (inclusive).", "gibberishLevel");
if (sentences < 1) throw new ArgumentException("Invalid argument. Must be greater than 0.", "sentences");
if (Path.GetExtension(filePath) != ".txt") throw new FileLoadException("The file entered is not a plain text (.txt) file.", filePath);

Loading…
Cancel
Save