Example #1
0
        // SteamAPICall_t
        // using: Detect_StringArray
        public CallbackHandle PublishWorkshopFile(string pchFile /*const char **/, string pchPreviewFile /*const char **/, AppId_t nConsumerAppId /*AppId_t*/, string pchTitle /*const char **/, string pchDescription /*const char **/, RemoteStoragePublishedFileVisibility eVisibility /*ERemoteStoragePublishedFileVisibility*/, string[] pTags /*struct SteamParamStringArray_t **/, WorkshopFileType eWorkshopFileType /*EWorkshopFileType*/, Action <RemoteStoragePublishFileProgress_t, bool> CallbackFunction = null /*Action<RemoteStoragePublishFileProgress_t, bool>*/)
        {
            SteamAPICall_t callback = 0;
            // Create strings
            var nativeStrings = new IntPtr[pTags.Length];

            for (int i = 0; i < pTags.Length; i++)
            {
                nativeStrings[i] = Marshal.StringToHGlobalAnsi(pTags[i]);
            }
            try
            {
                // Create string array
                var size        = Marshal.SizeOf(typeof(IntPtr)) * nativeStrings.Length;
                var nativeArray = Marshal.AllocHGlobal(size);
                Marshal.Copy(nativeStrings, 0, nativeArray, nativeStrings.Length);

                // Create SteamParamStringArray_t
                var tags = new SteamParamStringArray_t();
                tags.Strings    = nativeArray;
                tags.NumStrings = pTags.Length;
                callback        = platform.ISteamRemoteStorage_PublishWorkshopFile(pchFile, pchPreviewFile, nConsumerAppId.Value, pchTitle, pchDescription, eVisibility, ref tags, eWorkshopFileType);
            }
            finally
            {
                foreach (var x in nativeStrings)
                {
                    Marshal.FreeHGlobal(x);
                }
            }

            if (CallbackFunction == null)
            {
                return(null);
            }

            return(RemoteStoragePublishFileProgress_t.CallResult(steamworks, callback, CallbackFunction));
        }
Example #2
0
 void OnRemoteStoragePublishFileProgress(RemoteStoragePublishFileProgress_t pCallback)
 {
     Debug.Log("[" + RemoteStoragePublishFileProgress_t.k_iCallback + " - RemoteStoragePublishFileProgress] - " + pCallback.m_dPercentFile + " -- " + pCallback.m_bPreview);
 }
 void OnRemoteStoragePublishFileProgress(RemoteStoragePublishFileProgress_t pCallback)
 {
     Console.WriteLine("[" + RemoteStoragePublishFileProgress_t.k_iCallback + " - RemoteStoragePublishFileProgress] - " + pCallback.m_dPercentFile + " -- " + pCallback.m_bPreview);
 }