void AddFormatCallToInvocation (RefactoringContext context, Script script, PrimitiveExpression pExpr, InvocationExpression invocation) { var newInvocation = (InvocationExpression)invocation.Clone (); newInvocation.Arguments.First ().ReplaceWith (CreateFormatString (context, pExpr, newInvocation.Arguments.Count () - 1)); newInvocation.Arguments.Add (CreateFormatArgument (context)); script.Replace (invocation, newInvocation); }
void AddArgument(Script script, InvocationExpression invocationExpression, string stringComparison) { var astBuilder = ctx.CreateTypeSytemAstBuilder(invocationExpression); var newArgument = astBuilder.ConvertType(new TopLevelTypeName("System", "StringComparison")).Member(stringComparison); var copy = (InvocationExpression)invocationExpression.Clone(); copy.Arguments.Add(newArgument); script.Replace(invocationExpression, copy); }