DMGDetector.cs 882 B

12345678910111213141516171819202122
  1. using System.Reflection;
  2. using Masuit.Tools.Mime;
  3. namespace Masuit.Tools.Files.FileDetector.Detectors;
  4. [FormatCategory(FormatCategory.Archive)]
  5. internal sealed class DMGDetector : AbstractSignatureDetector
  6. {
  7. private static readonly SignatureInformation[] DmgSignatureInfo = {
  8. new() { Position = 510, Signature = new byte [] { 0x55, 0xAA, 0x45, 0x46, 0x49, 0x20, 0x50,0x41,0x52,0x54 } },
  9. };
  10. public override string Extension => "dmg";
  11. public override string MimeType => new MimeMapper().GetMimeFromExtension("." + Extension);
  12. public override List<FormatCategory> FormatCategories => GetType().GetCustomAttributes<FormatCategoryAttribute>().Select(a => a.Category).ToList();
  13. protected override SignatureInformation[] SignatureInformations => DmgSignatureInfo;
  14. public override string ToString() => "Apple Disk Mount Image(DMG) Detector";
  15. }