Пример #1
0
        protected void ParseSubquestion(Lesson lesson, IList <string> lines)
        {
            const string Separator = "_";

            var match = TextParseZhCn.SubQuestionPattern.Match(lines[0]);

            lines[0] = lines[0].Substring(match.Value.Length);
            var questions = TextParseZhCn.GetSubquestions(lines);
            var parts     = lesson.DayQuestions.Last().Questions.Last().Id.Split(new[] { Separator }, StringSplitOptions.None).ToList();
            var count     = int.Parse(parts.Last());

            foreach (var line in questions)
            {
                var id = string.Join(Separator, parts[0], parts[1], parts[2], ++count);
                this.AddQuestion(lesson, parts[2] + ". " + match.Groups[0].Value + line, id);
            }
        }
Пример #2
0
        protected void ParseQuestion(Lesson lesson, IList <string> lines)
        {
            const string Separator = "_";

            var match         = TextParseZhCn.QuestionPattern.Match(lines[0]);
            var questionOrder = match.Groups[1].Value;

            lines[0] = lines[0].Substring(match.Value.Length);
            var questions = TextParseZhCn.GetSubquestions(lines);
            var count     = 1;

            foreach (var line in questions)
            {
                var id = string.Join(Separator, this.Year, lesson.DayQuestions.Count(), questionOrder, count++);
                this.AddQuestion(lesson, match.Groups[0].Value + line, id);
            }
        }