|
|
@ -44,7 +44,7 @@ module Pancake = |
|
|
|
| :? InvalidOperationException -> return text |
|
|
|
| :? InvalidOperationException -> return text |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let TextInFileIsValid filePath = |
|
|
|
let TextInFileIsValidAsync filePath = |
|
|
|
async { |
|
|
|
async { |
|
|
|
return DataAccess.LoadFile filePath |> TextContainsValidEndToken |
|
|
|
return DataAccess.LoadFile filePath |> TextContainsValidEndToken |
|
|
|
} |
|
|
|
} |
|
|
@ -153,7 +153,9 @@ module Pancake = |
|
|
|
GibberishLevelIsValid gibberishLevel |> ignore |
|
|
|
GibberishLevelIsValid gibberishLevel |> ignore |
|
|
|
SentencesIsValid sentences |> ignore |
|
|
|
SentencesIsValid sentences |> ignore |
|
|
|
FilePathIsValid filePath |> ignore |
|
|
|
FilePathIsValid filePath |> ignore |
|
|
|
// pattern match the TextInFileIsValid function |
|
|
|
let! textIsValid = TextInFileIsValidAsync filePath |
|
|
|
|
|
|
|
if textIsValid = true then ignore () |
|
|
|
|
|
|
|
else failwith @"The .txt file does not contain an end token ('.', '!' or '?')." |
|
|
|
let data = |
|
|
|
let data = |
|
|
|
LoadFile filePath |
|
|
|
LoadFile filePath |
|
|
|
|> ApplyStandardSetup |
|
|
|
|> ApplyStandardSetup |
|
|
@ -163,6 +165,7 @@ module Pancake = |
|
|
|
with |
|
|
|
with |
|
|
|
| :? ArgumentException as ex -> return ex.Message |
|
|
|
| :? ArgumentException as ex -> return ex.Message |
|
|
|
| :? FileNotFoundException as ex -> return ex.Message |
|
|
|
| :? FileNotFoundException as ex -> return ex.Message |
|
|
|
|
|
|
|
| :? SystemException as ex -> return ex.Message |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|