private void button2_Click(object sender, EventArgs e) { if (email2.Text.Length >= 1 && pass2.Text.Length >= 1) { for (int i = 0; i < email2.Text.Length; i++) { if (email1.Text[i] == '@') { emailOK = true; break; } } } if (emailOK) { emailOK = false; lid Lid1 = new lid(email2.Text, pass2.Text); lid Lid2 = new lid(); for (int i = 1; i < k; i++) { Lid2 = lid.lidFileStreamOut(k - 1); if (Lid1 == Lid2) { ok.Visible = true; wrong.Visible = false; } else { ok.Visible = false; wrong.Visible = true; } } } }
public static lid lidFileStreamOut(int n) { FileStream fs = new FileStream(@"data" + n + ".xml", FileMode.OpenOrCreate, FileAccess.ReadWrite); XmlSerializer xs = new XmlSerializer(typeof(lid)); try { lid b = xs.Deserialize(fs) as lid; return(b); } catch (Exception e) { lid c = new lid(); return(c); } }
public static void lidFileStreamIn(lid Lid, int n) { FileStream fs = new FileStream(@"data" + n + ".xml", FileMode.OpenOrCreate, FileAccess.ReadWrite); XmlSerializer xs = new XmlSerializer(typeof(lid)); try { xs.Serialize(fs, Lid); n++; } catch (Exception e) { Console.WriteLine("ERROR!!!"); } finally { fs.Close(); } }
private void button1_Click(object sender, EventArgs e) { if (email1.Text.Length >= 1 && pass1.Text.Length >= 1) { for (int i = 0; i < email1.Text.Length; i++) { if (email1.Text[i] == '@') { emailOK = true; break; } } } if (emailOK) { lid Lid = new lid(email1.Text, pass1.Text); lid.lidFileStreamIn(Lid, k); emailOK = false; k++; } }