Skip to content

Commit

Permalink
Add dos argument to SaySomething
Browse files Browse the repository at this point in the history
  • Loading branch information
githubcatw committed Aug 24, 2021
1 parent 69f94eb commit 1f6e013
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions GeekSay/Geek.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ public static string SayWord(string word, bool dos = false) {
/// Say a random word in layman and geek.
/// </summary>
/// <returns> A string in this format: <br/>Random translation: [layman word] -> [geek word]</returns>
public static string SaySomething() {
int index = new Random().Next(GeekWords.conversions.Keys.Count);
var rndWord = GeekWords.conversions.ElementAt(index);
/// <param name="dos">Whether to enable extra Windows/DOS related translations.</param>
public static string SaySomething(bool dos = false) {
var words = GeekWords.conversions;
if (dos) words = words.Concat(GeekWords.winwords).ToDictionary(k => k.Key, v => v.Value);
int index = new Random().Next(words.Keys.Count);
var rndWord = words.ElementAt(index);
return $"Random translation: {rndWord.Key} -> {rndWord.Value}";
}
}
Expand Down

0 comments on commit 1f6e013

Please sign in to comment.