Dreamine.Web 1.0.0.0
WPF와 Blazor를 한 코드 흐름으로 연결하고 반복적인 MVVM 코드를 줄이는 오픈소스 FullKit 공식 웹 애플리케이션입니다.
로딩중...
검색중...
일치하는것 없음
DocumentationCatalogService.cs
이 파일의 문서화 페이지로 가기
2using Microsoft.AspNetCore.Hosting;
3using System.IO;
4using System.Text.Json;
5
7
16public sealed class DocumentationCatalogService
17{
26 private readonly IWebHostEnvironment _environment;
27
36 private IReadOnlyList<DocumentationProjectInfo>? _projects;
37
62 public DocumentationCatalogService(IWebHostEnvironment environment)
63 {
64 _environment = environment ?? throw new ArgumentNullException(nameof(environment));
65 }
66
91 public IReadOnlyList<DocumentationProjectInfo> GetProjects()
92 {
93 if (_projects is not null)
94 return _projects;
95
96 string catalogPath = Path.Combine(_environment.WebRootPath, "understand", "project-catalog.json");
97 if (!File.Exists(catalogPath))
98 throw new FileNotFoundException("Project documentation catalog was not generated. Run Publish-UnderstandDashboard.ps1.", catalogPath);
99
100 using FileStream stream = File.OpenRead(catalogPath);
101 DocumentationProjectCatalog catalog = JsonSerializer.Deserialize<DocumentationProjectCatalog>(stream, new JsonSerializerOptions
102 {
103 PropertyNameCaseInsensitive = true
104 }) ?? new DocumentationProjectCatalog();
105 _projects = catalog.Projects.OrderBy(project => project.Category).ThenBy(project => project.Name).ToArray();
106 return _projects;
107 }
108}
IReadOnlyList< DocumentationProjectInfo > GetProjects()
IReadOnlyList< DocumentationProjectInfo >? _projects