public override void StartElement(string uri, string localName, string qName, IAttributes attributes) { switch (localName.ToLower()) { case "questiongroups": QuestionGroups = new Dictionary <string, QuestionGroup>(); break; case "questiongroup": questionGroup = new QuestionGroup(attributes.GetValue("name"), attributes.GetValue("text"), attributes.GetValue("background"), int.Parse(attributes.GetValue("thumb")), attributes.GetValue("clue")); break; case "question": question = new Question(attributes.GetValue("id"), attributes.GetValue("text")); break; case "answer": answer = new Answer(bool.Parse(attributes.GetValue("correct")), attributes.GetValue("text")); break; } }
static bool CheckAnswers(int[] currentAnswers, QuestionGroup currentQuestions) { return(currentAnswers != null && !currentAnswers.Any(a => a == -1) && !currentQuestions.Questions.Where( (t, i) => !t.Answers[currentAnswers[i]].Correct).Any()); }