Exemple #1
0
	public void CreateWorkshopItem(string contentFolder, string previewFile, string name, string description, ERemoteStoragePublishedFileVisibility visibility) {
		Reset();
		m_State = EState.Creating;

		m_tmpContentFolder = contentFolder;
		m_tmpPreviewFile = previewFile;
		m_tmpName = name;
		m_tmpDescription = description;
		m_tmpVisibility = visibility;

		SteamAPICall_t handle = SteamUGC.CreateItem(s_AppId, EWorkshopFileType.k_EWorkshopFileTypeCommunity);
		m_CrateItemResult.Set(handle, OnCreateItemResult);
	}
Exemple #2
0
	private void Reset() {
		m_State = EState.Initialized;
		m_tmpPublishedFileId = PublishedFileId_t.Invalid;
		m_tmpNeedsToAcceptTOS = false;
		m_tmpUpdateHandle = UGCUpdateHandle_t.Invalid;

		m_tmpContentFolder = "";
		m_tmpPreviewFile = "";
		m_tmpName = "";
		m_tmpDescription = "";
		m_tmpVisibility = ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPrivate;

		m_CrateItemResult.Cancel();
		m_SubmitItemUpdateResult.Cancel();
	}
Exemple #3
0
        /// <summary>
        /// Creates a new editor tool to update a given UGC item.
        /// This will assume the file ID and AppID of the itemDetails provided.
        /// </summary>
        /// <param name="itemDetails">The details of the item to update</param>
        public SteamworksWorkshopItemEditorTool(HeathenWorkshopReadCommunityItem itemDetails)
        {
            m_SubmitItemUpdateResult = CallResult <SubmitItemUpdateResult_t> .Create(HandleItemUpdated);

            m_CreatedItem = CallResult <CreateItemResult_t> .Create(HandleItemCreate);

            m_RemoteStorageDownloadUGCResult = CallResult <RemoteStorageDownloadUGCResult_t> .Create(HandleUGCDownload);

            TargetApp            = itemDetails.TargetApp;
            FileId               = itemDetails.FileId;
            Title                = itemDetails.Title;
            Description          = itemDetails.Description;
            Visibility           = itemDetails.Visibility;
            Author               = SteamSettings.current.client.GetUserData(itemDetails.Author);
            previewImage         = itemDetails.previewImage;
            PreviewImageLocation = itemDetails.PreviewImageLocation;
        }
Exemple #4
0
        /// <summary>
        /// Creates a new editor tool to update a given UGC item.
        /// This will assume the file ID and AppID of the itemDetails provided.
        /// </summary>
        /// <param name="itemDetails">The details of the item to update</param>
        public SteamworksWorkshopItemEditorTool(SteamUGCDetails_t itemDetails)
        {
            m_SubmitItemUpdateResult = CallResult <SubmitItemUpdateResult_t> .Create(HandleItemUpdated);

            m_CreatedItem = CallResult <CreateItemResult_t> .Create(HandleItemCreate);

            m_RemoteStorageDownloadUGCResult = CallResult <RemoteStorageDownloadUGCResult_t> .Create(HandleUGCDownload);

            TargetApp   = itemDetails.m_nConsumerAppID;
            FileId      = itemDetails.m_nPublishedFileId;
            Title       = itemDetails.m_rgchTitle;
            Description = itemDetails.m_rgchDescription;
            Visibility  = itemDetails.m_eVisibility;
            Author      = SteamSettings.current.client.GetUserData(itemDetails.m_ulSteamIDOwner);
            var previewCall = SteamRemoteStorage.UGCDownload(itemDetails.m_hPreviewFile, 1);

            m_RemoteStorageDownloadUGCResult.Set(previewCall, HandleUGCDownload);
        }
Exemple #5
0
        public static MyPublishedFileVisibility ToService(
            this ERemoteStoragePublishedFileVisibility visibility)
        {
            switch (visibility)
            {
            case ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic:
                return(MyPublishedFileVisibility.Public);

            case ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityFriendsOnly:
                return(MyPublishedFileVisibility.FriendsOnly);

            case ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPrivate:
                return(MyPublishedFileVisibility.Private);

            default:
                return((MyPublishedFileVisibility)(int)visibility);
            }
        }
