Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
CommunityContentManager.cs
浏览该文件的文档.
1using System.Globalization;
2using System.Security.Cryptography;
3using System.Text;
4using System.Text.Json;
5using System.Xml.Linq;
6using Engine;
8using XmlUtilities;
9
10namespace Game {
11 public static class CommunityContentManager {
12
13 public static Dictionary<string, string> m_idToAddressMap = [];
14 public static Dictionary<string, bool> m_feedbackCache = [];
15
16 public const string fName = "CommunityContentManager";
17
18 public static void Initialize() {
19 Load();
20 WorldsManager.WorldDeleted += delegate(string path) { m_idToAddressMap.Remove(MakeContentIdString(ExternalContentType.World, path)); };
21 BlocksTexturesManager.BlocksTextureDeleted += delegate(string path) {
22 m_idToAddressMap.Remove(MakeContentIdString(ExternalContentType.BlocksTexture, path));
23 };
24 CharacterSkinsManager.CharacterSkinDeleted += delegate(string path) {
25 m_idToAddressMap.Remove(MakeContentIdString(ExternalContentType.CharacterSkin, path));
26 };
27 FurniturePacksManager.FurniturePackDeleted += delegate(string path) {
28 m_idToAddressMap.Remove(MakeContentIdString(ExternalContentType.FurniturePack, path));
29 };
31 }
32
33 public static string GetDownloadedContentAddress(ExternalContentType type, string name) {
34 m_idToAddressMap.TryGetValue(MakeContentIdString(type, name), out string value);
35 return value;
36 }
37
38 public static bool IsContentRated(string address, string userId) {
39 string key = MakeFeedbackCacheKey(address, "Rating", userId);
40 return m_feedbackCache.ContainsKey(key);
41 }
42
43 public static void List(string cursor,
44 string userFilter,
45 string typeFilter,
46 string moderationFilter,
47 string sortOrder,
48 string keySearch,
49 string searchType,
50 CancellableProgress progress,
51 Action<List<CommunityContentEntry>, string> success,
52 Action<Exception> failure) {
53 progress ??= new CancellableProgress();
55 failure(new InvalidOperationException(LanguageControl.Get(fName, "1")));
56 return;
57 }
58 Dictionary<string, string> dictionary = new();
59 Dictionary<string, string> Header = new() { { "Content-Type", "application/x-www-form-urlencoded" } };
60 dictionary.Add("Action", "list");
61 dictionary.Add("Cursor", cursor ?? string.Empty);
62 dictionary.Add("UserId", userFilter ?? string.Empty);
63 dictionary.Add("Type", typeFilter ?? string.Empty);
64 dictionary.Add("Moderation", moderationFilter ?? string.Empty);
65 dictionary.Add("SortOrder", sortOrder ?? string.Empty);
66 dictionary.Add("Platform", VersionsManager.PlatformString);
67 dictionary.Add("Version", VersionsManager.Version);
68 dictionary.Add("APIVersion", ModsManager.APIVersionString);
69 dictionary.Add("key", keySearch);
70 dictionary.Add("SearchType", searchType);
72 $"{CommunityServerManager.CurrentChineseInfo.ApiUrl}com/list",
73 null,
74 Header,
76 progress,
77 delegate(byte[] result) {
78 try {
79 string data = Encoding.UTF8.GetString(result, 0, result.Length);
80 XElement xElement = XmlUtils.LoadXmlFromString(data, true);
81 string attributeValue = XmlUtils.GetAttributeValue<string>(xElement, "NextCursor");
82 List<CommunityContentEntry> list = new();
83 foreach (XElement item in xElement.Elements()) {
84 try {
85 list.Add(
87 Type = XmlUtils.GetAttributeValue(item, "Type", ExternalContentType.Unknown),
88 Name = XmlUtils.GetAttributeValue<string>(item, "Name"),
89 Address = XmlUtils.GetAttributeValue<string>(item, "Url"),
90 UserId = XmlUtils.GetAttributeValue<string>(item, "UserId"),
91 UserName = XmlUtils.GetAttributeValue<string>(item, "UName"),
92 Boutique = XmlUtils.GetAttributeValue<int>(item, "Boutique"),
93 IsShow = XmlUtils.GetAttributeValue<int>(item, "IsShow"),
94 Size = XmlUtils.GetAttributeValue<long>(item, "Size"),
95 ExtraText = XmlUtils.GetAttributeValue(item, "ExtraText", string.Empty),
96 RatingsAverage = XmlUtils.GetAttributeValue(item, "RatingsAverage", 0f),
97 IconSrc = XmlUtils.GetAttributeValue(item, "Icon", ""),
98 CollectionID = XmlUtils.GetAttributeValue<int>(item, "CollectionID"),
99 CollectionName = XmlUtils.GetAttributeValue<string>(item, "CollectionName"),
100 CollectionDetails = XmlUtils.GetAttributeValue<string>(item, "CollectionDetails"),
101 Index = XmlUtils.GetAttributeValue<int>(item, "Id")
102 }
103 );
104 }
105 catch (Exception) {
106 // ignored
107 }
108 }
109 success(list, attributeValue);
110 }
111 catch (Exception obj) {
112 failure(obj);
113 }
114 },
115 failure
116 );
117 }
118
119 public static void Download(string address,
120 string name,
122 string userId,
123 CancellableProgress progress,
124 Action success,
125 Action<Exception> failure) {
126 progress ??= new CancellableProgress();
128 failure(new InvalidOperationException(LanguageControl.Get(fName, "1")));
129 }
130 else {
132 address,
133 null,
134 null,
135 progress,
136 delegate(byte[] data) {
137 string hash = CalculateContentHashString(data);
139 new MemoryStream(data),
140 type,
141 name,
142 delegate(string downloadedName) {
143 m_idToAddressMap[MakeContentIdString(type, downloadedName)] = address;
144 Feedback(
145 address,
146 "Success",
147 null,
148 hash,
149 data.Length,
150 userId,
151 progress,
152 delegate { },
153 delegate { }
154 );
155 success();
156 },
157 delegate(Exception error) {
158 Feedback(
159 address,
160 "ImportFailure",
161 null,
162 hash,
163 data.Length,
164 userId,
165 null,
166 delegate { },
167 delegate { }
168 );
169 failure(error);
170 }
171 );
172 },
173 delegate(Exception error) {
174 Feedback(
175 address,
176 "DownloadFailure",
177 null,
178 null,
179 0L,
180 userId,
181 null,
182 delegate { },
183 delegate { }
184 );
185 failure(error);
186 }
187 );
188 }
189 }
190
191 public static void Publish(string address,
192 string name,
194 string userId,
195 CancellableProgress progress,
196 Action success,
197 Action<Exception> failure) {
198 progress ??= new CancellableProgress();
200 failure(new InvalidOperationException(LanguageControl.Get(fName, "2")));
201 }
203 failure(new InvalidOperationException(LanguageControl.Get(fName, "1")));
204 }
205 else {
207 address,
208 name,
209 type,
210 progress,
211 delegate(byte[] data) {
212 string value = CalculateContentHashString(data);
214 $"{CommunityServerManager.CurrentChineseInfo.ApiUrl}com/list",
215 null,
216 null,
218 new Dictionary<string, string> {
219 { "Action", "publish" },
220 { "UserId", userId },
221 { "Name", name },
222 { "Url", address },
223 { "Type", type.ToString() },
224 { "Hash", value },
225 { "Size", data.Length.ToString(CultureInfo.InvariantCulture) },
226 { "Platform", VersionsManager.PlatformString },
227 { "Version", VersionsManager.Version }
228 }
229 ),
230 progress,
231 delegate { success(); },
232 failure
233 );
234 },
235 failure
236 );
237 }
238 }
239
240 public static void Delete(string address, string userId, CancellableProgress progress, Action success, Action<Exception> failure) {
241 progress ??= new CancellableProgress();
243 failure(new InvalidOperationException(LanguageControl.Get(fName, "1")));
244 return;
245 }
246 Dictionary<string, string> dictionary = new() {
247 { "Action", "delete" },
248 { "UserId", userId },
249 { "Url", address },
250 { "Platform", VersionsManager.PlatformString },
251 { "Version", VersionsManager.Version }
252 };
254 $"{CommunityServerManager.CurrentChineseInfo.ApiUrl}com/list",
255 null,
256 null,
258 progress,
259 delegate { success(); },
260 failure
261 );
262 }
263
264 public static void Rate(string address, string userId, int rating, CancellableProgress progress, Action success, Action<Exception> failure) {
265 rating = Math.Clamp(rating, 1, 5);
266 Feedback(
267 address,
268 "Rating",
269 rating.ToString(CultureInfo.InvariantCulture),
270 null,
271 0L,
272 userId,
273 progress,
274 success,
275 failure
276 );
277 }
278
279 public static void Report(string address,
280 string userId,
281 string report,
282 CancellableProgress progress,
283 Action success,
284 Action<Exception> failure) {
285 Feedback(
286 address,
287 "Report",
288 report,
289 null,
290 0L,
291 userId,
292 progress,
293 success,
294 failure
295 );
296 }
297
298 public static void SendPlayTime(string address,
299 string userId,
300 double time,
301 CancellableProgress progress,
302 Action success,
303 Action<Exception> failure) {
304 Feedback(
305 address,
306 "PlayTime",
307 Math.Round(time).ToString(CultureInfo.InvariantCulture),
308 null,
309 0L,
310 userId,
311 progress,
312 success,
313 failure
314 );
315 }
316
317 public static void VerifyLinkContent(string address,
318 string name,
320 CancellableProgress progress,
321 Action<byte[]> success,
322 Action<Exception> failure) {
323 progress ??= new CancellableProgress();
325 address,
326 null,
327 null,
328 progress,
329 delegate(byte[] data) {
331 new MemoryStream(data),
332 type,
333 "__Temp",
334 delegate(string downloadedName) {
335 ExternalContentManager.DeleteExternalContent(type, downloadedName);
336 success(data);
337 },
338 failure
339 );
340 },
341 failure
342 );
343 }
344
345 public static void Feedback(string address,
346 string feedback,
347 string feedbackParameter,
348 string hash,
349 long size,
350 string userId,
351 CancellableProgress progress,
352 Action success,
353 Action<Exception> failure) {
354 progress ??= new CancellableProgress();
356 failure(new InvalidOperationException(LanguageControl.Get(fName, "1")));
357 return;
358 }
359 Dictionary<string, string> dictionary = new() { { "Action", "feedback" }, { "Feedback", feedback } };
360 if (feedbackParameter != null) {
361 dictionary.Add("FeedbackParameter", feedbackParameter);
362 }
363 dictionary.Add("UserId", userId);
364 if (address != null) {
365 dictionary.Add("Url", address);
366 }
367 if (hash != null) {
368 dictionary.Add("Hash", hash);
369 }
370 if (size > 0) {
371 dictionary.Add("Size", size.ToString(CultureInfo.InvariantCulture));
372 }
373 dictionary.Add("Platform", VersionsManager.PlatformString);
374 dictionary.Add("Version", VersionsManager.Version);
376 $"{CommunityServerManager.CurrentChineseInfo.ApiUrl}com/list",
377 null,
378 null,
380 progress,
381 delegate {
382 string key = MakeFeedbackCacheKey(address, feedback, userId);
383 if (!m_feedbackCache.TryAdd(key, true)) {
384 Task.Run(
385 delegate {
386 Task.Delay(1500).Wait();
387 failure(new InvalidOperationException(LanguageControl.Get(fName, "3")));
388 }
389 );
390 return;
391 }
392 success();
393 },
394 failure
395 );
396 }
397
398/*
399 public static void UserList(string cursor, string searchKey, string searchType, string filter, int order, CancellableProgress progress, Action<List<ComUserInfo>, string> success, Action<Exception> failure)
400 {
401 progress ??= new CancellableProgress();
402 if (!WebManager.IsInternetConnectionAvailable())
403 {
404 failure(new InvalidOperationException(LanguageControl.Get(fName, "1")));
405 return;
406 }
407 var Header = new Dictionary<string, string>
408 {
409 { "Content-Type", "application/x-www-form-urlencoded" }
410 };
411 var dictionary = new Dictionary<string, string>
412 {
413 { "Cursor", cursor ?? string.Empty },
414 { "Action", "GetUserList" },
415 { "Operater", SettingsManager.ScpboxAccessToken },
416 { "SearchKey", searchKey },
417 { "SearchType", searchType },
418 { "Filter", filter },
419 { "Order", order.ToString() }
420 };
421 WebManager.Post($"{CommunityServerManager.CurrentChineseInfo.ApiUrl}/com/api/zh/userList", null, Header, WebManager.UrlParametersToStream(dictionary), progress, delegate (byte[] result)
422 {
423 try
424 {
425 //if (result != null)
426 //{
427 // using (FileStream fileStream = new FileStream(Storage.GetSystemPath(ModsManager.ModCachePath) + "/123����.txt", FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
428 // {
429 // fileStream.Write(result, 0, result.Length);
430 // fileStream.Flush();
431 // }
432 //}
433 //var json = (JsonObject)WebManager.JsonFromBytes(result);
434 XElement xElement = XmlUtils.LoadXmlFromString(Encoding.UTF8.GetString(result, 0, result.Length), throwOnError: true);
435 string attributeValue = XmlUtils.GetAttributeValue<string>(xElement, "NextCursor");
436 var list = new List<ComUserInfo>();
437 foreach (XElement item in xElement.Elements())
438 {
439 try
440 {
441 list.Add(new ComUserInfo
442 {
443 Id = XmlUtils.GetAttributeValue<int>(item, "Id"),
444 UserNo = XmlUtils.GetAttributeValue<string>(item, "User"),
445 Name = XmlUtils.GetAttributeValue<string>(item, "Nickname"),
446 Token = XmlUtils.GetAttributeValue<string>(item, "Token"),
447 LastLoginTime = XmlUtils.GetAttributeValue<string>(item, "LastLoginTime"),
448 ErrCount = XmlUtils.GetAttributeValue<int>(item, "ErrorTimes", 0),
449 IsLock = XmlUtils.GetAttributeValue<int>(item, "IsLock", 0),
450 LockTime = XmlUtils.GetAttributeValue<string>(item, "LockTime"),
451 UnlockTime = XmlUtils.GetAttributeValue<string>(item, "UnlockTime"),
452 LockDuration = XmlUtils.GetAttributeValue<int>(item, "LockDuration", 0),
453 Money = XmlUtils.GetAttributeValue<int>(item, "Money", 0),
454 Authority = XmlUtils.GetAttributeValue<string>(item, "Authority"),
455 HeadImg = XmlUtils.GetAttributeValue<string>(item, "HeadImg"),
456 IsAdmin = XmlUtils.GetAttributeValue<int>(item, "IsAdmin", 0),
457 RegTime = XmlUtils.GetAttributeValue<string>(item, "RegTime"),
458 LoginIP = XmlUtils.GetAttributeValue<string>(item, "LoginIP"),
459 MGroup = XmlUtils.GetAttributeValue<string>(item, "MGroup"),
460 PawToken = XmlUtils.GetAttributeValue<string>(item, "PassToken"),
461 Email = XmlUtils.GetAttributeValue<string>(item, "Email"),
462 Status = XmlUtils.GetAttributeValue<int>(item, "Status", 1),
463 LockReason = XmlUtils.GetAttributeValue<string>(item, "LockReason"),
464 EmailCount = XmlUtils.GetAttributeValue<int>(item, "EmailCount", 0),
465 EmailTime = XmlUtils.GetAttributeValue<string>(item, "EmailTime"),
466 Die = XmlUtils.GetAttributeValue<int>(item, "Die", 0),
467 Moblie = XmlUtils.GetAttributeValue<string>(item, "Moblie"),
468 AreaCode = XmlUtils.GetAttributeValue<string>(item, "AreaCode")
469 });
470 }
471 catch (Exception)
472 {
473 }
474 }
475 success(list, attributeValue);
476 }
477 catch (Exception obj)
478 {
479 failure(obj);
480 }
481 }, delegate (Exception error)
482 {
483 failure(error);
484 });
485 }
486*/
487 public static void UpdateLockState(int id,
488 int lockState,
489 string reason,
490 int duration,
491 CancellableProgress progress,
492 Action<byte[]> success,
493 Action<Exception> failure) {
494 progress ??= new CancellableProgress();
496 failure(new InvalidOperationException(LanguageControl.Get(fName, "1")));
497 return;
498 }
499 Dictionary<string, string> header = new() { { "Content-Type", "application/x-www-form-urlencoded" } };
500 Dictionary<string, string> dictionary = new() {
501 { "Action", "UpdateLockState" },
502 { "Id", id.ToString() },
503 { "Operater", SettingsManager.ScpboxAccessToken },
504 { "LockState", lockState.ToString() },
505 { "Duration", duration.ToString() },
506 { "Reason", reason }
507 };
509 $"{CommunityServerManager.CurrentChineseInfo.ApiUrl}/com/api/zh/userList",
510 null,
511 header,
513 progress,
514 success,
515 failure
516 );
517 }
518
519 public static void ResetPassword(int id, CancellableProgress progress, Action<byte[]> success, Action<Exception> failure) {
520 progress ??= new CancellableProgress();
522 failure(new InvalidOperationException(LanguageControl.Get(fName, "1")));
523 return;
524 }
525 Dictionary<string, string> header = new() { { "Content-Type", "application/x-www-form-urlencoded" } };
526 Dictionary<string, string> dictionary = new() {
527 { "Action", "ResetPassword" }, { "Id", id.ToString() }, { "Operater", SettingsManager.ScpboxAccessToken }
528 };
530 $"{CommunityServerManager.CurrentChineseInfo.ApiUrl}/com/api/zh/userList",
531 null,
532 header,
534 progress,
535 success,
536 failure
537 );
538 }
539
540 public static void UpdateBoutique(string type,
541 int id,
542 int boutique,
543 CancellableProgress progress,
544 Action<byte[]> success,
545 Action<Exception> failure) {
546 progress ??= new CancellableProgress();
548 failure(new InvalidOperationException(LanguageControl.Get(fName, "1")));
549 return;
550 }
551 Dictionary<string, string> header = new() { { "Content-Type", "application/x-www-form-urlencoded" } };
552 Dictionary<string, string> dictionary = new() {
553 { "Type", type }, { "Id", id.ToString() }, { "Operater", SettingsManager.ScpboxAccessToken }, { "Boutique", boutique.ToString() }
554 };
556 $"{CommunityServerManager.CurrentChineseInfo.ApiUrl}/com/api/zh/boutique",
557 null,
558 header,
560 progress,
561 success,
562 failure
563 );
564 }
565
566 public static void UpdateHidePara(int id, int isShow, CancellableProgress progress, Action<byte[]> success, Action<Exception> failure) {
567 progress ??= new CancellableProgress();
569 failure(new InvalidOperationException(LanguageControl.Get(fName, "1")));
570 return;
571 }
572 Dictionary<string, string> header = new() { { "Content-Type", "application/x-www-form-urlencoded" } };
573 Dictionary<string, string> dictionary = new() {
574 { "Id", id.ToString() }, { "Operater", SettingsManager.ScpboxAccessToken }, { "IsShow", isShow.ToString() }
575 };
577 $"{CommunityServerManager.CurrentChineseInfo.ApiUrl}/com/api/zh/hide",
578 null,
579 header,
581 progress,
582 success,
583 failure
584 );
585 }
586
587 public static void DeleteFile(int id, CancellableProgress progress, Action<byte[]> success, Action<Exception> failure) {
588 progress ??= new CancellableProgress();
590 failure(new InvalidOperationException(LanguageControl.Get(fName, "1")));
591 return;
592 }
593 Dictionary<string, string> header = new() { { "Content-Type", "application/x-www-form-urlencoded" } };
594 Dictionary<string, string> dictionary = new() { { "Id", id.ToString() }, { "Operater", SettingsManager.ScpboxAccessToken } };
596 $"{CommunityServerManager.CurrentChineseInfo.ApiUrl}/com/api/zh/deleteFile",
597 null,
598 header,
600 progress,
601 success,
602 failure
603 );
604 }
605
606 public static void IsAdmin(CancellableProgress progress, Action<bool> success, Action<Exception> failure) {
607 progress ??= new CancellableProgress();
609 failure(new InvalidOperationException(LanguageControl.Get(fName, "1")));
610 return;
611 }
612 Dictionary<string, string> header = new() { { "Content-Type", "application/x-www-form-urlencoded" } };
613 Dictionary<string, string> dictionary = new() { { "Operater", SettingsManager.ScpboxAccessToken } };
615 $"{CommunityServerManager.CurrentChineseInfo.ApiUrl}/com/api/zh/isadmin",
616 null,
617 header,
619 progress,
620 delegate(byte[] data) {
621 int i = 0;
622 foreach (JsonProperty property in JsonDocument.Parse(data, JsonDocumentReader.DefaultJsonOptions).RootElement.EnumerateObject()) {
623 if (i == 2) {
624 success(property.Value.GetString() == "Y");
625 break;
626 }
627 i++;
628 }
629 },
630 failure
631 );
632 }
633
634 public static string CalculateContentHashString(byte[] data) => Convert.ToBase64String(SHA384.HashData(data));
635
636 public static string MakeFeedbackCacheKey(string address, string feedback, string userId) => $"{address}\n{feedback}\n{userId}";
637
638 public static string MakeContentIdString(ExternalContentType type, string name) => $"{type}:{name}";
639
640 public static void Load() {
641 try {
644 XElement xElement = XmlUtils.LoadXmlFromStream(stream, null, true);
645 IEnumerable<XElement> feedbackElements = xElement.Element("Feedback")?.Elements();
646 if (feedbackElements != null) {
647 foreach (XElement item in feedbackElements) {
648 string attributeValue = XmlUtils.GetAttributeValue<string>(item, "Key");
649 m_feedbackCache[attributeValue] = true;
650 }
651 }
652 IEnumerable<XElement> contentElements = xElement.Element("Content")?.Elements();
653 if (contentElements != null) {
654 foreach (XElement item2 in contentElements) {
655 string attributeValue2 = XmlUtils.GetAttributeValue<string>(item2, "Path");
656 string attributeValue3 = XmlUtils.GetAttributeValue<string>(item2, "Address");
657 m_idToAddressMap[attributeValue2] = attributeValue3;
658 }
659 }
660 }
661 }
662 catch (Exception e) {
664 }
665 }
666
667 public static void Save() {
668 try {
669 XElement xElement = new("Cache");
670 XElement xElement2 = new("Feedback");
671 xElement.Add(xElement2);
672 foreach (string key in m_feedbackCache.Keys) {
673 XElement xElement3 = new("Item");
674 XmlUtils.SetAttributeValue(xElement3, "Key", key);
675 xElement2.Add(xElement3);
676 }
677 XElement xElement4 = new("Content");
678 xElement.Add(xElement4);
679 foreach (KeyValuePair<string, string> item in m_idToAddressMap) {
680 XElement xElement5 = new("Item");
681 XmlUtils.SetAttributeValue(xElement5, "Path", item.Key);
682 XmlUtils.SetAttributeValue(xElement5, "Address", item.Value);
683 xElement4.Add(xElement5);
684 }
686 XmlUtils.SaveXmlToStream(xElement, stream, null, true);
687 }
688 catch (Exception e) {
690 }
691 }
692 }
693}
static Stream OpenFile(string path, OpenFileMode openFileMode)
static bool FileExists(string path)
static Action Deactivated
static Action< string > BlocksTextureDeleted
static Action< string > CharacterSkinDeleted
static string GetDownloadedContentAddress(ExternalContentType type, string name)
static void UpdateHidePara(int id, int isShow, CancellableProgress progress, Action< byte[]> success, Action< Exception > failure)
static void UpdateBoutique(string type, int id, int boutique, CancellableProgress progress, Action< byte[]> success, Action< Exception > failure)
static void VerifyLinkContent(string address, string name, ExternalContentType type, CancellableProgress progress, Action< byte[]> success, Action< Exception > failure)
static void DeleteFile(int id, CancellableProgress progress, Action< byte[]> success, Action< Exception > failure)
static string MakeContentIdString(ExternalContentType type, string name)
static string CalculateContentHashString(byte[] data)
static void Download(string address, string name, ExternalContentType type, string userId, CancellableProgress progress, Action success, Action< Exception > failure)
static void ResetPassword(int id, CancellableProgress progress, Action< byte[]> success, Action< Exception > failure)
static void Rate(string address, string userId, int rating, CancellableProgress progress, Action success, Action< Exception > failure)
static void Publish(string address, string name, ExternalContentType type, string userId, CancellableProgress progress, Action success, Action< Exception > failure)
static Dictionary< string, string > m_idToAddressMap
static void List(string cursor, string userFilter, string typeFilter, string moderationFilter, string sortOrder, string keySearch, string searchType, CancellableProgress progress, Action< List< CommunityContentEntry >, string > success, Action< Exception > failure)
static void UpdateLockState(int id, int lockState, string reason, int duration, CancellableProgress progress, Action< byte[]> success, Action< Exception > failure)
static bool IsContentRated(string address, string userId)
static void Report(string address, string userId, string report, CancellableProgress progress, Action success, Action< Exception > failure)
static void IsAdmin(CancellableProgress progress, Action< bool > success, Action< Exception > failure)
static void SendPlayTime(string address, string userId, double time, CancellableProgress progress, Action success, Action< Exception > failure)
static void Delete(string address, string userId, CancellableProgress progress, Action success, Action< Exception > failure)
static string MakeFeedbackCacheKey(string address, string feedback, string userId)
static Dictionary< string, bool > m_feedbackCache
static void Feedback(string address, string feedback, string feedbackParameter, string hash, long size, string userId, CancellableProgress progress, Action success, Action< Exception > failure)
static void ReportExceptionToUser(string additionalMessage, Exception e)
static void ImportExternalContent(Stream stream, ExternalContentType type, string name, Action< string > success, Action< Exception > failure)
static void DeleteExternalContent(ExternalContentType type, string name)
static Action< string > FurniturePackDeleted
static readonly JsonDocumentOptions DefaultJsonOptions
static string Get(string className, int key)
获取在当前语言类名键对应的字符串
static void Post(string address, Dictionary< string, string > parameters, Dictionary< string, string > headers, Stream data, CancellableProgress progress, Action< byte[]> success, Action< Exception > failure)
static bool IsInternetConnectionAvailable()
static MemoryStream UrlParametersToStream(Dictionary< string, string > values)
static void Get(string address, Dictionary< string, string > parameters, Dictionary< string, string > headers, CancellableProgress progress, Action< byte[]> success, Action< Exception > failure)
static Action< string > WorldDeleted
static string CommunityContentCachePath
static string APIVersionString
static void SetAttributeValue(XElement node, string attributeName, object value)
static object GetAttributeValue(XElement node, string attributeName, Type type)
static XElement LoadXmlFromStream(Stream stream, Encoding encoding, bool throwOnError)
static XElement LoadXmlFromString(string data, bool throwOnError)
static void SaveXmlToStream(XElement node, Stream stream, Encoding encoding, bool throwOnError)