• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ITextFormatter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ITextFormatter的典型用法代码示例。如果您正苦于以下问题:C# ITextFormatter类的具体用法?C# ITextFormatter怎么用?C# ITextFormatter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ITextFormatter类属于命名空间,在下文中一共展示了ITextFormatter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RabbitMQ

        /// <summary>
        /// Adds a sink that lets you push log messages to RabbitMq
        /// </summary>
        public static LoggerConfiguration RabbitMQ(
            this LoggerSinkConfiguration loggerConfiguration,
            RabbitMQConfiguration rabbitMqConfiguration,
            ITextFormatter formatter,
            IFormatProvider formatProvider = null)
        {
            if (loggerConfiguration == null) throw new ArgumentNullException("loggerConfiguration");
            if (rabbitMqConfiguration == null) throw new ArgumentNullException("rabbitMqConfiguration");

            // calls overloaded extension method
            return loggerConfiguration.RabbitMQ(
                rabbitMqConfiguration.Hostname,
                rabbitMqConfiguration.Username,
                rabbitMqConfiguration.Password,
                rabbitMqConfiguration.Exchange,
                rabbitMqConfiguration.ExchangeType,
                rabbitMqConfiguration.Queue,
                rabbitMqConfiguration.DeliveryMode,
                rabbitMqConfiguration.RouteKey,
                rabbitMqConfiguration.Port,
                rabbitMqConfiguration.VHost,
                rabbitMqConfiguration.Heartbeat,
                rabbitMqConfiguration.Protocol,
                formatter,
                formatProvider);
        }
开发者ID:vidarkongsli,项目名称:serilog-sinks-rabbitmq,代码行数:29,代码来源:LoggerConfigurationRabbitMQExtension.cs


示例2: CompositeIdMap

        public string CompositeIdMap(IList<Column> columns, ITextFormatter formatter)
        {
            var builder = new StringBuilder();

            switch (_language)
            {
                case Language.CSharp:
                    builder.AppendLine("ComposedId(compId =>");
                    builder.AppendLine("\t\t\t\t{");
                    foreach (var column in columns)
                    {
                        builder.AppendLine("\t\t\t\t\tcompId.Property(x => x." + formatter.FormatText(column.Name) + ", m => m.Column(\"" + column.Name + "\"));");
                    }
                    builder.Append("\t\t\t\t});");
                    break;
                case Language.VB:
                    builder.AppendLine("ComposedId(Sub(compId)");
                    foreach (var column in columns)
                    {
                        builder.AppendLine("\t\t\t\t\tcompId.Property(Function(x) x." + formatter.FormatText(column.Name) + ", Sub(m) m.Column(\"" + column.Name + "\"))");
                    }
                    builder.AppendLine("\t\t\t\tEnd Sub)");
                    break;
            }

            return builder.ToString();
        }
开发者ID:stantoxt,项目名称:NHibernateMappingGenerator_Patched,代码行数:27,代码来源:DBColumnMapper.cs


示例3: OutputSink

 public OutputSink(Func<IOutput> outputProvider, ITextFormatter textFormatter, Func<IOutputLogFilter> outputLogFilterProvider = null)
 {
     if (textFormatter == null) throw new ArgumentNullException("textFormatter");
     _textFormatter = textFormatter;
     _outputProvider = outputProvider;
     _outputLogFilterProvider = outputLogFilterProvider;
 }
开发者ID:julianpaulozzi,项目名称:EntityProfiler,代码行数:7,代码来源:OutputSink.cs


示例4: Format

 public override string Format(IPostParsingContext context, ITextFormatter<IPostParsingContext> formatter)
 {
     if(this.Name.ToLower() == "q" || this.Name.ToLower() == "quote") {
         return "";
     } else if(this.Name.ToLower() == "code") {
         return "[code]" + this.InnerBBCode + "[/code]";
     } else {
         string name = this.Name;
         if(name.ToLower() == "uploadimage") name = "uploadLink";
         var sb = new StringBuilder();
         sb.Append("[");
         sb.Append(name);
         if(this.Default != null && this.Default != "") {
             sb.Append("='");
             sb.Append(this.Default.Replace("'", "''"));
             sb.Append("'");
         } else {
             foreach(var attribute in this.Attributes) {
                 sb.Append(" ");
                 sb.Append(attribute.Key);
                 sb.Append("='");
                 sb.Append(attribute.Value.Replace("'", "''"));
                 sb.Append("'");
             }
         }
         sb.Append("]");
         if(this.RequireClosingTag) {
             sb.Append(this.GetInnerHTML(context, formatter));
             sb.Append("[/");
             sb.Append(name);
             sb.Append("]");
         }
         return sb.ToString();
     }
 }
