Save/Import/Export characters
Allow the user to save/import/export certain characters in a certain file format (JSON?) or SQLite database (with Entity Framework?) so it can be loaded after closing and opening the program again, or when loading it onto a different computer. You could maybe carry a USB Stick with the file on it, or save it somewhere in the cloud and then download it and import the characters.
The way it is probably gonna happen:
- Save a .json file to the
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationDatafolder. (Create a folder in there calledD&D Combat Tracker. The file will be calledCharacters.json - The file will contain a list of categories. A category is a name (of the category) and a list of characters. (This is handy because users will be able to create different categories for different campaigns or something)
- Allow the user to access this file by implementing #16 . By clicking on a certain option he can open a GUI and add/edit/delete/add categories/characters to current list/import*/export* categories and characters. He should be able to add (items from) multiple (and different) categories to the current list at the same time.
*Not planned for the first version:
- Allow the user to import a character from a different location (USB drive or something). It will overwrite OR let the user choose what file to use.
- Exception handling (what if the software can't write to the disk, what if the file is deleted while doing things)
I'd like to take a stab at this.
I am thinking about a PartyManagerService and a Party class.
public class Party { public Guid partyId { get; set; } public string Name { get; set; } public List<Character> Characters { get; set; } public string Notes { get; set; } }
the manager service will expose the following:
- GetParties: returns a list of all currently saved parties
- SaveParty: looks up to see if a party currently exists. If so, updates the party, otherwise saves a new party
- SaveParties: (might be private) saves all parties to file.