예제 #1
0
 public static void populateFunctionViewerWithTreeViewData(ascx_FunctionsViewer afvFunctionViewer,
                                                           TreeView tvWithData)
 {
     var lsSignatures = new List<string>();
     foreach (TreeNode tnTreeNode in tvWithData.Nodes)
         lsSignatures.Add(tnTreeNode.Name);
     afvFunctionViewer.showSignatures(lsSignatures);
 }
        public static void viewClassMethods(ascx_FunctionsViewer targetFunctionsViewer , ICirClass targetClass, bool showInheritedMethods, bool ignoreCoreObjectClass)
        {
            if (targetClass != null)
            {
                O2Thread.mtaThread(
                    () =>
                        {
                            targetFunctionsViewer.clearLoadedSignatures();
                            targetFunctionsViewer.setNamespaceDepth(0);
                            var signaturesToShow = new List<string>();
                            if (showInheritedMethods)
                            {
                                List<ICirFunction> inheritedSignatures = CirDataAnalysisUtils.getListOfInheritedMethods(targetClass, ignoreCoreObjectClass);
                                foreach (var inheritedSignature in inheritedSignatures)
                                    signaturesToShow.Add(inheritedSignature.FunctionSignature);
                            }
                            else
                                signaturesToShow.AddRange(targetClass.dFunctions.Keys.ToList());
                            
                            targetFunctionsViewer.showSignatures(signaturesToShow);
                            /*var thread = targetFunctionsViewer.showSignatures(signaturesToShow);
                            if (thread != null)
                            {
                                thread.Join();
                                targetFunctionsViewer.expandNodes();
                            } */                                                     
                        });
            }

        }
        // DC: need to find a more optimized way to do this (this is 4am code :)  )
        public static void showFilteredMethods(bool useRegExSearch,string methodType, string methodName, string parameterType, string returnType, List<FilteredSignature> filteredSignatures, ascx_FunctionsViewer functionsViewer)
        {
            var typesFilter = new List<FilteredSignature>();
            var methodsFilter = new List<FilteredSignature>();
            var parametersFilter = new List<FilteredSignature>();
            var returnTypeFilter = new List<FilteredSignature>();

            // methodType
            if (methodType == "")
                typesFilter = filteredSignatures;
            else
                foreach (var filteredSignature in filteredSignatures)
                {
                    if (useRegExSearch)
                    {
                        if (RegEx.findStringInString(filteredSignature.sFunctionClass, methodType))
                            typesFilter.Add(filteredSignature);
                    }
                    else
                        if (filteredSignature.sFunctionClass.Contains(methodType))
                            typesFilter.Add(filteredSignature);
                }

            // methodName
            if (methodName == "")
                methodsFilter = typesFilter;
            else
                foreach (var filteredSignature in typesFilter)
                {
                    if (useRegExSearch)
                    {
                        if (RegEx.findStringInString(filteredSignature.sFunctionName, methodName))
                            methodsFilter.Add(filteredSignature);
                    }
                    else
                        if (filteredSignature.sFunctionName.Contains(methodName))
                            methodsFilter.Add(filteredSignature);
                }

            // parameterType
            if (parameterType == "")
                parametersFilter = methodsFilter;
            else
                foreach (var filteredSignature in methodsFilter)
                {
                    if (useRegExSearch)
                    {
                        if (RegEx.findStringInString(filteredSignature.sParameters, parameterType))
                            parametersFilter.Add(filteredSignature);
                    }
                    else
                        if (filteredSignature.sParameters.Contains(parameterType))
                            parametersFilter.Add(filteredSignature);
                }
            // returnType
            if (returnType == "")
                returnTypeFilter = parametersFilter;
            else
                foreach (var filteredSignature in parametersFilter)
                {
                    if (useRegExSearch)
                    {
                        if (RegEx.findStringInString(filteredSignature.sReturnClass, returnType))
                            returnTypeFilter.Add(filteredSignature);
                    }
                    else
                        if (filteredSignature.sReturnClass.Contains(returnType))
                            returnTypeFilter.Add(filteredSignature);
                }
            // get list of signatures to show using the last filter result (returnTypeFilter)
            var signaturesToShow = new List<string>();
            foreach (var filteredSignature in returnTypeFilter)
                signaturesToShow.Add(filteredSignature.sSignature);
            functionsViewer.showSignatures(signaturesToShow);
        }