コード例 #1
0
            async Task ExportToPlantUml(RelationsGraph relationsGraph)
            {
                var exporter = new PlantumlExporter(CreatePlantUmlTypeWriter(), new EscapingTypenameConverter());

                var relationsInNamespaces = relationsGraph.AsNamespaceTree();

                await exporter.CreateClassDiagramFile(outputFileName, relationsInNamespaces);
            }
コード例 #2
0
        public async Task <IActionResult> ProcessSolution([FromBody] WebHook webHook)
        {
            // string path = "CleanArchitecture";
            string path = "TestProject";

            // TODO: This Filter should later be served from Filter functionality on the Frontend
            var filter = new Filter();

            /*filter.Projects.Add("TestProject");
             * filter.Documents.Add("Program1");
             * filter.Documents.Add("Program2");
             * filter.Methods.Add("Main");
             * filter.Methods.Add("Program1TestFunction1");*/

            var solution = await _solutionService.LoadSolution(path);

            var listItems = _solutionService.GetSolutionItems(solution, filter).ToList();

            var lististItems = RelationsGraph.BuildTree(listItems)
                               .Where(item => item.GetType().Name == ItemType.Class.ToString() ||
                                      item.GetType().Name == ItemType.Method.ToString() ||
                                      item.GetType().Name == ItemType.Comment.ToString() ||
                                      item.GetType().Name == ItemType.Namespace.ToString())
                               .ToList();

            List <Node> graphNodes = new List <Node>();
            List <Edge> graphEdges = new List <Edge>();
            NodeData    nodeData   = new NodeData();

            foreach (var item in listItems)
            {
                nodeData           = _mapper.Map <NodeData>(item);
                nodeData.colorCode = "orange";
                nodeData.weight    = 100;
                nodeData.shapeType = "roundrectangle";
                nodeData.nodeType  = item.GetType().ToString();
                graphNodes.Add(new Node
                {
                    data = nodeData
                });
            }

            graphEdges = _relationsGraphMapper.MapItemsToEdges(listItems);

            var relationGraph = new Root
            {
                nodes = graphNodes,
                edges = graphEdges
            };

            return(Ok(relationGraph));
        }