protected override void LoadQuestion(System.IO.Stream stream) { this.a = (int)QuestionData.ReadValue(stream); this.b = (int)QuestionData.ReadValue(stream); this.op = (Operator)QuestionData.ReadValue(stream); this.c = (int)QuestionData.ReadValue(stream); string resultText = QuestionData.ReadText(stream); if (resultText == "{NULL}") { this.result = null; } else { this.result = Convert.ToInt32(resultText); } string isCorrectText = QuestionData.ReadText(stream); if (isCorrectText == "{NULL}") { this.IsCorrect = null; } else { this.IsCorrect = Convert.ToBoolean(isCorrectText); } }
public static Question Load(Stream stream) { Question question = null; int type = (int)QuestionData.ReadValue(stream); if (type == Question_a_b_c.type) { question = new Question_a_b_c(); } question.LoadQuestion(stream); return(question); }