public void CollectAnswers() { RuleRepository ruleRepository = ruleParser.GetRuleRepository(); IEnumerator <Question> enumerator = ruleRepository.GetEnumerator(); while (enumerator.MoveNext()) { //Console.WriteLine(enumerator.Current.id); Console.WriteLine(enumerator.Current.question); string input = Console.ReadLine(); questionsAndAnswers[enumerator.Current.id] = input; } //foreach(KeyValuePair<string,string> a in questionsAndAnswers) //{ // Console.WriteLine("{0},{1}",a.Key,a.Value); //} }
public void readRules() { loadXmlDocument("Rules.xml"); ruleRepo = new RuleRepository(); foreach (XmlNode node in doc.DocumentElement) { string ájdí = null; string q = null; ájdí = node.Attributes["id"].Value; bool abool = true; List <string> inputPattern = new List <string>(); foreach (XmlNode qu in node) { if (qu.Name == "Question") { q = qu.InnerText; } else if (qu.Name == "Answer") { foreach (XmlNode an in qu) { abool = Convert.ToBoolean(an.Attributes["value"].Value); foreach (XmlNode inpPattern in qu) { inputPattern.Add(inpPattern.Attributes["value"].Value); } } } else { Console.WriteLine("Cannot happen"); } } Answer answer = new Answer(abool, inputPattern); Question question = new Question(ájdí, q, answer); ruleRepo.addQuestion(question); //ruleRepo.addQuestion(question); } }