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


C# BsonWriter.WriteRegex方法代码示例

本文整理汇总了C#中Newtonsoft.Json.Bson.BsonWriter.WriteRegex方法的典型用法代码示例。如果您正苦于以下问题:C# BsonWriter.WriteRegex方法的具体用法?C# BsonWriter.WriteRegex怎么用?C# BsonWriter.WriteRegex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Newtonsoft.Json.Bson.BsonWriter的用法示例。


在下文中一共展示了BsonWriter.WriteRegex方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteBson

    private void WriteBson(BsonWriter writer, Regex regex)
    {
      // Regular expression - The first cstring is the regex pattern, the second
      // is the regex options string. Options are identified by characters, which 
      // must be stored in alphabetical order. Valid options are 'i' for case 
      // insensitive matching, 'm' for multiline matching, 'x' for verbose mode, 
      // 'l' to make \w, \W, etc. locale dependent, 's' for dotall mode 
      // ('.' matches everything), and 'u' to make \w, \W, etc. match unicode.

      string options = null;

      if (HasFlag(regex.Options, RegexOptions.IgnoreCase))
        options += "i";

      if (HasFlag(regex.Options, RegexOptions.Multiline))
        options += "m";

      if (HasFlag(regex.Options, RegexOptions.Singleline))
        options += "s";

      options += "u";

      if (HasFlag(regex.Options, RegexOptions.ExplicitCapture))
        options += "x";

      writer.WriteRegex(regex.ToString(), options);
    }
开发者ID:rdowdall,项目名称:Newtonsoft.Json,代码行数:27,代码来源:RegexConverter.cs

示例2: WriteBson

 private void WriteBson(BsonWriter writer, Regex regex)
 {
   string str = (string) null;
   if (this.HasFlag(regex.Options, RegexOptions.IgnoreCase))
     str = str + "i";
   if (this.HasFlag(regex.Options, RegexOptions.Multiline))
     str = str + "m";
   if (this.HasFlag(regex.Options, RegexOptions.Singleline))
     str = str + "s";
   string options = str + "u";
   if (this.HasFlag(regex.Options, RegexOptions.ExplicitCapture))
     options = options + "x";
   writer.WriteRegex(regex.ToString(), options);
 }
开发者ID:tanis2000,项目名称:FEZ,代码行数:14,代码来源:RegexConverter.cs

示例3: WriteRegexPlusContent

        public void WriteRegexPlusContent()
        {
            MemoryStream ms = new MemoryStream();
            BsonWriter writer = new BsonWriter(ms);

            writer.WriteStartObject();
            writer.WritePropertyName("regex");
            writer.WriteRegex("abc", "i");
            writer.WritePropertyName("test");
            writer.WriteRegex(string.Empty, null);
            writer.WriteEndObject();

            byte[] expected = HexToBytes("1A-00-00-00-0B-72-65-67-65-78-00-61-62-63-00-69-00-0B-74-65-73-74-00-00-00-00");

            CollectionAssert.AreEquivalent(expected, ms.ToArray());
        }
开发者ID:b-bot-108,项目名称:brain-bot-111-b-bot-110-BND,代码行数:16,代码来源:BsonWriterTests.cs

示例4: WriteBson

 // Token: 0x060001A6 RID: 422
 // RVA: 0x0002BE48 File Offset: 0x0002A048
 private void WriteBson(BsonWriter writer, Regex regex)
 {
     string text = null;
     if (this.HasFlag(regex.Options, RegexOptions.IgnoreCase))
     {
         text += "i";
     }
     if (this.HasFlag(regex.Options, RegexOptions.Multiline))
     {
         text += "m";
     }
     if (this.HasFlag(regex.Options, RegexOptions.Singleline))
     {
         text += "s";
     }
     text += "u";
     if (this.HasFlag(regex.Options, RegexOptions.ExplicitCapture))
     {
         text += "x";
     }
     writer.WriteRegex(regex.ToString(), text);
 }
开发者ID:newchild,项目名称:Project-DayZero,代码行数:24,代码来源:RegexConverter.cs


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