-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathWorkspaceBootstrapService.cs
More file actions
41 lines (35 loc) · 1.28 KB
/
WorkspaceBootstrapService.cs
File metadata and controls
41 lines (35 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using DecompilerServer.Services;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace DecompilerServer;
public sealed class WorkspaceBootstrapService(
ILogger<WorkspaceBootstrapService> log,
DecompilerWorkspace workspace) : BackgroundService
{
private readonly ILogger<WorkspaceBootstrapService> _log = log;
private readonly DecompilerWorkspace _workspace = workspace;
protected override Task ExecuteAsync(CancellationToken stoppingToken)
{
var restored = _workspace.RestoreRegisteredContexts();
if (restored.Count == 0)
{
_log.LogInformation("No registered workspace aliases found.");
return Task.CompletedTask;
}
foreach (var result in restored)
{
if (result.Loaded)
{
_log.LogInformation("Loaded registered context {Alias} -> {AssemblyPath}", result.ContextAlias, result.AssemblyPath);
}
else
{
_log.LogWarning("Failed to load registered context {Alias} -> {AssemblyPath}: {ErrorMessage}",
result.ContextAlias,
result.AssemblyPath,
result.ErrorMessage);
}
}
return Task.CompletedTask;
}
}