예제 #1
0
파일: Test.cs 프로젝트: 6aTaPeI9/FireSafe
        //Метод заполняет двусвязный список Quests.
        private void FillQuest()
        {
            //LinkedQuestList qs = new LinkedQuestList();
            //using (StreamReader rdr = new StreamReader(@"questions.txt"))
            //{
            //    string textfromfile = rdr.ReadToEnd();
            //    foreach (string question in Regex.Split(textfromfile, @"-------------------------------\r\n"))
            //    {
            //        List<string> sub_question = Regex.Split(question, "\r\n").Where(x => x != String.Empty).ToList();
            //        List<int> right_answer = new List<int>();
            //        for (int i = 1; i <= sub_question.Count() - 1; i++)
            //        {
            //            if (char.IsUpper(sub_question[i][0]))
            //            {
            //                right_answer.Add(i);
            //            }

            //            sub_question[i] = Regex.Split(sub_question[i], @"%%")[1];
            //        }
            //        string Data = string.Join("#", sub_question.GetRange(1, sub_question.Count - 1).ToArray());

            //        qs.Add(Data, sub_question[0], right_answer);
            //    }
            //}
            //_qs = qs;

            BinaryFormatter formatter = new BinaryFormatter();

            using (FileStream fs = new FileStream("Demon.dat", FileMode.OpenOrCreate))
            {
                _qs = (LinkedQuestList)formatter.Deserialize(fs);
            }
        }
예제 #2
0
 public QuestPanel(int index, LinkedQuestList qs)
 {
     InitializeComponent();
     _index            = index;
     _qs               = qs;
     this.button1.Text = index.ToString();
 }