private ApexTypeSyntax ConvertBaseType(BaseTypeSyntax csharpType)
        {
            if (csharpType != null)
            {
                return(new ApexTypeSyntax(csharpType.ToString()));
            }

            return(null);
        }
Exemple #2
0
        private SyntaxTree findMainTree(Project project)
        {
            SyntaxTree result = null;

            if (project != null && project.Documents != null && project.Documents.Count() > 0)
            {
                foreach (Document doc in project.Documents)
                {
                    SyntaxTree tree = doc.GetSyntaxTreeAsync().Result;
                    if (tree != null)
                    {
                        ClassDeclarationSyntax mainClass = ProjectAnalyzerHelper.GetMainClass(tree);
                        if (mainClass != null)
                        {
                            BaseListSyntax baseList = mainClass.BaseList;
                            if (baseList != null)
                            {
                                SeparatedSyntaxList <BaseTypeSyntax> types = baseList.Types;
                                if (types != null && types.Count() > 0)
                                {
                                    BaseTypeSyntax baseType = types.First();
                                    if (baseType != null)
                                    {
                                        if (baseType.ToString() == ProjectAnalyzer.DefaultProgramBaseType)
                                        {
                                            result = doc.GetSyntaxTreeAsync().Result;
                                            Console.Out.WriteLine("Found program file: " + doc.FilePath);
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }