public File(BF.BigFile parent, BF.Index parentIndex, uint[] rawIndexData, int hashNamePosition, int offsetPosition, int lengthPosition)
        {
            mNamePrefix    = "";
            mNameSuffix    = "";
            mParentBigFile = parent;
            mParentIndex   = parentIndex;
            mRawIndexData  = rawIndexData;
            uint rawHash = rawIndexData[hashNamePosition];

            mHashedName = BD.HexConverter.ByteArrayToHexString(BD.BinaryConverter.UIntToByteArray(rawHash));
            mOffset     = rawIndexData[offsetPosition] * mParentIndex.OffsetMultiplier;
            mLength     = (int)rawIndexData[lengthPosition];
            CheckFileDataForSanity();
            if (mIsValidReference)
            {
                GetHeaderData();
                mType          = GetFileType();
                mCanBeReplaced = true;
            }
            else
            {
                mType = BF.FileType.FromType(BF.FileType.FILE_TYPE_Invalid);
            }
            GetNameComponents();
        }
        protected void InitializeFileTypes()
        {
            BF.FileType ftUnknown = new BF.FileType();

            mFileTypes = new FileType[]
            {
                ftUnknown
            };
        }
 public File(BF.BigFile parent, BF.Index parentIndex, uint[] rawIndexData, string hashedName, int originPosition, int offsetPosition, int lengthPosition)
 {
     mParentBigFile = parent;
     mParentIndex   = parentIndex;
     mRawIndexData  = rawIndexData;
     mHashedName    = hashedName;
     mOffset        = originPosition + (rawIndexData[offsetPosition] * mParentIndex.OffsetMultiplier);
     mLength        = (int)rawIndexData[lengthPosition];
     CheckFileDataForSanity();
     if (mIsValidReference)
     {
         GetHeaderData();
         mType          = GetFileType();
         mCanBeReplaced = true;
     }
     else
     {
         mType = BF.FileType.FromType(BF.FileType.FILE_TYPE_Invalid);
     }
     GetNameComponents();
 }
        public void InitializeSpecificTypes()
        {
            //file types
            BF.FileType ftUnknown = new FileType();

            //mBigFileTypes = new BigFileType[]
            //{
            //    bftGex1PlayStation, bftGex1Saturn, bftBloodOmen, bftGex2, bftGex3, bftAkuji, bftSoulReaverProto1Demo, bftSoulReaverPlayStation,
            //    bftSoulReaverPlayStationPALPrereleaseJuly1999, bftSoulReaverPlayStationPALRetail, bftSoulReaverPC, bftSoulReaverDreamcast,
            //    bftSoulReaver2AirForgeDemo, bftSoulReaver2PlayStation2,
            //    bftSoulReaver2PC, bftDefiancePlayStation2, bftDefiancePC, bftTombRaiderLegendPlayStation2Demo, bftTombRaiderLegendPlayStation2, bftBloodOmen2
            //};

            mBigFileTypes = BigFileType.GetAllTypes();


            //BigFile fingerprints
            string dllPath = this.GetType().Assembly.Location;

            dllPath = System.IO.Path.GetDirectoryName(dllPath);
            string fpPath = System.IO.Path.Combine(dllPath, "Fingerprints.txt");

            string[] fingerprintLines = new string[] { };
            int      contentLineCount = 0;

            if (System.IO.File.Exists(fpPath))
            {
                try
                {
                    FileStream   inStream = new FileStream(fpPath, FileMode.Open, FileAccess.Read);
                    StreamReader inReader = new StreamReader(inStream);

                    string inData = inReader.ReadToEnd().Replace("\r\n", "\n");

                    fingerprintLines = inData.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);

                    inReader.Close();
                    inStream.Close();
                    foreach (string fpl in fingerprintLines)
                    {
                        bool isValid = true;
                        if (fpl.StartsWith("#"))
                        {
                            isValid = false;
                        }
                        if (fpl.Trim() == "")
                        {
                            isValid = false;
                        }
                        if (isValid)
                        {
                            contentLineCount++;
                        }
                    }
                }
                catch (Exception ex)
                {
                    // do something with this later?
                }
            }

            ArrayList fingerprintList = new ArrayList();

            int fingerprintNum = 0;

            foreach (string fpl in fingerprintLines)
            {
                bool   isValid             = true;
                string fpTitle             = "";
                string fpPlatform          = "";
                string fpFormat            = "";
                string fpLanguage          = "";
                string fpReleaseID         = "";
                string fpReleaseType       = "";
                string fpFileName          = "";
                string fpBuildDate         = "";
                long   fpFileSize          = -1;
                string fpBigFileTypeString = "";
                string fpSHA256Hash        = "";
                if (fpl.StartsWith("#"))
                {
                    isValid = false;
                }
                if (fpl.Trim() == "")
                {
                    isValid = false;
                }
                if (isValid)
                {
                    string[] lineSplit = fpl.Split(new string[] { "\t" }, StringSplitOptions.None);
                    if (lineSplit.Length >= 11)
                    {
                        fpTitle             = lineSplit[0];
                        fpPlatform          = lineSplit[1];
                        fpFormat            = lineSplit[2];
                        fpLanguage          = lineSplit[3];
                        fpReleaseID         = lineSplit[4];
                        fpReleaseType       = lineSplit[5];
                        fpFileName          = lineSplit[6];
                        fpBuildDate         = lineSplit[7];
                        fpFileSize          = long.Parse(lineSplit[8]);
                        fpBigFileTypeString = lineSplit[9];
                        fpSHA256Hash        = lineSplit[10];
                    }
                    else
                    {
                        isValid = false;
                    }
                }
                if (isValid)
                {
                    BF.Fingerprint newFingerprint = new BF.Fingerprint();
                    if (BigFileTypes.BigFileTypeHash.ContainsKey(fpBigFileTypeString))
                    {
                        newFingerprint.Type = (BigFileType)BigFileTypes.BigFileTypeHash[fpBigFileTypeString];
                    }
                    else
                    {
                        isValid = false;
                    }
                    if (isValid)
                    {
                        newFingerprint.Title       = fpTitle;
                        newFingerprint.Platform    = fpPlatform;
                        newFingerprint.Format      = fpFormat;
                        newFingerprint.Language    = fpLanguage;
                        newFingerprint.ReleaseID   = fpReleaseID;
                        newFingerprint.ReleaseType = fpReleaseType;
                        newFingerprint.FileName    = fpFileName;
                        newFingerprint.BuildDate   = fpBuildDate;
                        newFingerprint.FileSize    = fpFileSize;
                        if (fpSHA256Hash.Trim() != "")
                        {
                            newFingerprint.SHA256Hash = BLD.HexConverter.HexStringToBytes(fpSHA256Hash);
                        }
                        fingerprintList.Add(newFingerprint);

                        fingerprintNum++;
                    }
                }
            }

            BF.Fingerprint dummy = new BF.Fingerprint();
            mFingerprints = (BF.Fingerprint[])fingerprintList.ToArray(dummy.GetType());

            //mFingerprints = new BF.Fingerprint[]
            //{
            //    fpGexPlaystationNTSC, fpGexSaturnNTSC, fpGex2PlaystationNTSC,
            //    fpBloodOmenPlaystationNTSC, fpBloodOmenPlaystationPAL, fpBloodOmenKTV, fpBloodOmenPC,
            //    fpAkujiDemoNTSC,
            //    fpAkujiNTSC, fpGex3NTSC, fpSRPSLighthouseNTSC, fpSRPSLighthousePAL,
            //    fpSRPSBetaNTSC, fpSRPSFireDemoNTSC, fpSRPSFireDemoPAL, fpSRPSNTSC, fpSRPSPAL, fpSRPCFireDemo, fpSRPCQFM,
            //    fpSRPC, fpSRDCNTSC, fpSRDCDemo, fpSR2AirforgePS2NTSC, fpSR2AirforgePS2PAL, fpSR2PS2NTSC,
            //    fpSR2PS2PAL, fpSR2PS2Japan, fpSR2PC, fpSR2PCDeutsch,
            //    fpDefiancePS2NTSC, fpDefiancePS2PAL, fpDefiancePS2PALPR20031010, fpDefiancePC, fpDefiancePCDeutsch,
            //    fpTRLPS2DemoPAL, fpTRLPS2NTSC, fpTRLPS2PAL, fpTRLPSPPAL,
            //    fpBloodOmen2PC,
            //    fpUnknown
            //};

            int d2 = 7;
        }