private static bool IsGroup(string filter, int i, out int length, bool previous = false)
{
bool isGroup = false;
length = 0;
if (i < filter.Length - 1)
{
string op = filter.Substring(i - (i >= 2 ? (previous ? 2 : 0) : 0), 1);
if (op == "(" || op == ")")
{
isGroup = true;
length = 1;
}
if (!isGroup && previous)
{
op = filter.Substring(i - (i >= 1 ? (previous ? 1 : 0) : 0), 1);
if (op == "(") //|| op == ")")
{
isGroup = true;
length = 1;
}
}
}
return isGroup;
}