DreamineVMS 1.0.0.0
Windows PC의 RTSP·USB 카메라 영상을 HLS로 변환해 원격 CCTV Viewer에 전달하는 데스크톱 에이전트입니다.
로딩중...
검색중...
일치하는것 없음
DreamineVMS.Hosting.VmsBlazorServerHostedService< TRootComponent > 클래스 템플릿 참조sealed

더 자세히 ...

DreamineVMS.Hosting.VmsBlazorServerHostedService< TRootComponent >에 대한 상속 다이어그램 :
DreamineVMS.Hosting.VmsBlazorServerHostedService< TRootComponent >에 대한 협력 다이어그램:

Public 멤버 함수

 VmsBlazorServerHostedService (IServiceProvider rootServiceProvider, IOptions< VmsServerOptions > options)
async Task StartAsync (CancellationToken cancellationToken)
async Task StopAsync (CancellationToken cancellationToken)

Private 멤버 함수

void RegisterSharedServices (IServiceCollection services)
void AddShared< TService > (IServiceCollection services)

정적 Private 멤버 함수

static void RegisterBlazorViewModels (IServiceCollection services)
static FileExtensionContentTypeProvider CreateHlsContentTypeProvider ()
static void RemoveRangeHeadersForHls (WebApplication app)
static void UseHlsStaticFiles (WebApplication app, FileExtensionContentTypeProvider contentTypes)
static bool IsHlsPath (PathString path)

Private 속성

readonly IServiceProvider _rootServiceProvider
readonly VmsServerOptions _options
IHost? _webHost

상세한 설명

DreamineVMS 전용 Blazor Server HostedService입니다.

템플릿 파라메터
TRootComponent루트 Razor 컴포넌트 타입입니다.
타입 한정자들
TRootComponent :IComponent 

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

멤버 함수 문서화

◆ AddShared< TService >()

void DreamineVMS.Hosting.VmsBlazorServerHostedService< TRootComponent >.AddShared< TService > ( IServiceCollection services)
inlineprivate

WPF Host에 이미 등록된 서비스를 Blazor Server DI에 공유 등록합니다.

템플릿 파라메터
TService공유할 서비스 타입입니다.
매개변수
servicesBlazor Server 서비스 컬렉션입니다.
타입 한정자들
TService :class 

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

312 : class
313 {
314 TService service = _rootServiceProvider.GetRequiredService<TService>();
315 services.AddSingleton(service);
316 }

다음을 참조함 : _rootServiceProvider.

◆ CreateHlsContentTypeProvider()

FileExtensionContentTypeProvider DreamineVMS.Hosting.VmsBlazorServerHostedService< TRootComponent >.CreateHlsContentTypeProvider ( )
inlinestaticprivate

HLS 파일 확장자에 대한 Content-Type Provider를 생성합니다.

반환값
HLS Content-Type Provider입니다.

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

335 {
336 FileExtensionContentTypeProvider contentTypes = new();
337
338 contentTypes.Mappings[".m3u8"] = "application/vnd.apple.mpegurl";
339 contentTypes.Mappings[".ts"] = "video/mp2t";
340 contentTypes.Mappings[".mp4"] = "video/mp4";
341
342 return contentTypes;
343 }

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

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

◆ IsHlsPath()

bool DreamineVMS.Hosting.VmsBlazorServerHostedService< TRootComponent >.IsHlsPath ( PathString path)
inlinestaticprivate

요청 경로가 HLS 파일인지 확인합니다.

매개변수
path요청 경로입니다.
반환값
HLS 파일이면 true입니다.

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

451 {
452 if (!path.HasValue)
453 {
454 return false;
455 }
456
457 return path.Value.EndsWith(".m3u8", StringComparison.OrdinalIgnoreCase)
458 || path.Value.EndsWith(".ts", StringComparison.OrdinalIgnoreCase);
459 }

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

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

◆ RegisterBlazorViewModels()

