Refactoring type names/namespaces/assemblies causes error in loading.

Discussion and help for Easy Save 3
Post Reply
dlees9191
Posts: 1
Joined: Sat Jun 18, 2022 2:24 pm

Refactoring type names/namespaces/assemblies causes error in loading.

Post by dlees9191 »

Hi! I recently wanted to put everything in namespaces so that I could use assembly definitions. Once I updated the game, I noticed that players lost some of their progress because the type of the class I was saving changed from:

"__type" : "StageProgress,Assembly-CSharp",
to
"__type" : "StageSystem.StageProgress,Assembly-CSharp",

What is the best way to change a class's name, namespace, or assembly after we already started saving it?

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

Re: Refactoring type names/namespaces/assemblies causes error in loading.

Post by Joel »

Hi there, and thanks for getting in contact.

This occurs because C# now considers your class a different class.

In this case you would need to do a search and replace of the save file to replace the old type with the new one. I.e.

Code: Select all

string saveString = ES3.LoadRawString("SaveFile.es3");
saveString.Replace("StageProgress", "StageSystem.StageProgress");
ES3.SaveRaw(saveString, "SaveFile.es3");
All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply