public void LoadQuestionFile(string _filePath) { QuestionsInSet.Clear(); NumberOfAnsweredQuestions = 0; QuestionsRandomlyChoosenForTest.Clear(); using (StreamReader sr = new StreamReader(_filePath)) { string _questionLine; while ((_questionLine = sr.ReadLine()) != null) { if (!_questionLine.Contains(';')) { NumberOfQuestionsForThisTest = int.Parse(_questionLine); } else { string[] _questionElements = _questionLine.Split(';'); Question _question = new Question(_questionElements[0], _questionElements[1], _questionElements[2], _questionElements[3], int.Parse(_questionElements[4])); QuestionsInSet.Add(_question); } } } if (NumberOfQuestionsForThisTest == 0) { throw new Exception("Soubor otázek neobsahuje počet otázek vygenerovaných pro každý test. Nemůžu proto pokračovat."); } ChooseQuestionsForTest(); }