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


C# ITextFormatter类代码示例

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


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


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