コード例 #1
0
        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));
            }
        }
コード例 #2
0
        /// <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);
        }