Exemple #6
0
        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";
        }
Exemple #7
0
        public HeathenWorkshopReadCommunityItem(SteamUGCDetails_t itemDetails)
        {
            SourceItemDetails = itemDetails;

            if (itemDetails.m_eFileType != EWorkshopFileType.k_EWorkshopFileTypeCommunity)
            {
                Debug.LogWarning("HeathenWorkshopReadItem is designed to display File Type = Community Item, this item is not a community item and may not load correctly.");
            }

            m_RemoteStorageDownloadUGCResult = CallResult <RemoteStorageDownloadUGCResult_t> .Create(HandleUGCDownload);

            TargetApp       = itemDetails.m_nConsumerAppID;
            FileId          = itemDetails.m_nPublishedFileId;
            Title           = itemDetails.m_rgchTitle;
            Description     = itemDetails.m_rgchDescription;
            Visibility      = itemDetails.m_eVisibility;
            Author          = new CSteamID(itemDetails.m_ulSteamIDOwner);
            CreatedOn       = SteamUtilities.ConvertUnixDate(itemDetails.m_rtimeCreated);
            LastUpdated     = SteamUtilities.ConvertUnixDate(itemDetails.m_rtimeUpdated);
            UpVotes         = itemDetails.m_unVotesUp;
            DownVotes       = itemDetails.m_unVotesDown;
            VoteScore       = itemDetails.m_flScore;
            IsBanned        = itemDetails.m_bBanned;
            IsTagsTruncated = itemDetails.m_bTagsTruncated;
            FileSize        = itemDetails.m_nFileSize;
            Visibility      = itemDetails.m_eVisibility;
            Tags.AddRange(itemDetails.m_rgchTags.Split(','));
            uint state = SteamUGC.GetItemState(FileId);

            StateFlags = (EItemState)state;

            IsSubscribed = SteamUtilities.WorkshopItemStateHasFlag(StateFlags, EItemState.k_EItemStateSubscribed);

            if (itemDetails.m_nPreviewFileSize > 0)
            {
                var previewCall = SteamRemoteStorage.UGCDownload(itemDetails.m_hPreviewFile, 1);
                m_RemoteStorageDownloadUGCResult.Set(previewCall, HandleUGCDownloadPreviewFile);
            }
            else
            {
                Debug.LogWarning("Item [" + Title + "] has no preview file!");
            }
        }
