Codemaru 1.0.0.0
QR 코드, 모바일 랜딩 페이지, vCard 연락처 저장과 명함 디자인을 한 화면에서 제공하는 디지털 명함 서비스입니다.
로딩중...
검색중...
일치하는것 없음
Codemaru.Services.LandingPagePublisher 클래스 참조sealed

더 자세히 ...

Public 멤버 함수

 LandingPagePublisher (IOptions< LandingPagePublishOptions > options)
Task< LandingPagePublishResultPublishIndexAsync (CardProfile profile, string html, CancellationToken cancellationToken=default)

정적 Private 멤버 함수

static async Task< LandingPagePublishResultWriteAsync (CardProfile profile, string html, string filePath, string[] slugSegments, CancellationToken cancellationToken)
static string[] NormalizeSlug (string slug)
static string BuildPublicUrl (CardProfile profile, string[] slugSegments)

Private 속성

readonly string _webRootPath

상세한 설명

Landing Page Publisher 기능과 관련 상태를 캡슐화합니다.

LandingPagePublisher.cs 파일의 46 번째 라인에서 정의되었습니다.

생성자 & 소멸자 문서화

◆ LandingPagePublisher()

Codemaru.Services.LandingPagePublisher.LandingPagePublisher ( IOptions< LandingPagePublishOptions > options)
inline

지정한 설정으로 LandingPagePublisher 클래스의 새 인스턴스를 초기화합니다.

매개변수
options동작을 구성하는 설정입니다.

LandingPagePublisher.cs 파일의 74 번째 라인에서 정의되었습니다.

75 {
76 var configuredPath = options.Value.WebRootPath;
77 _webRootPath = string.IsNullOrWhiteSpace(configuredPath)
78 ? Path.Combine(AppContext.BaseDirectory, "wwwroot")
79 : Path.GetFullPath(configuredPath);
80 }

다음을 참조함 : _webRootPath.

멤버 함수 문서화

◆ BuildPublicUrl()

string Codemaru.Services.LandingPagePublisher.BuildPublicUrl ( CardProfile profile,
string[] slugSegments )
inlinestaticprivate

Public Url 값을 구성합니다.

매개변수
profileprofile에 사용할 CardProfile 값입니다.
slugSegmentsslug Segments에 사용할 string[] 값입니다.
반환값
Build Public Url 작업에서 생성한 string 결과입니다.

LandingPagePublisher.cs 파일의 294 번째 라인에서 정의되었습니다.

295 {
296 var website = string.IsNullOrWhiteSpace(profile.Website)
297 ? string.Empty
298 : profile.Website.Trim().TrimEnd('/');
299
300 var slug = string.Join("/", slugSegments);
301 if (string.IsNullOrWhiteSpace(website))
302 {
303 return "/" + slug + "/";
304 }
305
306 return website.EndsWith($"/{slug}", StringComparison.OrdinalIgnoreCase)
307 ? website + "/"
308 : $"{website}/{slug}/";
309 }

다음을 참조함 : Codemaru.Models.CardProfile().

다음에 의해서 참조됨 : WriteAsync().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ NormalizeSlug()

string[] Codemaru.Services.LandingPagePublisher.NormalizeSlug ( string slug)
inlinestaticprivate

Normalize Slug 작업을 수행합니다.

매개변수
slugslug에 사용할 string 값입니다.
반환값
Normalize Slug 작업에서 생성한 string[] 결과입니다.

LandingPagePublisher.cs 파일의 254 번째 라인에서 정의되었습니다.

255 {
256 return CardLandingPath.Split(slug)
257 .Select(CardLandingPath.Slugify)
258 .Where(static segment => !string.IsNullOrWhiteSpace(segment))
259 .ToArray();
260 }

다음을 참조함 : Codemaru.Services.CardLandingPath.Slugify(), Codemaru.Services.CardLandingPath.Split().

다음에 의해서 참조됨 : PublishIndexAsync().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ PublishIndexAsync()

Task< LandingPagePublishResult > Codemaru.Services.LandingPagePublisher.PublishIndexAsync ( CardProfile profile,
string html,
CancellationToken cancellationToken = default )
inline

Publish Index Async 작업을 수행합니다.

매개변수
profileprofile에 사용할 CardProfile 값입니다.
htmlhtml에 사용할 string 값입니다.
cancellationToken취소 요청을 감시하는 토큰입니다.
반환값
Publish Index Async 작업에서 생성한 Task<LandingPagePublishResult> 결과입니다.
예외
InvalidOperationException현재 객체 상태에서 Publish Index Async 작업을 수행할 수 없는 경우 발생합니다.

LandingPagePublisher.cs 파일의 130 번째 라인에서 정의되었습니다.

134 {
135 ArgumentNullException.ThrowIfNull(profile);
136
137 if (string.IsNullOrWhiteSpace(html))
138 {
139 throw new InvalidOperationException("저장할 HTML이 없습니다.");
140 }
141
142 var slugSegments = NormalizeSlug(profile.LandingSlug);
143 if (slugSegments.Length == 0)
144 {
145 throw new InvalidOperationException("랜딩 슬러그를 입력해 주세요.");
146 }
147
148 var targetDirectory = _webRootPath;
149 foreach (var segment in slugSegments)
150 {
151 targetDirectory = Path.Combine(targetDirectory, segment);
152 }
153 Directory.CreateDirectory(targetDirectory);
154
155 var filePath = Path.Combine(targetDirectory, "index.html");
156 return WriteAsync(profile, html, filePath, slugSegments, cancellationToken);
157 }

다음을 참조함 : _webRootPath, Codemaru.Models.CardProfile(), NormalizeSlug(), WriteAsync().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ WriteAsync()

async Task< LandingPagePublishResult > Codemaru.Services.LandingPagePublisher.WriteAsync ( CardProfile profile,
string html,
string filePath,
string[] slugSegments,
CancellationToken cancellationToken )
inlinestaticprivate

Async 데이터를 씁니다.

매개변수
profileprofile에 사용할 CardProfile 값입니다.
htmlhtml에 사용할 string 값입니다.
filePathfile Path에 사용할 string 값입니다.
slugSegmentsslug Segments에 사용할 string[] 값입니다.
cancellationToken취소 요청을 감시하는 토큰입니다.
반환값
Write Async 작업에서 생성한 Task<LandingPagePublishResult> 결과입니다.

LandingPagePublisher.cs 파일의 215 번째 라인에서 정의되었습니다.

221 {
222 await File.WriteAllTextAsync(filePath, html, cancellationToken).ConfigureAwait(false);
223
224 var publicPath = "/" + string.Join("/", slugSegments) + "/index.html";
225 var publicUrl = BuildPublicUrl(profile, slugSegments);
226
227 return new LandingPagePublishResult(filePath, publicPath, publicUrl);
228 }
record LandingPagePublishResult(string FilePath, string PublicPath, string PublicUrl)

다음을 참조함 : BuildPublicUrl(), Codemaru.Models.CardProfile(), Codemaru.Services.LandingPagePublishResult().

다음에 의해서 참조됨 : PublishIndexAsync().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

멤버 데이터 문서화

◆ _webRootPath

readonly string Codemaru.Services.LandingPagePublisher._webRootPath
private

web Root Path 값을 보관합니다.

LandingPagePublisher.cs 파일의 56 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : LandingPagePublisher(), PublishIndexAsync().


이 클래스에 대한 문서화 페이지는 다음의 파일로부터 생성되었습니다.: