C# Class NSoft.NFramework.Networks.HtmlTool

Html Document 형식과 관련된 Utility Class
显示文件 Open project: debop/NFramework Class Usage Examples

Public Methods

Method Description
ConvertToHtml ( string src ) : string

일반 문자열을 HTML 문자열로 변환하기 위하여 Environment.NewLine을 <BR>으로 변환한다.

HtmlDecode ( Stream stream ) : string

Html 형식으로 인코딩된 스트림을 디코딩한다.

HtmlDecode ( string s ) : string

Html 형식으로 인코딩된 문자열을 디코딩을 수행한다.

HtmlDecode ( string s, Stream output ) : void

Html 형식으로 인코딩된 문자열을 디코딩하여 스트림을 반환한다.

HtmlEncode ( Stream stream ) : string

지정된 스트림을 Html 형식으로 Encoding한다.

HtmlEncode ( string s ) : string

문자열을 Html 형식으로 Encoding한다.

HtmlEncode ( string s, Stream output ) : void

지정된 스트림을 Html 형식으로 Encoding 한다.

UrlDecode ( byte bytes, int offset, int count, Encoding enc = null ) : string

Url 인코딩된 데이터를 지정된 범위를 지정된 인코딩 방식으로 디코딩을 수행한다.

UrlDecode ( string s, Encoding enc = null ) : string

Url 인코딩된 데이터를 지정된 범위를 지정된 인코딩 방식으로 디코딩을 수행한다.

UrlEncode ( string payload, Encoding enc = null ) : string

Url을 Encoding한다. 특히 인자가 한글인 경우 문자열이 깨지기 쉽고, 연결자 (?, &) 등과 겹쳐서 다른 문자로 해석되어 질 수 있다. 이를 방지하기 위해 위의 문자들을 제거하여 작업을 수행한다.

UrlEncode ( string payload, Encoding enc, byte &output ) : void

Url을 Encoding한다. 특히 인자가 한글인 경우 문자열이 깨지기 쉽고, 연결자 (?, &) 등과 겹쳐서 다른 문자로 해석되어 질 수 있다. 이를 방지하기 위해 위의 문자들을 제거하여 작업을 수행한다.

UrlEncode ( string payload, byte &output ) : void

Url을 UTF8 방식으로 Encoding한다. 특히 인자가 한글인 경우 문자열이 깨지기 쉽고, 연결자 (?, &) 등과 겹쳐서 다른 문자로 해석되어 질 수 있다. 이를 방지하기 위해 위의 문자들을 제거하여 작업을 수행한다.

Private Methods

Method Description
MakeAutoLink ( string html ) : string
MakeAutoLink ( string html, bool displayHtml ) : string
NbspToSpace ( Match match ) : string

Html의 space를 나타내는 문장 (&nbsp;) 을 ASCII space로 변환한다.

SpaceToNbsp ( Match match, int tabNbspCount = 4 ) : string

space 갯수에 따라 &nbsp;를 넣어야하므로 delegate로 변환 처리를 위임한다.

ToNbsp ( string encSrc, RegexOptions ops ) : string

displayHtml이 true인 경우 NewLine 뒤의 첫 단어가 나오기까지의 공백은 &nbsp;로 교체된다. < > & 값을 원래 Html Tag로 변경한다.

ToSpace ( string html, RegexOptions ops ) : string

pre 태그나 code 태그가 붙은 것들은 원래 문장으로 복원한다.

Method Details

ConvertToHtml() public static method

일반 문자열을 HTML 문자열로 변환하기 위하여 Environment.NewLine을 <BR>으로 변환한다.
public static ConvertToHtml ( string src ) : string
src string
return string

HtmlDecode() public static method

Html 형식으로 인코딩된 스트림을 디코딩한다.
public static HtmlDecode ( Stream stream ) : string
stream Stream
return string

HtmlDecode() public static method

Html 형식으로 인코딩된 문자열을 디코딩을 수행한다.
public static HtmlDecode ( string s ) : string
s string
return string

HtmlDecode() public static method

Html 형식으로 인코딩된 문자열을 디코딩하여 스트림을 반환한다.
public static HtmlDecode ( string s, Stream output ) : void
s string
output Stream
return void

HtmlEncode() public static method

지정된 스트림을 Html 형식으로 Encoding한다.
public static HtmlEncode ( Stream stream ) : string
stream Stream 스트림
return string

HtmlEncode() public static method

문자열을 Html 형식으로 Encoding한다.
public static HtmlEncode ( string s ) : string
s string 문자열
return string

HtmlEncode() public static method

지정된 스트림을 Html 형식으로 Encoding 한다.
public static HtmlEncode ( string s, Stream output ) : void
s string
output Stream 인코딩된 문자가 담긴 stream
return void

UrlDecode() public static method

Url 인코딩된 데이터를 지정된 범위를 지정된 인코딩 방식으로 디코딩을 수행한다.
public static UrlDecode ( byte bytes, int offset, int count, Encoding enc = null ) : string
bytes byte 인코딩된 데이타
offset int 시작 위치
count int 변경할 바이트 수
enc System.Text.Encoding 인코딩 방식
return string

UrlDecode() public static method

Url 인코딩된 데이터를 지정된 범위를 지정된 인코딩 방식으로 디코딩을 수행한다.
public static UrlDecode ( string s, Encoding enc = null ) : string
s string string to decoding
enc System.Text.Encoding 인코딩 방식
return string

UrlEncode() public static method

Url을 Encoding한다. 특히 인자가 한글인 경우 문자열이 깨지기 쉽고, 연결자 (?, &) 등과 겹쳐서 다른 문자로 해석되어 질 수 있다. 이를 방지하기 위해 위의 문자들을 제거하여 작업을 수행한다.
public static UrlEncode ( string payload, Encoding enc = null ) : string
payload string 인코딩할 문자열
enc System.Text.Encoding 인코딩 방식
return string

UrlEncode() public static method

Url을 Encoding한다. 특히 인자가 한글인 경우 문자열이 깨지기 쉽고, 연결자 (?, &) 등과 겹쳐서 다른 문자로 해석되어 질 수 있다. 이를 방지하기 위해 위의 문자들을 제거하여 작업을 수행한다.
public static UrlEncode ( string payload, Encoding enc, byte &output ) : void
payload string URL 인자값
enc System.Text.Encoding byte로 변환할 시에 인코더
output byte url encoded bytes by a specified
return void

UrlEncode() public static method

Url을 UTF8 방식으로 Encoding한다. 특히 인자가 한글인 경우 문자열이 깨지기 쉽고, 연결자 (?, &) 등과 겹쳐서 다른 문자로 해석되어 질 수 있다. 이를 방지하기 위해 위의 문자들을 제거하여 작업을 수행한다.
public static UrlEncode ( string payload, byte &output ) : void
payload string URL 인자값
output byte url encoded bytes by
return void