Exemple #8
0
    public SteamworksUGCItem(Mod _mod)
    {
        waiting_for_create = false;
        uploading          = false;
        visibility         = ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPrivate;
        mod         = _mod;
        name        = new char[1024];
        description = new char[1024]; description[0] = '\0';
        tags        = new char[512]; tags[0] = '\0';
        author      = new char[256]; author[0] = '\0';
        version     = new char[128]; version[0] = '\0';
        is_owner    = true;
        ignore      = false;
        prev_ignore = false;

        if (SteamManager.Initialized)
        {
            m_CreateItemResult = CallResult <CreateItemResult_t> .Create(OnCreateItemResult);

            m_SubmitItemUpdateResult = CallResult <SubmitItemUpdateResult_t> .Create(OnSubmitItemUpdateResult);
        }

        // Load metadata
        string metaPath = Path.GetDirectoryName(mod.path) + "/metadata.json";

        if (File.Exists(metaPath))
        {
            try {
                string   metaText = File.ReadAllText(metaPath);
                JSONNode jnRoot   = JSON.Parse(metaText);

                CopyChars(jnRoot["name"].Value, name);
                CopyChars(jnRoot["description"].Value, description);
                CopyChars(jnRoot["tags"].Value, tags);
                CopyChars(jnRoot["author"].Value, author);
                CopyChars(jnRoot["version"].Value, version);
                steamworks_id = new PublishedFileId_t((ulong)jnRoot["steamworks_id"].AsLong);
                ignore        = jnRoot["ignore"].AsBool;
            } catch (Exception e) {
                Debug.LogError("Error reading metadata for mod: " + e);
            }
        }
    }
 public static SteamAPICall_t PublishWorkshopFile(string pchFile, string pchPreviewFile, AppId_t nConsumerAppId, string pchTitle, string pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, IList<string> pTags, EWorkshopFileType eWorkshopFileType)
 {
     InteropHelp.TestIfAvailableClient();
     SteamAPICall_t result;
     using (InteropHelp.UTF8StringHandle uTF8StringHandle = new InteropHelp.UTF8StringHandle(pchFile))
     {
         using (InteropHelp.UTF8StringHandle uTF8StringHandle2 = new InteropHelp.UTF8StringHandle(pchPreviewFile))
         {
             using (InteropHelp.UTF8StringHandle uTF8StringHandle3 = new InteropHelp.UTF8StringHandle(pchTitle))
             {
                 using (InteropHelp.UTF8StringHandle uTF8StringHandle4 = new InteropHelp.UTF8StringHandle(pchDescription))
                 {
                     result = (SteamAPICall_t)NativeMethods.ISteamRemoteStorage_PublishWorkshopFile(uTF8StringHandle, uTF8StringHandle2, nConsumerAppId, uTF8StringHandle3, uTF8StringHandle4, eVisibility, new InteropHelp.SteamParamStringArray(pTags), eWorkshopFileType);
                 }
             }
         }
     }
     return result;
 }
 /// <summary>
 /// <para> change the visibility of an UGC item</para>
 /// </summary>
 public static bool SetItemVisibility(UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVisibility eVisibility)
 {
     InteropHelp.TestIfAvailableGameServer();
     return(NativeMethods.ISteamUGC_SetItemVisibility(CSteamGameServerAPIContext.GetSteamUGC(), handle, eVisibility));
 }
		public static SteamAPICall_t PublishVideo(EWorkshopVideoProvider eVideoProvider, string pchVideoAccount, string pchVideoIdentifier, string pchPreviewFile, AppId_t nConsumerAppId, string pchTitle, string pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, System.Collections.Generic.IList<string> pTags) {
			InteropHelp.TestIfAvailableClient();
			return (SteamAPICall_t)NativeMethods.ISteamRemoteStorage_PublishVideo(eVideoProvider, pchVideoAccount, pchVideoIdentifier, pchPreviewFile, nConsumerAppId, pchTitle, pchDescription, eVisibility, new InteropHelp.SteamParamStringArray(pTags));
		}
 public UInt64 PublishFile(string pchFile, string pchPreviewFile, UInt32 nConsumerAppId, string pchTitle, string pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, ref SteamParamStringArray_t pTags)
 {
     return(this.GetFunction <NativePublishFileSSUSSES>(this.Functions.PublishFile22)(this.ObjectAddress, pchFile, pchPreviewFile, nConsumerAppId, pchTitle, pchDescription, eVisibility, ref pTags));
 }
		public static extern bool ISteamGameServerUGC_SetItemVisibility(UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVisibility eVisibility);
		public static extern bool ISteamRemoteStorage_UpdatePublishedFileVisibility(PublishedFileUpdateHandle_t updateHandle, ERemoteStoragePublishedFileVisibility eVisibility);
 /// <summary>
 /// <para> change the visibility of an UGC item</para>
 /// </summary>
 public static bool SetItemVisibility(UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVisibility eVisibility)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamUGC_SetItemVisibility(handle, eVisibility));
 }
 public bool UpdatePublishedFileVisibility(UInt64 hUpdateRequest, ERemoteStoragePublishedFileVisibility eVisibility)
 {
     return(this.GetFunction <NativeUpdatePublishedFileVisibilityUE>(this.Functions.UpdatePublishedFileVisibility33)(this.ObjectAddress, hUpdateRequest, eVisibility));
 }
 public static bool UpdatePublishedFileVisibility(PublishedFileUpdateHandle_t updateHandle, ERemoteStoragePublishedFileVisibility eVisibility)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamRemoteStorage_UpdatePublishedFileVisibility(CSteamAPIContext.GetSteamRemoteStorage(), updateHandle, eVisibility));
 }
 // Token: 0x0600093F RID: 2367 RVA: 0x0000F9E0 File Offset: 0x0000DBE0
 public static SteamAPICall_t PublishVideo(EWorkshopVideoProvider eVideoProvider, string pchVideoAccount, string pchVideoIdentifier, string pchPreviewFile, AppId_t nConsumerAppId, string pchTitle, string pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, IList <string> pTags)
 {
     InteropHelp.TestIfAvailableClient();
     return((SteamAPICall_t)NativeMethods.ISteamRemoteStorage_PublishVideo(eVideoProvider, pchVideoAccount, pchVideoIdentifier, pchPreviewFile, nConsumerAppId, pchTitle, pchDescription, eVisibility, new InteropHelp.SteamParamStringArray(pTags)));
 }
 // Token: 0x0600092B RID: 2347 RVA: 0x00005F56 File Offset: 0x00004156
 public static SteamAPICall_t PublishWorkshopFile(string pchFile, string pchPreviewFile, AppId_t nConsumerAppId, string pchTitle, string pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, IList <string> pTags, EWorkshopFileType eWorkshopFileType)
 {
     InteropHelp.TestIfAvailableClient();
     return((SteamAPICall_t)NativeMethods.ISteamRemoteStorage_PublishWorkshopFile(pchFile, pchPreviewFile, nConsumerAppId, pchTitle, pchDescription, eVisibility, new InteropHelp.SteamParamStringArray(pTags), eWorkshopFileType));
 }
