Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
CloudSocialModule.cs
Go to the documentation of this file.
1using System;
3using Steamworks;
5
7
9{
10 private const uint WRITE_CHUNK_SIZE = 1024u;
11
12 private object ioLock = new object();
13
14 private byte[] writeBuffer = new byte[1024];
15
16 public override void Initialize()
17 {
18 }
19
20 public override void Shutdown()
21 {
22 }
23
24 public override IEnumerable<string> GetFiles()
25 {
26 lock (ioLock)
27 {
28 int fileCount = SteamRemoteStorage.GetFileCount();
30 int num = default(int);
31 for (int i = 0; i < fileCount; i++)
32 {
33 list.Add(SteamRemoteStorage.GetFileNameAndSize(i, ref num));
34 }
35 return list;
36 }
37 }
38
39 public override bool Write(string path, byte[] data, int length)
40 {
41 //IL_0012: Unknown result type (might be due to invalid IL or missing references)
42 //IL_0017: Unknown result type (might be due to invalid IL or missing references)
43 //IL_0042: Unknown result type (might be due to invalid IL or missing references)
44 //IL_005f: Unknown result type (might be due to invalid IL or missing references)
45 lock (ioLock)
46 {
47 UGCFileWriteStreamHandle_t val = SteamRemoteStorage.FileWriteStreamOpen(path);
48 for (uint num = 0u; num < length; num += 1024)
49 {
50 int num2 = (int)Math.Min(1024L, length - num);
51 Array.Copy(data, num, writeBuffer, 0L, num2);
52 SteamRemoteStorage.FileWriteStreamWriteChunk(val, writeBuffer, num2);
53 }
54 return SteamRemoteStorage.FileWriteStreamClose(val);
55 }
56 }
57
58 public override int GetFileSize(string path)
59 {
60 lock (ioLock)
61 {
62 return SteamRemoteStorage.GetFileSize(path);
63 }
64 }
65
66 public override void Read(string path, byte[] buffer, int size)
67 {
68 lock (ioLock)
69 {
70 SteamRemoteStorage.FileRead(path, buffer, size);
71 }
72 }
73
74 public override bool HasFile(string path)
75 {
76 lock (ioLock)
77 {
78 return SteamRemoteStorage.FileExists(path);
79 }
80 }
81
82 public override bool Delete(string path)
83 {
84 lock (ioLock)
85 {
86 return SteamRemoteStorage.FileDelete(path);
87 }
88 }
89
90 public override bool Forget(string path)
91 {
92 lock (ioLock)
93 {
94 return SteamRemoteStorage.FileForget(path);
95 }
96 }
97}
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
Definition Array.cs:624
static byte Min(byte val1, byte val2)
Definition Math.cs:912
override bool Write(string path, byte[] data, int length)
override IEnumerable< string > GetFiles()
override void Read(string path, byte[] buffer, int size)