Пример #1
0
        public override SyntaxNode VisitInterfaceDeclaration(InterfaceDeclarationSyntax node)
        {
            var classSymbol = SemanticHelper.GetDeclaredSymbol(node, _semanticModel, _preportSemanticModel);
            InterfaceDeclarationSyntax newNode = (InterfaceDeclarationSyntax)base.VisitInterfaceDeclaration(node);

            foreach (var action in _allActions.OfType <InterfaceDeclarationAction>())
            {
                if (action.Key == node.Identifier.Text.Trim())
                {
                    var actionExecution = new GenericActionExecution(action, _filePath)
                    {
                        TimesRun = 1
                    };
                    try
                    {
                        newNode = action.InterfaceDeclarationActionFunc(_syntaxGenerator, newNode);
                        LogHelper.LogInformation(string.Format("{0}: {1}", node.SpanStart, action.Description));
                    }
                    catch (Exception ex)
                    {
                        var actionExecutionException = new ActionExecutionException(action.Name, action.Key, ex);
                        actionExecution.InvalidExecutions = 1;
                        LogHelper.LogError(actionExecutionException);
                    }
                    allExecutedActions.Add(actionExecution);
                }
            }
            return(newNode);
        }