stabilizaiton work - projects rework for maintenanceability and ui livening
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
using StellaOps.AuditPack.Models;
|
||||
|
||||
namespace StellaOps.AuditPack.Services;
|
||||
|
||||
public sealed partial class AuditBundleWriter
|
||||
{
|
||||
private static string? AddRequiredEntry(
|
||||
List<BundleEntry> entries,
|
||||
List<BundleFileEntry> files,
|
||||
List<ArchiveEntry> archiveEntries,
|
||||
string path,
|
||||
byte[]? content,
|
||||
BundleContentType type)
|
||||
{
|
||||
return content is null
|
||||
? null
|
||||
: AddEntry(entries, files, archiveEntries, path, content, type);
|
||||
}
|
||||
|
||||
private static string? AddOptionalEntry(
|
||||
List<BundleEntry> entries,
|
||||
List<BundleFileEntry> files,
|
||||
List<ArchiveEntry> archiveEntries,
|
||||
string path,
|
||||
byte[]? content,
|
||||
BundleContentType type)
|
||||
{
|
||||
return content is null
|
||||
? null
|
||||
: AddEntry(entries, files, archiveEntries, path, content, type);
|
||||
}
|
||||
|
||||
private static string AddEntry(
|
||||
List<BundleEntry> entries,
|
||||
List<BundleFileEntry> files,
|
||||
List<ArchiveEntry> archiveEntries,
|
||||
string path,
|
||||
byte[] content,
|
||||
BundleContentType type)
|
||||
{
|
||||
var digest = ComputeSha256(content);
|
||||
entries.Add(new BundleEntry(path, digest, content.Length));
|
||||
files.Add(new BundleFileEntry
|
||||
{
|
||||
RelativePath = path,
|
||||
Digest = digest,
|
||||
SizeBytes = content.Length,
|
||||
ContentType = type
|
||||
});
|
||||
archiveEntries.Add(new ArchiveEntry(path, content));
|
||||
return digest;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user