C# 클래스 CStyleLineEncoder, Malevich

Implements a very primitive syntax highlighter which emulates Visual Studio C/C++/C#/JavaScript 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 Note that, obviously, we can't do much for type names - there is simply no sufficient information to parse types. However, this could be adapted to know about some standard runtime types such as Console. I did not do that.
상속: ILineEncoder
파일 보기 프로젝트 열기: daptiv/Malevich

공개 메소드들

메소드 설명
CStyleLineEncoder ( CStyleLanguage languageType ) : System.Collections.Generic

Instantiates the CStyleLineEncoder.

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.

메소드 상세

CStyleLineEncoder() 공개 메소드

Instantiates the CStyleLineEncoder.
public CStyleLineEncoder ( CStyleLanguage languageType ) : System.Collections.Generic
languageType CStyleLanguage Which language is this?
리턴 System.Collections.Generic

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