using System.Collections.Generic;
using System.IO;
namespace Masuit.Tools.Files.FileDetector;
public interface IDetector
{
///
/// 基础文件类型
///
string Precondition { get; }
///
/// 真实扩展名
///
string Extension { get; }
bool Detect(Stream stream);
///
/// MimeType
///
string MimeType { get; }
///
/// 格式类别
///
List FormatCategories { get; }
}
public class NoneDetector:IDetector
{
public string Precondition { get; }
public string Extension { get; }
public bool Detect(Stream stream)
{
return false;
}
public string MimeType { get; }
public List FormatCategories { get; }=new List();
/// Returns a string that represents the current object.
/// A string that represents the current object.
public override string ToString()
{
return "不支持的文件格式,请自己实现针对该文件的IDetector";
}
}