コード例 #1
0
        /// <summary>
        /// Checks if updates are available for the passed mod.
        /// </summary>
        /// <param name="modInfo">The ModInfos of the mod to check for updates.</param>
        /// <param name="newModInfo">A reference to an empty ModInfo to write the updated ModInfos to.</param>
        /// <returns>True if there is an update, otherwise false.</returns>
        public bool CheckForUpdates(ModInfo modInfo, ref ModInfo newModInfo)
        {
            newModInfo = GetModInfo(modInfo.ModURL);
            if (string.IsNullOrEmpty(modInfo.Version) && !string.IsNullOrEmpty(newModInfo.Version))
            {
                return(true);
            }
            else if (!string.IsNullOrEmpty(modInfo.Version) && !string.IsNullOrEmpty(newModInfo.Version))
            {
                return(VersionComparer.CompareVersions(modInfo.Version, newModInfo.Version) == VersionComparer.Result.AisSmallerB);
            }
            else if (string.IsNullOrEmpty(modInfo.CreationDate) && !string.IsNullOrEmpty(newModInfo.CreationDate))
            {
                return(true);
            }
            else if (!string.IsNullOrEmpty(modInfo.CreationDate) && !string.IsNullOrEmpty(newModInfo.CreationDate))
            {
                return(modInfo.CreationDateAsDateTime < newModInfo.CreationDateAsDateTime);
            }

            return(false);
        }
コード例 #2
0
 /// <summary>
 /// Checks if updates are available for the passed mod.
 /// </summary>
 /// <param name="modInfo">The ModInfos of the mod to check for updates.</param>
 /// <param name="newModInfo">A reference to an empty ModInfo to write the updated ModInfos to.</param>
 /// <returns>True if there is an update, otherwise false.</returns>
 public bool CheckForUpdates(ModInfo modInfo, ref ModInfo newModInfo)
 {
     newModInfo = GetModInfo(modInfo.ModURL);
     return(VersionComparer.CompareVersions(modInfo.Version, newModInfo.Version) == VersionComparer.Result.AisSmallerB);
 }