void DreamineVMS.Hosting.VmsBlazorServerHostedService< TRootComponent >.RegisterBlazorViewModels ( IServiceCollection services)
inlinestaticprivate

Blazor Server 전용 ViewModel 서비스를 등록합니다.

매개변수
servicesBlazor Server 서비스 컬렉션입니다.

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

281 {
282 services.AddScoped<LivePageViewModel>();
283 services.AddScoped<DashboardPageViewModel>();
284 services.AddScoped<VmsLocalDashboardViewModel>();
285 }

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

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

◆ RegisterSharedServices()

void DreamineVMS.Hosting.VmsBlazorServerHostedService< TRootComponent >.RegisterSharedServices ( IServiceCollection services)
inlineprivate

WPF Host와 Blazor Server가 공유해야 하는 서비스를 등록합니다.

매개변수
servicesBlazor Server 서비스 컬렉션입니다.

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

254 {
255 AddShared<IHybridMessageBus>(services);
256 AddShared<IHybridStateStore<VmsDashboardState>>(services);
257 AddShared<IVmsCameraRepository>(services);
258 AddShared<ICameraRuntimeStateService>(services);
259 AddShared<ICameraStreamService>(services);
260 AddShared<IVmsDashboardStateService>(services);
261
262 }

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

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

◆ RemoveRangeHeadersForHls()

void DreamineVMS.Hosting.VmsBlazorServerHostedService< TRootComponent >.RemoveRangeHeadersForHls ( WebApplication app)
inlinestaticprivate

HLS 요청에서 Range 헤더를 제거합니다.

매개변수
appWebApplication 인스턴스입니다.

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

362 {
363 app.Use(async (context, next) =>
364 {
365 PathString path = context.Request.Path;
366
367 if (IsHlsPath(path))
368 {
369 context.Request.Headers.Remove("Range");
370 context.Request.Headers.Remove("If-Range");
371 }
372
373 await next().ConfigureAwait(false);
374 });
375 }

다음을 참조함 : IsHlsPath().

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

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

◆ StartAsync()

async Task DreamineVMS.Hosting.VmsBlazorServerHostedService< TRootComponent >.StartAsync ( CancellationToken cancellationToken)
inline

Start Async 작업을 수행합니다.

매개변수
cancellationToken취소 요청을 감시하는 토큰입니다.
반환값
Start Async 작업에서 생성한 Task 결과입니다.

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

139 {
140 Assembly blazorAssembly = typeof(TRootComponent).Assembly;
141
142 WebApplicationBuilder builder = WebApplication.CreateBuilder(new WebApplicationOptions
143 {
144 Args = Array.Empty<string>(),
145 ContentRootPath = AppContext.BaseDirectory,
146 ApplicationName = blazorAssembly.GetName().Name
147 });
148
149 StaticWebAssetsLoader.UseStaticWebAssets(builder.Environment, builder.Configuration);
150
151 builder.Services
152 .AddRazorComponents()
153 .AddInteractiveServerComponents();
154
155 builder.Services.Configure<CircuitOptions>(options =>
156 {
157 options.DetailedErrors = true;
158 });
159
160 RegisterSharedServices(builder.Services);
161 RegisterBlazorViewModels(builder.Services);
162
163 builder.WebHost.ConfigureKestrel(options =>
164 {
165 if (_options.ListenAnyIp)
166 {
167 options.ListenAnyIP(_options.Port);
168 }
169 else
170 {
171 options.ListenLocalhost(_options.Port);
172 }
173 });
174
175 WebApplication app = builder.Build();
176
177 FileExtensionContentTypeProvider contentTypes = CreateHlsContentTypeProvider();
178
179 RemoveRangeHeadersForHls(app);
180 UseHlsStaticFiles(app, contentTypes);
181
182 app.UseRouting();
183 app.UseAntiforgery();
184
185 app.MapGet("/healthz", () => Results.Text("OK", "text/plain"));
186
187 app.MapRazorComponents<TRootComponent>()
188 .AddInteractiveServerRenderMode();
189
190 _webHost = app;
191
192 await app.StartAsync(cancellationToken).ConfigureAwait(false);
193 }

