private void bt_enter_Click(object sender, EventArgs e) { UserU u = new UserU(); FileStream file = new FileStream(Path.Combine(Directory.GetCurrentDirectory(), "logins.txt"), FileMode.Open, FileAccess.Read); //StreamWriter writer = new StreamWriter(file, Encoding.UTF8); StreamReader reader = new StreamReader(file, Encoding.UTF8); u.login = reader.ReadLine(); u.Password = reader.ReadLine(); reader.Close(); if (tb_login.Text == u.login && tb_pass.Text == u.Password) { MessageBox.Show("Правельно!!!"); panel1.Hide(); PB_progress_test.Show(); TB_pages_test.Show(); lb_progress.Show(); lb_trak_pages.Show(); tabc_test.Show(); bt_end_test.Show(); timer1.Enabled = true; timer1.Start(); } else { MessageBox.Show("Неверно повторите еше раз!!"); } }
static void Main() { UserU u = new UserU(); u.login = "******"; u.Password = "******"; FileStream file = new FileStream(Path.Combine(Directory.GetCurrentDirectory(), "logins.txt"), FileMode.Create, FileAccess.Write); StreamWriter writer = new StreamWriter(file, Encoding.UTF8); //StreamReader reader = new StreamReader(file, Encoding.UTF8); writer.WriteLine(u.login); writer.WriteLine(u.Password); writer.Close(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }