protected void writeInternal(ProtocolTreeNode node)
{
int len = 1;
if (node.attributeHash != null)
{
len += node.attributeHash.Count() * 2;
}
if (node.children.Any())
{
len += 1;
}
if (node.data.Length > 0)
{
len += 1;
}
this.writeListStart(len);
this.writeString(node.tag);
this.writeAttributes(node.attributeHash);
if (node.data.Length > 0)
{
this.writeBytes(node.data);
}
if (node.children != null && node.children.Any())
{
this.writeListStart(node.children.Count());
foreach (var item in node.children)
{
this.writeInternal(item);
}
}
}