Exemple #20
0
 public static SteamAPICall_t PublishVideo(EWorkshopVideoProvider eVideoProvider, string pchVideoAccount, string pchVideoIdentifier, string pchPreviewFile, AppId_t nConsumerAppId, string pchTitle, string pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, System.Collections.Generic.IList <string> pTags)
 {
     return((SteamAPICall_t)0);
 }
Exemple #21
0
 public static bool UpdatePublishedFileVisibility(PublishedFileUpdateHandle_t updateHandle, ERemoteStoragePublishedFileVisibility eVisibility)
 {
     return(false);
 }
Exemple #22
0
 /// publishing UGC
 public static SteamAPICall_t PublishWorkshopFile(string pchFile, string pchPreviewFile, AppId_t nConsumerAppId, string pchTitle, string pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, System.Collections.Generic.IList <string> pTags, EWorkshopFileType eWorkshopFileType)
 {
     return((SteamAPICall_t)0);
 }
Exemple #23
0
 public UInt64 PublishVideo(string cszFileName, string cszPreviewFileName, UInt32 nConsumerAppId, string cszTitle, string cszDescription, ERemoteStoragePublishedFileVisibility eVisibility, ref SteamParamStringArray_t pTags)
 {
     return(this.GetFunction <NativePublishVideoSSUSSES>(this.Functions.PublishVideo43)(this.ObjectAddress, cszFileName, cszPreviewFileName, nConsumerAppId, cszTitle, cszDescription, eVisibility, ref pTags));
 }
    /// <summary>
    /// Registers a file's info. (Must send file next with sendFileOrUpdate). This is also used when updating files.
    /// </summary>
    /// <param name="pubId">Obtained from CreateWorkshopItem</param>
    /// <param name="title">Limit the title length to 128 ASCII characters</param>
    /// <param name="description">Limit the description length to 8000 ASCII characters</param>
    /// <param name="visability">Valid visibility (ERemoteStoragePublishedFileVisibility) values include:        k_ERemoteStoragePublishedFileVisibilityPublic = 0        k_ERemoteStoragePublishedFileVisibilityFriendsOnly = 1        k_ERemoteStoragePublishedFileVisibilityPrivate = 2</param>
    /// <param name="tags">Utilizes a SteamParamStringArray_t which contains a pointer to an array of char * strings and a count of the number of strings in the array. </param>
    /// <param name="contentFolder">pszContentFolder is the absolute path to a local folder containing one or more files that represents the workshop item. For efficient upload and download, files should not be merged or compressed into single files (e.g. zip files). </param>
    /// <param name="imagePreviewFile">pszPreviewFile is the absolute path to a local preview image file for the workshop item. It must be under 1MB in size. The format should be one that both the web and the application (if necessary) can render. Suggested formats include JPG, PNG or GIF. </param>
    /// <returns></returns>
    public UGCUpdateHandle_t registerFileInfoOrUpdate(PublishedFileId_t pubId, string title, string description, ERemoteStoragePublishedFileVisibility visability, IList <string> tags, string contentFolder, string imagePreviewFile)
    {
        bool success = true;
        //2. An item update begins with a call to:
        UGCUpdateHandle_t handle;

        handle = SteamUGC.StartItemUpdate(SteamUtils.GetAppID(), pubId);

        //3. Using the UGCUpdateHandle_t that is returned from StartItemUpdate, calls can be made to update the Title, Description, Visibility, Tags, Item Content and Item Preview Image through the various SetItem methods.
        success = SteamUGC.SetItemTitle(handle, title);
        Console.Write("Title: " + success);

        success = SteamUGC.SetItemDescription(handle, description);
        Console.Write(" -- Description: " + success);

        success = SteamUGC.SetItemVisibility(handle, visability);
        Console.Write(" -- Visability: " + success);

        success = SteamUGC.SetItemTags(handle, tags);
        Console.Write(" -- Tags: " + success);

        //TODO: We need to fix these paths>>>>>>>
        success = SteamUGC.SetItemContent(handle, contentFolder);
        Console.Write(" -- Content: " + success);

        success = SteamUGC.SetItemPreview(handle, imagePreviewFile);
        Console.WriteLine(" -- Preview: " + success);

        Console.WriteLine("registerFileInfo (UGCUpdateHandle_t): " + handle);

        m_UGCUpdateHandle = handle;

        return(handle);
    }
 public UInt64 PublishVideo(EWorkshopVideoProvider eVideoProvider, string cszVideoAccountName, string cszVideoIdentifier, string cszFileName, UInt32 nConsumerAppId, string cszTitle, string cszDescription, ERemoteStoragePublishedFileVisibility eVisibility, ref SteamParamStringArray_t pTags)
 {
     return(this.GetFunction <NativePublishVideoESSSUSSES>(this.Functions.PublishVideo47)(this.ObjectAddress, eVideoProvider, cszVideoAccountName, cszVideoIdentifier, cszFileName, nConsumerAppId, cszTitle, cszDescription, eVisibility, ref pTags));
 }
