private string GetConvertedScript(out List <string> newParameterNames, out List <object> newParameterValues) { newParameterNames = null; newParameterValues = null; string str = null; List <VariableExpressionAst> usingVariables = this.GetUsingVariables(this.scriptBlock); if ((usingVariables == null) || (usingVariables.Count == 0)) { return(base.MyInvocation.ExpectingInput ? this.scriptBlock.GetWithInputHandlingForInvokeCommand() : this.scriptBlock.ToString()); } newParameterNames = new List <string>(); List <string> values = new List <string>(); List <VariableExpressionAst> paramUsingVars = new List <VariableExpressionAst>(); HashSet <string> set = new HashSet <string>(StringComparer.OrdinalIgnoreCase); ScriptBlockAst ast = this.scriptBlock.Ast as ScriptBlockAst; foreach (VariableExpressionAst ast2 in usingVariables) { string userPath = ast2.VariablePath.UserPath; string item = "__using_" + userPath; string str4 = "$" + item; if (!set.Contains(str4)) { newParameterNames.Add(item); values.Add(str4); paramUsingVars.Add(ast2); set.Add(str4); } } newParameterValues = this.GetUsingVariableValues(paramUsingVars); string str5 = string.Join(", ", values); str = base.MyInvocation.ExpectingInput ? ast.GetWithInputHandlingForInvokeCommandImpl(Tuple.Create <List <VariableExpressionAst>, string>(usingVariables, str5)) : ast.ToStringForSerialization(Tuple.Create <List <VariableExpressionAst>, string>(usingVariables, str5), ast.Extent.StartOffset, ast.Extent.EndOffset); if (ast.ParamBlock == null) { str = "param(" + str5 + ")\n" + str; } return(str); }