stabilizaiton work - projects rework for maintenanceability and ui livening
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using System.Text.Json;
|
||||
using StellaOps.AuditPack.Models;
|
||||
|
||||
namespace StellaOps.AuditPack.Services;
|
||||
|
||||
public sealed partial class AuditBundleReader
|
||||
{
|
||||
private static async Task<ManifestLoadResult> LoadManifestAsync(
|
||||
string bundleDir,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var manifestPath = Path.Combine(bundleDir, "manifest.json");
|
||||
if (!File.Exists(manifestPath))
|
||||
{
|
||||
return new ManifestLoadResult(false, "Manifest not found in bundle", null, null);
|
||||
}
|
||||
|
||||
var manifestBytes = await File.ReadAllBytesAsync(manifestPath, ct).ConfigureAwait(false);
|
||||
var manifest = JsonSerializer.Deserialize<AuditBundleManifest>(manifestBytes, _jsonOptions);
|
||||
if (manifest is null)
|
||||
{
|
||||
return new ManifestLoadResult(false, "Failed to parse manifest", null, manifestBytes);
|
||||
}
|
||||
|
||||
return new ManifestLoadResult(true, null, manifest, manifestBytes);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user