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)); } }
public static Regex ToSingleCommentRegex(this RegexConfig conf) { return(string.IsNullOrEmpty(conf.SingleComment) ? null : new Regex(conf.SingleComment)); }
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()) { }