Specifies valid versions.
示例#1
0
        public async Task <IList <ServiceInformation> > FindServiceInstancesWithVersionAsync(string name, string version)
        {
            var instances = await FindServiceInstancesAsync(name);

            var range = new SemVer.Range(version);

            return(instances.Where(x => range.IsSatisfied(x.Version)).ToArray());
        }
示例#2
0
 /// <summary>
 /// Return the maximum version that satisfies a given range.
 /// </summary>
 /// <param name="rangeSpec">The range specification.</param>
 /// <param name="versionStrings">The version strings to select from.</param>
 /// <param name="loose">When true, be more forgiving of some invalid version specifications.</param>
 /// <returns>The maximum satisfying version string, or null if no versions satisfied this range.</returns>
 public static string MaxSatisfying(string rangeSpec, IEnumerable<string> versionStrings, bool loose=false)
 {
     var range = new Range(rangeSpec);
     return range.MaxSatisfying(versionStrings);
 }
示例#3
0
        // Static convenience methods

        /// <summary>
        /// Determine whether the given version satisfies a given range.
        /// With an invalid version this method returns false.
        /// </summary>
        /// <param name="rangeSpec">The range specification.</param>
        /// <param name="versionString">The version to check.</param>
        /// <param name="loose">When true, be more forgiving of some invalid version specifications.</param>
        /// <returns>true if the range is satisfied by the version.</returns>
        public static bool IsSatisfied(string rangeSpec, string versionString, bool loose=false)
        {
            var range = new Range(rangeSpec);
            return range.IsSatisfied(versionString);
        }
示例#4
0
        public bool InRange(string range)
        {
            var versionRange = new SemVer.Range(range);

            return(InRange(versionRange));
        }