Exemplo n.º 1
0
        /// <summary>
        /// Returns if the other version satisfies this RelationshipDescriptor.
        /// If the RelationshipDescriptor has version set it compares against that.
        /// Else it uses the {min,max}_version fields treating nulls as unbounded.
        /// Note: Uses inclusive inequalities.
        /// </summary>
        /// <param name="other_version"></param>
        /// <returns>True if other_version is within the bounds</returns>
        public bool version_within_bounds(Version other_version)
        {
            // DLL versions (aka autodetected mods) satisfy *all* relationships
            if (other_version is DllVersion)
            {
                return(true);
            }

            if (version == null)
            {
                if (max_version == null && min_version == null)
                {
                    return(true);
                }
                bool min_sat = min_version == null || min_version <= other_version;
                bool max_sat = max_version == null || max_version >= other_version;
                if (min_sat && max_sat)
                {
                    return(true);
                }
            }
            else
            {
                if (version.Equals(other_version))
                {
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 2
0
 protected bool Equals(CkanModule other)
 {
     return(string.Equals(identifier, other.identifier) && version.Equals(other.version));
 }