Esempio n. 1
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //TODO: FIX SO IT ACTUALLY SAVES THE FILE
            //currently saves in app folder


            //generates a path to the my documents folder and creates a streamwriter object to write a txt file there
            //string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            //StreamWriter saveFile = new StreamWriter(path + "save_game.txt");
            StreamWriter saveFile = new StreamWriter("save_game.txt");

            //Will save current rendition of the character
            saveFile.WriteLine(char1.getName());
            saveFile.WriteLine(char1.getXP());
            saveFile.WriteLine(char1.getHP());
            saveFile.WriteLine(char1.getStrength());
            saveFile.Close();

            MessageBox.Show("Save successful");
        }