Ejemplo n.º 1
0
        private int GetStartBytePosition(ref byte[] bufferData)
        {
            int num = 0;

            if (this._startIndexBufferID == this._currentBufferIndex + 1L)
            {
                num = this._startLocationInBufferID;
            }
            if (this._endIndexBufferID == this._currentBufferIndex + 1L)
            {
                num = this._endLocationInBufferID;
            }
            byte[] bytes = Encoding.UTF8.GetBytes("Content-Type: ");
            int    num2  = FileProcessor.FindBytePattern(ref bufferData, ref bytes, num);

            if (num2 != -1)
            {
                bytes = Encoding.UTF8.GetBytes("\r\n\r\n");
                int num3 = FileProcessor.FindBytePattern(ref bufferData, ref bytes, num2);
                if (num3 != -1)
                {
                    return(num3 + 4);
                }
            }
            else
            {
                if (num - bytes.Length > 0)
                {
                    return(-1);
                }
                if (this._currentBufferIndex > 0L)
                {
                    byte[] array  = this._bufferHistory[this._currentBufferIndex - 1L];
                    byte[] array2 = FileProcessor.MergeArrays(ref array, ref bufferData);
                    byte[] bytes2 = Encoding.UTF8.GetBytes("Content-Type: ");
                    num2 = FileProcessor.FindBytePattern(ref array2, ref bytes2, array.Length - bytes2.Length);
                    if (num2 != -1)
                    {
                        bytes2 = Encoding.UTF8.GetBytes("Content-Type: ");
                        int num4 = FileProcessor.FindBytePattern(ref array2, ref bytes2, array.Length - bytes2.Length);
                        if (num4 != -1)
                        {
                            if (num4 > array.Length)
                            {
                                return(num4 - array.Length);
                            }
                            return(0);
                        }
                    }
                }
            }
            return(-1);
        }
Ejemplo n.º 2
0
        private int GetStartBytePosition(ref byte[] bufferData)
        {
            int startAtIndex = 0;

            if (this._startIndexBufferID == this._currentBufferIndex + 1L)
            {
                startAtIndex = this._startLocationInBufferID;
            }
            if (this._endIndexBufferID == this._currentBufferIndex + 1L)
            {
                startAtIndex = this._endLocationInBufferID;
            }
            byte[] bytes1       = Encoding.UTF8.GetBytes("Content-Type: ");
            int    bytePattern1 = FileProcessor.FindBytePattern(ref bufferData, ref bytes1, startAtIndex);

            if (bytePattern1 != -1)
            {
                byte[] bytes2       = Encoding.UTF8.GetBytes("\r\n\r\n");
                int    bytePattern2 = FileProcessor.FindBytePattern(ref bufferData, ref bytes2, bytePattern1);
                if (bytePattern2 != -1)
                {
                    return(bytePattern2 + 4);
                }
            }
            else
            {
                if (startAtIndex - bytes1.Length > 0 || this._currentBufferIndex <= 0L)
                {
                    return(-1);
                }
                byte[] arrayOne       = this._bufferHistory[this._currentBufferIndex - 1L];
                byte[] containerBytes = FileProcessor.MergeArrays(ref arrayOne, ref bufferData);
                byte[] bytes2         = Encoding.UTF8.GetBytes("Content-Type: ");
                if (FileProcessor.FindBytePattern(ref containerBytes, ref bytes2, arrayOne.Length - bytes2.Length) != -1)
                {
                    byte[] bytes3       = Encoding.UTF8.GetBytes("Content-Type: ");
                    int    bytePattern2 = FileProcessor.FindBytePattern(ref containerBytes, ref bytes3, arrayOne.Length - bytes3.Length);
                    if (bytePattern2 != -1)
                    {
                        if (bytePattern2 > arrayOne.Length)
                        {
                            return(bytePattern2 - arrayOne.Length);
                        }
                        return(0);
                    }
                }
            }
            return(-1);
        }
Ejemplo n.º 3
0
        private int GetEndBytePosition(ref byte[] bufferData)
        {
            int startAtIndex = 0;

            if (this._startIndexBufferID == this._currentBufferIndex + 1L)
            {
                startAtIndex = this._startLocationInBufferID;
            }
            byte[] bytes1       = Encoding.UTF8.GetBytes(this._fieldSeperator);
            int    bytePattern1 = FileProcessor.FindBytePattern(ref bufferData, ref bytes1, startAtIndex);

            if (bytePattern1 != -1)
            {
                if (bytePattern1 - 2 >= 0)
                {
                    return(bytePattern1 - 2);
                }
            }
            else
            {
                if (startAtIndex - bytes1.Length > 0 || this._currentBufferIndex <= 0L)
                {
                    return(-1);
                }
                byte[] arrayOne       = this._bufferHistory[this._currentBufferIndex - 1L];
                byte[] containerBytes = FileProcessor.MergeArrays(ref arrayOne, ref bufferData);
                byte[] bytes2         = Encoding.UTF8.GetBytes(this._fieldSeperator);
                int    bytePattern2   = FileProcessor.FindBytePattern(ref containerBytes, ref bytes2, arrayOne.Length - bytes2.Length + startAtIndex);
                if (bytePattern2 != -1)
                {
                    bytes2 = Encoding.UTF8.GetBytes("\r\n\r\n");
                    int bytePattern3 = FileProcessor.FindBytePattern(ref containerBytes, ref bytes2, bytePattern2);
                    if (bytePattern3 != -1 && bytePattern3 > arrayOne.Length)
                    {
                        return(bytePattern3 - arrayOne.Length);
                    }
                }
            }
            return(-1);
        }