public SemanticVersionRange(SemanticVersion current, SemanticVersionSpan span) { //TODO: just handle MaxMinor for the moment if (span.Span == SemanticVersionSpan.SpanType.MaxMinorSpan) { SemanticVersion other = new SemanticVersion(current.Major + 1); Lower = current; LowerIsInclusive = true; Upper = other; UpperIsInclusive = false; } else { SemanticVersion other = new SemanticVersion( current.Major + span.Major, current.Minor + span.Minor, current.Patch + span.Patch); if (DefaultComparer.Compare(current, other) == 0) { Lower = current; LowerIsInclusive = true; Upper = current; UpperIsInclusive = true; } else if (DefaultComparer.Compare(current, other) > 0) { Lower = other; LowerIsInclusive = true; Upper = current; UpperIsInclusive = true; } else { Lower = current; LowerIsInclusive = true; Upper = other; UpperIsInclusive = true; } } }
static Func<SemanticVersion, bool> Includes(SemanticVersion begin, SemanticVersionSpan span) { SemanticVersionRange range = new SemanticVersionRange(begin, span); Console.WriteLine("Adding range: {0}", range); return (version) => { return range.Includes(version); }; }