Exemple #26
0
        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 static extern ulong ISteamRemoteStorage_PublishWorkshopFile(InteropHelp.UTF8StringHandle pchFile, InteropHelp.UTF8StringHandle pchPreviewFile, AppId_t nConsumerAppId, InteropHelp.UTF8StringHandle pchTitle, InteropHelp.UTF8StringHandle pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, IntPtr pTags, EWorkshopFileType eWorkshopFileType);
Exemple #28
0
 public UInt64 PublishFile(UInt32 nAppId, ERemoteStorageFileRoot eRemoteStorageFileRoot, string cszFileName, string cszPreviewFileName, UInt32 nConsumerAppId, string cszTitle, string cszDescription, ERemoteStoragePublishedFileVisibility eVisibility, ref SteamParamStringArray_t pTags, EWorkshopFileType eType)
 {
     return(this.GetFunction <NativePublishFileUESSUSSESE>(this.Functions.PublishFile28)(this.ObjectAddress, nAppId, eRemoteStorageFileRoot, cszFileName, cszPreviewFileName, nConsumerAppId, cszTitle, cszDescription, eVisibility, ref pTags, eType));
 }
		public static extern ulong ISteamRemoteStorage_PublishVideo(EWorkshopVideoProvider eVideoProvider, InteropHelp.UTF8StringHandle pchVideoAccount, InteropHelp.UTF8StringHandle pchVideoIdentifier, InteropHelp.UTF8StringHandle pchPreviewFile, AppId_t nConsumerAppId, InteropHelp.UTF8StringHandle pchTitle, InteropHelp.UTF8StringHandle pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, IntPtr pTags);
