30 lines
609 B
C#
30 lines
609 B
C#
using FluentValidation;
|
|
|
|
using MfGames.Gallium;
|
|
|
|
using Zio;
|
|
|
|
namespace MfGames.Nitride.Html;
|
|
|
|
public class IdentifyHtmlFromPath : IdentifyHtml
|
|
{
|
|
public IdentifyHtmlFromPath(IValidator<IdentifyHtml> validator)
|
|
: base(validator)
|
|
{
|
|
this.IsHtmlTest = DefaultIsHtml;
|
|
}
|
|
|
|
private static bool DefaultIsHtml(
|
|
Entity entity,
|
|
UPath path)
|
|
{
|
|
return (path.GetExtensionWithDot() ?? string.Empty).ToLowerInvariant()
|
|
switch
|
|
{
|
|
".htm" => true,
|
|
".html" => true,
|
|
_ => false,
|
|
};
|
|
}
|
|
}
|