How to handle type changes?

Discussion and help for Easy Save 3
User avatar
Joel
Moodkie Staff
Posts: 4123
Joined: Wed Nov 07, 2012 10:32 pm

Re: How to handle type changes?

Post by Joel »

Manufacture43-Daniel wrote:
Fri Sep 11, 2020 8:13 am
The strings are already being loaded into memory, it's just a matter of putting them unparsed (unparsed as in not converted to int or float) in dictionaries and lists that would be sent to a callback with the name of their variable to see if the client want to make anything of them. If you don't want to accumulate and wait for the end of the full loading, as this would have a bigger impact on memory, I understand, just call the callbacks as data is gathered.
Hi there,

If there's demand for this then we'd definitely consider implementing this in the way you've described, but happy for you to create your own implementation in the meantime.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started

DeliInteractive
Posts: 9
Joined: Sat Feb 27, 2021 4:03 am

Re: How to handle type changes?

Post by DeliInteractive »

Manufacture43-Daniel wrote:
Fri Sep 11, 2020 8:13 am
If I get the time, I'll implement the change myself and put the diffs here.
Hi there! Was this ever implemented? We'd be really interested in something like the feature you've described in this post. Saves evolve sometimes! :D

User avatar
Joel
Moodkie Staff
Posts: 4123
Joined: Wed Nov 07, 2012 10:32 pm

Re: How to handle type changes?

Post by Joel »

Hi there,

The issue with loading a class as a Dictionary<string, System.Object> is that although the JSON format has three different primitive types, these can represent many different primitive types (i.e. a JSON number could be a decimal, double, float, int, uint, ... etc). When saving data as a System.Object we save type data with it so that it can be loaded (this is one place where we depart from the JSON format). However, unless it's a System.Object, no type data will be stored with it because it's a primitive type and it's assumed that this can be established from the type provided when loading.

In your case if you wanted to load as a Dictionary<string, System.Object>, you would also need to save your data as a Dictionary<string, Object>.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started

Post Reply