private void SubmitWorkshopItem(PublishedFileId_t fileID, string changelog) { int iVisibility = 0; if (m_pVisibilityChoices[1].Checked) { iVisibility = 1; } else if (m_pVisibilityChoices[2].Checked) { iVisibility = 2; } try { File.Copy(pszImagePath, string.Format("{0}\\workshopper\\addons\\{1}.jpg", globals.GetTexturePath(), fileID.m_PublishedFileId.ToString()), true); } catch (Exception ex) { utils.LogAction(ex.Message); } finally { UGCHandler.SubmitItem(fileID, m_pTitle.Text, m_pDescription.Text, iVisibility, pszContentPath, pszImagePath, pszTagList, changelog, m_bShouldUpdateItem); Close(); } }
protected override void OnFormActive() { if (factory_list_init.InitSteamAPI(this)) { UGCHandler.Initialize(); } else { OnFormExit(); return; } base.OnFormActive(); }
private void OnUploadAddon(object sender, EventArgs e) { string imagePreview = (m_bHasChangedImagePath ? pszImagePath : null); if (string.IsNullOrEmpty(m_pTitle.Text) || string.IsNullOrEmpty(m_pDescription.Text)) { utils.ShowWarningDialog("Please fill out the fields first!", null, true); return; } if (pszTagList.Count() <= 0) { utils.ShowWarningDialog("You have to select at least one tag!", null, true); return; } if (string.IsNullOrEmpty(imagePreview) && !m_bShouldUpdateItem) { utils.ShowWarningDialog("You have to select an image!", null, true); return; } if (string.IsNullOrEmpty(pszContentPath) && !m_bShouldUpdateItem) { utils.ShowWarningDialog("You have to select the content directory!", null, true); return; } if (!IsStringValid(m_pTitle.Text) || !IsStringValid(m_pDescription.Text) || (m_bShouldUpdateItem && !IsStringValid(m_pPatchNotes.Text) && !string.IsNullOrEmpty(m_pPatchNotes.Text))) { utils.ShowWarningDialog("Invalid characters detected!", null, true); return; } if (!string.IsNullOrEmpty(pszContentPath)) { ulong fileSize = utils.GetSizeOfContent(pszContentPath); if (fileSize <= 0) { utils.ShowWarningDialog("No files selected!", null, true); return; } if (fileSize > 104857600) { utils.ShowWarningDialog("Content size is too big, 100MB is max!", null, true); return; } } if (!string.IsNullOrEmpty(imagePreview)) { ulong fileSize = utils.GetSizeOfFile(pszImagePath); if (fileSize <= 0) { utils.ShowWarningDialog("No image selected!", null, true); return; } if (fileSize > 5089488) { utils.ShowWarningDialog("Image size is too big, 5MB is max!", null, true); return; } } if (m_bShouldUpdateItem) { SubmitWorkshopItem(itemUniqueID, m_pPatchNotes.Text); } else { UGCHandler.CreateItem(); } }
private void OnClickRefresh(object sender, EventArgs e) { UGCHandler.RetrievePublishedItems(); }