Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
CloudSocialModule.cs
Go to the documentation of this file.
2using rail;
4
6
8{
9 private object ioLock = new object();
10
11 public override void Initialize()
12 {
13 }
14
15 public override void Shutdown()
16 {
17 }
18
19 public override IEnumerable<string> GetFiles()
20 {
21 //IL_0041: Unknown result type (might be due to invalid IL or missing references)
22 lock (ioLock)
23 {
24 uint fileCount = rail_api.RailFactory().RailStorageHelper().GetFileCount();
25 List<string> list = new List<string>((int)fileCount);
26 ulong num = 0uL;
27 string item = default(string);
28 for (uint num2 = 0u; num2 < fileCount; num2++)
29 {
30 rail_api.RailFactory().RailStorageHelper().GetFileNameAndSize(num2, ref item, ref num);
31 list.Add(item);
32 }
33 return list;
34 }
35 }
36
37 public override bool Write(string path, byte[] data, int length)
38 {
39 lock (ioLock)
40 {
41 bool result = true;
42 IRailFile val = null;
43 val = ((!rail_api.RailFactory().RailStorageHelper().IsFileExist(path)) ? rail_api.RailFactory().RailStorageHelper().CreateFile(path) : rail_api.RailFactory().RailStorageHelper().OpenFile(path));
44 if (val != null)
45 {
46 val.Write(data, (uint)length);
47 val.Close();
48 }
49 else
50 {
51 result = false;
52 }
53 return result;
54 }
55 }
56
57 public override int GetFileSize(string path)
58 {
59 lock (ioLock)
60 {
61 IRailFile val = rail_api.RailFactory().RailStorageHelper().OpenFile(path);
62 if (val != null)
63 {
64 int size = (int)val.GetSize();
65 val.Close();
66 return size;
67 }
68 return 0;
69 }
70 }
71
72 public override void Read(string path, byte[] buffer, int size)
73 {
74 lock (ioLock)
75 {
76 IRailFile val = rail_api.RailFactory().RailStorageHelper().OpenFile(path);
77 if (val != null)
78 {
79 val.Read(buffer, (uint)size);
80 val.Close();
81 }
82 }
83 }
84
85 public override bool HasFile(string path)
86 {
87 lock (ioLock)
88 {
89 return rail_api.RailFactory().RailStorageHelper().IsFileExist(path);
90 }
91 }
92
93 public override bool Delete(string path)
94 {
95 //IL_001c: Unknown result type (might be due to invalid IL or missing references)
96 //IL_0021: Unknown result type (might be due to invalid IL or missing references)
97 //IL_0022: Unknown result type (might be due to invalid IL or missing references)
98 //IL_0024: Invalid comparison between Unknown and I4
99 lock (ioLock)
100 {
101 RailResult val = rail_api.RailFactory().RailStorageHelper().RemoveFile(path);
102 return (int)val == 0;
103 }
104 }
105
106 public override bool Forget(string path)
107 {
108 return Delete(path);
109 }
110}
override bool Write(string path, byte[] data, int length)
override void Read(string path, byte[] buffer, int size)
override IEnumerable< string > GetFiles()