Inheritance: AbstractMessage, IHeartbeat
        protected internal IMessage DecodeLine(ChannelBuffer buf, ITransaction parent,
                                               Stack<ITransaction> stack, IMessageTree tree)
        {
            BufferHelper helper = _mBufferHelper;
            char identifier = (char)buf.ReadByte();
            string timestamp = helper.Read(buf, TAB);
            string type = helper.Read(buf, TAB);
            string name = helper.Read(buf, TAB);
            switch (identifier)
            {
                case 't':
                    IMessage transaction = new DefaultTransaction(type, name, null);

                    helper.Read(buf, LF); // get rid of line feed
                    transaction.Timestamp = _mDateHelper.Parse(timestamp);

                    if (parent != null)
                    {
                        parent.AddChild(transaction);
                    }

                    stack.Push(parent);
                    return transaction;
                case 'A':
                    DefaultTransaction tran = new DefaultTransaction(type, name, null);
                    string status = helper.Read(buf, TAB);
                    string duration = helper.Read(buf, TAB);
                    string data = helper.ReadRaw(buf, TAB);

                    helper.Read(buf, LF); // get rid of line feed
                    tran.Timestamp = _mDateHelper.Parse(timestamp);
                    tran.Status = status;
                    tran.AddData(data);

                    long d = long.Parse(duration.Substring(0, duration.Length - 2), NumberStyles.Integer);

                    tran.DurationInMicros = d;

                    if (parent != null)
                    {
                        parent.AddChild(tran);
                        return parent;
                    }
                    return tran;
                case 'T':
                    string transactionStatus = helper.Read(buf, TAB);
                    string transactionDuration = helper.Read(buf, TAB);
                    string transactionData = helper.ReadRaw(buf, TAB);

                    helper.Read(buf, LF); // get rid of line feed
                    parent.Status = transactionStatus;
                    parent.AddData(transactionData);

                    long transactionD = long.Parse(transactionDuration.Substring(0, transactionDuration.Length - 2), NumberStyles.Integer);

                    parent.DurationInMicros = transactionD;

                    return stack.Pop();
                case 'E':
                    DefaultEvent evt = new DefaultEvent(type, name);
                    string eventStatus = helper.Read(buf, TAB);
                    string eventData = helper.ReadRaw(buf, TAB);

                    helper.Read(buf, LF); // get rid of line feed
                    evt.Timestamp = _mDateHelper.Parse(timestamp);
                    evt.Status = eventStatus;
                    evt.AddData(eventData);

                    if (parent != null)
                    {
                        parent.AddChild(evt);
                        return parent;
                    }
                    return evt;
                case 'M':
                    DefaultMetric metric = new DefaultMetric(type, name);
                    string metricStatus = helper.Read(buf, TAB);
                    string metricData = helper.ReadRaw(buf, TAB);

                    helper.Read(buf, LF);
                    metric.Timestamp = _mDateHelper.Parse(timestamp);
                    metric.Status = metricStatus;
                    metric.AddData(metricData);

                    if (parent != null)
                    {
                        parent.AddChild(metric);
                        return parent;
                    }
                    return metric;
                case 'L':
                    DefaultTrace trace = new DefaultTrace(type, name);
                    string traceStatus = helper.Read(buf, TAB);
                    string traceData = helper.Read(buf, TAB);

                    helper.Read(buf, LF); // get rid of line feed
                    trace.Timestamp = _mDateHelper.Parse(timestamp);
                    trace.Status = traceStatus;
                    trace.AddData(traceData);

                    if (parent != null)
                    {
                        parent.AddChild(trace);
                        return parent;
                    }
                    return trace;
                case 'H':
                    DefaultHeartbeat heartbeat = new DefaultHeartbeat(type, name);
                    string heartbeatStatus = helper.Read(buf, TAB);
                    string heartbeatData = helper.ReadRaw(buf, TAB);

                    helper.Read(buf, LF); // get rid of line feed
                    heartbeat.Timestamp = _mDateHelper.Parse(timestamp);
                    heartbeat.Status = heartbeatStatus;
                    heartbeat.AddData(heartbeatData);

                    if (parent != null)
                    {
                        parent.AddChild(heartbeat);
                        return parent;
                    }
                    return heartbeat;
            }

            Logger.Error("Unknown identifier(" + identifier + ") of message: " + buf);
            //throw new Exception("Unknown identifier int name"); //java版的抛出异常

            // unknown message, ignore it
            return parent;
        }
        public virtual IHeartbeat NewHeartbeat(string type, string name)
        {
            if (!_manager.HasContext())
            {
                _manager.Setup();
            }

            if (_manager.CatEnabled)
            {
                IHeartbeat heartbeat = new DefaultHeartbeat(type, name);

                _manager.Add(heartbeat);
                return heartbeat;
            }
            return NullMessage.HEARTBEAT;
        }