Dreamine.Web
1.0.0.0
WPF와 Blazor를 한 코드 흐름으로 연결하고 반복적인 MVVM 코드를 줄이는 오픈소스 FullKit 공식 웹 애플리케이션입니다.
Toggle main menu visibility
로딩중...
검색중...
일치하는것 없음
XmlDocAutoLinker.cs
이 파일의 문서화 페이지로 가기
1
using
System.IO;
2
using
DreamineWeb.Models
;
3
4
namespace
DreamineWeb.Services
;
5
14
public
class
XmlDocAutoLinker
15
{
24
private
readonly
ILibraryStore
_store
;
33
private
readonly
string
_xmlDocRoot
;
34
51
public
XmlDocAutoLinker
(
ILibraryStore
store)
52
{
53
_store
= store;
54
_xmlDocRoot
= Path.Combine(AppContext.BaseDirectory,
"wwwroot"
,
"xmldocs"
);
55
}
56
73
public
async Task<int>
LinkAsync
()
74
{
75
if
(!Directory.Exists(
_xmlDocRoot
))
return
0;
76
77
// wwwroot/xmldocs/{LibraryName}/{LibraryName}.xml 구조로 탐색
78
var map =
new
Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
79
foreach
(var dir
in
Directory.EnumerateDirectories(
_xmlDocRoot
))
80
{
81
var libName = Path.GetFileName(dir);
82
var xmlPath = Path.Combine(dir, $
"{libName}.xml"
);
83
if
(File.Exists(xmlPath))
84
map[libName] = xmlPath;
85
}
86
87
var libs = (await
_store
.GetAllAsync()).ToList();
88
int
count = 0;
89
90
foreach
(var lib
in
libs)
91
{
92
// 이미 설정된 경우 건너뜀
93
if
(!
string
.IsNullOrEmpty(lib.XmlDocPath) && File.Exists(lib.XmlDocPath))
continue
;
94
95
if
(map.TryGetValue(lib.Name, out var path))
96
{
97
lib.XmlDocPath = path;
98
await
_store
.SaveAsync(lib);
99
count++;
100
}
101
}
102
103
return
count;
104
}
105
}
DreamineWeb.Models
Definition
DocMember.cs:1
DreamineWeb.Services
Definition
AdminAuthService.cs:6
DreamineWeb.Services.ILibraryStore
Definition
ILibraryStore.cs:14
DreamineWeb.Services.XmlDocAutoLinker._store
readonly ILibraryStore _store
Definition
XmlDocAutoLinker.cs:24
DreamineWeb.Services.XmlDocAutoLinker.LinkAsync
async Task< int > LinkAsync()
Definition
XmlDocAutoLinker.cs:73
DreamineWeb.Services.XmlDocAutoLinker.XmlDocAutoLinker
XmlDocAutoLinker(ILibraryStore store)
Definition
XmlDocAutoLinker.cs:51
DreamineWeb.Services.XmlDocAutoLinker._xmlDocRoot
readonly string _xmlDocRoot
Definition
XmlDocAutoLinker.cs:33
Services
XmlDocAutoLinker.cs
다음에 의해 생성됨 :
1.17.0