Esempio n. 1
0
        //----------------------------------------------------------------------------------------------------------------------------------------------------------
        // fills var testquestions with questions with their corresponding raw data
        private void gatherCompileDataIntoQuestions()
        {
            testQuestions.Clear(); // delete old compiled content

            TestQuestion tempQuestion = new TestQuestion("TEMP_QUESTION");
            bool         first        = true; // allows us to ignore any white space between title/descrip of lesson and the first question


            rawData = removeCommentsFromArray(rawData);//cut out all comments


            for (int i = 0; i < rawData.Length; i++) //for each line
            {
                if (i == 0)                          //if first of file then get name and descrip of lessonFile
                {
                    name = rawData[i];               //first line is name second is description
                    i++;
                    description = rawData[i];
                }
                else if (rawData[i].Contains("<?>"))
                {
                    if (first == true)
                    {
                        first = false;
                    }
                    else
                    {
                        testQuestions.Add(tempQuestion);
                        tempQuestion = new TestQuestion("TEMP_QUESTION"); // reset temp
                    }
                }
                else if (first != true)
                {
                    tempQuestion.addToRawData(rawData[i]);
                }
            }



            //because it only adds a new tempquestion when it finds the next question the last question of the lesson is added here \/
            testQuestions.Add(tempQuestion);
        }
 //----------------------------------------------------------------------------------------------------------------------------------------------------------
 //Constructor
 public MultibleChoice(FlowLayoutPanel inputPanel, TestQuestion aQuestion)
 {
     userInputPanel = inputPanel;
     question       = aQuestion;
 }