public static void NewCharacter() { SaveFileDialog SFD = new SaveFileDialog() { Title = "New character", Filter = "json file|*.json", InitialDirectory = Storage.Config.CharacterFolder, AddExtension = true }; if (SFD.ShowDialog() == true) { String Name = System.IO.Path.GetFileNameWithoutExtension(SFD.FileName); CharacterSheet Character = new CharacterSheet(); Character.Details.Name = Name; Character.Powers.Add(new Power()); Storage.Set(Character); PageController.Load(CharacterController.LoadCharacter(Character)); } }
/// <summary> /// /// </summary> /// <param name="Sheet"></param> /// <returns></returns> public static void Set(CharacterSheet Sheet) { String Filepath = Storage.Config.CharacterFolder + Sheet.Details.Name + ".json"; Serialization.Serialization.Serialize(Sheet, "json", Filepath); }