Exemplo n.º 1
0
        /// <summary>
        /// Scrubs the config of mods that Steam got around to actually updating.
        /// </summary>
        private static void DoScrubConfig()
        {
            var settings = ModUpdateInfo.Settings;
            var existing = settings?.ModUpdates;
            var manager  = Global.Instance.modManager;

            if (existing != null && manager != null)
            {
                // Anything that is up to date gets purged
                var remove = HashSetPool <ModUpdateData, ModUpdateHandler> .Allocate();

                foreach (var info in existing)
                {
                    ulong id = info.ID;
                    if (CheckMod(manager, id))
                    {
                        remove.Add(info);
                    }
                    if (info.Status == ModUpdateStatus.PendingUpdate)
                    {
                        // Purge the temporary zip
                        ExtensionMethods.RemoveOldDownload(ModUpdateHandler.GetDownloadPath(id));
                        info.Status = ModUpdateStatus.UpdatedByThisMod;
                    }
                }
                // Remove the obsolete entries
                foreach (var info in remove)
                {
                    existing.Remove(info);
                }
                remove.Recycle();
                POptions.WriteSettingsForAssembly(settings);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Disables the check for "is Debug Not Included the first mod?".
        /// </summary>
        private static void DisableFirstModCheck()
        {
            var instance = DebugNotIncludedOptions.Instance;

            instance.SkipFirstModCheck = true;
            POptions.WriteSettingsForAssembly(instance);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Updates the settings for the specified mod ID.
 /// </summary>
 /// <param name="id">The Steam mod ID to update.</param>
 /// <param name="lastUpdated">The new last updated date.</param>
 internal static void UpdateConfigFor(ulong id, System.DateTime lastUpdated)
 {
     lock (DETAILS) {
         var settings = ModUpdateInfo.Settings;
         if (settings.ModUpdates == null)
         {
             settings = new ModUpdateInfo();
         }
         var info = ModUpdateInfo.FindModInConfig(id);
         // Now tracked by this mod
         if (info == null)
         {
             info = new ModUpdateData(id, lastUpdated);
             settings.ModUpdates.Add(info);
         }
         else
         {
             info.LastUpdated = lastUpdated.Ticks;
         }
         info.Status = ModUpdateStatus.PendingUpdate;
         POptions.WriteSettingsForAssembly(settings);
     }
 }