Beispiel #1
0
        /// <summary>
        /// Looks for a mod in the known updates config.
        /// </summary>
        /// <param name="id">The Steam mod ID.</param>
        /// <returns>Any extra information that this mod knows about the mod from previous
        /// updates, or null if none is available.</returns>
        internal static ModUpdateData FindModInConfig(ulong id)
        {
            ModUpdateData info     = null;
            var           existing = Settings?.ModUpdates;

            if (existing != null)
            {
                // Previously tracked by this mod?
                foreach (var ud in existing)
                {
                    if (ud.ID == id)
                    {
                        info = ud;
                        break;
                    }
                }
            }
            return(info);
        }
Beispiel #2
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);
     }
 }