translatr.CineFile.parseBlock C# (CSharp) Method

parseBlock() private method

private parseBlock ( byte array, int block ) : void
array byte
block int
return void
        private void parseBlock(byte[] array, int block)
        {
            // Skip first block if its a big one
            // It's most likely a cinstream so no subs here
            if (block == 0)
            {
                if (array[8] != 0x60)
                    return;
            }

            // Start at end of block
            int index = array.Length - 1;

            // Remove end zeros
            while (index >= 0 && array[index] == 0x00)
            {
                index--;
            }

            if (array[index] != 0x0d)
                return; // No subs here

            // Search for start of subtitle section
            int endidx = index;

            int startidx = findSubsStartIndex(array, endidx);

            if (startidx == 0)
                return; //no subs found
            else
                parseSubsBlock(subEntries, Encoding.UTF8.GetString(array, startidx + 4, endidx - startidx - 4), block);
        }