1
0
mirror of https://github.com/Kopano-dev/kopano-ol-extension.git synced 2023-10-10 13:37:40 +02:00

[KOE-117] Improved layout of reminders query trace logging

This commit is contained in:
Patrick Simpson 2017-05-31 12:06:40 +02:00
parent 8110fab096
commit 86b2144e22

View File

@ -42,40 +42,50 @@ namespace Acacia
private void Indent()
{
_builder.Append(new String(' ', _indent));
_builder.Append(new String(' ', _indent * 4));
}
public void Encode(SearchQuery.And part)
{
EncodeMulti("AND", part.Operands);
EncodeMulti("AND", false, part.Operands);
}
public void Encode(SearchQuery.Or part)
{
EncodeMulti("OR", part.Operands);
EncodeMulti("OR", false, part.Operands);
}
public void Encode(SearchQuery.Not part)
{
EncodeMulti("NOT", new[] { part.Operand });
EncodeMulti("NOT", true, new[] { part.Operand });
}
private void EncodeMulti(string oper, IEnumerable<SearchQuery> parts)
private void EncodeMulti(string oper, bool prefix, IEnumerable<SearchQuery> parts)
{
Indent();
_builder.Append(oper).Append("\n");
Indent();
_builder.Append("{\n");
_builder.Append("(\n");
++_indent;
bool first = !prefix;
foreach (SearchQuery operand in parts)
{
if (first)
first = false;
else
{
--_indent;
Indent();
_builder.Append(oper).Append("\n");
++_indent;
}
operand.Encode(this);
}
--_indent;
Indent();
_builder.Append("}\n");
_builder.Append(")\n");
}
public void Encode(SearchQuery.PropertyBitMask part)