private void CreateNewCharacter() { if (!IsNameValid()) { string msg = "Invalid name\n*letter, number and spaces only\n*cannot begin or end with space\n*no 2 spaces in a row\n*min 3 characters"; new MessageBox(msg); return; } if (zHeroClass == HeroClass.Invalid) { new MessageBox("Select class"); return; } string fileName = Path.Make(Path.Save, zNametextbox.Text); fileName = fileName.Replace(" ", "_"); fileName += ".hero"; if (System.IO.File.Exists(Path.Make(Path.Save, fileName))) { new MessageBox("This name is taken"); return; } Hero hero = new Hero(zNametextbox.Text, zHeroClass); SaveHero shero = hero.ToSavehero(); Functions.Serialize(fileName, shero); hero.Destroy(); MainMenu m = (MainMenu)ScreenManager.CurrentScreen; m.ReloadCharacterList(); Destroy(); }