Exemple #30
0
 public UInt64 PublishVideoFromURL(UInt32 nAppId, ERemoteStorageFileRoot eRemoteStorageFileRoot, string cszVideoURL, string cszFileName, UInt32 nConsumerAppId, string cszTitle, string cszDescription, ERemoteStoragePublishedFileVisibility eVisibility, ref SteamParamStringArray_t pTags)
 {
     return(this.GetFunction <NativePublishVideoFromURLUESSUSSES>(this.Functions.PublishVideoFromURL30)(this.ObjectAddress, nAppId, eRemoteStorageFileRoot, cszVideoURL, cszFileName, nConsumerAppId, cszTitle, cszDescription, eVisibility, ref pTags));
 }
Exemple #31
0
        static void Main(string[] args)
        {
            foreach (var arg in args)
            {
                Console.WriteLine(arg);
            }
            var configPath = args[0];
            var file       = File.ReadAllText(configPath);
            var package    = JsonConvert.DeserializeObject <Package>(file);

            m_itemCreated = CallResult <CreateItemResult_t> .Create(OnItemCreated);

            var appID = "798840";

            var AppId_t = new AppId_t(uint.Parse(appID));

            var isInit = SteamAPI.Init();

            if (package.publishFileID == 0)
            {
                SteamAPICall_t call = SteamUGC.CreateItem(new AppId_t(uint.Parse(appID)), EWorkshopFileType.k_EWorkshopFileTypeCommunity);
                m_itemCreated.Set(call);
            }
            else
            {
                publishID = package.publishFileID;
            }
            while (publishID == 0)
            {
                SteamAPI.RunCallbacks();
                Thread.Sleep(1000);
            }


            Thread.Sleep(1000);

            if (package.publishFileID == 0)
            {
                package.publishFileID = publishID;
                File.WriteAllText(configPath, JsonConvert.SerializeObject(package));
                Console.WriteLine(string.Format("Rewrite package ID with {0}", publishID));
            }
            var publishFileID_t = new PublishedFileId_t(publishID);

            ugcUpdateHandle = SteamUGC.StartItemUpdate(AppId_t, publishFileID_t);

            SteamUGC.SetItemTitle(ugcUpdateHandle, package.title);
            SteamUGC.SetItemDescription(ugcUpdateHandle, package.description);
            SteamUGC.SetItemVisibility(ugcUpdateHandle, fileVisibility);
            SteamUGC.SetItemTags(ugcUpdateHandle, new string[] { package.tags });
            SteamUGC.SetItemPreview(ugcUpdateHandle, Directory.GetCurrentDirectory() + "/" + package.previewUrl);
            SteamUGC.SetItemContent(ugcUpdateHandle, Directory.GetCurrentDirectory() + "/" + package.contentUrl);
            Console.WriteLine(string.Format("{0} {1} {2}", package.title, package.description, package.tags));

            SteamAPICall_t t = SteamUGC.SubmitItemUpdate(ugcUpdateHandle, "Update file from game tool");

            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);

                ProgressPrint(string.Format("status:{0} bytesDone:{1} bytesTotal:{2}", status, bytesDone, bytesTotal));
            }
            Console.Clear();

            Console.WriteLine("Everything is ready !Check it on your workshop.");

            Console.WriteLine("Be sure to set the item public so that the community can download it!");

            Console.WriteLine("Press any key to quit");

            if (fileVisibility == ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPrivate)
            {
                Console.WriteLine("Press anykey(exclude escape) to set your content's visibility to public instantly");
                var key = Console.ReadKey();

                if (key.Key != ConsoleKey.Escape)
                {
                    fileVisibility = ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic;
                    Console.Clear();
                    Console.WriteLine("Preparing the content for sharing!");
                    Main(args);
                }
            }
            else
            {
                return;
            }

            Console.ReadKey();

            SteamAPI.Shutdown();
        }
