too many overloads on ES.Load()?

Discussion and help for Easy Save 3
Post Reply
Snoopy
Posts: 3
Joined: Mon Feb 13, 2017 2:16 am

too many overloads on ES.Load()?

Post by Snoopy »

I followed the getting started and want to do something like:
ES3.Load<string>("playerName", "Default Name")

but I noticed if I call that first without saving then as expected the save file isn't found but it throws an exception instead of giving me the default value.

Debugging why, it turns out its not going to this overload like I expected:
public static T Load<T>(string key, T defaultValue)

but instead its going to:
public static T Load<T>(string key, string filePath)

So to fix that I did:
ES3.Load<string>("playerName", "Default Name", ES3Settings.defaultSettings);

hoping that it would go to:
public static T Load<T>(string key, T defaultValue, ES3Settings settings)

but instead it went to:
public static T Load<T>(string key, string filePath, T defaultValue)

So to fix that I did:
ES3.Load<string>("playerName", "ES3/ES3Defaults", "Default Name", ES3Settings.defaultSettings);

and that finally worked cause it went to:
public static T Load<T>(string key, string filePath, T defaultValue, ES3Settings settings)

but geez. There's no exposed way to get to
private const string defaultSettingsPath = "ES3/ES3Defaults";
so I have to mirror that.

Seems like there's a few too many overloads named Load() when I just want to do something basic like this.

Is there a better way?

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

Re: too many overloads on ES.Load()?

Post by Joel »

Hi there,

Unfortunately it's necessary to have a lot of overloads as any combination of these is necessary depending on the project, but agreed this does make it difficult when saving strings. To make life easier in this case I'll add an ES3.LoadString method. If you private message me your invoice number I can send this over.

Just to clarify, the following will always return the default settings:

Code: Select all

new ES3Settings();
All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply