The “Custom File Type Registration” example in the README does not compile against the current File.TypeChecker package (4.4.0).
The example uses:
public override string Name => "...";
public override string Extension => "...";
public override string MimeType => "...";
public override bool IsMatch(byte[] signature, Stream stream) => ...;
FileTypeValidator.RegisterType<MyCustomType>();
However, in the current API:
- FileType.Name, Extension, and MimeType are not virtual.
- FileType requires values through its protected constructor.
- IsMatch(...) does not exist.
- FileTypeValidator.RegisterType<T>() does not exist.
The documented approach that compiles is:
using FileTypeChecker;
using FileTypeChecker.Abstracts;
public sealed class MyCustomType : FileType
{
public MyCustomType()
: base(
"My Custom Format",
"application/x-mycustom",
"mycustom",
[0x4D, 0x59, 0x43, 0x54])
{
}
}
FileTypeValidator.RegisterCustomTypes(typeof(MyCustomType).Assembly);
Could the README be updated to match the public API, or could the documented API be restored?
The “Custom File Type Registration” example in the README does not compile against the current
File.TypeCheckerpackage (4.4.0).The example uses: