private bool InvokesDispose(SyntaxNode node)
{
var expression = node as ExpressionStatementSyntax;
if (expression != null)
{
var invocation = expression.Expression as InvocationExpressionSyntax;
if (invocation != null)
{
var identifier = invocation.Expression as IdentifierNameSyntax;
if (identifier != null
&& identifier.Identifier.ValueText == "Dispose"
&& invocation.ArgumentList != null
&& invocation.ArgumentList.Arguments.Count == 1
&& invocation.ArgumentList.Arguments[0].EquivalentTo(SyntaxFactory.Argument(SyntaxFactory.LiteralExpression(SyntaxKind.FalseLiteralExpression, SyntaxFactory.Token(SyntaxKind.FalseKeyword)))))
{
return true;
}
}
}
return false;
}
}