fix issue with memory streams not being handled correctly through interfaces, using out variables.

implement full export handling now with the finalised interface.
This commit is contained in:
chris.watts90@outlook.com 2018-02-28 19:45:12 +00:00
parent 675479d2cf
commit ed345150b9

View File

@ -19,11 +19,22 @@ namespace RaceLapTimer.Extensions.FileExport
return _exporters;
}
public Stream Export(string fileContent, string baseUrl)
public void Export(string exportType, string fileContent, string baseUrl, out Stream exportStream)
{
if (_exporters.Any())
return _exporters.First().Export(fileContent, baseUrl);
return new MemoryStream();
{
var exporter = _exporters.FirstOrDefault(x => x.GetDetails().Type == exportType);
if (exporter != null)
{
exporter.Export(fileContent, baseUrl, out exportStream);
}
else
{
exportStream = new MemoryStream();
}
}
else
exportStream = new MemoryStream();
}
public List<ExportProviderDetails> GetExporterDetails()