public static Dictionary <string, List <KeyValuePair <INode, IMethodOrProperty> > > externalMethodsAndProperties(this O2MappedAstData astData, IMethod iMethod)
        {
            var externalMethods = new Dictionary <string, List <KeyValuePair <INode, IMethodOrProperty> > >();

            // add the current method

            externalMethods.add(iMethod.DotNetName, new KeyValuePair <INode, IMethodOrProperty>(astData.methodDeclaration(iMethod), iMethod));

            var iNodesAdded = new List <INode>();

            foreach (var methodCalled in astData.calledINodesReferences(iMethod))
            {
                if (methodCalled is MemberReferenceExpression)
                {
                    var memberRef = (MemberReferenceExpression)methodCalled;
                    {
                        var methodOrProperty = astData.fromMemberReferenceExpressionGetIMethodOrProperty(memberRef);
                        if (methodOrProperty.notNull())
                        {
                            externalMethods.add(methodOrProperty.DotNetName, new KeyValuePair <INode, IMethodOrProperty>(memberRef, methodOrProperty));
                            iNodesAdded.Add(memberRef);
                        }
                        else
                        {
                            externalMethods.add(astData.getTextForINode(memberRef), new KeyValuePair <INode, IMethodOrProperty>(memberRef, null));
                        }
                    }
                }
            }


            foreach (var mapping in astData.calledIMethods_getMappings(iMethod))
            {
                var iMethodMapping = mapping.Key;
                var iNodeMapping   = mapping.Value;
                if (iNodesAdded.Contains(iNodeMapping).isFalse())
                {
                    if (iNodeMapping is ObjectCreateExpression ||
                        ((iNodeMapping is InvocationExpression &&
                          (iNodeMapping as InvocationExpression).TargetObject.notNull() &&
                          iNodesAdded.Contains((iNodeMapping as InvocationExpression).TargetObject).isFalse())))
                    {
                        var nodeText = (iMethodMapping.notNull())
                                                                                                ? iMethodMapping.DotNetName
                                                                                                : astData.getTextForINode(iNodeMapping);
                        externalMethods.add(nodeText, new KeyValuePair <INode, IMethodOrProperty>(iNodeMapping, iMethodMapping));
                    }
                }
            }

            return(externalMethods);
        }
        public static T view_AstNodes_SourceCode_Locations <T>(this O2MappedAstData astData, List <AbstractNode> astNodes, T control)
            where T : Control
        {
            var codeViewer = control.add_SourceCodeViewer();
            var treeView   = codeViewer.insert_Left <Panel>(400).add_TreeView().sort();

            astData.afterSelect_ShowInSourceCodeEditor(treeView, codeViewer.editor());
            foreach (var astNode in astNodes)
            {
                treeView.add_Node("{0}   -    {1}".format(astData.getTextForINode(astNode), astNode), astNode);
            }
            treeView.selectFirst();
            return(control);
        }
        public static string add_Properties(this O2MappedAstData astData, string targetFolder)
        {
            //return methodMappingsIndexedBySignature;
            //handle Properties
            var propertyMappings = new Dictionary <string, List <KeyValuePair <INode, IMethodOrProperty> > >();
//			show.info(methodMappingsIndexedBySignature);

            var fileName = "_MethodMapings_For_Properties";
            //var md5Hash = fullName.safeFileName().md5Hash();
            var savedPropertiesMappingsFile = targetFolder.pathCombine(fileName) + ".xml";

            if (savedPropertiesMappingsFile.fileExists())
            {
                return(savedPropertiesMappingsFile);
            }

            var propertyRefs = new List <INode>();

            foreach (var propertyDeclaration in astData.MapAstToNRefactory.IPropertyToPropertyDeclaration.Values)
            {
                "Mapping property: {0}".info(propertyDeclaration.Name);

                propertyRefs.add(propertyDeclaration.iNodes <INode, MemberReferenceExpression>());
                propertyRefs.add(propertyDeclaration.iNodes <INode, InvocationExpression>());
                propertyRefs.add(propertyDeclaration.iNodes <INode, ObjectCreateExpression>());
            }
//			show.info(propertyRefs);
            try
            {
                foreach (Expression propertyRef in propertyRefs)
                {
                    var methodOrProperty = astData.fromExpressionGetIMethodOrProperty(propertyRef);
                    var nodeText         = astData.getTextForINode(propertyRef);             // propertyRef.str();
                    propertyMappings.add(nodeText, new KeyValuePair <INode, IMethodOrProperty>(propertyRef, methodOrProperty));
                }
            }
            catch (Exception ex)
            {
                ex.log("in add_Property");
            }
            var tempFile = astData.saveMappings(propertyMappings);

            if (tempFile.fileExists())
            {
                Files.MoveFile(tempFile, savedPropertiesMappingsFile);
            }
            return(savedPropertiesMappingsFile);
            /// PROPERTIES
        }