Example #1
0
        public void SaveGameState()
        {
            FileSaveNameDialog sn = new FileSaveNameDialog();

            sn.SetLabel("Name for state:");

            if (sn.ShowDialog() == DialogResult.OK && sn.GetName().Length > 0)
            {
                string file  = Filer.Load(Game.GetName());
                string name  = sn.GetName();
                string state = Game.SaveState();
                if (FM.StateExists(file, name) &&
                    MessageBox.Show("State Exists", "OK to overwrite?", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    Filer.ReplaceFile(name, FM.OverwriteSavedState(file, name, state));
                }
                else if (!FM.StateExists(file, name))
                {
                    Filer.AppendState(file, name, state);
                }
            }
        }