public PublishUGCResult(string localFolder, ulong? publishedFileId, PublishedFileVisibility visibility, string[] tags, Action<bool, ulong?> callbackOnFinished) { CallbackOnFinished = callbackOnFinished; Task = Parallel.Start(() => { PublishedFileId = PublishUGCBlocking(localFolder, publishedFileId, visibility, tags); }); }
public PublishUGCResult(string localFolder, ulong?publishedFileId, PublishedFileVisibility visibility, string[] tags, Action <bool, ulong?> callbackOnFinished) { CallbackOnFinished = callbackOnFinished; Task = Parallel.Start(() => { PublishedFileId = PublishUGCBlocking(localFolder, publishedFileId, visibility, tags); }); }
public static void PublishUGCAsync(string localModFolder, ulong? publishedFileId = null, PublishedFileVisibility visibility = PublishedFileVisibility.Private, Action<bool, ulong?> callbackOnFinished = null) { string[] tags = { WORKSHOP_MOD_TAG }; MyGuiSandbox.AddScreen(new MyGuiScreenProgressAsync(MyCommonTexts.ProgressTextUploadingWorld, null, () => new PublishUGCResult(localModFolder, publishedFileId, visibility, tags, callbackOnFinished), endActionPublishUGC)); }
public static void PublishUGCAsync(string localModFolder, ulong?publishedFileId = null, PublishedFileVisibility visibility = PublishedFileVisibility.Private, Action <bool, ulong?> callbackOnFinished = null) { string[] tags = { WORKSHOP_MOD_TAG }; MyGuiSandbox.AddScreen(new MyGuiScreenProgressAsync(MyCommonTexts.ProgressTextUploadingWorld, null, () => new PublishUGCResult(localModFolder, publishedFileId, visibility, tags, callbackOnFinished), endActionPublishUGC)); }
public static void PublishIngameScriptAsync(string localWorldFolder, string publishedTitle, string publishedDescription, ulong? publishedFileId, PublishedFileVisibility visibility, Action<bool, Result, ulong> callbackOnFinished = null) { m_onPublishingFinished = callbackOnFinished; m_publishSuccess = false; m_publishedFileId = 0; m_publishResult = Result.Fail; string[] tags = { WORKSHOP_INGAMESCRIPT_TAG }; string[] ignoredExtensions = { ".sbmi",".png",".jpg"}; MyGuiSandbox.AddScreen(m_asyncPublishScreen = new MyGuiScreenProgressAsync(MyCommonTexts.ProgressTextUploadingWorld, null, () => new PublishItemResult(localWorldFolder, publishedTitle, publishedDescription, publishedFileId, visibility, tags, ignoredExtensions), endActionPublish)); }
public PublishItemResult(string localFolder, string publishedTitle, string publishedDescription, ulong? publishedFileId, PublishedFileVisibility visibility, string[] tags, string[] ignoredExtensions) { if (MyFinalBuildConstants.IS_STABLE == false && tags.Contains(WORKSHOP_DEVELOPMENT_TAG) == false) { Array.Resize(ref tags, tags.Length + 1); tags[tags.Length - 1] = WORKSHOP_DEVELOPMENT_TAG; } Task = Parallel.Start(() => { m_publishedFileId = PublishItemBlocking(localFolder, publishedTitle, publishedDescription, publishedFileId, visibility, tags, ignoredExtensions); }); }
public static void PublishScenarioAsync(string localWorldFolder, string publishedTitle, string publishedDescription, ulong? publishedFileId, //string[] tags, PublishedFileVisibility visibility, Action<bool, Result, ulong> callbackOnFinished = null) { m_onPublishingFinished = callbackOnFinished; m_publishSuccess = false; m_publishedFileId = 0; m_publishResult = Result.Fail; string[] ignoredExtensions = { }; string[] tags = { WORKSHOP_SCENARIO_TAG }; MyGuiSandbox.AddScreen(m_asyncPublishScreen = new MyGuiScreenProgressAsync(MySpaceTexts.ProgressTextUploadingWorld, null, () => new PublishItemResult(localWorldFolder, publishedTitle, publishedDescription, publishedFileId, visibility, tags, ignoredExtensions), endActionPublish)); }
public unsafe bool SetItemVisibility(ulong handle, PublishedFileVisibility visibility) { return(false); // ISteamUGC* this2 = <Module>.SteamUGC(); // return calli(System.Byte modopt(System.Runtime.CompilerServices.CompilerMarshalOverride) modopt(System.Runtime.CompilerServices.CallConvCdecl)(System.IntPtr,System.UInt64,ERemoteStoragePublishedFileVisibility), this2, handle, visibility, *(*(long*)this2 + 152L)); }
public unsafe bool SetItemVisibility(ulong handle, PublishedFileVisibility visibility) { return false; // ISteamUGC* this2 = <Module>.SteamUGC(); // return calli(System.Byte modopt(System.Runtime.CompilerServices.CompilerMarshalOverride) modopt(System.Runtime.CompilerServices.CallConvCdecl)(System.IntPtr,System.UInt64,ERemoteStoragePublishedFileVisibility), this2, handle, visibility, *(*(long*)this2 + 152L)); }
private static ulong? PublishNewUGCBlocking(string localFolder, PublishedFileVisibility visibility, string[] tags) { var success = false; ulong? publishedFileId = null; ulong updateHandle; using (ManualResetEvent mrEvent = new ManualResetEvent(false)) { MySteam.API.UGC.CreateItem(MySteam.AppId, WorkshopFileType.Community, delegate(bool ioFailure, CreateItemResult data) { success = !ioFailure && data.Result == Result.OK; if (success) { publishedFileId = data.PublishedFileId; } else MySandboxGame.Log.WriteLine(string.Format("Error creating new item: {0}", GetErrorString(ioFailure, data.Result))); mrEvent.Set(); }); mrEvent.WaitOne(); } if (!success || !publishedFileId.HasValue) return null; string path = Path.Combine(m_workshopModsPath, publishedFileId.Value.ToString()); DirectoryCopy(localFolder, path, true); updateHandle = MySteam.API.UGC.StartItemUpdate(MySteam.AppId, publishedFileId.Value); if (!MySteam.API.UGC.IsUpdateHandleValid(updateHandle)) { MySandboxGame.Log.WriteLine(string.Format("Error creating new item, steam returned invalid update handle: '{0}'", localFolder)); return null; } var title = Path.GetFileName(localFolder); if (!MySteam.API.UGC.SetItemTitle(updateHandle, title)) { MySandboxGame.Log.WriteLine(string.Format("Error creating new item, SetItemTitle failed: '{0}'", title)); return null; } if (!MySteam.API.UGC.SetItemDescription(updateHandle, "lorem ipsum dolor sit amet")) { MySandboxGame.Log.WriteLine(string.Format("Error creating new item, SetItemTitle failed: '{0}'", title)); return null; } if (!MySteam.API.UGC.SetItemVisibility(updateHandle, visibility)) { MySandboxGame.Log.WriteLine(string.Format("Error creating new item, SetItemVisibility failed: '{0}'", visibility.ToString())); return null; } if (!MySteam.API.UGC.SetItemTags(updateHandle, tags)) { MySandboxGame.Log.WriteLine(string.Format("Error creating new item, SetItemTags failed: '{0}'", String.Join(", ", tags))); return null; } if (!MySteam.API.UGC.SetItemContent(updateHandle, path)) { MySandboxGame.Log.WriteLine(string.Format("Error creating new item, SetItemContent failed: '{0}'", localFolder)); return null; } var previewFile = Path.Combine(path, WORKSHOP_PREVIEW_FILENAME); if (File.Exists(previewFile)) { if (!MySteam.API.UGC.SetItemPreview(updateHandle, previewFile)) { MySandboxGame.Log.WriteLine(string.Format("Error creating new item, SetItemPreview failed: '{0}'", previewFile)); return null; } } using (ManualResetEvent mrEvent = new ManualResetEvent(false)) { MySteam.API.UGC.SubmitItemUpdate(updateHandle, "", delegate(bool ioFailure, SubmitItemUpdateResult data) { success = !ioFailure && data.Result == Result.OK; if (!success) MySandboxGame.Log.WriteLine(string.Format("Error creating new item: {0}", GetErrorString(ioFailure, data.Result))); mrEvent.Set(); }); mrEvent.WaitOne(); } return publishedFileId; }
private static ulong?PublishUGCBlocking(string localFolder, ulong?publishedFileId, PublishedFileVisibility visibility, string[] tags) { if (!Directory.Exists(localFolder)) { MySandboxGame.Log.WriteLine(string.Format("Error creating new item, directory does not exist: {0}", localFolder)); return(null); } if (publishedFileId.HasValue) { return(PublishUpdateUGCBlocking(localFolder, publishedFileId)); } else { return(PublishNewUGCBlocking(localFolder, visibility, tags)); } return(null); }
private static ulong?PublishNewUGCBlocking(string localFolder, PublishedFileVisibility visibility, string[] tags) { var success = false; ulong?publishedFileId = null; ulong updateHandle; using (ManualResetEvent mrEvent = new ManualResetEvent(false)) { MySteam.API.UGC.CreateItem(MySteam.AppId, WorkshopFileType.Community, delegate(bool ioFailure, CreateItemResult data) { success = !ioFailure && data.Result == Result.OK; if (success) { publishedFileId = data.PublishedFileId; } else { MySandboxGame.Log.WriteLine(string.Format("Error creating new item: {0}", GetErrorString(ioFailure, data.Result))); } mrEvent.Set(); }); mrEvent.WaitOne(); } if (!success || !publishedFileId.HasValue) { return(null); } string path = Path.Combine(m_workshopModsPath, publishedFileId.Value.ToString()); DirectoryCopy(localFolder, path, true); updateHandle = MySteam.API.UGC.StartItemUpdate(MySteam.AppId, publishedFileId.Value); if (!MySteam.API.UGC.IsUpdateHandleValid(updateHandle)) { MySandboxGame.Log.WriteLine(string.Format("Error creating new item, steam returned invalid update handle: '{0}'", localFolder)); return(null); } var title = Path.GetFileName(localFolder); if (!MySteam.API.UGC.SetItemTitle(updateHandle, title)) { MySandboxGame.Log.WriteLine(string.Format("Error creating new item, SetItemTitle failed: '{0}'", title)); return(null); } if (!MySteam.API.UGC.SetItemDescription(updateHandle, "lorem ipsum dolor sit amet")) { MySandboxGame.Log.WriteLine(string.Format("Error creating new item, SetItemTitle failed: '{0}'", title)); return(null); } if (!MySteam.API.UGC.SetItemVisibility(updateHandle, visibility)) { MySandboxGame.Log.WriteLine(string.Format("Error creating new item, SetItemVisibility failed: '{0}'", visibility.ToString())); return(null); } if (!MySteam.API.UGC.SetItemTags(updateHandle, tags)) { MySandboxGame.Log.WriteLine(string.Format("Error creating new item, SetItemTags failed: '{0}'", String.Join(", ", tags))); return(null); } if (!MySteam.API.UGC.SetItemContent(updateHandle, path)) { MySandboxGame.Log.WriteLine(string.Format("Error creating new item, SetItemContent failed: '{0}'", localFolder)); return(null); } var previewFile = Path.Combine(path, WORKSHOP_PREVIEW_FILENAME); if (File.Exists(previewFile)) { if (!MySteam.API.UGC.SetItemPreview(updateHandle, previewFile)) { MySandboxGame.Log.WriteLine(string.Format("Error creating new item, SetItemPreview failed: '{0}'", previewFile)); return(null); } } using (ManualResetEvent mrEvent = new ManualResetEvent(false)) { MySteam.API.UGC.SubmitItemUpdate(updateHandle, "", delegate(bool ioFailure, SubmitItemUpdateResult data) { success = !ioFailure && data.Result == Result.OK; if (!success) { MySandboxGame.Log.WriteLine(string.Format("Error creating new item: {0}", GetErrorString(ioFailure, data.Result))); } mrEvent.Set(); }); mrEvent.WaitOne(); } return(publishedFileId); }
public unsafe void PublishWorkshopFile(string file, string previewFile, uint appId, string title, string description, string longDescription, PublishedFileVisibility visibility, string[] tags, Action<bool, RemoteStoragePublishFileResult> onCallResult) { // sbyte* pchFile = (sbyte*)Marshal.StringToHGlobalAnsi(file).ToPointer(); // sbyte* pchPreviewFile = (sbyte*)Marshal.StringToHGlobalAnsi(previewFile).ToPointer(); // sbyte* pchTitle = (sbyte*)Marshal.StringToHGlobalAnsi(title).ToPointer(); // sbyte* pchDescription = (sbyte*)Marshal.StringToHGlobalAnsi(description).ToPointer(); // sbyte* pchLongDescription = (sbyte*)Marshal.StringToHGlobalAnsi(longDescription).ToPointer(); // SteamParamStringArray_t steamTags; // *(ref steamTags + 8) = tags.Length; // ulong longDescription2 = (ulong)((long)(*(ref steamTags + 8))); // ulong description2; // if (longDescription2 <= 2305843009213693951uL) // { // description2 = longDescription2 * 8uL; // } // else // { // description2 = 18446744073709551615uL; // } // steamTags = <Module>.new[](description2); // int i = 0; // if (0 < *(ref steamTags + 8)) // { // long appId2 = 0L; // do // { // IntPtr intPtr = Marshal.StringToHGlobalAnsi(tags[i]); // *(appId2 + steamTags) = intPtr.ToPointer(); // i++; // appId2 += 8L; // } // while (i < *(ref steamTags + 8)); // } // ISteamRemoteStorage* title2 = <Module>.SteamRemoteStorage(); // <Module>.SteamSDK.?A0x57ffc328.MakeCall<struct RemoteStoragePublishFileResult_t,class System::Action<bool,struct SteamSDK::RemoteStoragePublishFileResult> >(calli(System.UInt64 modopt(System.Runtime.CompilerServices.CallConvCdecl)(System.IntPtr,System.SByte modopt(System.Runtime.CompilerServices.IsSignUnspecifiedByte) modopt(System.Runtime.CompilerServices.IsConst)*,System.SByte modopt(System.Runtime.CompilerServices.IsSignUnspecifiedByte) modopt(System.Runtime.CompilerServices.IsConst)*,System.UInt32,System.SByte modopt(System.Runtime.CompilerServices.IsSignUnspecifiedByte) modopt(System.Runtime.CompilerServices.IsConst)*,System.SByte modopt(System.Runtime.CompilerServices.IsSignUnspecifiedByte) modopt(System.Runtime.CompilerServices.IsConst)*,ERemoteStoragePublishedFileVisibility,SteamParamStringArray_t*,EWorkshopFileType), title2, pchFile, pchPreviewFile, appId, pchTitle, pchDescription, visibility, ref steamTags, 0, *(*(long*)title2 + 216L)), ldftn(OnPublishFile), onCallResult); // Marshal.FreeHGlobal((IntPtr)((void*)pchFile)); // Marshal.FreeHGlobal((IntPtr)((void*)pchPreviewFile)); // Marshal.FreeHGlobal((IntPtr)((void*)pchTitle)); // Marshal.FreeHGlobal((IntPtr)((void*)pchDescription)); // Marshal.FreeHGlobal((IntPtr)((void*)pchLongDescription)); // int j = 0; // if (0 < *(ref steamTags + 8)) // { // long file2 = 0L; // do // { // Marshal.FreeHGlobal((IntPtr)(*(file2 + steamTags))); // j++; // file2 += 8L; // } // while (j < *(ref steamTags + 8)); // } // <Module>.delete[](steamTags); }
public unsafe void PublishWorkshopFile(string file, string previewFile, uint appId, string title, string description, string longDescription, PublishedFileVisibility visibility, string[] tags, Action <bool, RemoteStoragePublishFileResult> onCallResult) { // sbyte* pchFile = (sbyte*)Marshal.StringToHGlobalAnsi(file).ToPointer(); // sbyte* pchPreviewFile = (sbyte*)Marshal.StringToHGlobalAnsi(previewFile).ToPointer(); // sbyte* pchTitle = (sbyte*)Marshal.StringToHGlobalAnsi(title).ToPointer(); // sbyte* pchDescription = (sbyte*)Marshal.StringToHGlobalAnsi(description).ToPointer(); // sbyte* pchLongDescription = (sbyte*)Marshal.StringToHGlobalAnsi(longDescription).ToPointer(); // SteamParamStringArray_t steamTags; // *(ref steamTags + 8) = tags.Length; // ulong longDescription2 = (ulong)((long)(*(ref steamTags + 8))); // ulong description2; // if (longDescription2 <= 2305843009213693951uL) // { // description2 = longDescription2 * 8uL; // } // else // { // description2 = 18446744073709551615uL; // } // steamTags = <Module>.new[](description2); // int i = 0; // if (0 < *(ref steamTags + 8)) // { // long appId2 = 0L; // do // { // IntPtr intPtr = Marshal.StringToHGlobalAnsi(tags[i]); // *(appId2 + steamTags) = intPtr.ToPointer(); // i++; // appId2 += 8L; // } // while (i < *(ref steamTags + 8)); // } // ISteamRemoteStorage* title2 = <Module>.SteamRemoteStorage(); // <Module>.SteamSDK.?A0x57ffc328.MakeCall<struct RemoteStoragePublishFileResult_t,class System::Action<bool,struct SteamSDK::RemoteStoragePublishFileResult> >(calli(System.UInt64 modopt(System.Runtime.CompilerServices.CallConvCdecl)(System.IntPtr,System.SByte modopt(System.Runtime.CompilerServices.IsSignUnspecifiedByte) modopt(System.Runtime.CompilerServices.IsConst)*,System.SByte modopt(System.Runtime.CompilerServices.IsSignUnspecifiedByte) modopt(System.Runtime.CompilerServices.IsConst)*,System.UInt32,System.SByte modopt(System.Runtime.CompilerServices.IsSignUnspecifiedByte) modopt(System.Runtime.CompilerServices.IsConst)*,System.SByte modopt(System.Runtime.CompilerServices.IsSignUnspecifiedByte) modopt(System.Runtime.CompilerServices.IsConst)*,ERemoteStoragePublishedFileVisibility,SteamParamStringArray_t*,EWorkshopFileType), title2, pchFile, pchPreviewFile, appId, pchTitle, pchDescription, visibility, ref steamTags, 0, *(*(long*)title2 + 216L)), ldftn(OnPublishFile), onCallResult); // Marshal.FreeHGlobal((IntPtr)((void*)pchFile)); // Marshal.FreeHGlobal((IntPtr)((void*)pchPreviewFile)); // Marshal.FreeHGlobal((IntPtr)((void*)pchTitle)); // Marshal.FreeHGlobal((IntPtr)((void*)pchDescription)); // Marshal.FreeHGlobal((IntPtr)((void*)pchLongDescription)); // int j = 0; // if (0 < *(ref steamTags + 8)) // { // long file2 = 0L; // do // { // Marshal.FreeHGlobal((IntPtr)(*(file2 + steamTags))); // j++; // file2 += 8L; // } // while (j < *(ref steamTags + 8)); // } // <Module>.delete[](steamTags); }
/// <summary> /// Do NOT call this method from update thread. Use PublishWorldAsync or worker thread, otherwise it will block update. /// </summary> private static ulong PublishItemBlocking(string localFolder, string publishedTitle, string publishedDescription, ulong? workshopId, PublishedFileVisibility visibility, string[] tags, string[] ignoredExtensions) { MySandboxGame.Log.WriteLine("PublishItemBlocking - START"); MySandboxGame.Log.IncreaseIndent(); if (tags.Length == 0) { MySandboxGame.Log.WriteLine("Error: Can not publish with no tags!"); MySandboxGame.Log.DecreaseIndent(); MySandboxGame.Log.WriteLine("PublishItemBlocking - END"); return 0; } int totalBytes = 0; int availableBytes = 0; SteamAPI.Instance.RemoteStorage.GetQuota(out totalBytes, out availableBytes); MySandboxGame.Log.WriteLine(string.Format("Quota: total = {0}, available = {1}", totalBytes, availableBytes)); int totalCloudFiles = SteamAPI.Instance.RemoteStorage.GetFileCount(); MySandboxGame.Log.WriteLine(string.Format("Listing cloud {0} files", totalCloudFiles)); MySandboxGame.Log.IncreaseIndent(); for (int i = 0; i < totalCloudFiles; ++i) { int fileSize = 0; string fileName = SteamAPI.Instance.RemoteStorage.GetFileNameAndSize(i, out fileSize); bool persisted = SteamAPI.Instance.RemoteStorage.FilePersisted(fileName); bool forgot = false; if (persisted && fileName.StartsWith("tmp") && fileName.EndsWith(".tmp")) // dont sync useless temp files { forgot = SteamAPI.Instance.RemoteStorage.FileForget(fileName); } MySandboxGame.Log.WriteLine(string.Format("'{0}', {1}B, {2}, {3}", fileName, fileSize, persisted, forgot)); } MySandboxGame.Log.DecreaseIndent(); SteamAPI.Instance.RemoteStorage.GetQuota(out totalBytes, out availableBytes); MySandboxGame.Log.WriteLine(string.Format("Quota: total = {0}, available = {1}", totalBytes, availableBytes)); ulong publishedFileId = 0; var steam = MySteam.API; string steamItemFileName; string steamPreviewFileName = ""; MySandboxGame.Log.WriteLine("Packing Item - START"); var tempFileFullPath = Path.GetTempFileName(); try { string[] allIgnoredExtensions = new string[m_ignoredExecutableExtensions.Length + ignoredExtensions.Length]; ignoredExtensions.CopyTo(allIgnoredExtensions, 0); m_ignoredExecutableExtensions.CopyTo(allIgnoredExtensions, ignoredExtensions.Length); MyZipArchive.CreateFromDirectory(localFolder, tempFileFullPath, DeflateOptionEnum.Maximum, false, allIgnoredExtensions,false); } catch (Exception e) { MySandboxGame.Log.WriteLine(string.Format("Packing file failed: source = '{0}', destination = '{1}', error: {2}", localFolder, tempFileFullPath, e)); MySandboxGame.Log.DecreaseIndent(); return 0ul; } MySandboxGame.Log.WriteLine("Packing Item - END"); steamItemFileName = WriteAndShareFileBlocking(tempFileFullPath); File.Delete(tempFileFullPath); if (steamItemFileName == null) { MySandboxGame.Log.DecreaseIndent(); return 0; } foreach (var previewFileName in m_previewFileNames) { var localPreviewFileFullPath = Path.Combine(localFolder, previewFileName); if (File.Exists(localPreviewFileFullPath)) { steamPreviewFileName = WriteAndShareFileBlocking(localPreviewFileFullPath); if (steamPreviewFileName == null) { MySandboxGame.Log.WriteLine(string.Format("Could not share preview file = '{0}'", localPreviewFileFullPath)); MySandboxGame.Log.DecreaseIndent(); return 0; } break; } } MySandboxGame.Log.WriteLine("Publishing - START"); using (var mrEvent = new ManualResetEvent(false)) { // Update item if it has already been published, otherwise publish it. bool publishedFileNotFound = true; if (workshopId.HasValue && workshopId != 0) { MySandboxGame.Log.WriteLine("File appears to be published already. Attempting to update workshop file."); ulong updateHandle = steam.RemoteStorage.CreatePublishedFileUpdateRequest(workshopId.Value); steam.RemoteStorage.UpdatePublishedFileTags(updateHandle, tags); steam.RemoteStorage.UpdatePublishedFileFile(updateHandle, steamItemFileName); steam.RemoteStorage.UpdatePublishedFilePreviewFile(updateHandle, steamPreviewFileName); steam.RemoteStorage.CommitPublishedFileUpdate(updateHandle, delegate(bool ioFailure, RemoteStorageUpdatePublishedFileResult data) { m_publishResult = data.Result; bool success = !ioFailure && data.Result == Result.OK; if (success) MySandboxGame.Log.WriteLine("Published file update successful"); else MySandboxGame.Log.WriteLine(string.Format("Error during publishing: {0}", GetErrorString(ioFailure, data.Result))); m_publishSuccess = success; publishedFileId = data.PublishedFileId; publishedFileNotFound = data.Result == Result.FileNotFound; mrEvent.Set(); }); mrEvent.WaitOne(); mrEvent.Reset(); } if (publishedFileNotFound) { MySandboxGame.Log.WriteLine("Published file was not found. Publishing."); steam.RemoteStorage.PublishWorkshopFile(steamItemFileName, steamPreviewFileName, MySteam.AppId, publishedTitle, publishedDescription, publishedDescription, visibility, tags, delegate(bool ioFailure, RemoteStoragePublishFileResult data) { m_publishResult = data.Result; m_publishSuccess = !ioFailure && data.Result == Result.OK; if (m_publishSuccess) MySandboxGame.Log.WriteLine("Publishing successful"); else MySandboxGame.Log.WriteLine(string.Format("Error during publishing: {0}", GetErrorString(ioFailure, data.Result))); publishedFileId = data.PublishedFileId; mrEvent.Set(); }); mrEvent.WaitOne(); mrEvent.Reset(); if (m_publishSuccess) { MySandboxGame.Log.WriteLine("Subscribing to published file"); steam.RemoteStorage.SubscribePublishedFile(publishedFileId, delegate(bool ioFailure, RemoteStorageSubscribePublishedFileResult data) { var success = !ioFailure && data.Result == Result.OK; if (success) MySandboxGame.Log.WriteLine("Subscribing successful"); else MySandboxGame.Log.WriteLine(string.Format("Subscribing failed: id={0}, error={1}", publishedFileId, GetErrorString(ioFailure, data.Result))); mrEvent.Set(); }); mrEvent.WaitOne(); } } } MySandboxGame.Log.WriteLine("Publishing - END"); // Erasing temporary file. No need for it to take up cloud storage anymore. MySandboxGame.Log.WriteLine("Deleting cloud files - START"); steam.RemoteStorage.FileDelete(steamItemFileName); steam.RemoteStorage.FileDelete(steamPreviewFileName); MySandboxGame.Log.WriteLine("Deleting cloud files - END"); MySandboxGame.Log.DecreaseIndent(); MySandboxGame.Log.WriteLine("PublishItemBlocking - END"); return publishedFileId; }
private static ulong? PublishUGCBlocking(string localFolder, ulong? publishedFileId, PublishedFileVisibility visibility, string[] tags) { if (!Directory.Exists(localFolder)) { MySandboxGame.Log.WriteLine(string.Format("Error creating new item, directory does not exist: {0}", localFolder)); return null; } if (publishedFileId.HasValue) return PublishUpdateUGCBlocking(localFolder, publishedFileId); else return PublishNewUGCBlocking(localFolder, visibility, tags); return null; }
public PublishItemResult(string localFolder, string publishedTitle, string publishedDescription, ulong? publishedFileId, PublishedFileVisibility visibility, string[] tags, string[] ignoredExtensions) { Task = Parallel.Start(() => { m_publishedFileId = PublishItemBlocking(localFolder, publishedTitle, publishedDescription, publishedFileId, visibility, tags, ignoredExtensions); }); }
public extern static bool Workshop_SetItemVisibility(IntPtr workshop, PublishedFileVisibility visibility);