开发者ID:penartur,项目名称:FLocal,代码行数:35,代码来源:QuoteSkipper.cs


示例5: FileSink

 public FileSink(string path, ITextFormatter textFormatter)
 {
     if (path == null) throw new ArgumentNullException("path");
     if (textFormatter == null) throw new ArgumentNullException("textFormatter");
     _textFormatter = textFormatter;
     _output = new StreamWriter(System.IO.File.Open(path, FileMode.Append, FileAccess.Write, FileShare.Read));
 }
开发者ID:sandcastle,项目名称:serilog,代码行数:7,代码来源:FileSink.cs


示例6: XUnitTestOutputSink

        public XUnitTestOutputSink(ITestOutputHelper testOutputHelper, ITextFormatter textFormatter)
        {
            if (testOutputHelper == null) throw new ArgumentNullException("testOutputHelper");
            if (textFormatter == null) throw new ArgumentNullException("textFormatter");

            _output = testOutputHelper;
            _textFormatter = textFormatter;
        }
开发者ID:Rurouni,项目名称:MassiveOnlineUniversalServerEngine,代码行数:8,代码来源:XUnitTestOutputSink.cs


示例7: Format

 public override string Format(IPostParsingContext context, ITextFormatter<IPostParsingContext> formatter)
 {
     string inner = this.GetInnerHTML(context, formatter).TrimHtml();
     if(inner == "") return "";
     string marker = this.Default;
     if(marker == null) marker = "Quote:";
     return "<blockquote><div class=\"quotetitle\">" + marker + "</div><div class=\"quotecontent\">" + inner + "</div></blockquote>";
 }
开发者ID:penartur,项目名称:FLocal,代码行数:8,代码来源:Quote.cs


示例8: DummyRollingFile

 public static LoggerConfiguration DummyRollingFile(
     this LoggerSinkConfiguration loggerSinkConfiguration,
     ITextFormatter formatter,
     string pathFormat,
     LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum)
 {
     return loggerSinkConfiguration.Sink(new DummyRollingFileSink(), restrictedToMinimumLevel);
 }
开发者ID:serilog,项目名称:serilog,代码行数:8,代码来源:DummyLoggerConfigurationExtensions.cs


示例9: Format

 public override string Format(IPostParsingContext context, ITextFormatter<IPostParsingContext> formatter)
 {
     var upload = dataobjects.Upload.LoadById(int.Parse(this.DefaultOrValue));
     var name = this.Safe(upload.filename);
     if(this.Default != null) {
         name = this.GetInnerHTML(context, formatter);
     }
     return "<a href=\"/Upload/Info/" + upload.id.ToString() + "/\">" + name + "</a>";
 }
开发者ID:penartur,项目名称:FLocal,代码行数:9,代码来源:UploadLink.cs


示例10: SizeLimitedFileSink

 public SizeLimitedFileSink(ITextFormatter formatter, TemplatedPathRoller roller, long fileSizeLimitBytes,
     RollingLogFile rollingLogFile, Encoding encoding = null)
 {
     this.formatter = formatter;
     this.roller = roller;
     this.fileSizeLimitBytes = fileSizeLimitBytes;
     this.EnableLevelLogging = roller.PathIncludesLevel;
     this.output = OpenFileForWriting(roller.LogFileDirectory, rollingLogFile, encoding ?? Encoding.UTF8);
 }
开发者ID:Peymanmi,项目名称:Serilog.Sinks.RollingFile.Extension,代码行数:9,代码来源:SizeLimitedFileSink.cs


