public void OnDownloadedItem(DownloadItemResult_t Response) { if (Response.m_unAppID == new AppId_t(AppID)) { if (EnumUtil.GetStringFromKey(Response.m_eResult).Replace("k_EResult", "") == "OK") { ExistingItems.Add(GetItemPath(Response.m_nPublishedFileId)); EventSys.Internal.Invoke("Unary.Common.Steam.DownloadedItem", new DownloadItem() { Handle = Response.m_nPublishedFileId.m_PublishedFileId, Path = GetItemPath(Response.m_nPublishedFileId) }); } else { DownloadList.Remove(Response.m_nPublishedFileId.m_PublishedFileId); EventSys.Internal.Invoke("Unary.Common.Steam.DownloadedItemFailed", new DownloadItem() { Handle = Response.m_nPublishedFileId.m_PublishedFileId }); } if (DownloadList.Count == 0) { EventSys.Internal.Invoke("Unary.Common.Steam.DownloadedAll", null); } } }
private void onItemDownloaded(DownloadItemResult_t callback) { if (this.installing == null || this.installing.Count == 0) { return; } this.installing.Remove(callback.m_nPublishedFileId); LoadingUI.updateProgress((float)(this.installed - this.installing.Count) / (float)this.installed); ulong num; string text; uint num2; if (SteamUGC.GetItemInstallInfo(callback.m_nPublishedFileId, ref num, ref text, 1024u, ref num2) && ReadWrite.folderExists(text, false)) { if (WorkshopTool.checkMapMeta(text, false)) { this.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.MAP)); if (ReadWrite.folderExists(text + "/Bundles", false)) { Assets.load(text + "/Bundles", false, false, EAssetOrigin.WORKSHOP); } } else if (WorkshopTool.checkLocalizationMeta(text, false)) { this.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.LOCALIZATION)); } else if (WorkshopTool.checkObjectMeta(text, false)) { this.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.OBJECT)); Assets.load(text, false, false, EAssetOrigin.WORKSHOP); } else if (WorkshopTool.checkItemMeta(text, false)) { this.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.ITEM)); Assets.load(text, false, false, EAssetOrigin.WORKSHOP); } else if (WorkshopTool.checkVehicleMeta(text, false)) { this.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.VEHICLE)); Assets.load(text, false, false, EAssetOrigin.WORKSHOP); } if (Directory.Exists(text + "/Translations")) { Translator.registerTranslationDirectory(text + "/Translations"); } if (Directory.Exists(text + "/Content")) { Assets.searchForAndLoadContent(text + "/Content"); } } if (this.installing.Count == 0) { Provider.launch(); } else { SteamUGC.DownloadItem(this.installing[0], true); } }
private static void ItemDownloaded(DownloadItemResult_t result) { // Make sure someone is listening to event if (OnItemDownloaded == null) return; DownloadItemEventArgs args = new DownloadItemEventArgs { Result = result }; OnItemDownloaded(null, args); }
private void OnItemDownloaded(DownloadItemResult_t pCallback) { if (pCallback.m_unAppID != RECEIVER1_APP_ID) { // Not our game return; } }
protected void onItemDownloaded(DownloadItemResult_t callback) { if (callback.m_nPublishedFileId.m_PublishedFileId != this.workshopItemDetails.m_nPublishedFileId.m_PublishedFileId) { return; } Debug.Log("Downloaded: " + callback.m_eResult); TimeUtility.updated += this.mainUpdated; }
private void OnDownloadItemResult(DownloadItemResult_t downloadItemResult) { isDownloading = false; if (downloadItemResult.m_eResult != EResult.k_EResultOK) { Debug.LogErrorFormat("Failed to download item: {0}, error: {1}", downloadItemResult.m_nPublishedFileId, downloadItemResult.m_eResult); return; } Debug.LogFormat("Item downloaded: {0}", downloadItemResult.m_nPublishedFileId); Refresh(); }
private void OnDownloadLevel(DownloadItemResult_t param) { if (onRead != null) { if (param.m_eResult == EResult.k_EResultOK) { onRead(WorkshopItemMetadata.Load <WorkshopLevelMetadata>("ws:" + param.m_nPublishedFileId)); } else { onRead(null); } onRead = null; } }
private void OnGlobalDownloadComplete(DownloadItemResult_t callback) { var id = callback.m_nPublishedFileId; var result = callback.m_eResult; if (id == pending) { if (result != EResult.k_EResultOK) { OnError(pending, result); } else { OnComplete(pending, 0); } DestroyCallbacks(); pending = PublishedFileId_t.Invalid; Check(); } }
private void OnDownloadFinished(DownloadItemResult_t result) { if (result.m_eResult != EResult.k_EResultOK) { Console.WriteLine($"Download failed, EResult is {result.m_eResult}."); ExitCode = (int)Steam.ExitCodes.DownLoadFail; Finished = true; return; } Console.WriteLine($"Download mod {result.m_nPublishedFileId} succeed."); if (!SteamUGC.GetItemInstallInfo(result.m_nPublishedFileId, out ulong size, out string zipPath, 65536, out uint timestamp)) { Console.WriteLine("But failed to get info about downloaded mod due to some unknown reason."); ExitCode = (int)Steam.ExitCodes.DownLoadFail; Finished = true; return; } using var modZip = new ZipArchive(new FileStream(zipPath, FileMode.Open)); Location = Path.GetFullPath(Location); try { ClearDirectory(Location); modZip.ExtractToDirectory(Location); } catch (DirectoryNotFoundException) { Directory.CreateDirectory(Location); modZip.ExtractToDirectory(Location); } Console.WriteLine($"Successfully downloaded mod {result.m_nPublishedFileId} to {Location}."); Finished = true; }
void OnDownloadItemResult(DownloadItemResult_t pCallback) { Debug.Log("[" + DownloadItemResult_t.k_iCallback + " - DownloadItemResult] - " + pCallback.m_unAppID + " -- " + pCallback.m_nPublishedFileId + " -- " + pCallback.m_eResult); }
private static void onItemDownloaded(DownloadItemResult_t callback) { if (DedicatedUGC.installing == null || DedicatedUGC.installing.Count == 0) { return; } if (!DedicatedUGC.installing.Remove(callback.m_nPublishedFileId.m_PublishedFileId)) { return; } if (callback.m_eResult == 1) { CommandWindow.Log("Successfully downloaded workshop item: " + callback.m_nPublishedFileId.m_PublishedFileId); ulong num; string text; uint num2; if (SteamGameServerUGC.GetItemInstallInfo(callback.m_nPublishedFileId, ref num, ref text, 1024u, ref num2) && ReadWrite.folderExists(text, false)) { if (WorkshopTool.checkMapMeta(text, false)) { DedicatedUGC.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.MAP)); if (ReadWrite.folderExists(text + "/Bundles", false)) { Assets.load(text + "/Bundles", false, false, EAssetOrigin.WORKSHOP); } } else if (WorkshopTool.checkLocalizationMeta(text, false)) { DedicatedUGC.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.LOCALIZATION)); } else if (WorkshopTool.checkObjectMeta(text, false)) { DedicatedUGC.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.OBJECT)); Assets.load(text, false, false, EAssetOrigin.WORKSHOP); } else if (WorkshopTool.checkItemMeta(text, false)) { DedicatedUGC.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.ITEM)); Assets.load(text, false, false, EAssetOrigin.WORKSHOP); } else if (WorkshopTool.checkVehicleMeta(text, false)) { DedicatedUGC.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.VEHICLE)); Assets.load(text, false, false, EAssetOrigin.WORKSHOP); } if (Directory.Exists(text + "/Translations")) { Translator.registerTranslationDirectory(text + "/Translations"); } if (Directory.Exists(text + "/Content")) { Assets.searchForAndLoadContent(text + "/Content"); } } } else { CommandWindow.Log("Failed downloading workshop item: " + callback.m_nPublishedFileId.m_PublishedFileId); } DedicatedUGC.installNextItem(); }
private unsafe static void OnDownloadItemResult(DownloadItemResult_t result) { _pendingItemDownload?.ApplyDownloadResult((SteamResult)result.m_eResult); }