32 lines
No EOL
1 KiB
C#
32 lines
No EOL
1 KiB
C#
using LANCommander.SDK.Models.Manifest;
|
|
using LANCommander.Server.ImportExport.Models;
|
|
using LANCommander.Server.Services;
|
|
|
|
namespace LANCommander.Server.ImportExport.Exporters;
|
|
|
|
public class RedistributableExporter(RedistributableService redistributableService) : BaseExporter<Redistributable, Data.Models.Redistributable>
|
|
{
|
|
public override async Task<ExportItemInfo> GetExportInfoAsync(Data.Models.Redistributable record)
|
|
{
|
|
return new ExportItemInfo()
|
|
{
|
|
Id = record.Id,
|
|
Name = record.Name,
|
|
};
|
|
}
|
|
|
|
public override bool CanExport(Redistributable record) => true;
|
|
|
|
public override async Task<Redistributable> ExportAsync(Guid id)
|
|
{
|
|
var redistributable = await redistributableService.GetManifestAsync(id);
|
|
|
|
if (redistributable.Archives is null)
|
|
redistributable.Archives = new List<Archive>();
|
|
|
|
if (redistributable.Scripts is null)
|
|
redistributable.Scripts = new List<Script>();
|
|
|
|
return redistributable;
|
|
}
|
|
} |