forked from reallyjoel/Ludosity-s-Steamworks-Wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cloud.cs
319 lines (265 loc) · 13.8 KB
/
Cloud.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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
using System;
using System.Collections.Generic;
using System.Text;
using ManagedSteam.CallbackStructures;
using ManagedSteam.SteamTypes;
namespace ManagedSteam
{
/// <summary>
/// Does all cloud communication.
/// Wraps ISteamRemoteStorage.
/// </summary>
public interface ICloud
{
/// <summary>
/// Invoked by Share()
/// </summary>
event ResultEvent<CloudFileShareResult> CloudFileShareResult;
/// <summary>
/// Invoked by UGCDownload()
/// </summary>
event ResultEvent<CloudDownloadUGCResult> CloudDownloadUGCResult;
event ResultEvent<CloudPublishFileResult> CloudPublishFileResult;
event ResultEvent<CloudUpdatePublishedFileResult> CloudUpdatePublishedFileResult;
event ResultEvent<CloudGetPublishedFileDetailsResult> CloudGetPublishedFileDetailsResult;
event ResultEvent<CloudDeletePublishedFileResult> CloudDeletePublishedFileResult;
event ResultEvent<CloudEnumerateUserPublishedFilesResult> CloudEnumerateUserPublishedFilesResult;
event ResultEvent<CloudSubscribePublishedFileResult> CloudSubscribePublishedFileResult;
event ResultEvent<CloudEnumerateUserSubscribedFilesResult> CloudEnumerateUserSubscribedFilesResult;
event ResultEvent<CloudUnsubscribePublishedFileResult> CloudUnsubscribePublishedFileResult;
event ResultEvent<CloudGetPublishedItemVoteDetailsResult> CloudGetPublishedItemVoteDetailsResult;
event ResultEvent<CloudUpdateUserPublishedItemVoteResult> CloudUpdateUserPublishedItemVoteResult;
event ResultEvent<CloudUserVoteDetails> CloudUserVoteDetailsResult;
event ResultEvent<CloudEnumerateUserSharedWorkshopFilesResult> CloudEnumerateUserSharedWorkshopFilesResult;
event ResultEvent<CloudSetUserPublishedFileActionResult> CloudSetUserPublishedFileActionResult;
event ResultEvent<CloudEnumeratePublishedFilesByUserActionResult> CloudEnumeratePublishedFilesByUserActionResult;
event ResultEvent<CloudEnumerateWorkshopFilesResult> CloudEnumerateWorkshopFilesResult;
event CallbackEvent<CloudPublishFileProgress> CloudPublishFileProgress;
event CallbackEvent<CloudPublishedFileUpdated> CloudPublishedFileUpdated;
event CallbackEvent<CloudPublishedFileSubscribed> CloudPublishedFileSubscribed;
event CallbackEvent<CloudPublishedFileUnsubscribed> CloudPublishedFileUnsubscribed;
event CallbackEvent<CloudPublishedFileDeleted> CloudPublishedFileDeleted;
/// <summary>
/// NOTE
///
/// Filenames are case-insensitive, and will be converted to lowercase automatically.
/// So "foo.bar" and "Foo.bar" are the same file, and if you write "Foo.bar" then
/// iterate the files, the filename returned will be "foo.bar".
///
/// </summary>
/// <param name="fileName"></param>
/// <param name="data"></param>
/// <returns></returns>
bool Write(string fileName, IntPtr data, int dataSize);
/// <summary>
/// Will read data from the file and place it in the IntPtr. Will try to read \c dataToRead
/// number of bytes and place them in the array.
///
/// NOTE
///
/// Filenames are case-insensitive, and will be converted to lowercase automatically.
/// So "foo.bar" and "Foo.bar" are the same file, and if you write "Foo.bar" then
/// iterate the files, the filename returned will be "foo.bar".
/// </summary>
/// <param name="fileName"></param>
/// <param name="data"></param>
/// <returns></returns>
int Read(string fileName, IntPtr data, int dataToRead);
/// <summary>
/// NOTE
///
/// Filenames are case-insensitive, and will be converted to lowercase automatically.
/// So "foo.bar" and "Foo.bar" are the same file, and if you write "Foo.bar" then
/// iterate the files, the filename returned will be "foo.bar".
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
bool Forget(string fileName);
/// <summary>
/// NOTE
///
/// Filenames are case-insensitive, and will be converted to lowercase automatically.
/// So "foo.bar" and "Foo.bar" are the same file, and if you write "Foo.b
/// iterate the files, the filename returned will be "foo.bar".
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
bool Delete(string fileName);
/// <summary>
/// Invokes CloudFileShareResult
/// NOTE
///
/// Filenames are case-insensitive, and will be converted to lowercase automatically.
/// So "foo.bar" and "Foo.bar" are the same file, and if you write "Foo.b
/// iterate the files, the filename returned will be "foo.bar".
/// </summary>
/// <param name="fileName"></param>
void Share(string fileName);
/// <summary>
/// NOTE
///
/// Filenames are case-insensitive, and will be converted to lowercase automatically.
/// So "foo.bar" and "Foo.bar" are the same file, and if you write "Foo.b
/// iterate the files, the filename returned will be "foo.bar".
/// </summary>
/// <param name="fileName"></param>
/// <param name="remoteStoragePlatform"></param>
/// <returns></returns>
bool SetSyncPlatforms(string fileName, RemoteStoragePlatform remoteStoragePlatform);
/// <summary>
/// NOTE
///
/// Filenames are case-insensitive, and will be converted to lowercase automatically.
/// So "foo.bar" and "Foo.bar" are the same file, and if you write "Foo.b
/// iterate the files, the filename returned will be "foo.bar".
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
bool Exists(string fileName);
/// <summary>
/// NOTE
///
/// Filenames are case-insensitive, and will be converted to lowercase automatically.
/// So "foo.bar" and "Foo.bar" are the same file, and if you write "Foo.b
/// iterate the files, the filename returned will be "foo.bar".
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
bool Persisted(string fileName);
/// <summary>
/// NOTE
///
/// Filenames are case-insensitive, and will be converted to lowercase automatically.
/// So "foo.bar" and "Foo.bar" are the same file, and if you write "Foo.b
/// iterate the files, the filename returned will be "foo.bar".
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
int GetSize(string fileName);
/// <summary>
/// NOTE
///
/// Filenames are case-insensitive, and will be converted to lowercase automatically.
/// So "foo.bar" and "Foo.bar" are the same file, and if you write "Foo.b
/// iterate the files, the filename returned will be "foo.bar".
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
long Timestamp(string fileName);
/// <summary>
/// NOTE
///
/// Filenames are case-insensitive, and will be converted to lowercase automatically.
/// So "foo.bar" and "Foo.bar" are the same file, and if you write "Foo.b
/// iterate the files, the filename returned will be "foo.bar".
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
RemoteStoragePlatform GetSyncPlatforms(string fileName);
int GetFileCount();
string GetFileNameAndSize(int fileID, out int fileSize);
CloudGetFileNameAndSizeResult GetFileNameAndSize(int fileID);
bool GetQuota(out int totalBytes, out int availableBytes);
CloudGetQuotaResult GetQuota();
bool IsEnabledForAccount();
bool IsEnabledForApplication();
void SetEnabledForApplication(bool enabled);
/// <summary>
/// Invokes CloudDownloadUGCResult
/// </summary>
/// <param name="handle"></param>
void UGCDownload(UGCHandle handle, uint unPriority);
/// <summary>
/// Gets the amount of data downloaded so far for a piece of content. pnBytesExpected can be 0 if function returns false
/// or if the transfer hasn't started yet, so be careful to check for that before dividing to get a percentage
/// </summary>
/// <param name="handle"></param>
/// <param name="bytesDownloaded"></param>
/// <param name="bytesExpected"></param>
/// <returns></returns>
bool GetUGCDownloadProgress(UGCHandle handle, out int bytesDownloaded, out int bytesExpected);
/// <summary>
/// Gets the amount of data downloaded so far for a piece of content. pnBytesExpected can be 0 if function returns false
/// or if the transfer hasn't started yet, so be careful to check for that before dividing to get a percentage
/// </summary>
/// <param name="handle"></param>
/// <param name="bytesDownloaded"></param>
/// <param name="bytesExpected"></param>
/// <returns></returns>
CloudGetUGCDownloadProgressResult GetUGCDownloadProgress(UGCHandle handle);
/// <summary>
/// Gets metadata for a file after it has been downloaded. This is the same metadata given in the RemoteStorageDownloadUGCResult_t call result
/// </summary>
bool GetUGCDetails(UGCHandle handle, out AppID appID, out string name, out int fileSize,
out SteamID creator);
/// <summary>
/// Gets metadata for a file after it has been downloaded. This is the same metadata given in the RemoteStorageDownloadUGCResult_t call result
/// </summary>
CloudGetUGCDetailsResult GetUGCDetails(UGCHandle handle);
/// <summary>
/// After download, gets the content of the file
/// </summary>
/// <param name="handle"></param>
/// <param name="data"></param>
/// <returns></returns>
int UGCRead(UGCHandle handle, byte[] data, uint offset, UGCReadAction action);
/// <summary>
/// Functions to iterate through UGC that has finished downloading but has not yet been read via UGCRead(
/// </summary>
/// <returns></returns>
int GetCachedUGCCount();
UGCHandle GetUGCHandle(int handleID);
void PublishWorkshopFile(string fileName, string previewFile, AppID consumerAppId,
string title, string description, RemoteStoragePublishedFileVisibility visibility,
IList<string> tags, WorkshopFileType workshopFileType);
PublishedFileUpdateHandle CreatePublishedFileUpdateRequest(PublishedFileId publishedFileId);
bool UpdatePublishedFileFile(PublishedFileUpdateHandle updateHandle, string fileName);
bool UpdatePublishedFilePreviewFile(PublishedFileUpdateHandle updateHandle, string previewFile);
bool UpdatePublishedFileTitle(PublishedFileUpdateHandle updateHandle, string title);
bool UpdatePublishedFileDescription(PublishedFileUpdateHandle updateHandle, string description);
bool UpdatePublishedFileVisibility(PublishedFileUpdateHandle updateHandle, RemoteStoragePublishedFileVisibility visibility);
bool UpdatePublishedFileTags(PublishedFileUpdateHandle updateHandle, IList<string> tags);
void CommitPublishedFileUpdate(PublishedFileUpdateHandle updateHandle);
void GetPublishedFileDetails(PublishedFileId publishedFileId, uint maxSecondsOld);
void DeletePublishedFile(PublishedFileId publishedFileId);
void EnumerateUserPublishedFiles(int startIndex);
void SubscribePublishedFile(PublishedFileId publishedFileId);
void EnumerateUserSubscribedFiles(int startIndex);
void UnsubscribePublishedFile(PublishedFileId publishedFileId);
bool UpdatePublishedFileSetChangeDescription(PublishedFileUpdateHandle updateHandle, string changeDescription);
void GetPublishedItemVoteDetails(PublishedFileId publishedFileId);
void UpdateUserPublishedItemVote(PublishedFileId publishedFileId, bool voteUp);
void GetUserPublishedItemVoteDetails(PublishedFileId publishedFileId);
void EnumerateUserSharedWorkshopFiles(SteamID steamId, int startIndex, IList<string> requiredTags, IList<string> excludedTags);
void PublishVideo(WorkshopVideoProviders videoProviders, string videoAccount, string videoIdentifier, string previewFile, AppID comsumerAppId, string title, string description, RemoteStoragePublishedFileVisibility visibility, IList<string> tags);
void SetUserPublishedFileAction(PublishedFileId publishedFileId, WorkshopFileAction action);
void EnumeratePublishedFilesByUserAction(WorkshopFileAction action, int startIndex);
void EnumeratePublishedWorkshopFiles(WorkshopFileAction enumerationType, int startIndex, int count, int days, IList<string> tags, IList<string> userTags);
void UGCDownloadToLocation( ulong content, string location, uint priority );
}
public struct CloudGetFileNameAndSizeResult
{
public string result;
public int sender;
}
public struct CloudGetQuotaResult
{
public bool result;
public int totalBytesSender;
public int availableBytesSender;
}
public struct CloudGetUGCDownloadProgressResult
{
public bool result;
public int bytesDownloadedSender;
public int bytesExpectedSender;
}
public struct CloudGetUGCDetailsResult
{
public bool result;
public AppID appIDSender;
public string nameSender;
public int fileSizeSender;
public SteamID creatorSender;
}
}