예제 #1
0
 static void Main(string[] args)
 {
     string path = @"D:\gsoc related\ClassDiagramRelated\Class-Diagram-for-Mono\ClassDiagram.sln";
     Solution solution = new Solution(path);
     RoslynRun r = new RoslynRun();
     UMLClass result = r.AnalyzeCode(solution);
     UMLTree tree = new UMLTree(result);
     tree.BuildGraph();
 }
        /// <summary>
        /// The resolved type system for this project.
        /// This field is initialized once all projects have been loaded (in Solution constructor).
        /// </summary>
        public CSharpProject(Solution solution, string title, string fileName)
        {
            // Normalize the file name
            fileName = Path.GetFullPath(fileName);

            this.Solution = solution;
            this.Title = title;
            this.FileName = fileName;

            // Use MSBuild to open the .csproj
            var msbuildProject = new Microsoft.Build.Evaluation.Project(fileName);
            // Figure out some compiler settings
            this.AssemblyName = msbuildProject.GetPropertyValue("AssemblyName");

            // Parse the C# code files
            foreach (var item in msbuildProject.GetItems("Compile"))
            {
                var file = new CSharpFile(this, Path.Combine(msbuildProject.DirectoryPath, item.EvaluatedInclude));
                Files.Add(file);
            }
        }