private void ValidateAliasMustBeSortedAlphabeticallyInsideAGroup(IEnumerable<UsingDirective> usingDirectives) { usingDirectives.ForEachPair((firstUsing, secondUsing) => { if (string.CompareOrdinal(firstUsing.Alias, secondUsing.Alias) > -1) { this.sourceAnalyzer.AddViolation(secondUsing, secondUsing.LineNumber, ContribRule.UsingDirectiveMustBeSortedAlphabeticallyByGroup); } }); }
public static bool IsHitPolygone(IEnumerable<Vector> polygone, Vector vector) { var isHit = false; polygone.ForEachPair((first, second) => { if (((first.Y > vector.Y) != (second.Y > vector.Y)) && (vector.X < (second.X - first.X) * (vector.Y - first.Y) / (second.Y - first.Y) + first.X)) isHit = !isHit; }); return isHit; }
private void ValidateAliasUsingDirectiveMustBeLastInsideAGroup(IEnumerable<UsingDirective> usingDirectives) { usingDirectives.ForEachPair((firstUsing, secondUsing) => { if (!string.IsNullOrEmpty(firstUsing.Alias) && string.IsNullOrEmpty(secondUsing.Alias)) { this.sourceAnalyzer.AddViolation(secondUsing, secondUsing.LineNumber, ContribRule.UsingDirectiveMustBeSortedAlphabeticallyByGroup); } }); }
private void ValidateUsingGroupOrderMustBeRespected(IEnumerable<UsingDirectiveGroup> usingGroups) { usingGroups.ForEachPair((firstGroup, secondGroup) => { if (firstGroup.Index > secondGroup.Index) { this.sourceAnalyzer.AddViolation(secondGroup.First(), secondGroup.First().LineNumber, ContribRule.UsingDirectiveGroupMustFollowGivenOrder); } }); }
private void ValidateUsingGroupMustBeSeparatedByABlankLine(IEnumerable<UsingDirectiveGroup> usingGroups) { usingGroups.ForEachPair((firstGroup, secondGroup) => { if (secondGroup.FirstLineNumber - firstGroup.LastLineNumber <= 1) { this.sourceAnalyzer.AddViolation(secondGroup.First(), secondGroup.FirstLineNumber, ContribRule.UsingDirectiveGroupMustBeSeparatedByBlankLine); } }); }