Example #1
0
 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);
         }
     });
 }
Example #2
0
        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;
        }
Example #3
0
 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);
         }
     });
 }
Example #4
0
 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);
         }
     });
 }
Example #5
0
 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);
         }
     });
 }