Пример #1
0
        public static object ReadSyncObject(ByteReader data, SyncType syncType)
        {
            SyncLogger log = null;

            if (data is LoggingByteReader logger)
            {
                log = logger.log;
                log.Enter(syncType.type.FullName);
            }

            try
            {
                object obj = ReadSyncObjectInternal(data, syncType);
                log?.AppendToCurrentName($": {obj}");
                return(obj);
            }
            finally
            {
                log?.Exit();
            }
        }
Пример #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}");
                }
            }
        }
Пример #3
0
 public override void WritePrefixedBytes(byte[] bytes)
 {
     log.Enter("byte[]");
     base.WritePrefixedBytes(bytes);
     log.Exit();
 }