-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathIGameSave.cs
45 lines (39 loc) · 1.44 KB
/
IGameSave.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/// <summary>
/// The common persisted data (save/load) interface for various platforms.
/// </summary>
public interface IGameSave {
/// <summary>
/// Binary serialize any generic data object.
/// </summary>
/// <param name="filename">The filename to save this data to.</param>
/// <param name="data">The data to serialize.</param>
void BinarySerialize(string filename, object data);
/// <summary>
/// Binary deserialize any generic data object.
/// </summary>
/// <typeparam name="T">The class type of the deserialized data.</typeparam>
/// <param name="filename">The filename of the data to deserialize.</param>
/// <returns>The deserialized data if it existed, otherwise a default object.</returns>
T BinaryDeserialize<T>(string filename) where T : new();
/// <summary>
/// Delete a given file.
/// </summary>
/// <param name="filename">The name of the file to delete.</param>
void Delete(string filename);
/// <summary>
/// Checks if a given file exists.
/// </summary>
/// <param name="filename">The name of the file to check.</param>
/// <returns>True if the file exists, false otherwise.</returns>
bool FileExists(string filename);
/// <summary>
/// Gets the full save path, including the filename.
/// </summary>
/// <param name="filename"></param>
/// <returns>The full save path.</returns>
string GetFullPath(string filename);
/// <summary>
/// Write all changes to the disk.
/// </summary>
public void WriteToDisk();
}