DocumentContent.cs 998 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO.Abstractions;
  4. using Quadarax.Foundation.Core.IO.MimeTypes;
  5. namespace BO.ProcessServer.Business
  6. {
  7. public class DocumentContent
  8. {
  9. public long DocumentId { get; set; }
  10. public IList<FileContent> Files { get; }
  11. public DocumentContent(long documentId, IFileSystem fileSystem, IEnumerable<string> fileNames)
  12. {
  13. if (fileSystem==null) throw new ArgumentNullException(nameof(fileSystem));
  14. if (fileNames == null) throw new ArgumentNullException(nameof(fileNames));
  15. foreach (var fileName in fileNames)
  16. Files.Add(new FileContent() {FileName = fileName, MimeType = MimeTypeUtil.GetMimeType(fileSystem.Path.GetExtension(fileName))});
  17. DocumentId = documentId;
  18. }
  19. }
  20. public class FileContent
  21. {
  22. public string FileName { get; set; }
  23. public string MimeType { get; set; }
  24. }
  25. }