public static DetectBit check(byte[] text, long limitlen) { if (IsAscii(text, limitlen)) { return(DetectBit.ALL); } DetectBit detect = DetectBit.NONE; if (IsShiftJis(text, limitlen)) { detect |= DetectBit.ShiftJIS; } if (IsUtf8(text, limitlen)) { detect |= DetectBit.UTF8; } return(detect); }
public static bool IsAscii(DetectBit bit) => ((bit & DetectBit.ASCII) != 0);
public static bool IsUtf8(DetectBit bit) => ((bit & DetectBit.UTF8) != 0);
public static bool IsShiftJis(DetectBit bit) => ((bit & DetectBit.ShiftJIS) != 0);