private void mansNoHot() { OpenFileDialog bucket = new OpenFileDialog(); //bucket.InitialDirectory = @"C:\"; bucket.Filter = "shitcomp class (*.shittytestv3)|*.shittytestv3|" + "All Files (*.*)|*.*"; //bucket.FileName = "test.shittytest"; bucket.CheckFileExists = true; bucket.CheckPathExists = false; bucket.Title = "Открытие теста"; DialogResult yep = bucket.ShowDialog(); string test; if (yep == DialogResult.OK) { test = bucket.FileName; link = test; using (Stream input = File.OpenRead(link)) { BinaryFormatter formatter = new BinaryFormatter(); shi = (shitcomp)formatter.Deserialize(input); } textBox2.Text = link; } }
public testerv3(shitcomp shitcomp, user user, string tstName) // ИНИЦИАЛИЗАЦИЯ ПРИ СОЗДАНИИ { InitializeComponent(); this.FormBorderStyle = FormBorderStyle.None; preInit(shitcomp); User = user; testName = tstName; }
private shitcomp tts(string s) //получаем тестики { //Test sh = DBworker.getTest(s); shitcomp tt = DBworker.getTest(s); //shitcomp tt = new shitcomp { Name = sh.Name, User = sh.User, isInitialised = sh.isInitialised, questions = sh.questions, questionsAmount = sh.questionsAmount, questionsPoints = sh.questionsPoints }; return(tt); }
//string link; void preInit(shitcomp questionarium) // Загрузка теста { questions = questionarium; questions.questions = questionarium.questions.OrderBy(x => rand.Next()).ToArray(); progressBar1.Maximum = questions.questions.Length - 1; checks = new bool[questions.questions.Length][]; //int cntr4rs = 0; for (int n = 0; n < questions.questions.Length; n++) { checks[n] = new bool[questions.questions[n].trueanswer.Length]; //if (questions.questions[n].qtype == question.questiontypes.text) cntr4rs++; } //txt = new string[cntr4rs]; txt = new string[questions.questions.Length]; updateForm(); }
private void button3_Click(object sender, EventArgs e) // Тест { string s = listBox1.GetItemText(listBox1.SelectedItem); if (s != null && s != "") { shitcomp tst = tts(s); string tstn = DBworker.checkTest(s).Name; testerv3 form = new testerv3(tst, User, tstn); Hide(); form.ShowDialog(); Show(); } else { MessageBox.Show("Выберите существующий тест из списка!"); } }
private void button18_Click(object sender, EventArgs e) // Открыть тест { OpenFileDialog bucket = new OpenFileDialog(); bucket.Filter = "Test files (*.shittytestv3)|*.shittytestv3|" + "class data (*.dat)|*.dat|" + "All Files (*.*)|*.*"; bucket.CheckFileExists = true; bucket.CheckPathExists = false; bucket.Title = "Открытие бинарника теста"; DialogResult yep = bucket.ShowDialog(); if (yep == DialogResult.OK) { using (Stream input = File.OpenRead(bucket.FileName)) { BinaryFormatter formatter = new BinaryFormatter(); compared = (shitcomp)formatter.Deserialize(input); } qstep = compared.tamedCounterArray; numericUpDown1.Value = 1 + compared.tamedCounter; updateForm(); } }
void preInit() { shitcomp questionarium = new shitcomp(); using (Stream input = File.OpenRead(link)) { BinaryFormatter formatter = new BinaryFormatter(); questionarium = (shitcomp)formatter.Deserialize(input); } questions = questionarium; questions.questions = questionarium.questions.OrderBy(x => rand.Next()).ToArray(); progressBar1.Maximum = questions.questions.Length - 1; checks = new bool[questions.questions.Length][]; //int cntr4rs = 0; for (int n = 0; n < questions.questions.Length; n++) { checks[n] = new bool[questions.questions[n].trueanswer.Length]; //if (questions.questions[n].qtype == question.questiontypes.text) cntr4rs++; } //txt = new string[cntr4rs]; txt = new string[questions.questions.Length]; updateForm(); }