Exemplo n.º 1
0
 public static void Save(this RegexConfig conf, string path)
 {
     CreateDirectoryIfNotExist(Path.GetDirectoryName(path));
     using (var writer = new StreamWriter(path, false))
     {
         writer.Write(Newtonsoft.Json.JsonConvert.SerializeObject(conf));
     }
 }
Exemplo n.º 2
0
 public static Regex ToSingleCommentRegex(this RegexConfig conf)
 {
     return(string.IsNullOrEmpty(conf.SingleComment) ? null : new Regex(conf.SingleComment));
 }
Exemplo n.º 3
0
 public static IEnumerable <Regex> ToMiscExpressionRegex(this RegexConfig conf)
 {
     return(conf.MiscExpressions.Where(x => !string.IsNullOrEmpty(x)).Select(x => new Regex(x)));
 }
Exemplo n.º 4
0
 public RegexCoreCounterFactory(RegexConfig conf) :
     this(conf.ToBlockCommentRegex(), conf.ToSingleCommentRegex(), conf.ToMiscExpressionRegex().ToArray())
 {
 }