Exemple #32
0
 /// <summary>
 /// <para> publishing UGC</para>
 /// </summary>
 public static SteamAPICall_t PublishWorkshopFile(string pchFile, string pchPreviewFile, AppId_t nConsumerAppId, string pchTitle, string pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, System.Collections.Generic.IList <string> pTags, EWorkshopFileType eWorkshopFileType)
 {
     InteropHelp.TestIfAvailableClient();
     using (var pchFile2 = new InteropHelp.UTF8StringHandle(pchFile))
         using (var pchPreviewFile2 = new InteropHelp.UTF8StringHandle(pchPreviewFile))
             using (var pchTitle2 = new InteropHelp.UTF8StringHandle(pchTitle))
                 using (var pchDescription2 = new InteropHelp.UTF8StringHandle(pchDescription)) {
                     return((SteamAPICall_t)NativeMethods.ISteamRemoteStorage_PublishWorkshopFile(pchFile2, pchPreviewFile2, nConsumerAppId, pchTitle2, pchDescription2, eVisibility, new InteropHelp.SteamParamStringArray(pTags), eWorkshopFileType));
                 }
 }
			// publishing UGC
		public static SteamAPICall_t PublishWorkshopFile(string pchFile, string pchPreviewFile, AppId_t nConsumerAppId, string pchTitle, string pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, System.Collections.Generic.IList<string> pTags, EWorkshopFileType eWorkshopFileType) {
			InteropHelp.TestIfAvailableClient();
			return (SteamAPICall_t)NativeMethods.ISteamRemoteStorage_PublishWorkshopFile(pchFile, pchPreviewFile, nConsumerAppId, pchTitle, pchDescription, eVisibility, new InteropHelp.SteamParamStringArray(pTags), eWorkshopFileType);
		}
