Exemplo n.º 1
0
        public virtual FDumpInfo Dump(FDumpInfo info)
        {
            RDump.StartDump(info);
            FBytes bytes = Build();

            info.Append("Length:");
            info.AppendLine(bytes.Length);
            info.AppendLine(RDump.LINE_L2);
            string value = Encoding.ASCII.GetString(bytes.Memory, 0, bytes.Length);

            char[] chs   = value.ToCharArray();
            int    count = Math.Min(chs.Length, 2048);

            for (int n = 0; n < count; n++)
            {
                char ch = chs[n];
                if (ch >= ' ')
                {
                    info.Append(ch);
                }
                else if (ch == '\n' || ch == '\r')
                {
                    info.Append(ch);
                }
                else
                {
                    info.Append('.');
                }
            }
            info.AppendLine();
            info.AppendLine(RDump.LINE_L2);
            return(info);
        }
Exemplo n.º 2
0
        public override FDumpInfo Dump(FDumpInfo info)
        {
            RDump.StartDump(info);
            info.AppendProperty(PTY_ID, _id, true);
            info.AppendProperty(PTY_FACE, _faceName, true);
            info.AppendProperty(PTY_TYPE, _typeName, true);
            info.AppendProperty(PTY_SCOPE, _scope, true);
            // Get max id length
            int idlength = 0;

            if (!_initializes.IsEmpty() || _releases.IsEmpty())
            {
                // Initialize max id length
                for (int n = 0; n < _initializes.Count; n++)
                {
                    idlength = Math.Max(idlength, RString.Nvl(_initializes[n].Id).Length);
                }
                // Release max id length
                for (int n = 0; n < _releases.Count; n++)
                {
                    idlength = Math.Max(idlength, RString.Nvl(_releases[n].Id).Length);
                }
            }
            // Initializes
            if (!_initializes.IsEmpty())
            {
                for (int n = 0; n < _initializes.Count; n++)
                {
                    info.AppendLine();
                    RDump.AppendSpace(info, info.Deep + 1);
                    info.Append("Initialize: ");
                    info.Append(RString.Nvl(_initializes[n].Id).PadRight(idlength));
                    info.Append(" = ");
                    _initializes[n].Dump(info);
                }
            }
            // Releases
            if (!_releases.IsEmpty())
            {
                for (int n = 0; n < _releases.Count; n++)
                {
                    info.AppendLine();
                    RDump.AppendSpace(info, info.Deep + 1);
                    info.Append("Release:    ");
                    info.Append(RString.Nvl(_releases[n].Id).PadRight(idlength));
                    info.Append(" = ");
                    _releases[n].Dump(info);
                }
            }
            return(info);
        }
Exemplo n.º 3
0
        public virtual FDumpInfo Dump(FDumpInfo info)
        {
            RDump.StartDump(info);
            info.Append(" Protocol:", _protocol);
            info.Append(" Status:", _status.ToString());
            info.Append(' ');
            info.AppendLine(_statusNote);
            info.AppendLine(RDump.LINE_L2);
            int count = _heads.Count;

            for (int n = 0; n < count; n++)
            {
                info.Append(_heads.Name(n));
                info.Append(": ");
                info.AppendLine(_heads.Value(n));
            }
            info.AppendLine(RDump.LINE_L2);
            if (_data == null)
            {
                info.AppendLine("[null]");
            }
            else
            {
                info.AppendLine(Encoding.UTF8.GetString(_data.ToArray()));
            }
            info.AppendLine(RDump.LINE_L2);
            return(info);
        }
Exemplo n.º 4
0
        //============================================================
        // <T>获得调试转储信息。</T>
        //
        // @param info 转储信息
        // @return 转储信息
        //============================================================
        public override FDumpInfo Dump(FDumpInfo info)
        {
            RDump.StartDump(info);
            FXmlNode parent = (FXmlNode)info.Instance;

            // 转存名称
            info.Append(parent.Name);
            // 转存属性列表
            if (parent.HasAttribute())
            {
                info.Append(" [");
                foreach (IPair <string, string> pair in parent.Attributes)
                {
                    if (!pair.IsFirst())
                    {
                        info.Append(", ");
                    }
                    info.Append(pair.Name, "=", pair.Value);
                }
                info.Append("]");
            }
            // 转存内容
            if (parent.HasText())
            {
                info.Append("{");
                info.Append(parent.Text);
                info.Append("}");
            }
            // 转存元素列表
            if (parent.HasElement())
            {
                info.AppendLine();
                foreach (FXmlElement element in parent.Elements)
                {
                    info.IncreaseDeep(element);
                    Dump(info);
                    info.DecreaseDeep();
                }
            }
            return(info);
        }