XarDetector.cs 890 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.Compression)]
  8. internal class XarDetector : AbstractSignatureDetector
  9. {
  10. private static readonly SignatureInformation[] XarSignatureInfo = {
  11. new() { Position = 0, Signature = new byte [] { 0x78, 0x61, 0x72, 0x21 } },
  12. };
  13. public override string Extension => "xar";
  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 => XarSignatureInfo;
  17. public override string ToString() => "XAR Detector";
  18. }