Exemplo n.º 1
0
        private static void Analyzer(SyntaxNodeAnalysisContext context)
        {
            if (context.IsGenerated()) return;
            var mainConstrutor = new MethodInformation(
                nameof(Uri),
                "System.Uri.Uri(string)",
                args =>
                {
                    {
                        if (args[0] == null)
                        {
                            return;
                        }
                        new Uri(args[0].ToString());
                    }
                }
            );
            var constructorWithUriKind = new MethodInformation(
                nameof(Uri),
                "System.Uri.Uri(string, System.UriKind)",
                args =>
                {
                    if (args[0] == null)
                    {
                        return;
                    }
                    new Uri(args[0].ToString(), (UriKind)args[1]);
                }
            );

            var checker = new MethodChecker(context, Rule);
            checker.AnalyzeConstructor(mainConstrutor);
            checker.AnalyzeConstructor(constructorWithUriKind);
        }
Exemplo n.º 2
0
 private static void Analyzer(SyntaxNodeAnalysisContext context)
 {
     if (context.IsGenerated()) return;
     var method = new MethodInformation(
         "Parse",
         "System.Net.IPAddress.Parse(string)",
         args =>
         {
             parseMethodInfo.Value.Invoke(null, new[] { args[0].ToString() });
         }
         );
     var checker = new MethodChecker(context, Rule);
     checker.AnalyzeMethod(method);
 }