BinaryPropertyListDetector.cs 965 B

12345678910111213141516171819202122232425
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using System.Reflection;
  4. using Masuit.Tools.AspNetCore.Mime;
  5. namespace Masuit.Tools.Files.FileDetector.Detectors;
  6. [FormatCategory(FormatCategory.Document)]
  7. internal class BinaryPropertyListDetector : AbstractSignatureDetector
  8. {
  9. private static SignatureInformation[] BPLIST_SignatureInfo = new[]
  10. {
  11. new SignatureInformation () { Position = 0, Signature = new byte [] { 0x62, 0x70, 0x6C, 0x69, 0x73, 0x74 } },
  12. };
  13. public override string Extension => "bplist";
  14. protected override SignatureInformation[] SignatureInformations => BPLIST_SignatureInfo;
  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() => "Apple Binary Property List Detector";
  18. }