12345678910111213141516171819202122 |
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Reflection;
- using System.Text.RegularExpressions;
- using Masuit.Tools.Mime;
- namespace Masuit.Tools.Files.FileDetector.Detectors;
- [FormatCategory(FormatCategory.Document)]
- internal sealed class PdfDetector : AbstractRegexSignatureDetector
- {
- public override string Extension => "pdf";
- protected override Regex Signature => new("^%PDF-[0-9].[0-9]");
- public override string MimeType => new MimeMapper().GetMimeFromExtension("." + Extension);
- public override List<FormatCategory> FormatCategories => GetType().GetCustomAttributes<FormatCategoryAttribute>().Select(a => a.Category).ToList();
- public override string ToString() => "Portable Document Format Detector";
- }
|