Beispiel #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));
     }
 }
Beispiel #2
0
 public static Regex ToSingleCommentRegex(this RegexConfig conf)
 {
     return(string.IsNullOrEmpty(conf.SingleComment) ? null : new Regex(conf.SingleComment));
 }
Beispiel #3
0
 public static IEnumerable <Regex> ToMiscExpressionRegex(this RegexConfig conf)
 {
     return(conf.MiscExpressions.Where(x => !string.IsNullOrEmpty(x)).Select(x => new Regex(x)));
 }
 public RegexCoreCounterFactory(RegexConfig conf) :
     this(conf.ToBlockCommentRegex(), conf.ToSingleCommentRegex(), conf.ToMiscExpressionRegex().ToArray())
 {
 }