Add output file type, collect all files
This commit is contained in:
@@ -2,7 +2,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
@@ -55,12 +54,12 @@ namespace LeafWeb.Core.Entities
|
||||
/// <summary>
|
||||
/// Contains all output files in a zip
|
||||
/// </summary>
|
||||
public byte[] GetOutputFileZip()
|
||||
public byte[] GetOutputFileZip(LeafOutputFileType? fileType)
|
||||
{
|
||||
using (var compressedFileStream = new MemoryStream())
|
||||
using (var archive = new ZipArchive(compressedFileStream, ZipArchiveMode.Create, true))
|
||||
{
|
||||
foreach (var outputFile in OutputFiles)
|
||||
foreach (var outputFile in OutputFiles.Where(f => !fileType.HasValue || f.FileType==fileType.Value))
|
||||
{
|
||||
var entry = archive.CreateEntry(outputFile.Filename);
|
||||
using (var originalFileStream = new MemoryStream(outputFile.Contents))
|
||||
|
||||
@@ -14,6 +14,8 @@ namespace LeafWeb.Core.Entities
|
||||
|
||||
public string Filename { get; set; }
|
||||
|
||||
public LeafOutputFileType FileType { get; set; }
|
||||
|
||||
public byte[] Contents { get; set; }
|
||||
|
||||
public bool IsLeafChartFile => Filename?.Contains(Filename_LeafChart) ?? false;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace LeafWeb.Core.Entities
|
||||
{
|
||||
public enum LeafOutputFileType
|
||||
{
|
||||
ToUser,
|
||||
NotToUser,
|
||||
CleanedInput
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user