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());
        }
예제 #2
0
        private async Task SecondClipboardCopyAsync()
        {
            var text = await ForegroundInteractor.GetSelectedTextAsync();

            _values.Add(text);
            Env.Notifier.Info($"'{Helper.Truncate(text, 20)}' copied");
        }
예제 #3
0
 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}]");
 }
예제 #4
0
        private Task SecondClipboardPasteAsync()
        {
            var text = string.Join("  ", _values);

            if (text.Length > 0)
            {
                return(ForegroundInteractor.PasteAsync(text));
            }
            return(Task.CompletedTask);
        }
예제 #5
0
        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);
            }
        }
예제 #6
0
 private Task ExportVars()
 {
     return(ForegroundInteractor.PasteAsync(Helper.JsonSerialize(_state.Dict[_currentGroup], Formatting.Indented)));
 }
예제 #7
0
        private Task SecondClipboardPasteReverse()
        {
            var text = string.Join("  ", _values.Reverse <string>());

            return(ForegroundInteractor.PasteAsync(text));
        }