Exemple #1
0
        public void DefaultAssemblyPathIsFound()
        {
            AssemblyHelper.CompileAssemblies();
            var paths = AssemblyHelper.GetCompiledAssemblyPaths();

            Assert.Positive(paths.Count());
            Assert.NotNull(paths.FirstOrDefault(path => path.Contains("Assembly-CSharp.dll")));
        }
Exemple #2
0
        public void Audit(ProjectReport projectReport, IProgressBar progressBar = null)
        {
            if (!AssemblyHelper.CompileAssemblies())
            {
                return;
            }

            var callCrawler = new CallCrawler();

            using (var assemblyResolver = new DefaultAssemblyResolver())
            {
                var compiledAssemblyPaths = AssemblyHelper.GetCompiledAssemblyPaths();

                foreach (var dir in AssemblyHelper.GetPrecompiledAssemblyDirectories())
                {
                    assemblyResolver.AddSearchDirectory(dir);
                }

                foreach (var dir in AssemblyHelper.GetPrecompiledEngineAssemblyDirectories())
                {
                    assemblyResolver.AddSearchDirectory(dir);
                }

                foreach (var dir in AssemblyHelper.GetCompiledAssemblyDirectories())
                {
                    assemblyResolver.AddSearchDirectory(dir);
                }

                if (progressBar != null)
                {
                    progressBar.Initialize("Analyzing Scripts", "Analyzing project scripts", m_PlayerAssemblies.Length);
                }

                // Analyse all Player assemblies, including Package assemblies.
                foreach (var assemblyPath in compiledAssemblyPaths)
                {
                    if (progressBar != null)
                    {
                        progressBar.AdvanceProgressBar(string.Format("Analyzing {0} scripts", Path.GetFileName(assemblyPath)));
                    }

                    if (!File.Exists(assemblyPath))
                    {
                        Debug.LogError(assemblyPath + " not found.");
                        continue;
                    }

                    AnalyzeAssembly(assemblyPath, assemblyResolver, projectReport, callCrawler);
                }
            }

            if (progressBar != null)
            {
                progressBar.ClearProgressBar();
            }

            callCrawler.BuildCallHierarchies(projectReport, progressBar);
        }