private static async Task PasteRandomPrettyMatrixAsync() { var w = await Helper.GetIntAsync("Width", "167", 1); var h = await Helper.GetIntAsync("Height", "52", 1); var boundary = 3; var batch = 5; var sb = new StringBuilder(); GenerateHorizontalNumberLine(sb, w, boundary, batch); var matrix = Helper.GetRandomName(w * h); var reader = new StringReader(matrix); for (int i = 0; i < h - 2; i++) { AddBoundary(sb, i, boundary, false); for (int j = 0; j < w - boundary * 2; j++) { sb.Append((j + 1) % (batch + 1) == 0 ? ' ' : (char)reader.Read()); } AddBoundary(sb, i, boundary, true); sb.AppendLine(); } GenerateHorizontalNumberLine(sb, w, boundary, batch); await ForegroundInteractor.PasteAsync(sb.ToString()); }
private async Task SecondClipboardCopyAsync() { var text = await ForegroundInteractor.GetSelectedTextAsync(); _values.Add(text); Env.Notifier.Info($"'{Helper.Truncate(text, 20)}' copied"); }
private async Task SetVarFormattedAsync(string name, [AllowSpaces] string format, string value = null) { if (value == null) { value = await ForegroundInteractor.GetSelectedTextAsync(); } _state.Dict[_currentGroup][name] = string.Format(format, value); Env.Notifier.Info($"{name}: {_state.Dict[_currentGroup][name]} [{_currentGroup}]"); }
private Task SecondClipboardPasteAsync() { var text = string.Join(" ", _values); if (text.Length > 0) { return(ForegroundInteractor.PasteAsync(text)); } return(Task.CompletedTask); }
private async Task ImportVarsAsync(string text = null) { text = text ?? await ForegroundInteractor.GetSelectedTextAsync(); var dict = JsonConvert.DeserializeObject <Dictionary <string, string> >(text); foreach (var pair in dict) { await SetVarAsync(pair.Key, pair.Value); } }
private Task ExportVars() { return(ForegroundInteractor.PasteAsync(Helper.JsonSerialize(_state.Dict[_currentGroup], Formatting.Indented))); }
private Task SecondClipboardPasteReverse() { var text = string.Join(" ", _values.Reverse <string>()); return(ForegroundInteractor.PasteAsync(text)); }