Пример #1
0
        public void PresetFields()
        {
            string basePath = REG_PREFIX + ID.ToString();

            DataPath = Registry.CurrentUser.GetSubKeyValue(basePath, "DataFolder")?.
                       ToString() ?? "";
            Description = details.m_rgchDescription?.Trim() ?? "";
            PreviewPath = Registry.CurrentUser.GetSubKeyValue(basePath, "PreviewImg")?.
                          ToString() ?? "";
            Title = details.m_rgchTitle?.Trim() ?? "";
            string patchInfo = "(1.0.0.0) Initial release";

            if (!DataPath.IsNullOrWhiteSpace())
            {
                patchInfo = PopulatePatchInfo(DataPath) ?? patchInfo;
            }
            PatchInfo = patchInfo;
        }
Пример #2
0
 public void StartModify()
 {
     if (!updateHandle.Equals(PublishedFileUpdateHandle_t.Invalid))
     {
         throw new InvalidOperationException("Upload already started");
     }
     // Legacy Workshop item
     updateHandle = SteamRemoteStorage.CreatePublishedFileUpdateRequest(details.
                                                                        m_nPublishedFileId);
     if (updateHandle.Equals(PublishedFileUpdateHandle_t.Invalid))
     {
         OnModifyFailed?.Invoke();
     }
     else
     {
         PUtil.LogDebug("MODIFYING MOD: " + Mod.label.title);
         string desc = Description?.Trim(), title = Title?.Trim();
         if (!desc.IsNullOrWhiteSpace() && desc != details.m_rgchDescription)
         {
             PUtil.LogDebug("DESCRIPTION: " + desc);
             if (!SteamRemoteStorage.UpdatePublishedFileDescription(updateHandle, desc))
             {
                 PUtil.LogWarning("Failed to set item description!");
             }
         }
         if (!title.IsNullOrWhiteSpace() && title != details.m_rgchTitle)
         {
             PUtil.LogDebug("TITLE: " + title);
             if (!SteamRemoteStorage.UpdatePublishedFileTitle(updateHandle, title))
             {
                 PUtil.LogWarning("Failed to set item title!");
             }
         }
         if (!PatchInfo.IsNullOrWhiteSpace())
         {
             PUtil.LogDebug("PATCH INFO: " + PatchInfo);
             if (!SteamRemoteStorage.UpdatePublishedFileSetChangeDescription(
                     updateHandle, PatchInfo))
             {
                 PUtil.LogWarning("Failed to set change notes!");
             }
         }
         if (UpdateData && !DataPath.IsNullOrWhiteSpace())
         {
             byte[] zipData = ZipModFolder(DataPath);
             if (zipData != null)
             {
                 PUtil.LogDebug("DATA: " + DataPath + " => " + REMOTE_MOD_DATA);
                 if (!WriteToSteamStorage(zipData, REMOTE_MOD_DATA, OnDataUploaded))
                 {
                     OnModifyFailed?.Invoke();
                 }
             }
             else
             {
                 OnModifyFailed?.Invoke();
             }
         }
         else
         {
             StartPreviewUpload();
         }
     }
 }