Portfolio.Web 1.0.0.0
.NET, Blazor, WPF와 서비스 운영 경험을 프로젝트·이력·기술 스택 단위로 보여주는 개발자 포트폴리오입니다.
로딩중...
검색중...
일치하는것 없음
PortfolioApp.Services.LocalMediaService 클래스 참조

더 자세히 ...

PortfolioApp.Services.LocalMediaService에 대한 상속 다이어그램 :
PortfolioApp.Services.LocalMediaService에 대한 협력 다이어그램:

Public 멤버 함수

 LocalMediaService (PortfolioOptions opts)
async Task< string > SaveAsync (string slug, string projectId, IBrowserFile file)
async Task< string > SaveVideoAsync (string slug, string projectId, IBrowserFile file)
Task DeleteAsync (string slug, string projectId, string fileName)
async Task< string > SaveProfileImageAsync (string slug, IBrowserFile file)
string GetMediaUrl (string slug, string projectId, string fileName)
string GetProfileImageUrl (string slug, string fileName)

Private 속성

readonly string _root

정적 Private 속성

const long MaxImageBytes = 20 * 1024 * 1024
const long MaxVideoBytes = 500 * 1024 * 1024

상세한 설명

Local Media Service 기능과 관련 상태를 캡슐화합니다.

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

생성자 & 소멸자 문서화

◆ LocalMediaService()

PortfolioApp.Services.LocalMediaService.LocalMediaService ( PortfolioOptions opts)
inline

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

매개변수
optsopts에 사용할 PortfolioOptions 값입니다.

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

60=> _root = opts.ResolvedDataPath;

다음을 참조함 : _root.

멤버 함수 문서화

◆ DeleteAsync()

Task PortfolioApp.Services.LocalMediaService.DeleteAsync ( string slug,
string projectId,
string fileName )
inline

Delete Async 작업을 수행합니다.

매개변수
slugslug에 사용할 string 값입니다.
projectIdproject Id에 사용할 string 값입니다.
fileNamefile Name에 사용할 string 값입니다.
반환값
Delete Async 작업에서 생성한 Task 결과입니다.

PortfolioApp.Services.IMediaService를 구현.

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

207 {
208 var path = Path.Combine(_root, slug, "media", projectId, fileName);
209 if (File.Exists(path)) File.Delete(path);
210 return Task.CompletedTask;
211 }

다음을 참조함 : _root.

◆ GetMediaUrl()

string PortfolioApp.Services.LocalMediaService.GetMediaUrl ( string slug,
string projectId,
string fileName )
inline

Media Url 값을 가져옵니다.

매개변수
slugslug에 사용할 string 값입니다.
projectIdproject Id에 사용할 string 값입니다.
fileNamefile Name에 사용할 string 값입니다.
반환값
Get Media Url 작업에서 생성한 string 결과입니다.

PortfolioApp.Services.IMediaService를 구현.

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

297 =>
298 $"/portfolio-data/{slug}/media/{projectId}/{Uri.EscapeDataString(fileName)}";

◆ GetProfileImageUrl()

string PortfolioApp.Services.LocalMediaService.GetProfileImageUrl ( string slug,
string fileName )
inline

Profile Image Url 값을 가져옵니다.

매개변수
slugslug에 사용할 string 값입니다.
fileNamefile Name에 사용할 string 값입니다.
반환값
Get Profile Image Url 작업에서 생성한 string 결과입니다.

PortfolioApp.Services.IMediaService를 구현.

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

332 =>
333 $"/portfolio-data/{slug}/media/_profile/{Uri.EscapeDataString(fileName)}";

◆ SaveAsync()

async Task< string > PortfolioApp.Services.LocalMediaService.SaveAsync ( string slug,
string projectId,
IBrowserFile file )
inline

Async 데이터를 저장합니다.

매개변수
slugslug에 사용할 string 값입니다.
projectIdproject Id에 사용할 string 값입니다.
filefile에 사용할 IBrowserFile 값입니다.
반환값
Save Async 작업에서 생성한 Task<string> 결과입니다.

PortfolioApp.Services.IMediaService를 구현.

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

103 {
104 var dir = Path.Combine(_root, slug, "media", projectId);
105 Directory.CreateDirectory(dir);
106 var ext = Path.GetExtension(file.Name).ToLowerInvariant();
107 var safe = $"{Guid.NewGuid():N}{ext}";
108 var path = Path.Combine(dir, safe);
109 await using var fs = new FileStream(path, FileMode.Create);
110 await file.OpenReadStream(MaxImageBytes).CopyToAsync(fs);
111 return safe;
112 }

다음을 참조함 : _root, MaxImageBytes.

◆ SaveProfileImageAsync()

async Task< string > PortfolioApp.Services.LocalMediaService.SaveProfileImageAsync ( string slug,
IBrowserFile file )
inline

Profile Image Async 데이터를 저장합니다.

매개변수
slugslug에 사용할 string 값입니다.
filefile에 사용할 IBrowserFile 값입니다.
반환값
Save Profile Image Async 작업에서 생성한 Task<string> 결과입니다.

PortfolioApp.Services.IMediaService를 구현.

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

246 {
247 var dir = Path.Combine(_root, slug, "media", "_profile");
248 Directory.CreateDirectory(dir);
249 var ext = Path.GetExtension(file.Name).ToLowerInvariant();
250 var safe = $"profile{ext}";
251 var path = Path.Combine(dir, safe);
252 await using var fs = new FileStream(path, FileMode.Create);
253 await file.OpenReadStream(MaxImageBytes).CopyToAsync(fs);
254 return safe;
255 }

다음을 참조함 : _root, MaxImageBytes.

◆ SaveVideoAsync()

async Task< string > PortfolioApp.Services.LocalMediaService.SaveVideoAsync ( string slug,
string projectId,
IBrowserFile file )
inline

Video Async 데이터를 저장합니다.

매개변수
slugslug에 사용할 string 값입니다.
projectIdproject Id에 사용할 string 값입니다.
filefile에 사용할 IBrowserFile 값입니다.
반환값
Save Video Async 작업에서 생성한 Task<string> 결과입니다.

PortfolioApp.Services.IMediaService를 구현.

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

155 {
156 var dir = Path.Combine(_root, slug, "media", projectId);
157 Directory.CreateDirectory(dir);
158 var ext = Path.GetExtension(file.Name).ToLowerInvariant();
159 var safe = $"vid_{Guid.NewGuid():N}{ext}";
160 var path = Path.Combine(dir, safe);
161 await using var fs = new FileStream(path, FileMode.Create);
162 await file.OpenReadStream(MaxVideoBytes).CopyToAsync(fs);
163 return safe;
164 }

다음을 참조함 : _root, MaxVideoBytes.

멤버 데이터 문서화

◆ _root

readonly string PortfolioApp.Services.LocalMediaService._root
private

root 값을 보관합니다.

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

다음에 의해서 참조됨 : DeleteAsync(), LocalMediaService(), SaveAsync(), SaveProfileImageAsync(), SaveVideoAsync().

◆ MaxImageBytes

const long PortfolioApp.Services.LocalMediaService.MaxImageBytes = 20 * 1024 * 1024
staticprivate

Max Image Bytes 값을 보관합니다.

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

다음에 의해서 참조됨 : SaveAsync(), SaveProfileImageAsync().

◆ MaxVideoBytes

const long PortfolioApp.Services.LocalMediaService.MaxVideoBytes = 500 * 1024 * 1024
staticprivate

Max Video Bytes 값을 보관합니다.

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

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


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