private void CreateExtensionInSteam(ExtensionInfo info) { this.m_CreateItemResult.Set(SteamUGC.CreateItem(this.hacknetAppID, EWorkshopFileType.k_EWorkshopFileTypeFirst), (CallResult <CreateItemResult_t> .APIDispatchDelegate)null); this.showLoadingSpinner = true; this.currentTitleMessage = "Creating Extension with Steam..."; }
public void Update() { switch (State) { case States.Creating: if (Mod.SteamID == 0) { CreateCallResult = CallResult <CreateItemResult_t> .Create((callback, IOFailure) => { if (IOFailure) { State = States.Done; Message = "There was an error communicating with steam."; Status = UGCStatus.Failure; return; } if (callback.m_eResult != EResult.k_EResultOK) { State = States.Done; Status = UGCStatus.Failure; Message = String.Format("Creating new item failed: {0}", callback.m_eResult); return; } Mod.SteamID = (ulong)callback.m_nPublishedFileId; Mod.Save(); State = States.Initializing; }); CreateCallResult.Set(SteamUGC.CreateItem(Steam.AppID, EWorkshopFileType.k_EWorkshopFileTypeCommunity)); State = States.WaitingForCreation; Message = "Creating new UGC Item"; } else { State = States.Initializing; Message = "Initializing update"; } return; case States.WaitingForCreation: return; case States.Initializing: UpdateHandle = SteamUGC.StartItemUpdate(Steam.AppID, (PublishedFileId_t)Mod.SteamID); SteamUGC.SetItemTitle(UpdateHandle, Mod.Name); SteamUGC.SetItemDescription(UpdateHandle, Mod.Description); SteamUGC.SetItemVisibility(UpdateHandle, ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic); SteamUGC.SetItemPreview(UpdateHandle, System.IO.Path.GetFullPath(Mod.Directory) + Program.DirChar + Mod.PreviewURL); SteamUGC.SetItemContent(UpdateHandle, System.IO.Path.GetFullPath(Mod.Directory)); State = States.Submitting; Message = "Submitting"; return; case States.Submitting: SubmitCallResult = CallResult <SubmitItemUpdateResult_t> .Create((callback, IOFailure) => { if (IOFailure) { State = States.Done; Status = UGCStatus.Failure; Message = "There was an error communicating with steam."; return; } if (callback.m_eResult != EResult.k_EResultOK) { State = States.Done; Status = UGCStatus.Failure; Message = String.Format("Update item failed: {0}", callback.m_eResult); return; } State = States.Done; Status = UGCStatus.Success; Message = "Successfully updated mod"; }); SubmitCallResult.Set(SteamUGC.SubmitItemUpdate(UpdateHandle, Mod.ChangeNote)); State = States.WaitingForSubmission; return; case States.WaitingForSubmission: { ulong bytesProcessed = 0; ulong totalBytes = 0; SteamUGC.GetItemUpdateProgress(UpdateHandle, out bytesProcessed, out totalBytes); Message = String.Format("Submitting {0} of {1}", bytesProcessed, totalBytes); } return; case States.Done: return; } }
public static void DownloadItem(ulong id) { _downloadItemCallback = Callback<DownloadItemResult_t>.Create(ItemDownloaded); SteamUGC.DownloadItem(new PublishedFileId_t(id), true); }
private async Task <GameLoadResult> _CreateGameAsync(string mapName, string gamemode) { DevConsole.SetVariable("game.mode", gamemode, true, true); State = GameLoaderState.ChangingMap; LoadingHint = "Loading map: " + mapName; if (ulong.TryParse(mapName, out ulong workshopId)) { LoadingHint = "Downloading map from workshop"; if (!SteamServer.IsValid && !SteamClient.IsValid) { return(GameLoadResult.FailedToLoadMap); } var item = await Item.GetAsync(workshopId); if (!item.HasValue) { return(GameLoadResult.FailedToLoadMap); } var download = await SteamUGC.DownloadAsync(workshopId); if (!download) { return(GameLoadResult.FailedToLoadMap); } var provider = FileSystem.AddLocalProvider(item.Value.Directory); FileSystem.Build(); foreach (var file in provider.Files) { file.Value.WorkshopId = workshopId; } } if (MapLoader.Instance.CurrentMap == null || MapLoader.Instance.CurrentMap.Name != mapName) { var mapLoadResult = await MapLoader.Instance.LoadMapAsync2(mapName); if (mapLoadResult != MapLoadState.Loaded) { return(GameLoadResult.FailedToLoadMap); } } if (_cancelled) { return(GameLoadResult.Cancelled); } PreGameLoaded?.Invoke(); LoadingHint = "Loading gamemode: " + gamemode; var gamemodeLoaded = Game.GamemodeLoader.LoadGamemode(gamemode); if (!gamemodeLoaded) { return(GameLoadResult.FailedToLoadGamemode); } GameLoaded?.Invoke(); State = GameLoaderState.Playing; LoadingHint = "Done, game is created."; return(GameLoadResult.Success); }
protected void OnGUI() { if (!SteamAPI.IsSteamRunning()) { EditorGUILayout.HelpBox("Steam is not running. Please start Steam to continue.", MessageType.Error); } else if (ModConfig.Instance == null || string.IsNullOrEmpty(ModConfig.ID)) { EditorGUILayout.HelpBox("You must configure your ModConfig using \"Keep Talking Mod Kit -> Configure Mod\".", MessageType.Error); } else if (!isInitialized) { EditorGUILayout.HelpBox("You must log in to Steam to continue.", MessageType.Error); } else { if (currentWorkshopItem == null) { string workshopItemAssetPath = "Assets/Editor/Resources/WorkshopItem.asset"; currentWorkshopItem = AssetDatabase.LoadAssetAtPath <WorkshopItem>(workshopItemAssetPath); if (currentWorkshopItem == null) { currentWorkshopItem = ScriptableObject.CreateInstance <WorkshopItem>(); if (ModConfig.Instance != null) { currentWorkshopItem.Title = ModConfig.Title; } AssetDatabase.CreateAsset(currentWorkshopItem, workshopItemAssetPath); } if (workshopItemEditor != null && workshopItemEditor.target != currentWorkshopItem) { DestroyImmediate(workshopItemEditor); workshopItemEditor = null; } if (workshopItemEditor == null) { workshopItemEditor = (WorkshopItemEditor)Editor.CreateEditor(currentWorkshopItem, typeof(WorkshopItemEditor)); } } scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); workshopItemEditor.OnInspectorGUI(); //Publishing Tools EditorGUILayout.Separator(); Color oldBGColor = GUI.backgroundColor; GUI.backgroundColor = new Color(0.1f, 0.1f, 0.5f, 0.7f); EditorGUILayout.BeginVertical(EditorStyles.helpBox); GUI.backgroundColor = oldBGColor; EditorGUILayout.LabelField("Publishing Tools", EditorStyles.largeLabel); EditorGUILayout.Separator(); EditorGUILayout.LabelField("User:"******"Content Folder:", GetContentPath()); DirectoryInfo dir = new DirectoryInfo(GetContentPath()); if (dir.Exists) { FileInfo[] files = dir.GetFiles("*.*", SearchOption.AllDirectories); long totalSize = 0; foreach (var file in files) { totalSize += file.Length; } EditorGUILayout.LabelField("File Count:", files.Length.ToString()); EditorGUILayout.LabelField("Total Size:", FormatFileSize(totalSize)); } else { EditorGUILayout.HelpBox("Content folder not found", MessageType.Error); } string[] tags = GetTags(); if (tags == null) { EditorGUILayout.LabelField("Tags [0]: (none set)"); } else { EditorGUILayout.LabelField(string.Format("Tags [{0}]: {1}", tags == null ? "0" : tags.Length.ToString(), string.Join(", ", tags))); } //Change Notes EditorGUILayout.PrefixLabel("Change Notes:"); changeNotes = EditorGUILayout.TextArea(changeNotes, GUILayout.MinHeight(64)); if (string.IsNullOrEmpty(changeNotes)) { EditorGUILayout.HelpBox("Change notes must be entered before publishing to Workshop", MessageType.Warning); } //Publishing changes if (currentWorkshopItem.WorkshopPublishedFileID == 0) { //Create and Publish GUI.enabled = (onCreateItemCallResultHandler != null && !onCreateItemCallResultHandler.IsActive() && !string.IsNullOrEmpty(changeNotes)); if (GUILayout.Button("Create New Workshop Item and Publish to Steam")) { Debug.Log("CreateItem"); var createItemCall = SteamUGC.CreateItem(KTANE_APP_ID, EWorkshopFileType.k_EWorkshopFileTypeCommunity); onCreateItemCallResultHandler.Set(createItemCall); } GUI.enabled = true; } else { //Publish to Existing Item GUI.enabled = (onItemUpdateCallResultHandler != null && !onItemUpdateCallResultHandler.IsActive() && !string.IsNullOrEmpty(changeNotes)); if (GUILayout.Button("Publish Changes to Steam")) { PublishWorkshopChanges(); } if (!string.IsNullOrEmpty(ugcUpdateStatus)) { EditorGUILayout.LabelField(ugcUpdateStatus); } GUI.enabled = true; } EditorGUILayout.EndVertical(); EditorGUILayout.EndScrollView(); } }
private void ExportLoadButtonClick(object sender, EventArgs e) { var dialog = new OpenFileDialog { Filter = "Text files|*.txt", DefaultExt = "txt", CheckPathExists = true, CheckFileExists = true, Multiselect = false, }; if (dialog.ShowDialog() != DialogResult.OK) { return; } bool OverrideTags; if (!Settings.NeverImportTags) { OverrideTags = MessageBox.Show("Do you want to override the tags and categories of your current mods with the tags saved in your profile?\r\n" + "Warning: This action cannot be undone", "Importing profile", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes; } else { OverrideTags = false; } // parse file var categoryRegex = new Regex(@"^(?<category>.*?)\s\(\d*\):$", RegexOptions.Compiled | RegexOptions.Multiline); var modEntryRegex = new Regex(@"^\s*(?<name>.*?)[ ]*\t(?<id>.*?)[ ]*\t(?:.*=)?(?<sourceID>\d+)([ ]*\t(?<tags>.*?))?$", RegexOptions.Compiled | RegexOptions.Multiline); var mods = Mods.All.ToList(); var activeMods = new List <ModEntry>(); var missingMods = new List <Match>(); var categoryName = ""; foreach (var line in File.ReadAllLines(dialog.FileName)) { var categoryMatch = categoryRegex.Match(line); if (categoryMatch.Success) { categoryName = categoryMatch.Groups["category"].Value; } var modMatch = modEntryRegex.Match(line); if (!modMatch.Success) { continue; } var entries = mods.Where(mod => mod.ID == modMatch.Groups["id"].Value).ToList(); if (entries.Count == 0) { // Mod missing // -> add to list missingMods.Add(modMatch); continue; } activeMods.AddRange(entries); if (OverrideTags) { var tags = modMatch.Groups["tags"].Value.Split(';').Where(t => !string.IsNullOrWhiteSpace(t)).ToList(); foreach (var tag in tags) { if (AvailableTags.ContainsKey(tag.ToLower()) == false) { AvailableTags[tag.ToLower()] = new ModTag(tag); } } foreach (var modEntry in entries) { modEntry.Tags = tags; Mods.RemoveMod(modEntry); Mods.AddMod(categoryName, modEntry); } } } // Check entries if (activeMods.Count == 0) { MessageBox.Show("No mods found. Bad profile?", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } // Check missing if (missingMods.Count > 0) { var steamMissingMods = missingMods.Where(match => match.Groups["sourceID"].Value != "Unknown").ToList(); var text = $"This profile contains {missingMods.Count} mod(s) that are not currently installed:\r\n\r\n"; foreach (var match in missingMods) { text += match.Groups["name"].Value; if (steamMissingMods.Contains(match)) { text += "*"; } text += "\r\n"; } if (steamMissingMods.Count != 0) { text += "\r\nDo you want to subscribe to the mods marked with an asterisk on Steam?"; var result = FlexibleMessageBox.Show(this, text, "Mods missing!", MessageBoxButtons.YesNoCancel); if (result == DialogResult.Cancel) { return; } if (result == DialogResult.Yes) { // subscribe foreach (var id in steamMissingMods.Select(match => ulong.Parse(match.Groups["sourceID"].Value))) { SteamUGC.SubscribeItem(id.ToPublishedFileID()); } MessageBox.Show("Done. Close the launcher, wait for steam to download the mod(s) and try again.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } else { text += "\r\nDo you wish to continue?"; if (FlexibleMessageBox.Show(this, text, "Mods missing!", MessageBoxButtons.YesNo) == DialogResult.No) { return; } } } // Confirm if (FlexibleMessageBox.Show(this, $"Adopt profile? {activeMods.Count} mods found.", "Confirm", MessageBoxButtons.YesNo) == DialogResult.No) { return; } // Apply changes foreach (var mod in mods) { mod.isActive = false; } foreach (var mod in activeMods) { mod.isActive = true; } modlist_ListObjectListView.RefreshObjects(mods); UpdateExport(); UpdateLabels(); }
/// <summary> /// Start downloading this item. /// If this returns false the item isn't getting downloaded. /// </summary> public bool Download(bool highPriority = false) { return(SteamUGC.Download(Id, highPriority)); }
public static bool Upload(Mod mod, string changeNotes) { if (string.IsNullOrEmpty(changeNotes)) { changeNotes = $"[Auto-generated text]: Update on {DateTime.Now:yyyy-MM-dd HH:mm:ss}"; } var creating = false; if (mod.PublishedFileId == PublishedFileId_t.Invalid) { // create item first. creating = true; Console.WriteLine("No PublishedFileId found, create new mod?"); Console.ReadLine(); if (!Create(mod)) { throw new Exception("mod creation failed!"); } } // set up steam API call var handle = SteamUGC.StartItemUpdate(RIMWORLD, mod.PublishedFileId); SetItemAttributes(handle, mod, creating); // start async call var call = SteamUGC.SubmitItemUpdate(handle, changeNotes); submitResultCallback = CallResult <SubmitItemUpdateResult_t> .Create(OnItemSubmitted); submitResultCallback.Set(call); // keep checking for async call to complete var lastStatus = ""; var niceStatus = ""; while (!ready.WaitOne(500)) { var status = SteamUGC.GetItemUpdateProgress(handle, out ulong done, out ulong total); SteamAPI.RunCallbacks(); if (lastStatus != status.ToString() && status.ToString() != "k_EItemUpdateStatusInvalid") { niceStatus = status.ToString().Replace("k_EItemUpdateStatus", ""); niceStatus = Regex.Replace(niceStatus, "(\\B[A-Z])", " $1"); switch (niceStatus) { case "Uploading Content": Console.WriteLine($"{niceStatus} ({Math.Round((double)mod.ModBytes / 1000)} KB)"); break; case "Uploading Preview File": Console.WriteLine($"{niceStatus} ({Math.Round((double)mod.PreviewBytes / 1000)} KB)"); break; default: Console.WriteLine(niceStatus); break; } lastStatus = status.ToString(); } } // we have completed! if (submitResult.m_eResult != EResult.k_EResultOK) { Console.WriteLine($"Unexpected result: {submitResult.m_eResult}"); } return(submitResult.m_eResult == EResult.k_EResultOK); }
public void GetSubscribedItems(out PublishedFileId_t[] subscribedItems, out uint numberOfSubscribedItems) { numberOfSubscribedItems = SteamUGC.GetNumSubscribedItems(); subscribedItems = new PublishedFileId_t[numberOfSubscribedItems]; SteamUGC.GetSubscribedItems(subscribedItems, numberOfSubscribedItems); }
/// <summary> /// Not sure if this is needed. Accessing the ISteamUGC API. The API must be accessed through the pointer that is returned from SteamUGC(). /// </summary> public SteamAPICall_t getID(PublishedFileId_t workshopItemID) { return(SteamUGC.RequestUGCDetails(workshopItemID, 60)); }
private void LoadExtensions() { if (!Directory.Exists("Extensions/")) { Directory.CreateDirectory("Extensions/"); } foreach (string directory in Directory.GetDirectories("Extensions/")) { this.AddExtensionSafe(directory); } this.DefaultModImage = Game1.getSingleton().Content.Load <Texture2D>("Sprites/Hammer"); if (PlatformAPISettings.Running) { PublishedFileId_t[] pvecPublishedFileID = new PublishedFileId_t[200]; uint subscribedItems = SteamUGC.GetSubscribedItems(pvecPublishedFileID, 200U); Console.WriteLine(subscribedItems); if (pvecPublishedFileID != null) { for (int index = 0; (long)index < (long)subscribedItems; ++index) { if (((EItemState)Enum.Parse(typeof(EItemState), string.Concat((object)SteamUGC.GetItemState(pvecPublishedFileID[index])))).HasFlag((Enum)EItemState.k_EItemStateInstalled)) { ulong punSizeOnDisk = 0; string pchFolder = (string)null; uint cchFolderSize = 20000; uint punTimeStamp = 0; Console.WriteLine((SteamUGC.GetItemInstallInfo(pvecPublishedFileID[index], out punSizeOnDisk, out pchFolder, cchFolderSize, out punTimeStamp) ? "Installed" : "Uninstalled") + " Extension at: " + pchFolder); this.AddExtensionSafe(pchFolder); } } } } this.HasLoaded = true; }
public void RenderOnGUI() { //GUILayout.BeginArea(new Rect(Screen.width - 120, 0, 120, Screen.height)); Console.WriteLine("Variables:"); Console.WriteLine("m_UGCQueryHandle: " + m_UGCQueryHandle); Console.WriteLine("m_PublishedFileId: " + m_PublishedFileId); Console.WriteLine("m_UGCUpdateHandle: " + m_UGCUpdateHandle); //GUILayout.EndArea(); //if (GUILayout.Button("CreateQueryUserUGCRequest(SteamUser.GetSteamID().GetAccountID(), EUserUGCList.k_EUserUGCList_Published, EUGCMatchingUGCType.k_EUGCMatchingUGCType_Screenshots, EUserUGCListSortOrder.k_EUserUGCListSortOrder_CreationOrderDesc, AppId_t.Invalid, SteamUtils.GetAppID(), 1)")) { m_UGCQueryHandle = SteamUGC.CreateQueryUserUGCRequest(SteamUser.GetSteamID().GetAccountID(), EUserUGCList.k_EUserUGCList_Published, EUGCMatchingUGCType.k_EUGCMatchingUGCType_Screenshots, EUserUGCListSortOrder.k_EUserUGCListSortOrder_CreationOrderDesc, AppId_t.Invalid, SteamUtils.GetAppID(), 1); Console.WriteLine("SteamUGC.CreateQueryUserUGCRequest(" + SteamUser.GetSteamID().GetAccountID() + ", EUserUGCList.k_EUserUGCList_Published, EUGCMatchingUGCType.k_EUGCMatchingUGCType_Screenshots, EUserUGCListSortOrder.k_EUserUGCListSortOrder_CreationOrderDesc, " + AppId_t.Invalid + ", " + SteamUtils.GetAppID() + ", 1) : " + m_UGCQueryHandle); } //if (GUILayout.Button("CreateQueryAllUGCRequest(EUGCQuery.k_EUGCQuery_RankedByPublicationDate, EUGCMatchingUGCType.k_EUGCMatchingUGCType_AllGuides, AppId_t.Invalid, SteamUtils.GetAppID(), 1)")) { m_UGCQueryHandle = SteamUGC.CreateQueryAllUGCRequest(EUGCQuery.k_EUGCQuery_RankedByPublicationDate, EUGCMatchingUGCType.k_EUGCMatchingUGCType_AllGuides, AppId_t.Invalid, SteamUtils.GetAppID(), 1); Console.WriteLine("SteamUGC.CreateQueryAllUGCRequest(EUGCQuery.k_EUGCQuery_RankedByPublicationDate, EUGCMatchingUGCType.k_EUGCMatchingUGCType_AllGuides, " + AppId_t.Invalid + ", " + SteamUtils.GetAppID() + ", 1) : " + m_UGCQueryHandle); } //if (GUILayout.Button("SendQueryUGCRequest(m_UGCQueryHandle)")) { SteamAPICall_t handle = SteamUGC.SendQueryUGCRequest(m_UGCQueryHandle); OnSteamUGCQueryCompletedCallResult.Set(handle); Console.WriteLine("SteamUGC.SendQueryUGCRequest(" + m_UGCQueryHandle + ") : " + handle); } //if (GUILayout.Button("GetQueryUGCResult(m_UGCQueryHandle, 0, out Details)")) { SteamUGCDetails_t Details; bool ret = SteamUGC.GetQueryUGCResult(m_UGCQueryHandle, 0, out Details); Console.WriteLine("SteamUGC.GetQueryUGCResult(" + m_UGCQueryHandle + ", 0, out Details) : " + ret); Console.WriteLine(Details.m_nPublishedFileId + " -- " + Details.m_eResult + " -- " + Details.m_eFileType + " -- " + Details.m_nCreatorAppID + " -- " + Details.m_nConsumerAppID + " -- " + Details.m_rgchTitle + " -- " + Details.m_rgchDescription + " -- " + Details.m_ulSteamIDOwner + " -- " + Details.m_rtimeCreated + " -- " + Details.m_rtimeUpdated + " -- " + Details.m_rtimeAddedToUserList + " -- " + Details.m_eVisibility + " -- " + Details.m_bBanned + " -- " + Details.m_bAcceptedForUse + " -- " + Details.m_bTagsTruncated + " -- " + Details.m_rgchTags + " -- " + Details.m_hFile + " -- " + Details.m_hPreviewFile + " -- " + Details.m_pchFileName + " -- " + Details.m_nFileSize + " -- " + Details.m_nPreviewFileSize + " -- " + Details.m_rgchURL + " -- " + Details.m_unVotesUp + " -- " + Details.m_unVotesDown + " -- " + Details.m_flScore + " -- " + Details.m_unNumChildren); } //if (GUILayout.Button("ReleaseQueryUGCRequest(m_UGCQueryHandle)")) { Console.WriteLine("SteamUGC.ReleaseQueryUGCRequest(" + m_UGCQueryHandle + ") : " + SteamUGC.ReleaseQueryUGCRequest(m_UGCQueryHandle)); } //if (GUILayout.Button("AddRequiredTag(m_UGCQueryHandle, \"Co-op\")")) { Console.WriteLine("SteamUGC.AddRequiredTag(" + m_UGCQueryHandle + ", \"Co-op\") : " + SteamUGC.AddRequiredTag(m_UGCQueryHandle, "Co-op")); } //if (GUILayout.Button("AddExcludedTag(m_UGCQueryHandle, \"Co-op\")")) { Console.WriteLine("SteamUGC.AddExcludedTag(" + m_UGCQueryHandle + ", \"Co-op\") : " + SteamUGC.AddExcludedTag(m_UGCQueryHandle, "Co-op")); } //if (GUILayout.Button("SetReturnLongDescription(m_UGCQueryHandle, true)")) { Console.WriteLine("SteamUGC.SetReturnLongDescription(" + m_UGCQueryHandle + ", true) : " + SteamUGC.SetReturnLongDescription(m_UGCQueryHandle, true)); } // if (GUILayout.Button("SetReturnTotalOnly(m_UGCQueryHandle, true)")) { Console.WriteLine("SteamUGC.SetReturnTotalOnly(" + m_UGCQueryHandle + ", true) : " + SteamUGC.SetReturnTotalOnly(m_UGCQueryHandle, true)); } //if (GUILayout.Button("SetAllowCachedResponse(m_UGCQueryHandle, 5)")) { Console.WriteLine("SteamUGC.SetAllowCachedResponse(" + m_UGCQueryHandle + ", 5) : " + SteamUGC.SetAllowCachedResponse(m_UGCQueryHandle, 5)); } //if (GUILayout.Button("SetCloudFileNameFilter(m_UGCQueryHandle, \"\")")) { Console.WriteLine("SteamUGC.SetCloudFileNameFilter(" + m_UGCQueryHandle + ", \"\") : " + SteamUGC.SetCloudFileNameFilter(m_UGCQueryHandle, "")); } //if (GUILayout.Button("SetMatchAnyTag(m_UGCQueryHandle, true)")) { Console.WriteLine("SteamUGC.SetMatchAnyTag(" + m_UGCQueryHandle + ", true) : " + SteamUGC.SetMatchAnyTag(m_UGCQueryHandle, true)); } //if (GUILayout.Button("SetSearchText(m_UGCQueryHandle, \"AciD\")")) { Console.WriteLine("SteamUGC.SetSearchText(" + m_UGCQueryHandle + ", \"AciD\") : " + SteamUGC.SetSearchText(m_UGCQueryHandle, "AciD")); } //if (GUILayout.Button("SetRankedByTrendDays(m_UGCQueryHandle, 7)")) { Console.WriteLine("SteamUGC.SetRankedByTrendDays(" + m_UGCQueryHandle + ", 7) : " + SteamUGC.SetRankedByTrendDays(m_UGCQueryHandle, 7)); } //if (GUILayout.Button("RequestUGCDetails(m_PublishedFileId, 5)")) { SteamAPICall_t handle = SteamUGC.RequestUGCDetails(m_PublishedFileId, 5); OnSteamUGCRequestUGCDetailsResultCallResult.Set(handle); Console.WriteLine("SteamUGC.RequestUGCDetails(m_PublishedFileId, 5) : " + handle); } //if (GUILayout.Button("CreateItem((AppId_t)480, EWorkshopFileType.k_EWorkshopFileTypeWebGuide)")) { SteamAPICall_t handle = SteamUGC.CreateItem((AppId_t)480, EWorkshopFileType.k_EWorkshopFileTypeWebGuide); OnCreateItemResultCallResult.Set(handle); Console.WriteLine("SteamUGC.CreateItem((AppId_t)480, EWorkshopFileType.k_EWorkshopFileTypeWebGuide) : " + handle); } //if (GUILayout.Button("StartItemUpdate((AppId_t)480, m_PublishedFileId)")) { m_UGCUpdateHandle = SteamUGC.StartItemUpdate((AppId_t)480, m_PublishedFileId); Console.WriteLine("SteamUGC.StartItemUpdate((AppId_t)480, " + m_PublishedFileId + ") : " + m_UGCUpdateHandle); } // if (GUILayout.Button("SetItemTitle(m_UGCUpdateHandle, \"This is a Test\")")) { bool ret = SteamUGC.SetItemTitle(m_UGCUpdateHandle, "This is a Test"); Console.WriteLine("SteamUGC.SetItemTitle(" + m_UGCUpdateHandle + ", \"This is a Test\") : " + ret); } //if (GUILayout.Button("SetItemDescription(m_UGCUpdateHandle, \"This is the test description.\")")) { bool ret = SteamUGC.SetItemDescription(m_UGCUpdateHandle, "This is the test description."); Console.WriteLine("SteamUGC.SetItemDescription(" + m_UGCUpdateHandle + ", \"This is the test description.\") : " + ret); } //if (GUILayout.Button("SetItemVisibility(m_UGCUpdateHandle, ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPrivate)")) { bool ret = SteamUGC.SetItemVisibility(m_UGCUpdateHandle, ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPrivate); Console.WriteLine("SteamUGC.SetItemVisibility(" + m_UGCUpdateHandle + ", ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPrivate) : " + ret); } //if (GUILayout.Button("SetItemTags(m_UGCUpdateHandle, new string[] {\"Tag One\", \"Tag Two\", \"Test Tags\", \"Sorry\"})")) { bool ret = SteamUGC.SetItemTags(m_UGCUpdateHandle, new string[] { "Tag One", "Tag Two", "Test Tags", "Sorry" }); Console.WriteLine("SteamUGC.SetItemTags(" + m_UGCUpdateHandle + ", new string[] {\"Tag One\", \"Tag Two\", \"Test Tags\", \"Sorry\"}) : " + ret); } //if (GUILayout.Button("SetItemContent(m_UGCUpdateHandle, Application.dataPath + \"/Scenes\")")) { bool ret = SteamUGC.SetItemContent(m_UGCUpdateHandle, AppDomain.CurrentDomain.BaseDirectory + "/Scenes"); // Should point to a folder containing the UGC Item Console.WriteLine("SteamUGC.SetItemContent(" + m_UGCUpdateHandle + ", Application.dataPath + \"/Scenes\") : " + ret); } //if (GUILayout.Button("SetItemPreview(m_UGCUpdateHandle, Application.dataPath + \"/controller.vdf\")")) { bool ret = SteamUGC.SetItemPreview(m_UGCUpdateHandle, AppDomain.CurrentDomain.BaseDirectory + "/controller.vdf"); // Should actually be a PNG/JPG Screenshot. Console.WriteLine("SteamUGC.SetItemPreview(" + m_UGCUpdateHandle + ", Application.dataPath + \"/controller.vdf\") : " + ret); } //if (GUILayout.Button("SubmitItemUpdate(m_UGCUpdateHandle, \"Test Changenote\")")) { SteamAPICall_t handle = SteamUGC.SubmitItemUpdate(m_UGCUpdateHandle, "Test Changenote"); OnSubmitItemUpdateResultCallResult.Set(handle); Console.WriteLine("SteamUGC.SubmitItemUpdate(" + m_UGCUpdateHandle + ", \"Test Changenote\") : " + handle); } { ulong BytesProcessed; ulong BytesTotal; EItemUpdateStatus ret = SteamUGC.GetItemUpdateProgress(m_UGCUpdateHandle, out BytesProcessed, out BytesTotal); Console.WriteLine("GetItemUpdateProgress(m_UGCUpdateHandle, out BytesProcessed, out BytesTotal) : " + ret + " -- " + BytesProcessed + " -- " + BytesTotal); } //if (GUILayout.Button("SubscribeItem((PublishedFileId_t)113142309)")) { SteamAPICall_t handle = SteamUGC.SubscribeItem((PublishedFileId_t)113142309); // http://steamcommunity.com/sharedfiles/filedetails/?id=113142309 OnRemoteStorageSubscribePublishedFileResultCallResult.Set(handle); Console.WriteLine("SteamUGC. : " + handle); } //if (GUILayout.Button("UnsubscribeItem((PublishedFileId_t)113142309)")) { SteamAPICall_t handle = SteamUGC.UnsubscribeItem((PublishedFileId_t)113142309); // http://steamcommunity.com/sharedfiles/filedetails/?id=113142309 OnRemoteStorageUnsubscribePublishedFileResultCallResult.Set(handle); Console.WriteLine("SteamUGC. : " + handle); } Console.WriteLine("GetNumSubscribedItems() : " + SteamUGC.GetNumSubscribedItems()); //if (GUILayout.Button("GetSubscribedItems(PublishedFileID, (uint)PublishedFileID.Length)")) { PublishedFileId_t[] PublishedFileID = new PublishedFileId_t[1]; uint ret = SteamUGC.GetSubscribedItems(PublishedFileID, (uint)PublishedFileID.Length); m_PublishedFileId = PublishedFileID[0]; Console.WriteLine("SteamUGC.GetSubscribedItems(" + PublishedFileID + ", (uint)PublishedFileID.Length) : " + ret + " -- " + PublishedFileID[0]); } { ulong SizeOnDisk; string Folder; uint LegacyItem; //bool LegacyItem; bool ret = SteamUGC.GetItemInstallInfo(m_PublishedFileId, out SizeOnDisk, out Folder, 1024, out LegacyItem); Console.WriteLine("GetItemInstallInfo(m_PublishedFileId, out SizeOnDisk, out Folder, 1024) : " + ret + " -- " + SizeOnDisk + " -- " + Folder + " -- " + LegacyItem); } { //bool NeedsUpdate; //bool IsDownloading; ulong BytesDownloaded; ulong BytesTotal; //bool ret = SteamUGC.GetItemUpdateInfo(m_PublishedFileId, out NeedsUpdate, out IsDownloading, out BytesDownloaded, out BytesTotal); bool ret = SteamUGC.GetItemDownloadInfo(m_PublishedFileId, out BytesDownloaded, out BytesTotal); //, out BytesDownloaded, out BytesTotal); Console.WriteLine("GetItemUpdateInfo(m_PublishedFileId, out NeedsUpdate, out IsDownloading, out BytesDownloaded, out BytesTotal) : " + ret + " -- " + " -- " + BytesDownloaded + " -- " + BytesTotal); //Console.WriteLine("GetItemUpdateInfo(m_PublishedFileId, out NeedsUpdate, out IsDownloading, out BytesDownloaded, out BytesTotal) : " + ret + " -- " + NeedsUpdate + " -- " + IsDownloading + " -- " + BytesDownloaded + " -- " + BytesTotal); } }
/// <summary> /// Sends or updates a file (must be registered first). 5. If desired, the progress of the upload can be tracked using EItemUpdateStatus GetItemUpdateProgress( UGCUpdateHandle_t handle, uint64 *punBytesProcessed, uint64* punBytesTotal). In the same way as Creating a Workshop Item, confirm the user has accepted the legal agreement. This is necessary in case where the user didn't initially create the item but is editing an existing item. /// </summary> /// <param name="handle"></param> /// <param name="changeNote">Info about the change to the file for updates.</param> /// <returns></returns> public SteamAPICall_t sendFileOrUpdate(UGCUpdateHandle_t handle, string changeNote) { //4. Once the update calls have been completed, calling SteamAPICall_t SubmitItemUpdate( UGCUpdateHandle_t handle, const char *pchChangeNote ) will initiate the upload process to the Steam Workshop. return(SteamUGC.SubmitItemUpdate(handle, changeNote)); }
private void PerformUpdate(ExtensionInfo info) { this.updateHandle = SteamUGC.StartItemUpdate(this.hacknetAppID, new PublishedFileId_t((ulong)Convert.ToInt64(info.WorkshopPublishID))); this.isInUpload = true; bool flag1 = ((true & SteamUGC.SetItemTitle(this.updateHandle, info.Name) & SteamUGC.SetItemDescription(this.updateHandle, info.WorkshopDescription) ? 1 : 0) & (SteamUGC.SetItemTags(this.updateHandle, (IList <string>)info.WorkshopTags.Split(new string[3] { " ,", ", ", "," }, StringSplitOptions.RemoveEmptyEntries)) ? 1 : 0)) != 0; string str = (Path.Combine(Directory.GetCurrentDirectory(), info.FolderPath) + "/" + info.WorkshopPreviewImagePath).Replace("\\", "/"); if (File.Exists(str)) { if (new FileInfo(str).Length < 1000000L) { flag1 &= SteamUGC.SetItemPreview(this.updateHandle, str); } else { this.currentStatusMessage = "Workshop Preview Image too large! Max size 1mb. Ignoring..."; } } ERemoteStoragePublishedFileVisibility eVisibility = (int)info.WorkshopVisibility <= 0 ? ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic : ((int)info.WorkshopVisibility == 1 ? ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityFriendsOnly : ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPrivate); bool flag2 = flag1 & SteamUGC.SetItemVisibility(this.updateHandle, eVisibility); string pszContentFolder = Path.Combine(Directory.GetCurrentDirectory(), info.FolderPath).Replace("\\", "/"); Console.WriteLine("Content Path: " + pszContentFolder); if (!(flag2 & SteamUGC.SetItemContent(this.updateHandle, pszContentFolder))) { Console.WriteLine("Error!"); } string path = info.FolderPath + "/Changelog.txt"; string pchChangeNote = ""; if (File.Exists(path)) { pchChangeNote = File.ReadAllText(path); } this.SubmitItemUpdateResult_t.Set(SteamUGC.SubmitItemUpdate(this.updateHandle, pchChangeNote), (CallResult <Steamworks.SubmitItemUpdateResult_t> .APIDispatchDelegate)null); this.transferStarted = DateTime.Now; this.showLoadingSpinner = true; this.isInUpload = true; this.currentBodyMessage = "Uploading to Steam Workshop..."; this.currentTitleMessage = "Upload in progress"; }
public void UploadMod(ModObject mod, string changelog, string[] tags, bool keepUnCooked, bool keepScripts, int visibility, string description) { if (IsUploaderRunning) { MainWindow.Instance.Invoke(new MethodInvoker(() => { GUI.MessageBox.Show(MainWindow.Instance, "Only one uploader instance can run at once!"); })); return; } success = true; IsUploaderRunning = true; try { ERemoteStoragePublishedFileVisibility fileVisibility = (ERemoteStoragePublishedFileVisibility)Enum.ToObject(typeof(ERemoteStoragePublishedFileVisibility), visibility);; mod.Refresh(); SetStatus("Preparing the uploader..."); var tmpDir = Path.Combine(Program.GetAppRoot(), "uploader_tmp"); if (Directory.Exists(tmpDir)) { Directory.Delete(tmpDir, true); } Directory.CreateDirectory(tmpDir); Utils.DirectoryCopy(mod.RootPath, tmpDir, true); if (!keepScripts) { if (Directory.Exists(Path.Combine(tmpDir, "CompiledScripts"))) { Directory.Delete(Path.Combine(tmpDir, "CompiledScripts"), true); } if (Directory.Exists(Path.Combine(tmpDir, "Classes"))) { Directory.Delete(Path.Combine(tmpDir, "Classes"), true); } } if (!keepUnCooked) { if (Directory.Exists(Path.Combine(tmpDir, "Maps"))) { Directory.Delete(Path.Combine(tmpDir, "Maps"), true); } if (Directory.Exists(Path.Combine(tmpDir, "Content"))) { Directory.Delete(Path.Combine(tmpDir, "Content"), true); } } //var description = mod.GetDescription(); var modid = mod.GetUploadedId(); SetStatus("Creating callback..."); m_itemCreated = CallResult <CreateItemResult_t> .Create(OnItemCreated); var appId = new AppId_t(uint.Parse(GameFinder.AppID)); if (modid == 0) { SteamAPICall_t call = SteamUGC.CreateItem(appId, EWorkshopFileType.k_EWorkshopFileTypeCommunity); m_itemCreated.Set(call); } else { publishID = modid; } while (publishID == 0) { SteamAPI.RunCallbacks(); Thread.Sleep(1000); } Thread.Sleep(1000); if (modid == 0) { SetStatus("Uploading an new mod " + mod.Name + " with WorkshopID: " + publishID); mod.SetUploadedId(publishID); } else { SetStatus("Updating the mod " + mod.Name + " with WorkshopID: " + publishID); } var publishFileID_t = new PublishedFileId_t(publishID); ugcUpdateHandle = SteamUGC.StartItemUpdate(appId, publishFileID_t); SteamUGC.SetItemTitle(ugcUpdateHandle, mod.Name); SteamUGC.SetItemDescription(ugcUpdateHandle, description); SteamUGC.SetItemVisibility(ugcUpdateHandle, fileVisibility); if (tags != null) { SteamUGC.SetItemTags(ugcUpdateHandle, tags); } SteamUGC.SetItemPreview(ugcUpdateHandle, Path.Combine(tmpDir, mod.Icon)); SteamUGC.SetItemContent(ugcUpdateHandle, tmpDir); SteamAPICall_t t = SteamUGC.SubmitItemUpdate(ugcUpdateHandle, changelog); m_itemSubmitted = CallResult <SubmitItemUpdateResult_t> .Create(OnItemSubmitted); m_itemSubmitted.Set(t); while (true) { Thread.Sleep(1000); if (ugcUpdateHandle == UGCUpdateHandle_t.Invalid) { break; } SteamAPI.RunCallbacks(); ulong bytesDone, bytesTotal; EItemUpdateStatus status = SteamUGC.GetItemUpdateProgress(ugcUpdateHandle, out bytesDone, out bytesTotal); if (status == EItemUpdateStatus.k_EItemUpdateStatusInvalid && !success) { break; } SetStatus(string.Format("[{3}%] Status: {0}\n{1}/{2}", TranslateStatus(status), BytesToString(bytesDone), BytesToString(bytesTotal), bytesTotal > 0 ? Math.Floor(((double)bytesDone / (double)bytesTotal) * (double)100) : 100)); } DialogResult res = DialogResult.No; if (success) { MainWindow.Instance.Invoke(new MethodInvoker(() => { res = GUI.MessageBox.Show(MainWindow.Instance, "Done, mod url:" + "\nhttps://steamcommunity.com/sharedfiles/filedetails/?id=" + publishID + "\n\nOpen it in the browser?", "Uploader", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (res == DialogResult.Yes) { Process.Start("steam://openurl/https://steamcommunity.com/sharedfiles/filedetails/?id=" + publishID); } })); SetStatus("Item uploaded successfully!"); Thread.Sleep(1000); } SetStatus("Cleanup"); if (Directory.Exists(tmpDir)) { Directory.Delete(tmpDir, true); } SetStatus(null); IsUploaderRunning = false; } catch (Exception e) { MainWindow.Instance.Invoke(new MethodInvoker(() => { GUI.MessageBox.Show(MainWindow.Instance, e.Message + "\n" + e.ToString()); })); IsUploaderRunning = false; SetStatus(null); } }
public void GetUpdateProgress(out ulong bytesProcessed, out ulong bytesTotal) { EItemUpdateStatus status = SteamUGC.GetItemUpdateProgress(updateHandle, out bytesProcessed, out bytesTotal); }
// Token: 0x060013B6 RID: 5046 RVA: 0x0007E702 File Offset: 0x0007CB02 protected void downloadWorkshopItem() { Debug.Log("Downloading..."); SteamUGC.DownloadItem(this.workshopItemDetails.m_nPublishedFileId, true); }
private async void ItemInstalled(ItemInstalled item) { var result = await SteamUGC.GetItemDetailsAsync(item.PublishedFile); Console.WriteLine("Installed: " + result.Details.Title); }
internal static void Unsubscribe(WorkshopUploadable item) { SteamUGC.UnsubscribeItem(item.GetPublishedFileId()); }
private async void ItemSubscribed(RemoteStoragePublishedFileSubscribed item) { var result = await SteamUGC.GetItemDetailsAsync(item.PublishedField); Console.WriteLine("Subscribed: " + result.Details.Title); }
/// <summary> /// Allows the user to subscribe to download this item asyncronously /// If CancellationToken is default then there is 60 seconds timeout /// Progress will be set to 0-1 /// </summary> public async Task <bool> DownloadAsync(Action <float> progress = null, int milisecondsUpdateDelay = 60, CancellationToken ct = default) { return(await SteamUGC.DownloadAsync(Id, progress, milisecondsUpdateDelay, ct)); }
public uint CountWorkshopStuff() => SteamUGC.GetNumSubscribedItems();
public static void Subscribe(string identifier) { SteamUGC.SubscribeItem(new PublishedFileId_t(ulong.Parse(identifier))); }
/// <summary> /// Configures the request to limit the cache time to 1 hour, then sends it. /// </summary> /// <param name="query">The UGC query to send.</param> /// <returns>The API call result of the query.</returns> internal static SteamAPICall_t ConfigureAndSend(UGCQueryHandle_t query) { SteamUGC.SetAllowCachedResponse(query, 3600U); return(SteamUGC.SendQueryUGCRequest(query)); }
public unsafe void Subscribe() { SteamUGC.SubscribeItem(_id); }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); e.Graphics.DrawImage(globals.GetTexture(ulFileID.ToString(), "jpg"), new Rectangle(1, 1, Height - 2, Height - 2)); if (m_bWhitelisted) { e.Graphics.DrawImage(Properties.Resources.verified, new Rectangle(Height - 18, Height - 18, 18, 18)); } e.Graphics.FillRectangle(new SolidBrush(colOverlay), new Rectangle(0, 0, Width, Height)); e.Graphics.DrawRectangle(Pens.Black, new Rectangle(1, 1, Height - 2, Height - 2)); StringFormat formatter = new StringFormat(); formatter.LineAlignment = StringAlignment.Center; formatter.Alignment = StringAlignment.Near; if (m_bUploading) { bool bDrawProgress = false; string statusString = ""; ulong punBytesProcessed = 0, punBytesTotal = 0; EItemUpdateStatus uploadStatus = SteamUGC.GetItemUpdateProgress(updateHandle, out punBytesProcessed, out punBytesTotal); if (uploadStatus == EItemUpdateStatus.k_EItemUpdateStatusPreparingConfig) { statusString = "Preparing Content..."; } else if (uploadStatus == EItemUpdateStatus.k_EItemUpdateStatusPreparingContent) { statusString = string.Format("Uploading Content: {0} / {1} bytes", punBytesProcessed, punBytesTotal); bDrawProgress = true; } else if (uploadStatus == EItemUpdateStatus.k_EItemUpdateStatusUploadingContent || uploadStatus == EItemUpdateStatus.k_EItemUpdateStatusUploadingPreviewFile) { statusString = "Configuring Content..."; } else if (uploadStatus == EItemUpdateStatus.k_EItemUpdateStatusCommittingChanges) { statusString = "Committing Changes..."; } e.Graphics.DrawString(statusString, new Font("Times New Roman", 11, FontStyle.Bold), new SolidBrush(Color.White), new Rectangle(Height + 2, 1, Width - Height - 2, 30), formatter); if (bDrawProgress && (punBytesTotal > 0)) { e.Graphics.DrawImage(globals.GetTexture("bar"), new Rectangle(Height + 2, 33, Width - Height - 24, 16)); double flPercent = ((double)punBytesProcessed) / ((double)punBytesTotal); double flWide = (double)(Width - Height - 24) * flPercent; e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(145, 200, 15, 15)), new Rectangle(Height + 2, 33, (int)flWide, 16)); e.Graphics.DrawRectangle(Pens.Black, new Rectangle(Height + 2, 33, Width - Height - 24, 16)); } return; } e.Graphics.DrawString(pszName, new Font("Times New Roman", 20, FontStyle.Bold), new SolidBrush(Color.White), new Rectangle(Height + 2, 1, Width - Height - 2, 30), formatter); e.Graphics.DrawString(pszDescription, new Font("Times New Roman", 10, FontStyle.Regular), new SolidBrush(Color.White), new Rectangle(Height + 3, 33, Width - Height - 3, 20), formatter); formatter.LineAlignment = StringAlignment.Center; formatter.Alignment = StringAlignment.Far; e.Graphics.DrawString(pszDate, new Font("Times New Roman", 10, FontStyle.Bold), new SolidBrush(Color.White), new Rectangle(Width - 142, 2, 140, 20), formatter); }
private void ExportLoadButtonClick(object sender, EventArgs e) { var dialog = new OpenFileDialog { Filter = "Text files|*.txt", DefaultExt = "txt", CheckPathExists = true, CheckFileExists = true, Multiselect = false, }; if (dialog.ShowDialog() != DialogResult.OK) { return; } // parse file var regex = new Regex(@"^\s*(?<name>.*?)[ ]*\t(?<id>.*?)[ ]*\t(?:.*=)?(?<sourceID>\d+)$", RegexOptions.Compiled | RegexOptions.Multiline); var mods = Mods.All.ToList(); var activeMods = new List <ModEntry>(); var missingMods = new List <Match>(); foreach (var line in File.ReadAllLines(dialog.FileName)) { var match = regex.Match(line); if (!match.Success) { continue; } var entries = mods.Where(mod => mod.ID == match.Groups["id"].Value).ToList(); if (entries.Count == 0) { // Mod missing // -> add to list missingMods.Add(match); continue; } activeMods.AddRange(entries); if (entries.Count > 1) { // More than 1 mod // Add warning? } } // Check entries if (activeMods.Count == 0) { MessageBox.Show("No mods found. Bad profile?"); return; } // Check missing if (missingMods.Count > 0) { var steamMissingMods = missingMods.Where(match => match.Groups["sourceID"].Value != "Unknown").ToList(); var text = $"This profile contains {missingMods.Count} mod(s) that are not currently installed:\r\n\r\n"; foreach (var match in missingMods) { text += match.Groups["name"].Value; if (steamMissingMods.Contains(match)) { text += "*"; } text += "\r\n"; } if (steamMissingMods.Count != 0) { text += "\r\nDo you want to subscribe to the mods marked with an asterisk on Steam?"; var result = MessageBox.Show(this, text, "Mods missing!", MessageBoxButtons.YesNoCancel); if (result == DialogResult.Cancel) { return; } if (result == DialogResult.Yes) { // subscribe foreach (var id in steamMissingMods.Select(match => ulong.Parse(match.Groups["sourceID"].Value))) { SteamUGC.SubscribeItem(id.ToPublishedFileID()); } MessageBox.Show("Done. Close the launcher, wait for steam to download the mod(s) and try again."); return; } } else { text += "\r\nDo you wish to continue?"; if (MessageBox.Show(this, text, "Mods missing!", MessageBoxButtons.YesNo) == DialogResult.No) { return; } } } // Confirm if (MessageBox.Show(this, $"Adopt profile? {activeMods.Count} mods found.", "Confirm", MessageBoxButtons.YesNo) == DialogResult.No) { return; } // Apply changes foreach (var mod in mods) { mod.isActive = false; } foreach (var mod in activeMods) { mod.isActive = true; } modlist_objectlistview.UpdateObjects(mods); UpdateExport(); UpdateLabels(); }
public static EItemState GetDownloadStatus(ulong id) { SteamAPIWrapper.Init(); return((EItemState)SteamUGC.GetItemState(new PublishedFileId_t(id))); }
public static void Unsubscribe(ulong id) { SteamAPIWrapper.Init(); SteamUGC.UnsubscribeItem(id.ToPublishedFileID()); }
public Vector2 Draw(SpriteBatch sb, Rectangle dest, ExtensionInfo info) { this.ActiveInfo = info; if (!this.HasInitializedSteamCallbacks) { this.InitSteamCallbacks(); } this.Update(); Vector2 vector2 = new Vector2((float)dest.X, (float)dest.Y); bool flag1 = info.WorkshopPublishID != "NONE"; this.currentStatusMessage = flag1 ? "Ready to push Updates" : "Ready to create in steam"; if (!flag1 && string.IsNullOrWhiteSpace(this.currentBodyMessage)) { this.currentBodyMessage = "By submitting this item, you agree to the workshop terms of service\nhttp://steamcommunity.com/sharedfiles/workshoplegalagreement"; } Vector2 pos1 = new Vector2(vector2.X + (float)(dest.Width / 2), vector2.Y); TextItem.doFontLabel(pos1, this.currentStatusMessage, GuiData.font, new Color?(Color.Gray), (float)dest.Width / 2f, 30f, false); pos1.Y += 30f; TextItem.doFontLabel(pos1, this.currentTitleMessage, GuiData.font, new Color?(Color.White), (float)dest.Width / 2f, 30f, false); pos1.Y += 30f; Vector2 pos2 = pos1; if (this.showLoadingSpinner) { pos1.X += 16f; this.spinnerRot += 0.1f; Rectangle destinationRectangle = new Rectangle((int)pos1.X, (int)pos1.Y + 20, 40, 40); sb.Draw(this.spinnerTex, destinationRectangle, new Rectangle?(), Color.White, this.spinnerRot, this.spinnerTex.GetCentreOrigin(), SpriteEffects.None, 0.5f); pos2.X += 45f; } if (this.isInUpload) { Rectangle rectangle = new Rectangle((int)pos2.X, (int)pos2.Y + 6, dest.Width / 2, 20); ulong punBytesProcessed = 0; ulong punBytesTotal = 1; int itemUpdateProgress = (int)SteamUGC.GetItemUpdateProgress(this.updateHandle, out punBytesProcessed, out punBytesTotal); double val1 = (double)punBytesProcessed / (double)punBytesTotal; if ((long)punBytesTotal == 0L) { val1 = 0.0; } sb.Draw(Utils.white, Utils.InsetRectangle(rectangle, -1), Utils.AddativeWhite * 0.7f); sb.Draw(Utils.white, rectangle, Utils.VeryDarkGray); rectangle.Width = (int)((double)rectangle.Width * val1); sb.Draw(Utils.white, rectangle, Color.LightBlue); pos2.Y += 31f; if (punBytesTotal > 0UL) { string format = "{0}% - {1}mb of {2}mb Transfered"; string str1 = (val1 * 100.0).ToString("00.00"); ulong num = punBytesProcessed / 1000000UL; string str2 = num.ToString("0.00"); num = punBytesTotal / 1000000UL; string str3 = num.ToString("0.00"); string text1 = string.Format(format, (object)str1, (object)str2, (object)str3); Utils.DrawStringMonospace(sb, text1, GuiData.smallfont, pos2, Color.White, 9f); pos2.Y += 20f; TimeSpan time = DateTime.Now - this.transferStarted; string text2 = string.Format("ETA: {0} // Elapsed : {1}", (object)this.getTimespanDisplayString(TimeSpan.FromSeconds(time.TotalSeconds / Math.Max(val1, 0.01))), (object)this.getTimespanDisplayString(time)); Utils.DrawStringMonospace(sb, text2, GuiData.smallfont, pos2, Color.White, 9f); pos2.Y += 25f; } } TextItem.doFontLabel(pos2, this.currentBodyMessage, GuiData.smallfont, new Color?(Color.White * 0.8f), (float)dest.Width / 2f, 30f, false); int height = 40; int width = 450; bool flag2 = !this.showLoadingSpinner; if (!this.isInUpload) { if (Button.doButton(371711001, (int)vector2.X, (int)vector2.Y, width, height, flag1 ? " - Item Created -" : "Create Entry in Steam Workshop", new Color?(flag1 ? Color.LightBlue : Color.Gray)) && !flag1 && flag2) { this.CreateExtensionInSteam(info); } vector2.Y += (float)(height + 4); if (Button.doButton(371711003, (int)vector2.X, (int)vector2.Y, width, height, "Upload to Steam Workshop", new Color?(flag1 ? Color.LightBlue : Color.Gray)) && flag2) { this.PerformUpdate(info); } vector2.Y += (float)(height + 4); if (Button.doButton(371711005, (int)vector2.X, (int)vector2.Y + 10, width, height - 10, "Back to Extension Menu", new Color?(Color.Black)) && flag2 && this.GoBack != null) { this.GoBack(); } vector2.Y += (float)(height + 4); } return(vector2); }