A working save system is a crucial part of every app that has some sort of settings or other user inputs that need to be stored. Most of my apps save some kind of files as well. Currently, practically every app I have uses a different save system, all of them being pretty outdated and flawed. That's why I've decided to make one universal save system that can be used in all of my apps that are written in C# and WPF.
SeeloewenLib v1.0.0 already comes with a basic implementation of a Save System, though it was mostly meant for test purposes and wasn't ready for actual use yet. As you may know, there haven't been any updates since the first release of the library. That's because since the release, I've been cooking up ideas for features and improvements. Now, it's finally time to add them and the Save System is the first since I think it's most important.
How am I going to implement it?
Pretty much everything is automated. One of the few manual things is the creation of settings entrys. When starting your app, you will need to create a new SaveSystem. To the saveEntries list of that SaveSystem you will have to add a SaveEntry for each entry you want to save. This entry includes the following parameters: string name, string content, bool isCategory, bool hasDefinedValues, string[] possibleValues, int index
When this is done, you can get all settings from your settings file and load the respective values from file into the entries. While doing this, it automatically checks for corruption or invalid values. After finding a corrupted value, you will be asked whether to continue loading it or correct it. When correcting the file, a backup will be created in case you need your old values back.
The entries can be accessed and customized using the provided methods, or simply by accessing the SaveEntries by your own methods.
GetEntry(name) => Returns the value of the given entry
SetEntry(name, value) => Sets entry to given value
ResetEntries() => Resets entries to their default value (1st in possibleValues array or "" if hasDefinedValues is false)
Saving the entries is also very easy. Simply run the Save() method and all of the entries will be written to a settings file. You are free to decide the header and also the filename and path of that settings file.