CursorDetector.cs 873 B

123456789101112131415161718192021222324
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using System.Reflection;
  4. using Masuit.Tools.Mime;
  5. namespace Masuit.Tools.Files.FileDetector.Detectors;
  6. [FormatCategory(FormatCategory.Image)]
  7. internal class CursorDetector : AbstractSignatureDetector
  8. {
  9. private static readonly SignatureInformation[] CurSignatureInfo = {
  10. new() { Position = 0, Signature = new byte [] { 0x00, 0x00, 0x02, 0x00 } },
  11. };
  12. public override string Extension => "cur";
  13. protected override SignatureInformation[] SignatureInformations => CurSignatureInfo;
  14. public override string MimeType => new MimeMapper().GetMimeFromExtension("." + Extension);
  15. public override List<FormatCategory> FormatCategories => GetType().GetCustomAttributes<FormatCategoryAttribute>().Select(a => a.Category).ToList();
  16. public override string ToString() => "Cursor Detector";
  17. }