Thinktecture.Tools.Web.Services.CodeGeneration.CodeRefactoringAgent.RefactorMethodNamesInStatement C# (CSharp) Method

RefactorMethodNamesInStatement() private method

private RefactorMethodNamesInStatement ( CodeStatement statement, string newName ) : void
statement System.CodeDom.CodeStatement
newName string
return void
        private void RefactorMethodNamesInStatement(CodeStatement statement, string newName)
        {
            if (typeof(CodeVariableDeclarationStatement) == statement.GetType())
            {
                CodeVariableDeclarationStatement vdeclStatement = (CodeVariableDeclarationStatement)statement;
                if (vdeclStatement.InitExpression != null)
                {
                    if (typeof(CodeCastExpression) == vdeclStatement.InitExpression.GetType())
                    {
                        CodeCastExpression castExp = (CodeCastExpression)vdeclStatement.InitExpression;
                        if (typeof(CodeMethodInvokeExpression) == castExp.Expression.GetType())
                        {
                            CodeMethodInvokeExpression miExp = (CodeMethodInvokeExpression)castExp.Expression;
                            miExp.Method.MethodName = PascalCaseConverterHelper.GetPascalCaseMethodName(miExp.Method.MethodName);
                        }
                    }
                    else if (typeof(CodeMethodInvokeExpression) == vdeclStatement.InitExpression.GetType())
                    {
                        CodeMethodInvokeExpression miExp = (CodeMethodInvokeExpression)vdeclStatement.InitExpression;
                        miExp.Method.MethodName = PascalCaseConverterHelper.GetPascalCaseMethodName(miExp.Method.MethodName);
                    }
                }
            }
            else if (typeof(CodeExpressionStatement) == statement.GetType())
            {
                CodeExpressionStatement ceStatement = (CodeExpressionStatement)statement;
                if (typeof(CodeMethodInvokeExpression) == ceStatement.Expression.GetType())
                {
                    CodeMethodInvokeExpression miExp = (CodeMethodInvokeExpression)ceStatement.Expression;
                    miExp.Method.MethodName = PascalCaseConverterHelper.GetPascalCaseMethodName(miExp.Method.MethodName);
                }
            }
            else if (typeof(CodeAssignStatement) == statement.GetType())
            {
                CodeAssignStatement asnStatement = (CodeAssignStatement)statement;
                if (typeof(CodeCastExpression) == asnStatement.Right.GetType())
                {
                    CodeCastExpression castExp = (CodeCastExpression)asnStatement.Right;
                    if (typeof(CodeMethodInvokeExpression) == castExp.Expression.GetType())
                    {
                        CodeMethodInvokeExpression miExp = (CodeMethodInvokeExpression)castExp.Expression;
                        miExp.Method.MethodName = PascalCaseConverterHelper.GetPascalCaseMethodName(miExp.Method.MethodName);
                    }
                }
                else if (typeof(CodeMethodInvokeExpression) == asnStatement.Right.GetType())
                {
                    CodeMethodInvokeExpression miExp = (CodeMethodInvokeExpression)asnStatement.Right;
                    miExp.Method.MethodName = PascalCaseConverterHelper.GetPascalCaseMethodName(miExp.Method.MethodName);
                }
            }
            else if (typeof(CodeMethodReturnStatement) == statement.GetType())
            {
                CodeMethodReturnStatement retStatement = (CodeMethodReturnStatement)statement;
                if (typeof(CodeMethodInvokeExpression) == retStatement.Expression.GetType())
                {
                    CodeMethodInvokeExpression miExp = (CodeMethodInvokeExpression)retStatement.Expression;
                    miExp.Method.MethodName = PascalCaseConverterHelper.GetPascalCaseMethodName(miExp.Method.MethodName);
                }
            }
        }