private void StartMenu_StartGame_Click(object sender, EventArgs e) { string[] file; if (File.Exists(@"D:\\HeroWarsSaves.txt")) { file = File.ReadAllLines(@"D:\\HeroWarsSaves.txt"); if (file.Length >= 1) { this.Hide(); Saves saves = new Saves(); saves.ShowDialog(); this.Close(); } else { MessageBox.Show("No characters found! Please create a character!"); this.Hide(); CharacterCreator createcharacter = new CharacterCreator(); createcharacter.ShowDialog(); this.Close(); } } else { MessageBox.Show("No characters found! Please create a character!"); this.Hide(); CharacterCreator createcharacter = new CharacterCreator(); createcharacter.ShowDialog(); this.Close(); } }
private void Saves_CreateC_Click(object sender, EventArgs e) { this.Hide(); CharacterCreator createcharacter = new CharacterCreator(); createcharacter.ShowDialog(); this.Close(); }
private void NoCharacters() { this.Hide(); MessageBox.Show("You ran out of characters! Create a new one."); CharacterCreator createcharacter = new CharacterCreator(); createcharacter.ShowDialog(); this.Close(); }
private void NoCharacters() { using (FileStream file = new FileStream(@"D:\\Users.txt", FileMode.Truncate, FileAccess.Write)) { StreamWriter sw = new StreamWriter(file); foreach (var c in LogIn.users) { sw.WriteLine(c.Name + "|" + c.Password + "|" + c.Heroes); } sw.Close(); sw.Dispose(); } this.Hide(); MessageBox.Show("You ran out of characters! Create a new one."); CharacterCreator createcharacter = new CharacterCreator(); createcharacter.ShowDialog(); this.Close(); }