Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
CloudSocialModule.cs
Go to the documentation of this file.
2using Terraria.IO;
3
5
6public abstract class CloudSocialModule : ISocialModule
7{
8 public bool EnabledByDefault;
9
10 public virtual void BindTo(Preferences preferences)
11 {
12 preferences.OnSave += Configuration_OnSave;
13 preferences.OnLoad += Configuration_OnLoad;
14 }
15
17 {
18 EnabledByDefault = preferences.Get("CloudSavingDefault", defaultValue: false);
19 }
20
22 {
23 preferences.Put("CloudSavingDefault", EnabledByDefault);
24 }
25
26 public abstract void Initialize();
27
28 public abstract void Shutdown();
29
30 public abstract IEnumerable<string> GetFiles();
31
32 public abstract bool Write(string path, byte[] data, int length);
33
34 public abstract void Read(string path, byte[] buffer, int length);
35
36 public abstract bool HasFile(string path);
37
38 public abstract int GetFileSize(string path);
39
40 public abstract bool Delete(string path);
41
42 public abstract bool Forget(string path);
43
44 public byte[] Read(string path)
45 {
46 byte[] array = new byte[GetFileSize(path)];
47 Read(path, array, array.Length);
48 return array;
49 }
50
51 public void Read(string path, byte[] buffer)
52 {
53 Read(path, buffer, buffer.Length);
54 }
55
56 public bool Write(string path, byte[] data)
57 {
58 return Write(path, data, data.Length);
59 }
60}
void Configuration_OnLoad(Preferences preferences)
bool Write(string path, byte[] data)
void Read(string path, byte[] buffer, int length)
void Configuration_OnSave(Preferences preferences)
bool Write(string path, byte[] data, int length)
IEnumerable< string > GetFiles()
void Read(string path, byte[] buffer)
virtual void BindTo(Preferences preferences)