C# Класс MarkDownEditor.SimpleHelpers.FileEncoding

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
CheckForTextualData ( byte rawData ) : bool

Detects if contains textual data.

CheckForTextualData ( byte rawData, int start, int count ) : bool

Detects if contains textual data.

Complete ( ) : Encoding

Finalize detection phase and gets detected encoding name.

Detect ( Stream inputData ) : string

Detects the encoding of textual data of the specified input data. Only the stream first 20Mb will be analysed.

Detect ( Stream inputData, int maxSize, int bufferSize = 16*1024 ) : string

Detects the encoding of textual data of the specified input data.

Detect ( byte inputData, int start, int count ) : string

Detects the encoding of textual data of the specified input data.

DetectFileEncoding ( Stream inputStream, Encoding defaultIfNotDetected = null ) : Encoding

Tries to detect the file encoding.

DetectFileEncoding ( byte inputData, int start, int count, Encoding defaultIfNotDetected = null ) : Encoding

Tries to detect the file encoding.

DetectFileEncoding ( string inputFilename, Encoding defaultIfNotDetected = null ) : Encoding

Tries to detect the file encoding.

Reset ( ) : void

Resets this instance.

TryLoadFile ( string filename, string defaultValue = "" ) : string

Tries to load file content with the correct encoding.

Приватные методы

Метод Описание
CheckForByteOrderMark ( byte rawData, int start ) : bool

Detects if data has bytes order mark to indicate its encoding for textual data.

GetCurrentEncoding ( ) : string
IncrementFrequency ( string charset ) : void

Описание методов

CheckForTextualData() публичный статический Метод

Detects if contains textual data.
public static CheckForTextualData ( byte rawData ) : bool
rawData byte The raw data.
Результат bool

CheckForTextualData() публичный статический Метод

Detects if contains textual data.
public static CheckForTextualData ( byte rawData, int start, int count ) : bool
rawData byte The raw data.
start int The start.
count int The count.
Результат bool

Complete() публичный Метод

Finalize detection phase and gets detected encoding name.
public Complete ( ) : Encoding
Результат System.Text.Encoding

Detect() публичный Метод

Detects the encoding of textual data of the specified input data. Only the stream first 20Mb will be analysed.
public Detect ( Stream inputData ) : string
inputData Stream The input data.
Результат string

Detect() публичный Метод

Detects the encoding of textual data of the specified input data.
bufferSize parameter cannot be 0 or less.
public Detect ( Stream inputData, int maxSize, int bufferSize = 16*1024 ) : string
inputData Stream The input data.
maxSize int Size in byte of analysed data, if you want to analysed only a sample. Use 0 to read all stream data.
bufferSize int Size of the buffer for the stream read.
Результат string

Detect() публичный Метод

Detects the encoding of textual data of the specified input data.
public Detect ( byte inputData, int start, int count ) : string
inputData byte The input data.
start int The start.
count int The count.
Результат string

DetectFileEncoding() публичный статический Метод

Tries to detect the file encoding.
public static DetectFileEncoding ( Stream inputStream, Encoding defaultIfNotDetected = null ) : Encoding
inputStream Stream The input stream.
defaultIfNotDetected System.Text.Encoding The default encoding if none was detected.
Результат System.Text.Encoding

DetectFileEncoding() публичный статический Метод

Tries to detect the file encoding.
public static DetectFileEncoding ( byte inputData, int start, int count, Encoding defaultIfNotDetected = null ) : Encoding
inputData byte The input data.
start int The start.
count int The count.
defaultIfNotDetected System.Text.Encoding The default encoding if none was detected.
Результат System.Text.Encoding

DetectFileEncoding() публичный статический Метод

Tries to detect the file encoding.
public static DetectFileEncoding ( string inputFilename, Encoding defaultIfNotDetected = null ) : Encoding
inputFilename string The input filename.
defaultIfNotDetected System.Text.Encoding The default encoding if none was detected.
Результат System.Text.Encoding

Reset() публичный Метод

Resets this instance.
public Reset ( ) : void
Результат void

TryLoadFile() публичный статический Метод

Tries to load file content with the correct encoding.
public static TryLoadFile ( string filename, string defaultValue = "" ) : string
filename string The filename.
defaultValue string The default value if unable to load file content.
Результат string