コード例 #1
0
        /// <summary>
        /// Returns whether the given constraint matches the desired version
        /// for the mod we're processing.
        /// </summary>
        private static bool ConstraintPasses(string op, Version version, Version desiredVersion)
        {
            switch (op)
            {
                case "":
                case "=":
                    return version.IsEqualTo(desiredVersion);

                case "<":
                    return version.IsLessThan(desiredVersion);

                case ">":
                    return version.IsGreaterThan(desiredVersion);

                case "<=":
                    return version.CompareTo(desiredVersion) <= 0;

                case ">=":
                    return version.CompareTo(desiredVersion) >= 0;

                default:
                    throw new Kraken(
                        string.Format("Unknown x_netkan_override comparator: {0}", op));
            }
        }