|
|
|
@ -34,31 +34,45 @@ namespace WetPancakeCLI
|
|
|
|
|
public static string GenerateRandomText() |
|
|
|
|
{ |
|
|
|
|
string result = String.Empty; |
|
|
|
|
try { result = RequestRandomText(); } |
|
|
|
|
try { return RequestRandomText(); } |
|
|
|
|
catch (Exception e) |
|
|
|
|
{ |
|
|
|
|
Debug.WriteLine(e.Message); |
|
|
|
|
System.Console.WriteLine("[ERROR] Unable to complete request. Re-executing command..."); |
|
|
|
|
result = RequestRandomText(); |
|
|
|
|
return RequestRandomText(); |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[ListCommand] |
|
|
|
|
[Description ("Generates text using the gibberish level and number of sentences specified by the user.")] |
|
|
|
|
[Description("Generates text using the gibberish level and number of sentences specified by the user. Gibberish level must be greater the 1.")] |
|
|
|
|
[Parameters("gibberish level: int, sentences: int")] |
|
|
|
|
[Usage("> GenerateText 5 10")] |
|
|
|
|
public static string GenerateText(int gibberishLevel, int sentences) => RequestText(gibberishLevel, sentences); |
|
|
|
|
public static string GenerateText(int gibberishLevel, int sentences) |
|
|
|
|
{ |
|
|
|
|
if (gibberishLevel < 2) return "Please enter a gibberish level greater than 1."; |
|
|
|
|
try { return RequestText(gibberishLevel, sentences); } |
|
|
|
|
catch (Exception e) |
|
|
|
|
{ |
|
|
|
|
Debug.WriteLine(e.Message); |
|
|
|
|
System.Console.WriteLine("[ERROR] Unable to complete request. Re-executing command..."); |
|
|
|
|
return RequestText(gibberishLevel, sentences); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[ListCommand] |
|
|
|
|
[Description("Loads the specified .txt file and generates text based on it using the gibberish level and number of sentences specified by the user.")] |
|
|
|
|
[Parameters("gibberish level: int, sentences: int, file path: string")] |
|
|
|
|
[Usage("> RequestTextFromFile 3 6 C:/yourfile.txt")] |
|
|
|
|
public static string RequestTextFromFile(int gibberishLevel, int sentences, string filePath) => RequestTextFromFile(gibberishLevel, sentences, filePath); |
|
|
|
|
|
|
|
|
|
public static string test1() |
|
|
|
|
public static string RequestTextFromFile(int gibberishLevel, int sentences, string filePath) |
|
|
|
|
{ |
|
|
|
|
return RequestRandomText(); |
|
|
|
|
if(gibberishLevel < 2) return "Please enter a gibberish level greater than 1."; |
|
|
|
|
try { return RequestTextFromFile(gibberishLevel, sentences, filePath); } |
|
|
|
|
catch (Exception e) |
|
|
|
|
{ |
|
|
|
|
Debug.WriteLine(e.Message); |
|
|
|
|
System.Console.WriteLine("[ERROR] Unable to complete request. Re-executing command..."); |
|
|
|
|
return RequestTextFromFile(gibberishLevel, sentences, filePath); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|