private string GetFormatPacket(ref int? offset, string str)
{
if (offset == null)
return "";
int start = offset.Value;
offset = FindNextNotEscaped (offset.Value, str, "}") + 1;
if (offset == 0)
throw new FormatException ("Cannot find end Marker '}'");
return str.Substring (start, offset.Value - start - 1);
}