Quick and dirty way to save the program state in C#
I have a game I'm writing that I need to debug a certain feature of. The problem with this game is that currently, there is no way to begin fr开发者_JS百科om a "running game" which mean that every time I want to test certain features, I need to do the setup (which takes 2-3 minutes every time)
To make things worse, the game randomizes the objects therefore I may not see them in the game for a while. I have turned off the randomization for debugging purposes however unfortunately doing so breaks a lot of other parts of the game.
Therefore, I was wondering if (like C) there is a way to dump the application state to the hard drive and load it again later.
I'm aware that there is serialization in the C#, however since being able to load a "save game" wouldn't be available in the final release version I'd prefer an easier way if possible.
Thanks
Don't know about saving a full dump, doubt that it is possible, but the randomization problem is usually solved by seeding the (pseudo) random number generator with the same number every time -- this will ensure that your random number sequence is the same every time.
精彩评论