Exemple #34
0
 /// change the visibility of an UGC item
 public static bool SetItemVisibility(UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVisibility eVisibility)
 {
     return(false);
 }
		/// <summary>
		/// <para> change the visibility of an UGC item</para>
		/// </summary>
		public static bool SetItemVisibility(UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVisibility eVisibility) {
			InteropHelp.TestIfAvailableGameServer();
			return NativeMethods.ISteamGameServerUGC_SetItemVisibility(handle, eVisibility);
		}
 public bool SetItemVisibility(UInt64 arg0, ERemoteStoragePublishedFileVisibility arg1)
 {
     return(this.GetFunction <NativeSetItemVisibilityUE>(this.Functions.SetItemVisibility22)(this.ObjectAddress, arg0, arg1));
 }
 public static SteamAPICall_t PublishVideo(EWorkshopVideoProvider eVideoProvider, string pchVideoAccount, string pchVideoIdentifier, string pchPreviewFile, AppId_t nConsumerAppId, string pchTitle, string pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, IList<string> pTags)
 {
     InteropHelp.TestIfAvailableClient();
     SteamAPICall_t result;
     using (InteropHelp.UTF8StringHandle uTF8StringHandle = new InteropHelp.UTF8StringHandle(pchVideoAccount))
     {
         using (InteropHelp.UTF8StringHandle uTF8StringHandle2 = new InteropHelp.UTF8StringHandle(pchVideoIdentifier))
         {
             using (InteropHelp.UTF8StringHandle uTF8StringHandle3 = new InteropHelp.UTF8StringHandle(pchPreviewFile))
             {
                 using (InteropHelp.UTF8StringHandle uTF8StringHandle4 = new InteropHelp.UTF8StringHandle(pchTitle))
                 {
                     using (InteropHelp.UTF8StringHandle uTF8StringHandle5 = new InteropHelp.UTF8StringHandle(pchDescription))
                     {
                         result = (SteamAPICall_t)NativeMethods.ISteamRemoteStorage_PublishVideo(eVideoProvider, uTF8StringHandle, uTF8StringHandle2, uTF8StringHandle3, nConsumerAppId, uTF8StringHandle4, uTF8StringHandle5, eVisibility, new InteropHelp.SteamParamStringArray(pTags));
                     }
                 }
             }
         }
     }
     return result;
 }
        public static SteamAPICall_t PublishWorkshopFile(string pchFile, string pchPreviewFile, AppId_t nConsumerAppId, string pchTitle, string pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, IList <string> pTags, EWorkshopFileType eWorkshopFileType)
        {
            InteropHelp.TestIfAvailableClient();
            SteamAPICall_t result;

            using (InteropHelp.UTF8StringHandle utf8StringHandle = new InteropHelp.UTF8StringHandle(pchFile))
            {
                using (InteropHelp.UTF8StringHandle utf8StringHandle2 = new InteropHelp.UTF8StringHandle(pchPreviewFile))
                {
                    using (InteropHelp.UTF8StringHandle utf8StringHandle3 = new InteropHelp.UTF8StringHandle(pchTitle))
                    {
                        using (InteropHelp.UTF8StringHandle utf8StringHandle4 = new InteropHelp.UTF8StringHandle(pchDescription))
                        {
                            result = (SteamAPICall_t)NativeMethods.ISteamRemoteStorage_PublishWorkshopFile(utf8StringHandle, utf8StringHandle2, nConsumerAppId, utf8StringHandle3, utf8StringHandle4, eVisibility, new InteropHelp.SteamParamStringArray(pTags), eWorkshopFileType);
                        }
                    }
                }
            }
            return(result);
        }
 public static bool UpdatePublishedFileVisibility(PublishedFileUpdateHandle_t updateHandle, ERemoteStoragePublishedFileVisibility eVisibility)
 {
     InteropHelp.TestIfAvailableClient();
     return NativeMethods.ISteamRemoteStorage_UpdatePublishedFileVisibility(updateHandle, eVisibility);
 }
        public static SteamAPICall_t PublishVideo(EWorkshopVideoProvider eVideoProvider, string pchVideoAccount, string pchVideoIdentifier, string pchPreviewFile, AppId_t nConsumerAppId, string pchTitle, string pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, IList <string> pTags)
        {
            InteropHelp.TestIfAvailableClient();
            SteamAPICall_t result;

            using (InteropHelp.UTF8StringHandle utf8StringHandle = new InteropHelp.UTF8StringHandle(pchVideoAccount))
            {
                using (InteropHelp.UTF8StringHandle utf8StringHandle2 = new InteropHelp.UTF8StringHandle(pchVideoIdentifier))
                {
                    using (InteropHelp.UTF8StringHandle utf8StringHandle3 = new InteropHelp.UTF8StringHandle(pchPreviewFile))
                    {
                        using (InteropHelp.UTF8StringHandle utf8StringHandle4 = new InteropHelp.UTF8StringHandle(pchTitle))
                        {
                            using (InteropHelp.UTF8StringHandle utf8StringHandle5 = new InteropHelp.UTF8StringHandle(pchDescription))
                            {
                                result = (SteamAPICall_t)NativeMethods.ISteamRemoteStorage_PublishVideo(eVideoProvider, utf8StringHandle, utf8StringHandle2, utf8StringHandle3, nConsumerAppId, utf8StringHandle4, utf8StringHandle5, eVisibility, new InteropHelp.SteamParamStringArray(pTags));
                            }
                        }
                    }
                }
            }
            return(result);
        }
 public static SteamAPICall_t PublishVideo(EWorkshopVideoProvider eVideoProvider, string pchVideoAccount, string pchVideoIdentifier, string pchPreviewFile, AppId_t nConsumerAppId, string pchTitle, string pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, System.Collections.Generic.IList <string> pTags)
 {
     InteropHelp.TestIfAvailableClient();
     using (var pchVideoAccount2 = new InteropHelp.UTF8StringHandle(pchVideoAccount))
         using (var pchVideoIdentifier2 = new InteropHelp.UTF8StringHandle(pchVideoIdentifier))
             using (var pchPreviewFile2 = new InteropHelp.UTF8StringHandle(pchPreviewFile))
                 using (var pchTitle2 = new InteropHelp.UTF8StringHandle(pchTitle))
                     using (var pchDescription2 = new InteropHelp.UTF8StringHandle(pchDescription)) {
                         return((SteamAPICall_t)NativeMethods.ISteamRemoteStorage_PublishVideo(CSteamAPIContext.GetSteamRemoteStorage(), eVideoProvider, pchVideoAccount2, pchVideoIdentifier2, pchPreviewFile2, nConsumerAppId, pchTitle2, pchDescription2, eVisibility, new InteropHelp.SteamParamStringArray(pTags)));
                     }
 }
 public bool SetItemVisibility(UInt64 handle, ERemoteStoragePublishedFileVisibility eVisibility)
 {
     return(this.GetFunction <NativeSetItemVisibilityUE>(this.Functions.SetItemVisibility19)(this.ObjectAddress, handle, eVisibility));
 }