Beispiel #1
0
        public static string createAllMethodsStreams(this O2MappedAstData astData, string targetFolder, ProgressBar TopProgressBar, Func <string, bool> statusMessage)
        {
            var iMethods = astData.iMethods(astData.methodDeclarations());

            TopProgressBar.maximum(iMethods.size());
            int count = 0;
            int total = iMethods.size();

            //this.MethodStreams = new Dictionary<IMethod, string>();
            foreach (var iMethod in iMethods)
            {
                TopProgressBar.increment(1);
                astData.createO2MethodStreamFile(iMethod, targetFolder);

                //MethodStreams.Add(iMethod,AstData.createO2MethodStream(iMethod).csharpCode());
                if (statusMessage.notNull())
                {
                    if (statusMessage("calculating methodStream: {0}/{1}".format(count++, total)).isFalse())
                    {
                        "Scan Cancel/Stop request received".info();
                        return(targetFolder);
                    }
                }
            }
            return(targetFolder);
        }
        public static O2MappedAstData showInTreeView(this O2MappedAstData o2MappedAstData, System.Windows.Forms.TreeView treeView)
        {
            treeView.clear();
            // Show AST objects
            var astNode = treeView.add_Node("ast");

            astNode.show_Asts(o2MappedAstData.compilationUnits());
            astNode.show_Asts(o2MappedAstData.typeDeclarations());
            astNode.show_Asts(o2MappedAstData.methodDeclarations());
            // add GetAllNodes to mapAstWithDom object : var name AllAstNodes
            //			var allNodes = new GetAllINodes().loadCode(code);
            //			treeView.add_Node("All Nodes (by type)").add_Nodes(allNodes.NodesByType);
            // Show CodeDom objects
            var domNode = treeView.add_Node("dom");

            domNode.add_Node("CodeNamespaces").show_CodeDom(o2MappedAstData.codeNamespaces());
            domNode.add_Node("CodeTypeDeclarations").show_CodeDom(o2MappedAstData.codeTypeDeclarations());
            domNode.add_Node("CodeMemberMethods").show_CodeDom(o2MappedAstData.codeMemberMethods());

            treeView.add_Node("NRefactory").show_NRefactoryDom(o2MappedAstData.iCompilationUnits())
            .show_NRefactoryDom(o2MappedAstData.iClasses())
            .show_NRefactoryDom(o2MappedAstData.iMethods());


            return(o2MappedAstData);
        }