HWPDetector.cs 781 B

12345678910111213141516171819202122
  1. using System.Collections.Generic;
  2. using System.IO;
  3. using System.Linq;
  4. using System.Reflection;
  5. using System.Text.RegularExpressions;
  6. using Masuit.Tools.Mime;
  7. namespace Masuit.Tools.Files.FileDetector.Detectors;
  8. [FormatCategory(FormatCategory.Document)]
  9. internal class HWPDetector : AbstractRegexSignatureDetector
  10. {
  11. public override string Extension => "hwp";
  12. protected override Regex Signature => new("^HWP Document File V[0-9]+.[0-9][0-9]");
  13. public override string MimeType => new MimeMapper().GetMimeFromExtension("." + Extension);
  14. public override List<FormatCategory> FormatCategories => GetType().GetCustomAttributes<FormatCategoryAttribute>().Select(a => a.Category).ToList();
  15. public override string ToString() => "Hancom HWP Document Detector";
  16. }