示例11: Format

 public override string Format(IPostParsingContext context, ITextFormatter<IPostParsingContext> formatter)
 {
     var url = this.url;
     var name = this.Safe(url.title);
     if(this.Default != null) {
         name = this.GetInnerHTML(context, formatter);
     }
     return string.Format("<a href=\"{0}\">{1}</a>", url.canonical, url.title);
 }
开发者ID:penartur,项目名称:FLocal,代码行数:9,代码来源:AbstractLocalLink.cs


示例12: Format

 public override string Format(IPostParsingContext context, ITextFormatter<IPostParsingContext> formatter)
 {
     string rawUrl = this.DefaultOrValue;
     string title = null;
     if(rawUrl.ToLower() != this.InnerText.ToLower()) {
         title = this.GetInnerHTML(context, formatter);
     }
     return UrlProcessor.ProcessLink(rawUrl, title, false);
 }
开发者ID:penartur,项目名称:FLocal,代码行数:9,代码来源:FUrl.cs


示例13: Format

 public override string Format(IPostParsingContext context, ITextFormatter<IPostParsingContext> formatter)
 {
     var urlInfo = UrlProcessor.Process(this.InnerText);
     if (urlInfo.isLocal && urlInfo.relativeUrl.StartsWith("/user/upload/")) {
         return "<f:img><f:src>" + urlInfo.relativeUrl + "</f:src><f:alt>" + urlInfo.relativeUrl + "</f:alt></f:img>";
     } else {
         return "<a href=\"" + urlInfo.relativeUrl + "\">" + urlInfo.relativeUrl + "</a>";
     }
 }
开发者ID:penartur,项目名称:FLocal,代码行数:9,代码来源:Image.cs


示例14: RabbitMQSink

 public RabbitMQSink(RabbitMQConfiguration configuration,
     ITextFormatter formatter,
     IFormatProvider formatProvider)
     : base(configuration.BatchPostingLimit, configuration.Period)
 {
     _formatter = formatter ?? new RawFormatter();
     _formatProvider = formatProvider;
     _client = new RabbitMQClient(configuration);
 }
开发者ID:sonicjolt,项目名称:serilog-sinks-rabbitmq,代码行数:9,代码来源:RabbitMQSink.cs


示例15: AzureEventHubSink

 /// <summary>
 /// Construct a sink that saves log events to the specified EventHubClient.
 /// </summary>
 /// <param name="eventHubClient">The EventHubClient to use in this sink.</param>
 /// <param name="partitionKey">PartitionKey to group events by within the Event Hub.</param>
 /// <param name="formatter">Provides formatting for outputting log data</param>
 public AzureEventHubSink(
     EventHubClient eventHubClient,
     string partitionKey,
     ITextFormatter formatter)
 {
     _eventHubClient = eventHubClient;
     _partitionKey = partitionKey;
     _formatter = formatter;
 }
开发者ID:bitpulse,项目名称:serilog-sinks-azureeventhub,代码行数:15,代码来源:AzureEventHubSink.cs


示例16: DatadogSink

        /// <summary>
        /// Construct a sink that uses datadog with the specified details.
        /// </summary>
        /// <param name="datadogConfiguration">Connection information used to construct the Datadog client.</param>
        /// <param name="batchSizeLimit">The maximum number of events to post in a single batch.</param>
        /// <param name="period">The time to wait between checking for event batches.</param>
        /// <param name="textFormatter">Supplies culture-specific formatting information, or null.</param>
        public DatadogSink(DatadogConfiguration datadogConfiguration, int batchSizeLimit, TimeSpan period, ITextFormatter textFormatter)
            : base(batchSizeLimit, period)
        {
            if (datadogConfiguration == null) throw new ArgumentNullException("datadogConfiguration");

            _datadogConfiguration = datadogConfiguration;
            _textFormatter = textFormatter;
            _statsdUdp = new StatsdUDP(datadogConfiguration.StatsdServer, datadogConfiguration.StatsdPort);
            _statsd = new Statsd(_statsdUdp);
        }
开发者ID:Applicita,项目名称:serilog-sinks-datadog,代码行数:17,代码来源:DatadogSink.cs


