ISODetector.cs 908 B

12345678910111213141516171819202122232425
  1. using System.Collections.Generic;
  2. using System.IO;
  3. using System.Linq;
  4. using System.Reflection;
  5. using Masuit.Tools.Mime;
  6. namespace Masuit.Tools.Files.FileDetector.Detectors;
  7. [FormatCategory(FormatCategory.Archive)]
  8. internal class ISODetector : AbstractSignatureDetector
  9. {
  10. private static readonly SignatureInformation[] IsoSignatureInfo = {
  11. new() { Position = 0, Signature = new byte [] { 0x43, 0x44, 0x30, 0x30, 0x31 } },
  12. };
  13. public override string Extension => "iso";
  14. protected override SignatureInformation[] SignatureInformations => IsoSignatureInfo;
  15. public override string MimeType => new MimeMapper().GetMimeFromExtension("." + Extension);
  16. public override List<FormatCategory> FormatCategories => GetType().GetCustomAttributes<FormatCategoryAttribute>().Select(a => a.Category).ToList();
  17. public override string ToString() => "ISO-9660 Disc Image Detector";
  18. }