C# Class Majestic12.HTMLchunk

Parsed HTML token that is either text, comment, script, open or closed tag as indicated by the oType variable.
Inheritance: IDisposable
Afficher le fichier Open project: arktronic/sevenauth Class Usage Examples

Méthodes publiques

Свойство Type Description
MAX_PARAMS int
TEXT_CAPACITY int
bClosure bool
bComments bool
bEndClosure bool
bEntities bool
bHashMode bool
bLtEntity bool
cParamChars byte[]
iChunkLength int
iChunkOffset int
iParams int
oEnc Encoding
oHTML string
oParams object>.System.Collections.Generic.Dictionary
oType HTMLchunkType
sParams string[]
sTag string
sValues string[]

Méthodes publiques

Méthode Description
AddParam ( string sParam, string sValue, byte cParamChar ) : void

Adds tag parameter to the chunk

Clear ( ) : void

Clears chunk preparing it for

ConvertParamsToHash ( ) : void

This function will convert parameters stored in sParams/sValues arrays into oParams hash Useful if generally parsing is done when bHashMode is FALSE. Hash operations are not the fastest, so its best not to use this function.

Dispose ( ) : void
GenerateHTML ( ) : string

Generates HTML based on current chunk's data Note: this is not a high performance method and if you want ORIGINAL HTML that was parsed to create this chunk then use relevant HTMLparser method to obtain such HTML then you should use function of parser: SetRawHTML

GenerateParamHTML ( string sParam, string sValue, char cParamChar ) : string

Generates HTML for param/value pair

GenerateParamsHTML ( ) : string

Generates HTML for params in this chunk

GetParamValue ( string sParam ) : string

Returns value of a parameter

HTMLchunk ( bool p_bHashMode ) : System

Initialises new HTMLchunk

MakeSafeParamValue ( string sLine, char cQuoteChar ) : string

Makes parameter value safe to be used in param - this will check for any conflicting quote chars, but not full entity-encoding

SetEncoding ( Encoding p_oEnc ) : void

Sets encoding to be used for conversion of binary data into string

Private Methods

Méthode Description
Dispose ( bool bDisposing ) : void

Method Details

AddParam() public méthode

Adds tag parameter to the chunk
public AddParam ( string sParam, string sValue, byte cParamChar ) : void
sParam string Parameter name (ie color)
sValue string Value of the parameter (ie white)
cParamChar byte
Résultat void

Clear() public méthode

Clears chunk preparing it for
public Clear ( ) : void
Résultat void

ConvertParamsToHash() public méthode

This function will convert parameters stored in sParams/sValues arrays into oParams hash Useful if generally parsing is done when bHashMode is FALSE. Hash operations are not the fastest, so its best not to use this function.
public ConvertParamsToHash ( ) : void
Résultat void

Dispose() public méthode

public Dispose ( ) : void
Résultat void

GenerateHTML() public méthode

Generates HTML based on current chunk's data Note: this is not a high performance method and if you want ORIGINAL HTML that was parsed to create this chunk then use relevant HTMLparser method to obtain such HTML then you should use function of parser: SetRawHTML
public GenerateHTML ( ) : string
Résultat string

GenerateParamHTML() public méthode

Generates HTML for param/value pair
public GenerateParamHTML ( string sParam, string sValue, char cParamChar ) : string
sParam string Param
sValue string Value (empty if not specified)
cParamChar char
Résultat string

GenerateParamsHTML() public méthode

Generates HTML for params in this chunk
public GenerateParamsHTML ( ) : string
Résultat string

GetParamValue() public méthode

Returns value of a parameter
public GetParamValue ( string sParam ) : string
sParam string Parameter
Résultat string

HTMLchunk() public méthode

Initialises new HTMLchunk
public HTMLchunk ( bool p_bHashMode ) : System
p_bHashMode bool Sets
Résultat System

MakeSafeParamValue() public static méthode

Makes parameter value safe to be used in param - this will check for any conflicting quote chars, but not full entity-encoding
public static MakeSafeParamValue ( string sLine, char cQuoteChar ) : string
sLine string Line of text
cQuoteChar char Quote char used in param - any such chars in text will be entity-encoded
Résultat string

SetEncoding() public méthode

Sets encoding to be used for conversion of binary data into string
public SetEncoding ( Encoding p_oEnc ) : void
p_oEnc System.Text.Encoding Encoding object
Résultat void

Property Details

MAX_PARAMS public_oe static_oe property

Maximum number of parameters in a tag - should be high enough to fit most sensible cases
public static int MAX_PARAMS
Résultat int

TEXT_CAPACITY public_oe static_oe property

Maximum default capacity of buffer that will keep data
public static int TEXT_CAPACITY
Résultat int

bClosure public_oe property

If true then it must be closed tag
public bool bClosure
Résultat bool

bComments public_oe property

If true then it must be comments tag
public bool bComments
Résultat bool

bEndClosure public_oe property

If true then it must be closed tag and closure sign / was at the END of tag, ie this is a SOLO tag
public bool bEndClosure
Résultat bool

bEntities public_oe property

True if entities were present (and transformed) in the original HTML
public bool bEntities
Résultat bool

bHashMode public_oe property

If true then tag params will be kept in a hash rather than in a fixed size arrays. This will be slow down parsing, but make it easier to use.
public bool bHashMode
Résultat bool

bLtEntity public_oe property

Set to true if < entity (tag start) was found
public bool bLtEntity
Résultat bool

cParamChars public_oe property

Character used to quote param's value: it is taken actually from parsed HTML
public byte[] cParamChars
Résultat byte[]

iChunkLength public_oe property

Length of the chunk in bHTML data array
public int iChunkLength
Résultat int

iChunkOffset public_oe property

Offset in bHTML data array at which this chunk starts
public int iChunkOffset
Résultat int

iParams public_oe property

Number of parameters and values stored in sParams array, OR in oParams hashtable if bHashMode is true
public int iParams
Résultat int

oEnc public_oe property

Encoder to be used for conversion of binary data into strings, Encoding.Default is used by default, but it can be changed if top level user of the parser detects that encoding was different
public Encoding oEnc
Résultat Encoding

oHTML public_oe property

For TAGS: it stores raw HTML that was parsed to generate thus chunk will be here UNLESS HTMLparser was configured not to store it there as it can improve performance

For TEXT or COMMENTS: actual text or comments - you MUST call Finalise(); first.

public string oHTML
Résultat string

oParams public_oe property

Hashtable with tag parameters: keys are param names and values are param values. ONLY used if bHashMode is set to TRUE.
public System.Collections.Generic.Dictionary oParams
Résultat object>.System.Collections.Generic.Dictionary

oType public_oe property

Chunk type showing whether its text, open or close tag, comments or script. WARNING: if type is comments or script then you have to manually call Finalise(); method in order to have actual text of comments/scripts in oHTML variable
public HTMLchunkType oType
Résultat HTMLchunkType

sParams public_oe property

Param names will be stored here - actual number is in iParams. ONLY used if bHashMode is set to FALSE.
public string[] sParams
Résultat string[]

sTag public_oe property

If its open/close tag type then this is where lowercased Tag will be kept
public string sTag
Résultat string

sValues public_oe property

Param values will be stored here - actual number is in iParams. ONLY used if bHashMode is set to FALSE.
public string[] sValues
Résultat string[]