Beispiel #1
0
 public override byte[] ReadPrefixedBytes(int maxLen = int.MaxValue)
 {
     log.Pause();
     byte[] array = base.ReadPrefixedBytes();
     log.Resume();
     log.Node($"byte[{array.Length}]");
     return(array);
 }
Beispiel #2
0
        private static void LogXML(SyncLogger log, byte[] xmlData)
        {
            if (log == null)
            {
                return;
            }

            var reader = XmlReader.Create(new MemoryStream(xmlData));

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    string name = reader.Name;
                    if (reader.GetAttribute("IsNull") == "True")
                    {
                        name += " (IsNull)";
                    }

                    if (reader.IsEmptyElement)
                    {
                        log.Node(name);
                    }
                    else
                    {
                        log.Enter(name);
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    log.Exit();
                }
                else if (reader.NodeType == XmlNodeType.Text)
                {
                    log.AppendToCurrentName($": {reader.Value}");
                }
            }
        }
 public override void WriteInt32(int val)
 {
     log.Node("int: " + val.ToString());
     base.WriteInt32(val);
 }