예제 #1
0
        /// <summary>
        /// Inits parsing
        /// </summary>
        /// <param name="p_bHTML">Data buffer</param>
        /// <param name="p_iHtmlLength">Length of data (buffer itself can be longer) - start offset assumed to be 0</param>
        public void Init(byte[] p_bHTML, int p_iHtmlLength)
        {
            // set default encoding
            if (oEnc == null)
            {
                oEnc = Encoding.Default;
            }

            CleanUp();

            bHTML = p_bHTML;

            // check whether we have got data that is actually in Unicode format
            // normally this would mean we have got plenty of zeroes
            // this and related code was contributed by Martin B�chtold from TTN Tele.Translator.Network
            if (bHTML.Length > 2)
            {
                if (bHTML[0] == 255 && bHTML[1] == 254)
                {
                    bHTML = Encoding.Default.GetBytes(Encoding.Unicode.GetString(bHTML, 2, bHTML.Length - 2));
                }
            }

            iDataLength = p_iHtmlLength;

            oTP.Init(this, oChunk, sText, bHTML, iDataLength, oE, oHE);
        }