当前位置: 首页>>代码示例>>C#>>正文


C# ByteArray.Append方法代码示例

本文整理汇总了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);
 }
开发者ID:graffen,项目名称:NLog.Targets.Syslog,代码行数:8,代码来源:SdParam.cs

示例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);
        }
开发者ID:graffen,项目名称:NLog.Targets.Syslog,代码行数:12,代码来源:Rfc5424.cs

示例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);
        }
开发者ID:graffen,项目名称:NLog.Targets.Syslog,代码行数:16,代码来源:StructuredData.cs

示例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);
                });
        }
开发者ID:graffen,项目名称:NLog.Targets.Syslog,代码行数:17,代码来源:SdElement.cs

示例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);
 }
开发者ID:graffen,项目名称:NLog.Targets.Syslog,代码行数:8,代码来源:Rfc3164.cs

示例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);
 }
开发者ID:graffen,项目名称:NLog.Targets.Syslog,代码行数:11,代码来源:Rfc5424.cs

示例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);
        }
开发者ID:graffen,项目名称:NLog.Targets.Syslog,代码行数:11,代码来源:Rfc3164.cs

示例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);
 }
开发者ID:graffen,项目名称:NLog.Targets.Syslog,代码行数:6,代码来源:SdId.cs

示例9: AppendLogEntryBytes

 private static void AppendLogEntryBytes(ByteArray buffer, string logEntry, EncodingSet encodings)
 {
     var logEntryBytes = encodings.Utf8.GetBytes(logEntry);
     buffer.Append(logEntryBytes);
 }
开发者ID:graffen,项目名称:NLog.Targets.Syslog,代码行数:5,代码来源:Rfc5424.cs

示例10: AppendPreambleBytes

 private static void AppendPreambleBytes(ByteArray buffer, EncodingSet encodings)
 {
     var preambleBytes = encodings.Utf8.GetPreamble();
     buffer.Append(preambleBytes);
 }
开发者ID:graffen,项目名称:NLog.Targets.Syslog,代码行数:5,代码来源:Rfc5424.cs

示例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);
 }
开发者ID:graffen,项目名称:NLog.Targets.Syslog,代码行数:6,代码来源:SdParam.cs

示例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);
 }
开发者ID:graffen,项目名称:NLog.Targets.Syslog,代码行数:6,代码来源:SdParam.cs

示例13: AppendContentBytes

 private void AppendContentBytes(ByteArray buffer, string logEntry, Encoding encoding)
 {
     var content = plainContentPolicySet.Apply(logEntry);
     var contentBytes = encoding.GetBytes(content);
     buffer.Append(contentBytes);
 }
开发者ID:graffen,项目名称:NLog.Targets.Syslog,代码行数:6,代码来源:Rfc3164.cs

示例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);
 }
开发者ID:graffen,项目名称:NLog.Targets.Syslog,代码行数:6,代码来源:Rfc3164.cs

示例15: AppendPriBytes

 private static void AppendPriBytes(ByteArray buffer, string pri, Encoding encoding)
 {
     var priBytes = encoding.GetBytes(pri);
     buffer.Append(priBytes);
 }
开发者ID:graffen,项目名称:NLog.Targets.Syslog,代码行数:5,代码来源:Rfc3164.cs


注:本文中的ByteArray.Append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。