C# Class SunsetHigh.SaveManager

Static class for managing save states. Saves games by serializing SaveGameData as XML and then encrypting it. The encryption prevents players from easily accessing and "hacking" the XML files.
Afficher le fichier Open project: ErraticUnicorn/MOSH

Méthodes publiques

Méthode Description
generateNewFileName ( ) : string
getSaveData ( string fileName, bool encrypt = true ) : SaveGameData

Loads a game with a given file name in the "SaveData" folder. By default the method will attempt to decrypt the file.

loadAllGames ( bool encrypt = true ) : List

Loads all save files in the "SaveData" folder. Can be used for previewing save files in the title screen

loadGame ( string fileName, bool encrypt = true ) : void
packData ( ) : SaveGameData
saveGame ( string fileName, SaveGameData saveGame, bool encrypt = true ) : bool

Saves a game to an external file in the "SaveData" folder. By default the save file is encrypted.

saveGame ( string fileName, bool encrypt = true ) : void
unpackData ( SaveGameData data ) : void
unpackDefaultData ( ) : void

Private Methods

Méthode Description
decryptFile ( string fileNameIn, bool debug = false ) : Stream
encryptFile ( Stream streamIn, string fileNameOut ) : bool

Method Details

generateNewFileName() public static méthode

public static generateNewFileName ( ) : string
Résultat string

getSaveData() public static méthode

Loads a game with a given file name in the "SaveData" folder. By default the method will attempt to decrypt the file.
public static getSaveData ( string fileName, bool encrypt = true ) : SaveGameData
fileName string Name of the file to load
encrypt bool Optional, specifies whether to decrypt the file
Résultat SaveGameData

loadAllGames() public static méthode

Loads all save files in the "SaveData" folder. Can be used for previewing save files in the title screen
public static loadAllGames ( bool encrypt = true ) : List
encrypt bool
Résultat List

loadGame() public static méthode

public static loadGame ( string fileName, bool encrypt = true ) : void
fileName string
encrypt bool
Résultat void

packData() public static méthode

public static packData ( ) : SaveGameData
Résultat SaveGameData

saveGame() public static méthode

Saves a game to an external file in the "SaveData" folder. By default the save file is encrypted.
public static saveGame ( string fileName, SaveGameData saveGame, bool encrypt = true ) : bool
fileName string Name to give saved data file
saveGame SaveGameData Data to be saved
encrypt bool Optional, specifies whether output file should be encrypted (True by default)
Résultat bool

saveGame() public static méthode

public static saveGame ( string fileName, bool encrypt = true ) : void
fileName string
encrypt bool
Résultat void

unpackData() public static méthode

public static unpackData ( SaveGameData data ) : void
data SaveGameData
Résultat void

unpackDefaultData() public static méthode

public static unpackDefaultData ( ) : void
Résultat void