Exemple #1
0
        public static void ParseCSharp(string filePath)
        {
            string data = Parser.ReadDataFromFile(filePath);

            //xxx
            if (data.Contains("unsafe") ||
                data.Contains("fixed") ||
                data.Contains("stackalloc") ||
                data.Contains("sizeof") ||
                data.Contains("public class PreProcessorDirectives : ContextBoundObject, IPerfFoo") ||
                data.Contains("#if ") ||
                data.Contains("__arglist") ||
                data.Contains("async"))
            {
                return;
            }

            if (data.Contains("public class PrefixLocalCallsWithThis") ||
                data.Contains("public class CurlyBracketsEvents") ||
                data.Contains("public class DeclarationKeywordOrderConstructors") ||
                data.Contains("/// Invalid destructor header.") ||
                data.Contains("public class DocumentationIndexers") ||
                data.Contains("public class QueryExpressions") ||
                data.Contains("public class ClassMembersLocalVariables") ||
                data.Contains("public event EventHandler E4") ||
                data.Contains("public class LambdaExpressions") ||
                data.Contains("public class NestedClassesConstructorSummary") ||
                data.Contains("public class ValidInheritDoc1") ||
                data.Contains("namespace InvalidContinuationQueryClauses") ||
                data.Contains("namespace InvalidQueryClauses") ||
                data.Contains("namespace ValidQueryClauses") ||
                data.Contains("namespace ElementOrderStatics1") ||
                data.Contains("namespace ElementOrderGlobalGeneratedCode1") ||
                data.Contains("namespace LineSpacingBetweenElements1") ||
                data.Contains("namespace InterfaceMethodDeclarationClosingParenthesisPlacement1") ||
                data.Contains("namespace InterfaceMethodDeclarationCommaPlacement1") ||
                data.Contains("namespace InterfaceMethodDeclarationOpeningParenthesisPlacement1") ||
                data.Contains("namespace InterfaceMethodDeclarationParameterFollowsComma1") ||
                data.Contains("namespace InterfaceMethodDeclarationParameterListStart1") ||
                data.Contains("namespace InterfaceMethodDeclarationSpanningMultipleLines1") ||
                data.Contains("namespace InterfaceMethodDeclarationSplitParameterMustStartOnLineAfterDeclaration1") ||
                data.Contains("namespace InterfaceMethodDeclarationValidPlacement1") ||
                data.Contains("directed Primary -> Secondary availability replica pairs.") ||
                data.Contains("this.currentSite = SPControl.GetContextSite(Context)") ||
                data.Contains("namespace [email protected]") ||
                data.Contains("namespace [email protected]") ||
                data.Contains("@namespace Microsoft.StyleCop.CSharp") ||
                data.Contains("namesp\\u0061ce Microsoft.StyleCop.CSharp") ||
                data.Contains("CheckWhetherLastCodeLineIsEmpty"))
            {
                return;
            }

            CSharpParser.Ensure(data);
        }