Exemplo n.º 1
0
        internal static void Upload(WorkshopUploadable item)
        {
            if (Workshop.curStage != WorkshopInteractStage.None)
            {
                Messages.Message("UploadAlreadyInProgress".Translate(), MessageTypeDefOf.RejectInput, false);
            }
            else
            {
                Workshop.uploadingHook = item.GetWorkshopItemHook();
                if (Workshop.uploadingHook.PublishedFileId != PublishedFileId_t.Invalid)
                {
                    if (Prefs.LogVerbose)
                    {
                        Log.Message(string.Concat(new object[]
                        {
                            "Workshop: Starting item update for mod '",
                            Workshop.uploadingHook.Name,
                            "' with PublishedFileId ",
                            Workshop.uploadingHook.PublishedFileId
                        }), false);
                    }
                    Workshop.curStage        = WorkshopInteractStage.SubmittingItem;
                    Workshop.curUpdateHandle = SteamUGC.StartItemUpdate(SteamUtils.GetAppID(), Workshop.uploadingHook.PublishedFileId);
                    Workshop.SetWorkshopItemDataFrom(Workshop.curUpdateHandle, Workshop.uploadingHook, false);
                    SteamAPICall_t hAPICall = SteamUGC.SubmitItemUpdate(Workshop.curUpdateHandle, "[Auto-generated text]: Update on " + DateTime.Now.ToString() + ".");
                    if (Workshop.< > f__mg$cache3 == null)
                    {
                        Workshop.< > f__mg$cache3 = new CallResult <SubmitItemUpdateResult_t> .APIDispatchDelegate(Workshop.OnItemSubmitted);
                    }
                    Workshop.submitResult = CallResult <SubmitItemUpdateResult_t> .Create(Workshop.< > f__mg$cache3);

                    Workshop.submitResult.Set(hAPICall, null);
                }
                else
                {
                    if (Prefs.LogVerbose)
                    {
                        Log.Message("Workshop: Starting item creation for mod '" + Workshop.uploadingHook.Name + "'.", false);
                    }
                    Workshop.curStage = WorkshopInteractStage.CreatingItem;
                    SteamAPICall_t hAPICall2 = SteamUGC.CreateItem(SteamUtils.GetAppID(), EWorkshopFileType.k_EWorkshopFileTypeFirst);
                    if (Workshop.< > f__mg$cache4 == null)
                    {
                        Workshop.< > f__mg$cache4 = new CallResult <CreateItemResult_t> .APIDispatchDelegate(Workshop.OnItemCreated);
                    }
                    Workshop.createResult = CallResult <CreateItemResult_t> .Create(Workshop.< > f__mg$cache4);

                    Workshop.createResult.Set(hAPICall2, null);
                }
                Find.WindowStack.Add(new Dialog_WorkshopOperationInProgress());
            }
        }
Exemplo n.º 2
0
        internal static void Upload(WorkshopUploadable item)
        {
            if (curStage != 0)
            {
                Messages.Message("UploadAlreadyInProgress".Translate(), MessageTypeDefOf.RejectInput, historical: false);
            }
            else
            {
                uploadingHook = item.GetWorkshopItemHook();
                if (uploadingHook.PublishedFileId != PublishedFileId_t.Invalid)
                {
                    if (Prefs.LogVerbose)
                    {
                        Log.Message("Workshop: Starting item update for mod '" + uploadingHook.Name + "' with PublishedFileId " + uploadingHook.PublishedFileId);
                    }
                    curStage        = WorkshopInteractStage.SubmittingItem;
                    curUpdateHandle = SteamUGC.StartItemUpdate(SteamUtils.GetAppID(), uploadingHook.PublishedFileId);
                    SetWorkshopItemDataFrom(curUpdateHandle, uploadingHook, creating: false);
                    SteamAPICall_t hAPICall = SteamUGC.SubmitItemUpdate(curUpdateHandle, "[Auto-generated text]: Update on " + DateTime.Now.ToString() + ".");
                    submitResult = CallResult <SubmitItemUpdateResult_t> .Create(OnItemSubmitted);

                    submitResult.Set(hAPICall);
                }
                else
                {
                    if (Prefs.LogVerbose)
                    {
                        Log.Message("Workshop: Starting item creation for mod '" + uploadingHook.Name + "'.");
                    }
                    curStage = WorkshopInteractStage.CreatingItem;
                    SteamAPICall_t hAPICall2 = SteamUGC.CreateItem(SteamUtils.GetAppID(), EWorkshopFileType.k_EWorkshopFileTypeFirst);
                    createResult = CallResult <CreateItemResult_t> .Create(OnItemCreated);

                    createResult.Set(hAPICall2);
                }
                Find.WindowStack.Add(new Dialog_WorkshopOperationInProgress());
            }
        }