Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string dosyaismigiris = txtKullaniciAdiGiris.Text + ".xml";

            if (File.Exists(dosyaismigiris))
            {
                XMLOkuma.XmlOku(txtKullaniciAdiGiris);
                if (txtKullaniciAdiGiris.Text == XMLOkuma.Oyunbilgileri.SelectSingleNode("KullaniciAdi").InnerText&& txtSifre.Text == XMLOkuma.Oyunbilgileri.SelectSingleNode(" Sifre").InnerText)
                {
                    f1.Show();
                    this.Hide();
                }
            }
            else
            {
                DialogResult sonuc = MessageBox.Show("Bu isimde bir kullanici bulunamadı. Yeni hesap oluşturmak ister misiniz?", "Yeni Kullanıcı Hesabı", MessageBoxButtons.YesNo);
                if (sonuc == DialogResult.Yes)
                {
                    YeniKullaniciForm yk = new YeniKullaniciForm();
                    yk.Show();
                    yk.txtKullaniciAdiYeni.Text = txtKullaniciAdiGiris.Text;
                    this.Hide();
                }
                else
                {
                    YeniKullaniciForm yk = new YeniKullaniciForm();
                    yk.Close();
                    this.Show();
                }
            }
        }
Пример #2
0
        //public static string DosyaIsmi;
        private void button1_Click(object sender, EventArgs e)
        {
            XmlDocument doc = new XmlDocument();

            //DosyaIsmi = txtKullaniciAdiYeni.Text + ".xml";
            if (!File.Exists(txtKullaniciAdiYeni.Text + ".xml"))
            {
                XmlElement Oyunbilgileri = doc.CreateElement("Oyunbilgileri");
                doc.AppendChild(Oyunbilgileri);
                XmlElement KullaniciAdi = doc.CreateElement("KullaniciAdi");
                KullaniciAdi.InnerText = txtKullaniciAdiYeni.Text;
                Oyunbilgileri.AppendChild(KullaniciAdi);
                XmlElement Sifre = doc.CreateElement("Sifre");
                Sifre.InnerText = txtSifre.Text;
                Oyunbilgileri.AppendChild(Sifre);
                XmlElement Sayac = doc.CreateElement("sayac");
                Sayac.InnerText = "1";
                Oyunbilgileri.AppendChild(Sayac);
                XmlElement Skor = doc.CreateElement("Skor");
                Skor.InnerText = "0";
                Oyunbilgileri.AppendChild(Skor);
                XmlElement KutuHarfleri = doc.CreateElement("KutuHarfleri");
                Oyunbilgileri.AppendChild(KutuHarfleri);
                XmlElement AltKutuHarfleri = doc.CreateElement("AltKutuHarfleri");
                Oyunbilgileri.AppendChild(AltKutuHarfleri);
                XmlElement listbox = doc.CreateElement("listbox");
                Oyunbilgileri.AppendChild(listbox);
                XmlElement KutuSayisi = doc.CreateElement("KutuSayisi");
                KutuSayisi.InnerText = "11";
                Oyunbilgileri.AppendChild(KutuSayisi);



                doc.Save(txtKullaniciAdiYeni.Text + ".xml");

                XMLOkuma.XmlOku(txtKullaniciAdiYeni);
                Form1 f1 = new Form1();
                f1.Show();
                this.Close();
            }
            else
            {
                DialogResult sonuc = MessageBox.Show("Bu isimde kullanıcı mevcuttur. Yeni bir isim deneyiniz.", "Uyarı", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (sonuc == DialogResult.Yes)
                {
                    this.Show();
                }
                else
                {
                    this.Close();
                }
            }
        }