示例17: EmailSink

        /// <summary>
        /// Construct a sink emailing with the specified details.
        /// </summary>
        /// <param name="connectionInfo">Connection information used to construct the SMTP client and mail messages.</param>
        /// <param name="batchSizeLimit">The maximum number of events to post in a single batch.</param>
        /// <param name="period">The time to wait between checking for event batches.</param>
        /// <param name="textFormatter">Supplies culture-specific formatting information, or null.</param>
        public EmailSink(EmailConnectionInfo connectionInfo, int batchSizeLimit, TimeSpan period, ITextFormatter textFormatter)
            : base(batchSizeLimit, period)
        {
            if (connectionInfo == null) throw new ArgumentNullException(nameof(connectionInfo));

            _connectionInfo = connectionInfo;
            _textFormatter = textFormatter;
            _smtpClient = CreateSmtpClient();
            _smtpClient.SendCompleted += SendCompletedCallback;
        }
开发者ID:normanhh3,项目名称:serilog-sinks-email,代码行数:17,代码来源:EmailSink.cs


示例18: EventLogSink

        /// <summary>
        /// Construct a sink posting to the Windows event log, creating the specified <paramref name="source"/> if it does not exist.
        /// </summary>
        /// <param name="source">The source name by which the application is registered on the local computer. </param>
        /// <param name="logName">The name of the log the source's entries are written to. Possible values include Application, System, or a custom event log.</param>
        /// <param name="textFormatter">Supplies culture-specific formatting information, or null.</param>
        /// <param name="machineName">The name of the machine hosting the event log written to.</param>
        public EventLogSink(string source, string logName, ITextFormatter textFormatter, string machineName)
        {
            if (source == null) throw new ArgumentNullException("source");

            _textFormatter = textFormatter;
            _source = source;

            var sourceData = new EventSourceCreationData(source, logName) { MachineName = machineName };

            if (!System.Diagnostics.EventLog.SourceExists(source, machineName)) System.Diagnostics.EventLog.CreateEventSource(sourceData);
        }
开发者ID:Worthaboutapig,项目名称:serilog,代码行数:18,代码来源:EventLogSink.cs


示例19: RabbitMQSink

        public RabbitMQSink(
            RabbitMQConfiguration configuration,
            ITextFormatter formatter,
            IFormatProvider formatProvider
       )
        {

            // prepare client
            _client = new RabbitMQClient(configuration);
            _formatProvider = formatProvider;
            _formatter = formatter ?? new RawFormatter();
        }
开发者ID:vidarkongsli,项目名称:serilog-sinks-rabbitmq,代码行数:12,代码来源:RabbitMQSink.cs


示例20: EmailSink

        /// <summary>
        /// Construct a sink emailing with the specified details.
        /// </summary>
        /// <param name="fromEmail">The email address emails will be sent from</param>
        /// <param name="toEmail">The email address emails will be sent to</param>
        /// <param name="mailServer">The SMTP email server to use</param>
        /// <param name="networkCredential">The network credentials to use to authenticate with mailServer</param>
        /// <param name="batchSizeLimit">The maximum number of events to post in a single batch.</param>
        /// <param name="period">The time to wait between checking for event batches.</param>
        /// <param name="textFormatter">Supplies culture-specific formatting information, or null.</param>
        public EmailSink(string fromEmail, string toEmail, string mailServer, ICredentialsByHost networkCredential, int batchSizeLimit, TimeSpan period, ITextFormatter textFormatter) 
            : base(batchSizeLimit, period)
        {
            if (fromEmail == null) throw new ArgumentNullException("fromEmail");
            if (toEmail == null) throw new ArgumentNullException("toEmail");
            if (mailServer == null) throw new ArgumentNullException("mailServer");

            _fromEmail = fromEmail;
            _toEmail = toEmail;
            _textFormatter = textFormatter;

            _smtpClient = new SmtpClient(mailServer) {Credentials = networkCredential};
            _smtpClient.SendCompleted += SendCompletedCallback;
        }
开发者ID:RossMerr,项目名称:serilog,代码行数:24,代码来源:EmailSink.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ITextOutput类代码示例发布时间:2022-05-24
下一篇:
C# ITextEditorOptions类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap