本文整理汇总了C#中ByteArray.Append方法的典型用法代码示例。如果您正苦于以下问题:C# ByteArray.Append方法的具体用法?C# ByteArray.Append怎么用?C# ByteArray.Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ByteArray
的用法示例。
在下文中一共展示了ByteArray.Append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AppendBytes
private void AppendBytes(ByteArray message, LogEventInfo logEvent, string invalidNamesPattern, EncodingSet encodings)
{
AppendNameBytes(message, logEvent, invalidNamesPattern, encodings);
message.Append(EqualBytes);
message.Append(QuotesBytes);
AppendValueBytes(message, logEvent, encodings);
message.Append(QuotesBytes);
}
示例2: PrepareMessage
protected override void PrepareMessage(ByteArray buffer, LogEventInfo logEvent, string pri, string logEntry)
{
var encodings = new EncodingSet(!disableBom);
AppendHeaderBytes(buffer, pri, logEvent, encodings);
buffer.Append(SpaceBytes);
AppendStructuredDataBytes(buffer, logEvent, encodings);
buffer.Append(SpaceBytes);
AppendMsgBytes(buffer, logEntry, encodings);
utf8MessagePolicy.Apply(buffer);
}
示例3: AppendBytes
public void AppendBytes(ByteArray message, LogEventInfo logEvent, EncodingSet encodings)
{
var sdFromEvtProps = fromEventProperties.Render(logEvent);
if (!string.IsNullOrEmpty(sdFromEvtProps))
{
var sdBytes = encodings.Utf8.GetBytes(sdFromEvtProps);
message.Append(sdBytes);
return;
}
if (sdElements.Count == 0)
message.Append(NilValueBytes);
else
SdElement.AppendBytes(message, sdElements, logEvent, encodings);
}
示例4: AppendBytes
public static void AppendBytes(ByteArray message, IEnumerable<SdElement> sdElements, LogEventInfo logEvent, EncodingSet encodings)
{
var elements = sdElements
.Select(x => new { SdId = x.sdId, RenderedSdId = x.sdId.Render(logEvent), SdParams = x.sdParams })
.ToList();
InternalLogDuplicatesPolicy.Apply(elements, x => x.RenderedSdId);
elements
.ForEach(elem =>
{
message.Append(LeftBracketBytes);
elem.SdId.AppendBytes(message, elem.RenderedSdId, encodings);
SdParam.AppendBytes(message, elem.SdParams, logEvent, SdIdToInvalidParamNamePattern.Map(elem.RenderedSdId), encodings);
message.Append(RightBracketBytes);
});
}
示例5: AppendHeaderBytes
private void AppendHeaderBytes(ByteArray buffer, LogEventInfo logEvent, Encoding encoding)
{
var timestamp = string.Format(CultureInfo.InvariantCulture, TimestampFormat, logEvent.TimeStamp);
var host = hostnamePolicySet.Apply(hostnameLayout.Render(logEvent));
var header = $"{timestamp} {host}";
var headerBytes = encoding.GetBytes(header);
buffer.Append(headerBytes);
}
示例6: AppendHeaderBytes
private void AppendHeaderBytes(ByteArray buffer, string pri, LogEventInfo logEvent, EncodingSet encodings)
{
var timestamp = string.Format(CultureInfo.InvariantCulture, TimestampFormat, logEvent.TimeStamp);
var hostname = hostnamePolicySet.Apply(hostnameLayout.Render(logEvent));
var appName = appNamePolicySet.Apply(appNameLayout.Render(logEvent));
var procId = procIdPolicySet.Apply(procIdLayout.Render(logEvent));
var msgId = msgIdPolicySet.Apply(msgIdLayout.Render(logEvent));
var header = $"{pri}{version} {timestamp} {hostname} {appName} {procId} {msgId}";
var headerBytes = encodings.Ascii.GetBytes(header);
buffer.Append(headerBytes);
}
示例7: PrepareMessage
protected override void PrepareMessage(ByteArray buffer, LogEventInfo logEvent, string pri, string logEntry)
{
var encoding = new ASCIIEncoding();
AppendPriBytes(buffer, pri, encoding);
AppendHeaderBytes(buffer, logEvent, encoding);
buffer.Append(SpaceBytes);
AppendMsgBytes(buffer, logEvent, logEntry, encoding);
asciiMessagePolicy.Apply(buffer);
}
示例8: AppendBytes
public void AppendBytes(ByteArray message, string renderedSdId, EncodingSet encodings)
{
var sdId = sdIdPolicySet.Apply(renderedSdId);
var sdIdBytes = encodings.Ascii.GetBytes(sdId);
message.Append(sdIdBytes);
}
示例9: AppendLogEntryBytes
private static void AppendLogEntryBytes(ByteArray buffer, string logEntry, EncodingSet encodings)
{
var logEntryBytes = encodings.Utf8.GetBytes(logEntry);
buffer.Append(logEntryBytes);
}
示例10: AppendPreambleBytes
private static void AppendPreambleBytes(ByteArray buffer, EncodingSet encodings)
{
var preambleBytes = encodings.Utf8.GetPreamble();
buffer.Append(preambleBytes);
}
示例11: AppendValueBytes
private void AppendValueBytes(ByteArray message, LogEventInfo logEvent, EncodingSet encodings)
{
var paramValue = paramValuePolicySet.Apply(value.Render(logEvent));
var valueBytes = encodings.Utf8.GetBytes(paramValue);
message.Append(valueBytes);
}
示例12: AppendNameBytes
private void AppendNameBytes(ByteArray message, LogEventInfo logEvent, string invalidNamesPattern, EncodingSet encodings)
{
var paramName = paramNamePolicySet.Apply(name.Render(logEvent), invalidNamesPattern);
var nameBytes = encodings.Ascii.GetBytes(paramName);
message.Append(nameBytes);
}
示例13: AppendContentBytes
private void AppendContentBytes(ByteArray buffer, string logEntry, Encoding encoding)
{
var content = plainContentPolicySet.Apply(logEntry);
var contentBytes = encoding.GetBytes(content);
buffer.Append(contentBytes);
}
示例14: AppendTagBytes
private void AppendTagBytes(ByteArray buffer, LogEventInfo logEvent, Encoding encoding)
{
var tag = tagPolicySet.Apply(tagLayout.Render(logEvent));
var tagBytes = encoding.GetBytes(tag);
buffer.Append(tagBytes);
}
示例15: AppendPriBytes
private static void AppendPriBytes(ByteArray buffer, string pri, Encoding encoding)
{
var priBytes = encoding.GetBytes(pri);
buffer.Append(priBytes);
}