-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommands.cs
More file actions
40 lines (34 loc) · 1.22 KB
/
Commands.cs
File metadata and controls
40 lines (34 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using MermaidGraph.Diagrams;
namespace MermaidGraph;
/// <summary>
/// The commands that can be run by `mermaid-graph`.
/// </summary>
public class Commands
{
/// <summary>
/// Generate the dependency graph of a Visual Studio Project.
/// </summary>
/// <param name="file">`.csproj` file.</param>
/// <param name="diagramType"></param>
public static string Project(FileInfo file, DiagramType diagramType = DiagramType.Graph)
{
var graph = GetGraphType(diagramType);
return graph.Project(file);
}
/// <summary>
/// Generate the dependency graph of a Visual Studio Solution.
/// </summary>
/// <param name="file">`.sln` file.</param>
/// <param name="diagramType"></param>
public static string Solution(FileInfo file, DiagramType diagramType = DiagramType.Graph)
{
var graph = GetGraphType(diagramType);
return graph.Solution(file);
}
private static IMermaidDiagram GetGraphType(DiagramType diagramType) => diagramType switch
{
DiagramType.Class => new ClassDiagram(),
DiagramType.Graph => new GraphDiagram(),
_ => throw new NotImplementedException($"Option not supported: {diagramType}"),
};
}