本文整理汇总了C#中ITransaction.AddData方法的典型用法代码示例。如果您正苦于以下问题:C# ITransaction.AddData方法的具体用法?C# ITransaction.AddData怎么用?C# ITransaction.AddData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITransaction
的用法示例。
在下文中一共展示了ITransaction.AddData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DecodeLine
protected internal IMessage DecodeLine(ChannelBuffer buf, ITransaction parent,
Stack<ITransaction> stack, IMessageTree tree)
{
BufferHelper helper = _mBufferHelper;
byte identifier = buf.ReadByte();
String timestamp = helper.Read(buf, TAB);
String type = helper.Read(buf, TAB);
String name = helper.Read(buf, TAB);
if (identifier == 'E')
{
IMessage evt = new DefaultEvent(type, name);
String status = helper.Read(buf, TAB);
String data = helper.ReadRaw(buf, TAB);
helper.Read(buf, LF); // get rid of line feed
evt.Timestamp = _mDateHelper.Parse(timestamp);
evt.Status = status;
evt.AddData(data);
if (parent != null)
{
parent.AddChild(evt);
tree.EstimatedByteSize += evt.EstimateByteSize();
return parent;
}
return evt;
}
if (identifier == 'M')
{
DefaultMetric metric = new DefaultMetric(type, name);
String status = helper.Read(buf, TAB);
String data = helper.ReadRaw(buf, TAB);
helper.Read(buf, LF); // get rid of line feed
metric.Timestamp = _mDateHelper.Parse(timestamp);
metric.Status = status;
metric.AddData(data);
if (parent != null)
{
parent.AddChild(metric);
tree.EstimatedByteSize += metric.EstimateByteSize();
return parent;
}
return metric;
}
if (identifier == 'H')
{
IMessage heartbeat = new DefaultHeartbeat(type, name);
String status0 = helper.Read(buf, TAB);
String data1 = helper.ReadRaw(buf, TAB);
helper.Read(buf, LF); // get rid of line feed
heartbeat.Timestamp = _mDateHelper.Parse(timestamp);
heartbeat.Status = status0;
heartbeat.AddData(data1);
if (parent != null)
{
parent.AddChild(heartbeat);
tree.EstimatedByteSize += heartbeat.EstimateByteSize();
return parent;
}
return heartbeat;
}
if (identifier == '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;
}
if (identifier == 'A')
{
ITransaction transaction2 = new DefaultTransaction(type, name, null);
String status3 = helper.Read(buf, TAB);
String duration = helper.Read(buf, TAB);
String data4 = helper.ReadRaw(buf, TAB);
helper.Read(buf, LF); // get rid of line feed
transaction2.Timestamp = _mDateHelper.Parse(timestamp);
transaction2.Status = status3;
transaction2.AddData(data4);
long d = Int64.Parse(duration.Substring(0, duration.Length - 2), NumberStyles.Integer);
transaction2.DurationInMicros = d;
if (parent != null)
{
parent.AddChild(transaction2);
//.........这里部分代码省略.........
示例2: DecodeLine
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);
//.........这里部分代码省略.........