summaryrefslogtreecommitdiff
path: root/Thronefall_v1.0/Thronefall/I2.Loc/PersistentStorage.cs
blob: 37854fd75b33c5a5a543d9fe7e3cf3a2adf79054 (plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
namespace I2.Loc;

public static class PersistentStorage
{
	public enum eFileType
	{
		Raw,
		Persistent,
		Temporal,
		Streaming
	}

	private static I2CustomPersistentStorage mStorage;

	public static void SetSetting_String(string key, string value)
	{
		if (mStorage == null)
		{
			mStorage = new I2CustomPersistentStorage();
		}
		mStorage.SetSetting_String(key, value);
	}

	public static string GetSetting_String(string key, string defaultValue)
	{
		if (mStorage == null)
		{
			mStorage = new I2CustomPersistentStorage();
		}
		return mStorage.GetSetting_String(key, defaultValue);
	}

	public static void DeleteSetting(string key)
	{
		if (mStorage == null)
		{
			mStorage = new I2CustomPersistentStorage();
		}
		mStorage.DeleteSetting(key);
	}

	public static bool HasSetting(string key)
	{
		if (mStorage == null)
		{
			mStorage = new I2CustomPersistentStorage();
		}
		return mStorage.HasSetting(key);
	}

	public static void ForceSaveSettings()
	{
		if (mStorage == null)
		{
			mStorage = new I2CustomPersistentStorage();
		}
		mStorage.ForceSaveSettings();
	}

	public static bool CanAccessFiles()
	{
		if (mStorage == null)
		{
			mStorage = new I2CustomPersistentStorage();
		}
		return mStorage.CanAccessFiles();
	}

	public static bool SaveFile(eFileType fileType, string fileName, string data, bool logExceptions = true)
	{
		if (mStorage == null)
		{
			mStorage = new I2CustomPersistentStorage();
		}
		return mStorage.SaveFile(fileType, fileName, data, logExceptions);
	}

	public static string LoadFile(eFileType fileType, string fileName, bool logExceptions = true)
	{
		if (mStorage == null)
		{
			mStorage = new I2CustomPersistentStorage();
		}
		return mStorage.LoadFile(fileType, fileName, logExceptions);
	}

	public static bool DeleteFile(eFileType fileType, string fileName, bool logExceptions = true)
	{
		if (mStorage == null)
		{
			mStorage = new I2CustomPersistentStorage();
		}
		return mStorage.DeleteFile(fileType, fileName, logExceptions);
	}

	public static bool HasFile(eFileType fileType, string fileName, bool logExceptions = true)
	{
		if (mStorage == null)
		{
			mStorage = new I2CustomPersistentStorage();
		}
		return mStorage.HasFile(fileType, fileName, logExceptions);
	}
}