DMGDetector.cs 928 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 DMGDetector : AbstractSignatureDetector
  9. {
  10. private static readonly SignatureInformation[] DmgSignatureInfo = {
  11. new() { Position = 0, Signature = new byte [] { 0x78, 0x01, 0x73, 0x0D, 0x62, 0x62, 0x60 } },
  12. };
  13. public override string Extension => "dmg";
  14. public override string MimeType => new MimeMapper().GetMimeFromExtension("." + Extension);
  15. public override List<FormatCategory> FormatCategories => GetType().GetCustomAttributes<FormatCategoryAttribute>().Select(a => a.Category).ToList();
  16. protected override SignatureInformation[] SignatureInformations => DmgSignatureInfo;
  17. public override string ToString() => "Apple Disk Mount Image(DMG) Detector";
  18. }