public override async Task OnKeyUp(StreamDeckEventPayload args) { //var title = $"{SettingsModel.Count.ToString()} {SettingsModel.JeffsumType.ToString("g")}"; var title = $"{SettingsModel.Count.ToString()} {SettingsModel.JeffsumType.ToString()}"; await Manager.SetTitleAsync(args.context, title); var count = SettingsModel.Count; var jeffsumType = SettingsModel.JeffsumType; //this.Logger.LogInformation($"Count: {count} | jeffsumType: {jeffsumType}"); var path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); path = Path.Combine(path, "JeffSum"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } path = Path.Combine(path, "quote.txt"); var items = new List <string>(); switch (jeffsumType) { case "Words": // JeffsumType.Words: var words = Goldblum.ReceiveTheJeff(count, JeffsumType.Words); items = words.ToList(); break; case "Quotes": // JeffsumType.Quotes: var quotes = Goldblum.ReceiveTheJeff(count, JeffsumType.Quotes); items = quotes.ToList(); break; case "Paragraphs": // JeffsumType.Paragraphs: default: var paragraphs = Goldblum.ReceiveTheJeff(count, JeffsumType.Paragraphs); //default items = paragraphs.ToList(); break; } // TODO: Separator configurable? var jeffsum = string.Join(Environment.NewLine, items); File.WriteAllText(path, jeffsum); //update settings await Manager.SetSettingsAsync(args.context, SettingsModel); }
/// <summary> /// Gets the desired amount of paragraphs of Jeff-related /// Lorem Ipsum content from 'JeffSum' library. /// </summary> /// <param name="paragraphCount">The amount of paragraphs of content to generate.</param> /// <returns>A <see cref="List{string}"/> holding the generated Lorem Ipsum content.</returns> public async Task <List <string> > GetIpsumParagraphsAsync(int paragraphCount) => await Task.Run(() => Goldblum.ReceiveTheJeff(paragraphCount).ToList());
public string[] GenerateCharacters(int numberOfChars) { var quotes = string.Join(" ", Goldblum.ReceiveTheJeff(numberOfChars, JeffsumType.Quotes)); return(new string[] { quotes.Substring(0, numberOfChars) }); }
public string[] GenerateWords(int numberOfWords) { return(Goldblum.ReceiveTheJeff(numberOfWords, JeffsumType.Words).ToArray()); }
public string[] GenerateSentences(int numberOfSentences) { return(Goldblum.ReceiveTheJeff(numberOfSentences, JeffsumType.Quotes).ToArray()); }