using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
public static class ClipboardFusionHelper
{
public static string ProcessText(string text)
{
int indentSize = 1; //Use negative or positve values
char indentChar = '\t'; //Tab character
Dictionary<string, int> options = new Dictionary<string, int>
{
{"Add 1 tab", 1},
{"Add 2 tabs", 2},
{"Add 3 tabs", 3},
{"Remove 1 tab", -1},
{"Remove 2 tabs", -2},
{"Remove 3 tabs", -3},
};
string selection = BFS.Dialog.GetUserInputList(
"How much would you like to indent or unindent the text?",
options.Keys.ToArray());
if(string.IsNullOrEmpty(selection))
return text;
if(!options.TryGetValue(selection, out indentSize))
return text;
if (indentSize > 0)
text = Regex.Replace(text, @"^", new string(indentChar, indentSize), RegexOptions.Multiline);
else if (indentSize < 0)
text = Regex.Replace(text, @"^" + new string(indentChar, Math.Abs(indentSize)), "", RegexOptions.Multiline);
return text;
}
}