public static void AddReRule <TMsg>(this Controller <TMsg> controller, Re re, MatchHandle <TMsg> handle, ReRuleOptions options = null) { options ??= new ReRuleOptions(); if (options.ImplicitBeginEnd) { re = begin + re + end; } var regex = new Regex(re.ToString(), options.RegexOptions); AddRegexRule(controller, regex, handle); }
public RegexAction(IProvider <TMsg, string> textProvider, Regex regex, MatchHandle <TMsg> handle) { _textProvider = textProvider; _regex = regex; _handle = handle; }
public static void AddRegexRule <TMsg>(this Controller <TMsg> controller, Regex regex, MatchHandle <TMsg> handle) { var prov = controller.Providers.OfType <IProvider <TMsg, string> >().SingleOrDefault(); if (prov == null) { throw new KeyNotFoundException("Provider not found"); } controller.Add(new RegexAction <TMsg>(prov, regex, handle)); }