示例#1
0
        // bool
        // using: Detect_StringArray
        public bool UpdatePublishedFileTags(PublishedFileUpdateHandle_t updateHandle /*PublishedFileUpdateHandle_t*/, string[] pTags /*struct SteamParamStringArray_t **/)
        {
            // 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;
                return(platform.ISteamRemoteStorage_UpdatePublishedFileTags(updateHandle.Value, ref tags));
            }
            finally
            {
                foreach (var x in nativeStrings)
                {
                    Marshal.FreeHGlobal(x);
                }
            }
        }
        // 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);
            }
            if (callback == 0)
            {
                return(null);
            }

            return(RemoteStoragePublishFileProgress_t.CallResult(steamworks, callback, CallbackFunction));
        }
        // SteamAPICall_t
        // using: Detect_StringArray
        public CallbackHandle EnumerateUserSharedWorkshopFiles(CSteamID steamId /*class CSteamID*/, uint unStartIndex /*uint32*/, string[] pRequiredTags /*struct SteamParamStringArray_t **/, ref SteamParamStringArray_t pExcludedTags /*struct SteamParamStringArray_t **/, Action <RemoteStorageEnumerateUserPublishedFilesResult_t, bool> CallbackFunction = null /*Action<RemoteStorageEnumerateUserPublishedFilesResult_t, bool>*/)
        {
            SteamAPICall_t callback = 0;
            // Create strings
            var nativeStrings = new IntPtr[pRequiredTags.Length];

            for (int i = 0; i < pRequiredTags.Length; i++)
            {
                nativeStrings[i] = Marshal.StringToHGlobalAnsi(pRequiredTags[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 = pRequiredTags.Length;
                callback        = platform.ISteamRemoteStorage_EnumerateUserSharedWorkshopFiles(steamId.Value, unStartIndex, ref tags, ref pExcludedTags);
            }
            finally
            {
                foreach (var x in nativeStrings)
                {
                    Marshal.FreeHGlobal(x);
                }
            }

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

            return(RemoteStorageEnumerateUserPublishedFilesResult_t.CallResult(steamworks, callback, CallbackFunction));
        }
        public static SteamParamStringArray From(string[] array)
        {
            SteamParamStringArray hGlobalAnsi = new SteamParamStringArray()
            {
                NativeStrings = new IntPtr[(int)array.Length]
            };

            for (int i = 0; i < (int)hGlobalAnsi.NativeStrings.Length; i++)
            {
                hGlobalAnsi.NativeStrings[i] = Marshal.StringToHGlobalAnsi(array[i]);
            }
            int num = Marshal.SizeOf(typeof(IntPtr)) * (int)hGlobalAnsi.NativeStrings.Length;

            hGlobalAnsi.NativeArray = Marshal.AllocHGlobal(num);
            Marshal.Copy(hGlobalAnsi.NativeStrings, 0, hGlobalAnsi.NativeArray, (int)hGlobalAnsi.NativeStrings.Length);
            SteamParamStringArray_t steamParamStringArrayT = new SteamParamStringArray_t()
            {
                Strings    = hGlobalAnsi.NativeArray,
                NumStrings = (int)array.Length
            };

            hGlobalAnsi.Value = steamParamStringArrayT;
            return(hGlobalAnsi);
        }
示例#5
0
 public override bool SetItemTags(ulong updateHandle,ref SteamParamStringArray_t pTags)
 {
     CheckIfUsable();
     bool result = NativeEntrypoints.SteamAPI_ISteamUGC_SetItemTags(m_pSteamUGC,updateHandle,ref pTags);
     return result;
 }
示例#6
0
 public abstract bool UpdatePublishedFileTags(ulong updateHandle,ref SteamParamStringArray_t pTags);
示例#7
0
 public override ulong PublishWorkshopFile(string pchFile,string pchPreviewFile,uint nConsumerAppId,string pchTitle,string pchDescription,uint eVisibility,ref SteamParamStringArray_t pTags,uint eWorkshopFileType)
 {
     CheckIfUsable();
     ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_PublishWorkshopFile(m_pSteamRemoteStorage,pchFile,pchPreviewFile,nConsumerAppId,pchTitle,pchDescription,eVisibility,ref pTags,eWorkshopFileType);
     return result;
 }
示例#8
0
 public override bool UpdatePublishedFileTags(ulong updateHandle,ref SteamParamStringArray_t pTags)
 {
     CheckIfUsable();
     bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTags(m_pSteamRemoteStorage,updateHandle,ref pTags);
     return result;
 }
示例#9
0
 public override ulong EnumerateUserSharedWorkshopFiles(ulong steamId,uint unStartIndex,ref SteamParamStringArray_t pRequiredTags,ref SteamParamStringArray_t pExcludedTags)
 {
     CheckIfUsable();
     ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_EnumerateUserSharedWorkshopFiles(m_pSteamRemoteStorage,steamId,unStartIndex,ref pRequiredTags,ref pExcludedTags);
     return result;
 }
示例#10
0
 public override ulong PublishVideo(uint eVideoProvider,string pchVideoAccount,string pchVideoIdentifier,string pchPreviewFile,uint nConsumerAppId,string pchTitle,string pchDescription,uint eVisibility,ref SteamParamStringArray_t pTags)
 {
     CheckIfUsable();
     ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_PublishVideo(m_pSteamRemoteStorage,eVideoProvider,pchVideoAccount,pchVideoIdentifier,pchPreviewFile,nConsumerAppId,pchTitle,pchDescription,eVisibility,ref pTags);
     return result;
 }
示例#11
0
 public abstract bool SetItemTags(ulong updateHandle,ref SteamParamStringArray_t pTags);
示例#12
0
 public override ulong EnumeratePublishedWorkshopFiles(uint eEnumerationType,uint unStartIndex,uint unCount,uint unDays,ref SteamParamStringArray_t pTags,ref SteamParamStringArray_t pUserTags)
 {
     CheckIfUsable();
     ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_EnumeratePublishedWorkshopFiles(m_pSteamRemoteStorage,eEnumerationType,unStartIndex,unCount,unDays,ref pTags,ref pUserTags);
     return result;
 }
示例#13
0
        public async Task <PublishResult> SubmitAsync(IProgress <float> progress = null)
        {
            PublishResult     publishResult;
            bool              flag;
            float             single;
            PublishResult     result    = new PublishResult();
            IProgress <float> progress1 = progress;

            if (progress1 != null)
            {
                progress1.Report(0f);
            }
            else
            {
            }
            if (this.consumerAppId == 0)
            {
                this.consumerAppId = SteamClient.AppId;
            }
            if (this.creatingNew)
            {
                result.Result = Result.Fail;
                CreateItemResult_t?nullable = await SteamUGC.Internal.CreateItem(this.consumerAppId, this.creatingType);

                CreateItemResult_t?nullable1 = nullable;
                nullable = null;
                if (nullable1.HasValue)
                {
                    result.Result = nullable1.Value.Result;
                    if (result.Result == Result.OK)
                    {
                        this.fileId = nullable1.Value.PublishedFileId;
                        result.NeedsWorkshopAgreement = nullable1.Value.UserNeedsToAcceptWorkshopLegalAgreement;
                        result.FileId = this.fileId;
                        nullable1     = null;
                    }
                    else
                    {
                        publishResult = result;
                        return(publishResult);
                    }
                }
                else
                {
                    publishResult = result;
                    return(publishResult);
                }
            }
            result.FileId = this.fileId;
            UGCUpdateHandle_t uGCUpdateHandleT = SteamUGC.Internal.StartItemUpdate(this.consumerAppId, this.fileId);

            if (uGCUpdateHandleT != (long)-1)
            {
                if ((object)this.Title != (object)null)
                {
                    SteamUGC.Internal.SetItemTitle(uGCUpdateHandleT, this.Title);
                }
                if ((object)this.Description != (object)null)
                {
                    SteamUGC.Internal.SetItemDescription(uGCUpdateHandleT, this.Description);
                }
                if ((object)this.MetaData != (object)null)
                {
                    SteamUGC.Internal.SetItemMetadata(uGCUpdateHandleT, this.MetaData);
                }
                if ((object)this.Language != (object)null)
                {
                    SteamUGC.Internal.SetItemUpdateLanguage(uGCUpdateHandleT, this.Language);
                }
                if (this.ContentFolder != null)
                {
                    SteamUGC.Internal.SetItemContent(uGCUpdateHandleT, this.ContentFolder.FullName);
                }
                if ((object)this.PreviewFile != (object)null)
                {
                    SteamUGC.Internal.SetItemPreview(uGCUpdateHandleT, this.PreviewFile);
                }
                if (this.Visibility.HasValue)
                {
                    SteamUGC.Internal.SetItemVisibility(uGCUpdateHandleT, this.Visibility.Value);
                }
                flag = (this.Tags == null ? false : this.Tags.Count > 0);
                if (flag)
                {
                    SteamParamStringArray steamParamStringArray = SteamParamStringArray.From(this.Tags.ToArray());
                    try
                    {
                        SteamParamStringArray_t value = steamParamStringArray.Value;
                        SteamUGC.Internal.SetItemTags(uGCUpdateHandleT, ref value);
                    }
                    finally
                    {
                        ((IDisposable)steamParamStringArray).Dispose();
                    }
                    steamParamStringArray = new SteamParamStringArray();
                }
                result.Result = Result.Fail;
                if (this.ChangeLog == null)
                {
                    this.ChangeLog = "";
                }
                Task <SubmitItemUpdateResult_t?> task = SteamUGC.Internal.SubmitItemUpdate(uGCUpdateHandleT, this.ChangeLog);
                while (!task.IsCompleted)
                {
                    if (progress != null)
                    {
                        ulong num  = (ulong)0;
                        ulong num1 = (ulong)0;
                        switch (SteamUGC.Internal.GetItemUpdateProgress(uGCUpdateHandleT, ref num1, ref num))
                        {
                        case ItemUpdateStatus.PreparingConfig:
                        {
                            IProgress <float> progress2 = progress;
                            if (progress2 != null)
                            {
                                progress2.Report(0.1f);
                            }
                            else
                            {
                            }
                            break;
                        }

                        case ItemUpdateStatus.PreparingContent:
                        {
                            IProgress <float> progress3 = progress;
                            if (progress3 != null)
                            {
                                progress3.Report(0.2f);
                            }
                            else
                            {
                            }
                            break;
                        }

                        case ItemUpdateStatus.UploadingContent:
                        {
                            single = (num > (long)0 ? (float)((float)num1) / (float)((float)num) : 0f);
                            float             single1   = single;
                            IProgress <float> progress4 = progress;
                            if (progress4 != null)
                            {
                                progress4.Report(0.2f + single1 * 0.7f);
                            }
                            else
                            {
                            }
                            break;
                        }

                        case ItemUpdateStatus.UploadingPreviewFile:
                        {
                            IProgress <float> progress5 = progress;
                            if (progress5 != null)
                            {
                                progress5.Report(8f);
                            }
                            else
                            {
                            }
                            break;
                        }

                        case ItemUpdateStatus.CommittingChanges:
                        {
                            IProgress <float> progress6 = progress;
                            if (progress6 != null)
                            {
                                progress6.Report(1f);
                            }
                            else
                            {
                            }
                            break;
                        }
                        }
                    }
                    await Task.Delay(16);
                }
                IProgress <float> progress7 = progress;
                if (progress7 != null)
                {
                    progress7.Report(1f);
                }
                else
                {
                }
                SubmitItemUpdateResult_t?result1 = task.Result;
                if (result1.HasValue)
                {
                    result.Result = result1.Value.Result;
                    if (result.Result == Result.OK)
                    {
                        result.NeedsWorkshopAgreement = result1.Value.UserNeedsToAcceptWorkshopLegalAgreement;
                        result.FileId = this.fileId;
                        task          = null;
                        result1       = null;
                        publishResult = result;
                    }
                    else
                    {
                        publishResult = result;
                    }
                }
                else
                {
                    publishResult = result;
                }
            }
            else
            {
                publishResult = result;
            }
            return(publishResult);
        }
示例#14
0
 public abstract ulong PublishWorkshopFile(string pchFile,string pchPreviewFile,uint nConsumerAppId,string pchTitle,string pchDescription,uint eVisibility,ref SteamParamStringArray_t pTags,uint eWorkshopFileType);
示例#15
0
 public abstract ulong PublishVideo(uint eVideoProvider,string pchVideoAccount,string pchVideoIdentifier,string pchPreviewFile,uint nConsumerAppId,string pchTitle,string pchDescription,uint eVisibility,ref SteamParamStringArray_t pTags);
示例#16
0
 public abstract ulong EnumerateUserSharedWorkshopFiles(ulong steamId,uint unStartIndex,ref SteamParamStringArray_t pRequiredTags,ref SteamParamStringArray_t pExcludedTags);
示例#17
0
 public abstract ulong EnumeratePublishedWorkshopFiles(uint eEnumerationType,uint unStartIndex,uint unCount,uint unDays,ref SteamParamStringArray_t pTags,ref SteamParamStringArray_t pUserTags);