internal AbstractTextParser(int year, CultureInfo culture, IDictionary <Regex, MethodInfo> methodMappings, VerseLocator verseLocator)
        {
            this.Year           = year;
            this.Culture        = culture;
            this.methodMappings = methodMappings;
            this.verseLocator   = verseLocator;
            var pattern = verseLocator.GetPattern();

            this.verseRegex = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);
        }
Esempio n. 2
0
        public static TextParseZhCn Create(int year, IRepository repository)
        {
            const string CultureName = "zh-CN";

            var methods = typeof(TextParseZhCn).GetMethods(BindingFlags.Instance | BindingFlags.NonPublic)
                          .Where(method => method.GetCustomAttributes(false).OfType <SectionAttribute>().Any());
            var methodMappings = methods.ToDictionary(TextParseZhCn.GetRegex);
            var culture        = CultureInfo.CreateSpecificCulture(CultureName);
            var verseLocator   = VerseLocator.Create(repository.GetBibleBooksAsync(CultureName).Result);

            return(new TextParseZhCn(year, culture, methodMappings, verseLocator));
        }
Esempio n. 3
0
 internal TextParseZhCn(int year, CultureInfo culture, IDictionary <Regex, MethodInfo> methodMappings, VerseLocator verseLocator)
     : base(year, culture, methodMappings, verseLocator)
 {
 }