/
spirzen
/
it-code-examples
Обзор
Документация
Войти
/
spirzen
/
it-code-examples
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/csharp/code-412-113-002/main.cs
44 строки
1 KB
Spirzen
Code migration pack
09 июн 2026, 01:41
09 июн 2026, 01:41
cebc284
Код
Авторство
О чём код?
// Core/AppKernel.cs public class SuperAppKernel { private readonly IAuthService _authService; private readonly IPaymentGateway _paymentGateway; private readonly IProfileManager _profileManager; private readonly IModuleRegistry _moduleRegistry; public SuperAppKernel( IAuthService authService, IPaymentGateway paymentGateway, IProfileManager profileManager, IModuleRegistry moduleRegistry) { _authService = authService; _paymentGateway = paymentGateway; _profileManager = profileManager; _moduleRegistry = moduleRegistry; } public async Task InitializeAsync() { await _authService.InitializeAsync(); await _paymentGateway.ConnectAsync(); await _profileManager.LoadUserProfileAsync(); } public async Task<IModuleResult> LaunchModuleAsync(string moduleName, ModuleContext context) { var module = _moduleRegistry.GetModule(moduleName); if (module == null) throw new ModuleNotFoundException($"Модуль {moduleName} не зарегистрирован"); var safeContext = new SafeModuleContext { UserId = _authService.CurrentUserId, AuthToken = await _authService.GetShortLivedTokenAsync(), PaymentMethods = await _paymentGateway.ListAvailableMethodsAsync(), Permissions = _authService.GetUserPermissions() }; return await module.ExecuteAsync(context, safeContext); } }