C# Класс SqlLineEncoder, Malevich

Implements a very primitive syntax highlighter which emulates SQL Server Management Studio SQL syntax coloring. This is just a sample code, and is not a part of Malevich installation. Nevertheless, it is fairly complex. If you develop your own based on this sample, please consider running the test to make sure corner cases are handled. The test is SampleHighlighterTest
Наследование: ILineEncoder
Показать файл Открыть проект

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

Метод Описание
Dispose ( ) : void

Does nothing, just satisfies ILineEncoder interface.

EncodeLine ( string s, int maxLineWidth, string tab ) : string

Encodes the string. Unlike standard HtmlEncode, our custom version preserves spaces correctly. Also, converts tabs to "\t", and breaks lines in chunks of maxLineWidth non-breaking segments.

GetEncoderCssStream ( ) : TextReader

Returns the CSS used by the encoder.

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

Метод Описание
SqlLineEncoder ( ) : System.Collections.Generic

Trivial static constructor.

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

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

Does nothing, just satisfies ILineEncoder interface.
public Dispose ( ) : void
Результат void

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

Encodes the string. Unlike standard HtmlEncode, our custom version preserves spaces correctly. Also, converts tabs to "\t", and breaks lines in chunks of maxLineWidth non-breaking segments.
public EncodeLine ( string s, int maxLineWidth, string tab ) : string
s string The string to encode.
maxLineWidth int The maximum width.
tab string Text string to replace tabs with.
Результат string

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

Returns the CSS used by the encoder.
public GetEncoderCssStream ( ) : TextReader
Результат TextReader