다음을 참조함 : _options, _webHost, CreateHlsContentTypeProvider(), RegisterBlazorViewModels(), RegisterSharedServices(), RemoveRangeHeadersForHls(), UseHlsStaticFiles().

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

◆ StopAsync()

async Task DreamineVMS.Hosting.VmsBlazorServerHostedService< TRootComponent >.StopAsync ( CancellationToken cancellationToken)
inline

Stop Async 작업을 수행합니다.

매개변수
cancellationToken취소 요청을 감시하는 토큰입니다.
반환값
Stop Async 작업에서 생성한 Task 결과입니다.

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

220 {
221 if (_webHost is null)
222 {
223 return;
224 }
225
226 try
227 {
228 await _webHost.StopAsync(cancellationToken).ConfigureAwait(false);
229 }
230 finally
231 {
232 _webHost.Dispose();
233 _webHost = null;
234 }
235 }

다음을 참조함 : _webHost.

◆ UseHlsStaticFiles()

void DreamineVMS.Hosting.VmsBlazorServerHostedService< TRootComponent >.UseHlsStaticFiles ( WebApplication app,
FileExtensionContentTypeProvider contentTypes )
inlinestaticprivate

HLS 정적 파일 제공 설정을 적용합니다.

매개변수
appWebApplication 인스턴스입니다.
contentTypesContent-Type Provider입니다.

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

404 {
405 app.UseStaticFiles(new StaticFileOptions
406 {
407 ContentTypeProvider = contentTypes,
408 OnPrepareResponse = context =>
409 {
410 string extension = Path.GetExtension(context.File.PhysicalPath ?? string.Empty)
411 .ToLowerInvariant();
412
413 if (extension is ".m3u8" or ".ts")
414 {
415 IHeaderDictionary headers = context.Context.Response.Headers;
416
417 headers["Cache-Control"] = "no-store, must-revalidate";
418 headers["Pragma"] = "no-cache";
419 headers["Expires"] = "0";
420 headers["Accept-Ranges"] = "none";
421 }
422 }
423 });
424 }

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

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

◆ VmsBlazorServerHostedService()

DreamineVMS.Hosting.VmsBlazorServerHostedService< TRootComponent >.VmsBlazorServerHostedService ( IServiceProvider rootServiceProvider,
IOptions< VmsServerOptions > options )
inline

VmsBlazorServerHostedService 클래스의 새 인스턴스를 초기화합니다.

매개변수
rootServiceProviderWPF Host의 루트 서비스 공급자입니다.
optionsVMS Server 옵션입니다.
예외
ArgumentNullException필수 입력 인자 중 하나가 null인 경우 발생합니다.

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

109 {
110 _rootServiceProvider = rootServiceProvider ?? throw new ArgumentNullException(nameof(rootServiceProvider));
111 _options = options?.Value ?? throw new ArgumentNullException(nameof(options));
112 }

다음을 참조함 : _options, _rootServiceProvider.

멤버 데이터 문서화

◆ _options

readonly VmsServerOptions DreamineVMS.Hosting.VmsBlazorServerHostedService< TRootComponent >._options
private

options 값을 보관합니다.

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

다음에 의해서 참조됨 : StartAsync(), VmsBlazorServerHostedService().

◆ _rootServiceProvider

readonly IServiceProvider DreamineVMS.Hosting.VmsBlazorServerHostedService< TRootComponent >._rootServiceProvider
private

root Service Provider 값을 보관합니다.

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

다음에 의해서 참조됨 : AddShared< TService >(), VmsBlazorServerHostedService().

◆ _webHost

IHost? DreamineVMS.Hosting.VmsBlazorServerHostedService< TRootComponent >._webHost
private

web Host 값을 보관합니다.

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

다음에 의해서 참조됨 : StartAsync(), StopAsync().


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