public override string GetInternalName(BF.File checkFile)
        {
            return("");

            int    nameOffset   = mNameOffset;
            string internalName = "";

            Stream       iStream;
            BinaryReader iReader;

            try
            {
                if (checkFile.GetType() == typeof(CompressedFile))
                {
                    iStream = new MemoryStream(checkFile.Length);
                    CompressedFile compressedCheckFile = (CompressedFile)checkFile;
                    compressedCheckFile.ExportToStream(iStream);
                    iStream.Seek(0, SeekOrigin.Begin);
                    iReader = new BinaryReader(iStream);
                    iStream.Seek(nameOffset, SeekOrigin.Begin);
                }
                else
                {
                    iStream = new FileStream(checkFile.ParentBigFile.Path, FileMode.Open, FileAccess.Read);
                    iStream.Seek(checkFile.Offset, SeekOrigin.Begin);
                    iReader = new BinaryReader(iStream);
                    iStream.Seek(checkFile.Offset + nameOffset, SeekOrigin.Begin);
                }

                byte[] nameBuffer = sanitizeByteArray(iReader.ReadBytes(8), (byte)95);
                internalName = new string(Encoding.ASCII.GetChars(nameBuffer, 0, 8));
                internalName = internalName.Trim(new char[] { (char)'_' });
                internalName = internalName.ToLower();

                //String strModelName = new String(iReader.ReadChars(10)); // Need to check
                //try
                //{
                //    internalName = strModelName.Substring(0, strModelName.IndexOf('\0'));
                //}
                //catch
                //{
                //    internalName = strModelName;
                //}

                iReader.Close();
                iStream.Close();
            }
            catch (Exception ex)
            {
                throw new FileReadException
                          ("Failed to read file " + Name + "\r\n" +
                          "The specific error message is: \r\n" +
                          ex.Message
                          );
            }
            return(internalName);
        }
        public override void ReadIndex()
        {
            ReadEntries();
            int numFiles = mEntries.GetUpperBound(0) + 1;

            Files = new BF.File[numFiles];
            for (int i = 0; i < numFiles; i++)
            {
                BF.File tFile;
                if (mEntries[i][mCompressedLengthPosition] > 0)
                {
                    tFile = new BF.CompressedFile(mParentBigFile, this, mEntries[i], mNameHashPosition, mOffsetPosition, mLengthPosition, mCompressedLengthPosition);
                }
                else
                {
                    tFile = new BF.File(mParentBigFile, this, mEntries[i], mNameHashPosition, mOffsetPosition, mLengthPosition);
                }
                Files[i] = tFile;
                if (i > 0)
                {
                    mLoadedPercent = (((float)i / (float)numFiles) * READ_CONTENT_PERCENT) + READ_INDEX_PERCENT;
                }
            }
        }
        public override bool CompareHeaders(BF.File checkFile, int offset)
        {
            bool matchFound = true;

            //if the header data has already been read into the file, use its copy
            if (offset == 0)
            {
                if (mHeader.GetUpperBound(0) > checkFile.RawHeaderData.GetUpperBound(0))
                {
                    return(false);
                }
                for (int i = 0; i <= mHeader.GetUpperBound(0); i++)
                {
                    if (mHeader[i] != checkFile.RawHeaderData[i])
                    {
                        matchFound = false;
                    }
                }
            }
            //otherwise read the appropriate bytes
            else
            {
                if ((offset + mHeader.GetUpperBound(0) > checkFile.Length))
                {
                    return(false);
                }

                byte[] headerFromFile = new byte[mHeader.GetUpperBound(0) + 1];

                Stream       iStream;
                BinaryReader iReader;

                try
                {
                    if (checkFile.GetType() == typeof(CompressedFile))
                    {
                        iStream = new MemoryStream(checkFile.Length);
                        CompressedFile compressedCheckFile = (CompressedFile)checkFile;
                        compressedCheckFile.ExportToStream(iStream);

                        iReader = new BinaryReader(iStream);
                        iStream.Seek(offset, SeekOrigin.Begin);

                        //read as many bytes as the header should hold
                        iStream.Read(headerFromFile, 0, headerFromFile.GetUpperBound(0) + 1);
                        for (int i = 0; i <= headerFromFile.GetUpperBound(0); i++)
                        {
                            if (mHeader[i] != headerFromFile[i])
                            {
                                matchFound = false;
                            }
                        }
                    }
                    else
                    {
                        iStream = new FileStream(checkFile.ParentBigFile.Path, FileMode.Open, FileAccess.Read);
                        iReader = new BinaryReader(iStream);
                        iStream.Seek(checkFile.Offset + offset, SeekOrigin.Begin);

                        //read as many bytes as the header should hold
                        iStream.Read(headerFromFile, 0, headerFromFile.GetUpperBound(0) + 1);
                        for (int i = 0; i <= headerFromFile.GetUpperBound(0); i++)
                        {
                            if (mHeader[i] != headerFromFile[i])
                            {
                                matchFound = false;
                            }
                        }
                    }

                    iReader.Close();
                    iStream.Close();
                }
                catch (Exception ex)
                {
                    throw new FileReadException
                              ("Failed to read file " + Name + "\r\n" +
                              "The specific error message is: \r\n" +
                              ex.Message
                              );
                }
            }

            return(matchFound);
        }
        protected int GetRealHeaderLocation(BF.File checkFile)
        {
            int          headerLocation = 0;
            Stream       iStream;
            BinaryReader iReader;

            try
            {
                if (checkFile.GetType() == typeof(CompressedFile))
                {
                    iStream = new MemoryStream(checkFile.Length);
                    CompressedFile compressedCheckFile = (CompressedFile)checkFile;
                    compressedCheckFile.ExportToStream(iStream);
                    iStream.Seek(0, SeekOrigin.Begin);
                }
                else
                {
                    iStream = new FileStream(checkFile.ParentBigFile.Path, FileMode.Open, FileAccess.Read);
                    iStream.Seek(checkFile.Offset, SeekOrigin.Begin);
                }

                iReader = new BinaryReader(iStream);

                Int32          nameOffsetLocation = 0;
                Int32          nameOffset         = 0;
                UInt32         startPosition      = (UInt32)iReader.BaseStream.Position;
                UInt32         bytesRead          = 0;
                RelativeStream relStream          = new RelativeStream(iReader, startPosition);

                relStream.Pos  = 0;
                relStream.Pos += 0x04;
                UInt32 regionCount = iReader.ReadUInt32();

                // AMF 02/08/14 - 500 seemed like a reasonable maximum
                if (regionCount > 500)
                {
                    throw new Exception("Too many regions to scan.");
                }

                UInt32   regionPosition      = 0;
                UInt32[] regionSizes         = new UInt32[regionCount];
                UInt32[] regionPositions     = new UInt32[regionCount];
                UInt32[] objectDataSizes     = new UInt32[regionCount];
                UInt32[] objectDataPositions = new UInt32[regionCount];
                for (UInt32 r = 0; r < regionCount; r++)
                {
                    regionSizes[r]     = iReader.ReadUInt32();
                    regionPositions[r] = regionPosition;
                    regionPosition    += regionSizes[r];
                    relStream.Pos     += 0x08;
                }

                UInt32 regionDataSize      = regionCount * 0x0C;
                UInt32 pointerDataPosition = (regionDataSize & 0x00000003) + ((regionDataSize + 0x17) & 0xFFFFFFF0);
                for (UInt32 r = 0; r < regionCount; r++)
                {
                    relStream.Pos = pointerDataPosition;
                    UInt32 pointerCount       = iReader.ReadUInt32();
                    UInt32 pointerDataSize    = pointerCount * 0x04;
                    UInt32 objectDataPosition = pointerDataPosition + ((pointerDataSize + 0x13) & 0xFFFFFFF0);
                    UInt32 objectDataSize     = (regionSizes[r] + 0x0F) & 0xFFFFFFF0;

                    objectDataSizes[r]     = objectDataSize;
                    objectDataPositions[r] = objectDataPosition;

                    relStream.Pos = objectDataPosition;
                    Byte[] objectData = iReader.ReadBytes((Int32)objectDataSize);
                    bytesRead += objectDataSize;

                    if (headerLocation == 0 && bytesRead >= mHeaderOffset)
                    {
                        Int64 overshot = (Int64)iReader.BaseStream.Position - (Int32)objectDataSize;
                        overshot      += (Int64)mHeaderOffset;
                        headerLocation = ((Int32)overshot) - ((Int32)startPosition + 0x04);
                    }

                    if (nameOffsetLocation == 0 && bytesRead >= mNamePointerOffset)
                    {
                        Int64 overshot = (Int64)iReader.BaseStream.Position - (Int32)objectDataSize;
                        overshot          += (Int64)mNamePointerOffset;
                        nameOffsetLocation = ((Int32)overshot) - ((Int32)startPosition + 0x04);
                    }

                    relStream.Pos = pointerDataPosition + 0x04;
                    UInt32[] pointers = new UInt32[pointerCount];
                    for (UInt32 p = 0; p < pointerCount; p++)
                    {
                        pointers[p] = iReader.ReadUInt32();
                    }

                    UInt32[] addresses = new UInt32[pointerCount];
                    for (UInt32 p = 0; p < pointerCount; p++)
                    {
                        relStream.Pos = objectDataPosition + pointers[p];

                        bool readingNameOffset = (relStream.Pos == nameOffsetLocation);

                        UInt32 value1 = iReader.ReadUInt32();
                        UInt32 value2 = value1 & 0x003FFFFF;
                        UInt32 value3 = value1 >> 0x16;

                        pointers[p] += regionPositions[r];
                        addresses[p] = regionPositions[value3] + value2;

                        if (readingNameOffset)
                        {
                            nameOffset = (Int32)addresses[p];
                        }
                    }

                    pointerDataPosition = objectDataPosition + objectDataSize;

                    if (headerLocation != 0 && nameOffsetLocation != 0)
                    {
                        break;
                    }
                }

                for (UInt32 r = 0; r < regionCount; r++)
                {
                    if (nameOffset < (Int32)objectDataSizes[r])
                    {
                        nameOffset += (Int32)objectDataPositions[r];
                        break;
                    }

                    if (r == (regionCount - 1))
                    {
                        nameOffset = 0;
                    }

                    nameOffset -= (Int32)objectDataSizes[r];
                }

                mNameOffset = nameOffset;

                iReader.Close();
                iStream.Close();
            }
            catch (Exception ex)
            {
                throw new FileReadException
                          ("Failed to read file " + Name + "\r\n" +
                          "The specific error message is: \r\n" +
                          ex.Message
                          );
            }

            return(headerLocation);
        }