//if the file size has not been specified, treat this as a generic "unrecognized" fingerprint public virtual bool CheckBigFileForMatch(BF.BigFile compareFile, bool checkHash) { if (FileSize == 0) { return(false); } else { bool isMatch = true; if (FileSize != compareFile.FileSize) { isMatch = false; } else { if (checkHash) { string strHash = BLD.HexConverter.ByteArrayToHexString(SHA256Hash); if (strHash != "0000000000000000000000000000000000000000000000000000000000000000") { if (strHash != BLD.HexConverter.ByteArrayToHexString(compareFile.SHA256Hash)) { isMatch = false; } } } } return(isMatch); } }
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(); }
public Index(string name, BF.BigFile parentBigFile, BF.Index parentIndex, long offset) { Initialize(); Name = name; ParentBigFile = parentBigFile; ParentIndex = parentIndex; Offset = offset; }
protected void StartBigFileLoad(string fileName) { mBigFile = new BF.BigFile(fileName); mBigFile.DirectoryMode = mDirectoryMode; mBigFile.ParseNamesFromKnownFileTypes = mParseNamesFromKnownFileTypes; Thread bfrThread = new Thread(new ThreadStart(ReadBigFile)); bfrThread.Start(); }
public Directory() { mName = "New Directory"; mParentBigFile = null; mParentDirectory = null; mDirectories = new ArrayList(); mFiles = new ArrayList(); mFilenames = new Hashtable(); mDirectoryNames = new Hashtable(); mFileCountRecursive = 0; }
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 BloodOmen2WrappedFile(BF.BigFile parent, BF.Index parentIndex, uint[] rawIndexData, string hashedName, int offset, int length) : base() { mParentBigFile = parent; mParentIndex = parentIndex; mRawIndexData = rawIndexData; mHashedName = hashedName; mOffset = offset; mLength = length; CheckFileDataForSanity(); if (mIsValidReference) { GetHeaderData(); mType = GetFileType(); mCanBeReplaced = true; } else { mType = BF.FileType.FromType(BF.FileType.FILE_TYPE_Invalid); } GetNameComponents(); }
public IndexIndex(string name, BF.BigFile parentBigFile, BF.Index parentIndex, long offset) : base(name, parentBigFile, parentIndex, offset) { mSubIndexType = IndexType.Unknown; }
public SR1Proto1CompressedFile(BF.BigFile parent, BF.Index parentIndex, uint[] rawIndexData, string hashedName, int offsetPosition, int lengthPosition, int compressedLengthPosition) : base(parent, parentIndex, rawIndexData, hashedName, offsetPosition, lengthPosition, compressedLengthPosition) { }
public WhiplashBigFileFileIndex(string name, BF.BigFile parentBigFile, BF.Index parentIndex, long offset) : base(name, parentBigFile, parentIndex, offset) { }
public CompressedFile(BF.BigFile parent, BF.Index parentIndex, uint[] rawIndexData, string hashedName, int offsetPosition, int lengthPosition, int compressedLengthPosition) : base(parent, parentIndex, rawIndexData, hashedName, offsetPosition, lengthPosition) { mCompressedLength = (int)rawIndexData[compressedLengthPosition]; mCanBeReplaced = false; }
public SoulReaverPlaystationPALFileIndex(string name, BF.BigFile parentBigFile, BF.Index parentIndex, long offset) : base(name, parentBigFile, parentIndex, offset) { _XorValue16 = 0xB722; _XorValue32 = 0xB722B722; }
public SoulReaver2AirForgeDemoFileIndex(string name, BF.BigFile parentBigFile, BF.Index parentIndex, long offset) : base(name, parentBigFile, parentIndex, offset) { mCompressedLengthPosition = 3; }
public MadDashRacingBigFileIndex(string name, BF.BigFile parentBigFile, BF.Index parentIndex, long offset) : base(name, parentBigFile, parentIndex, offset) { }
public Index(string name, BF.BigFile parentBigFile, long offset) { Initialize(); Name = name; ParentBigFile = parentBigFile; }
public SR1Proto1FileIndex(string name, BF.BigFile parentBigFile, BF.Index parentIndex, long offset) : base(name, parentBigFile, parentIndex, offset) { mCompressedLengthPosition = 2; }
public FileIndexWithCompressedFiles(string name, BF.BigFile parentBigFile, BF.Index parentIndex, long offset) : base(name, parentBigFile, parentIndex, offset) { mCompressedLengthPosition = 0; }
public PandemoniumFileIndex(string name, BF.BigFile parentBigFile, BF.Index parentIndex, long offset) : base(name, parentBigFile, parentIndex, offset) { }
//protected string GetNextUnusedName(Hashtable currentList, BF.File currentFile) //{ // int number = 0; // string newName = currentFile.Name; // do // { // newName = currentFile.Name + "-duplicate-" + string.Format("{0:000}", number); // number++; // } while (currentList.Contains(newName + "." + currentFile.FileExtension)); // return newName; //} public static BF.Index CreateMasterIndex(BF.BigFile bigfile) { return(CreateIndex(bigfile, bigfile.Type.MasterIndexType)); }
public FileIndexWithSeparateHashes(string name, BF.BigFile parentBigFile, BF.Index parentIndex, long offset) : base(name, parentBigFile, parentIndex, offset) { }
public static BF.Index CreateIndex(BF.BigFile bigfile, IndexType indexType) { switch (indexType) { case IndexType.Pandemonium: BF.PandemoniumFileIndex pfi = new PandemoniumFileIndex("Index", bigfile, null, 0); pfi.EntryLength = 2; pfi.OffsetPosition = 0; pfi.NameHashPosition = 1; return(pfi); break; case IndexType.SR1PS1MainIndex: BF.IndexIndex ixiSoulReaverPlayStationMainIndex; ixiSoulReaverPlayStationMainIndex = new BF.IndexIndex("Index", bigfile, null, 0); ixiSoulReaverPlayStationMainIndex.EntryLength = 2; ixiSoulReaverPlayStationMainIndex.OffsetPosition = 1; //??Position = 0; ixiSoulReaverPlayStationMainIndex.SubIndexType = IndexType.SR1PS1SubIndex; return(ixiSoulReaverPlayStationMainIndex); break; case IndexType.SR1PS1SubIndex: BF.FileIndex ixfSoulReaverPlayStationSubIndex; ixfSoulReaverPlayStationSubIndex = new BF.FileIndex("Index", bigfile, null, 0); ixfSoulReaverPlayStationSubIndex.EntryLength = 4; ixfSoulReaverPlayStationSubIndex.NameHashPosition = 0; ixfSoulReaverPlayStationSubIndex.LengthPosition = 1; ixfSoulReaverPlayStationSubIndex.OffsetPosition = 2; //??Position = 3; return(ixfSoulReaverPlayStationSubIndex); break; case IndexType.SR1PS1PALRetailMainIndex: BF.IndexIndex ixiSoulReaverPlayStationPALRetailMainIndex; ixiSoulReaverPlayStationPALRetailMainIndex = new BF.IndexIndex("Index", bigfile, null, 0); ixiSoulReaverPlayStationPALRetailMainIndex.EntryLength = 2; ixiSoulReaverPlayStationPALRetailMainIndex.OffsetPosition = 1; //??Position = 0; ixiSoulReaverPlayStationPALRetailMainIndex.SubIndexType = IndexType.SR1PS1PALRetailSubIndex; return(ixiSoulReaverPlayStationPALRetailMainIndex); break; case IndexType.SR1PS1PALRetailSubIndex: BF.SoulReaverPlaystationPALFileIndex ixfSoulReaverPlaystationPALRetailSubIndex; ixfSoulReaverPlaystationPALRetailSubIndex = new BF.SoulReaverPlaystationPALFileIndex("Index", bigfile, null, 0); ixfSoulReaverPlaystationPALRetailSubIndex.EntryLength = 4; ixfSoulReaverPlaystationPALRetailSubIndex.NameHashPosition = 0; ixfSoulReaverPlaystationPALRetailSubIndex.LengthPosition = 1; ixfSoulReaverPlaystationPALRetailSubIndex.OffsetPosition = 2; //??Position = 3; return(ixfSoulReaverPlaystationPALRetailSubIndex); break; case IndexType.SR1PS1PALJuly1999MainIndex: BF.IndexIndex ixiSoulReaverPlayStationPALPrereleaseJuly1999MainIndex; ixiSoulReaverPlayStationPALPrereleaseJuly1999MainIndex = new BF.IndexIndex("Index", bigfile, null, 0); ixiSoulReaverPlayStationPALPrereleaseJuly1999MainIndex.EntryLength = 2; ixiSoulReaverPlayStationPALPrereleaseJuly1999MainIndex.OffsetPosition = 1; //??Position = 0; ixiSoulReaverPlayStationPALPrereleaseJuly1999MainIndex.SubIndexType = IndexType.SR1PS1PALJuly1999SubIndex; return(ixiSoulReaverPlayStationPALPrereleaseJuly1999MainIndex); break; case IndexType.SR1PS1PALJuly1999SubIndex: BF.SoulReaverPlaystationPALFileIndex ixfSoulReaverPlaystationPALPrereleaseJuly1999SubIndex; ixfSoulReaverPlaystationPALPrereleaseJuly1999SubIndex = new BF.SoulReaverPlaystationPAL0x1b71FileIndex("Index", bigfile, null, 0); ixfSoulReaverPlaystationPALPrereleaseJuly1999SubIndex.EntryLength = 4; ixfSoulReaverPlaystationPALPrereleaseJuly1999SubIndex.NameHashPosition = 0; ixfSoulReaverPlaystationPALPrereleaseJuly1999SubIndex.LengthPosition = 1; ixfSoulReaverPlaystationPALPrereleaseJuly1999SubIndex.OffsetPosition = 2; //??Position = 3; return(ixfSoulReaverPlaystationPALPrereleaseJuly1999SubIndex); break; case IndexType.Gex1PlayStation: BF.FileIndex ixfSI100; ixfSI100 = new BF.FileIndex("Index", bigfile, null, 0); ixfSI100.FirstEntryOffset = 20; ixfSI100.EntryLength = 4; ixfSI100.NameHashPosition = 0; ixfSI100.LengthPosition = 1; ixfSI100.OffsetPosition = 2; //??Position = 3; return(ixfSI100); break; case IndexType.Gex1Saturn: BF.FileIndex ixfSI110; ixfSI110 = new BF.FileIndex("Index", bigfile, null, 0); ixfSI110.Endianness = BenLincoln.Data.Endianness.Big; ixfSI110.FirstEntryOffset = 20; ixfSI110.EntryLength = 4; ixfSI110.NameHashPosition = 0; ixfSI110.LengthPosition = 1; ixfSI110.OffsetPosition = 2; //??Position = 3; return(ixfSI110); break; case IndexType.BloodOmen: BF.FileIndex ixfSI200; ixfSI200 = new BF.FileIndex("Index", bigfile, null, 0); ixfSI200.EntryLength = 3; ixfSI200.NameHashPosition = 0; ixfSI200.LengthPosition = 1; ixfSI200.OffsetPosition = 2; return(ixfSI200); break; case IndexType.Gex2: BF.SR1Proto1FileIndex ixfSI300; ixfSI300 = new BF.SR1Proto1FileIndex("Index", bigfile, null, 0); ixfSI300.EntryLength = 6; ixfSI300.NameHashPosition = 0; ixfSI300.LengthPosition = 1; ixfSI300.OffsetPosition = 3; ixfSI300.CompressedLengthPosition = 2; //ixfSI300. //??Position = 2; //??Position = 4; //??Position = 5; return(ixfSI300); break; case IndexType.SR1PC: BF.FileIndex ixfSI400; ixfSI400 = new BF.FileIndex("Index", bigfile, null, 0); ixfSI400.EntryLength = 4; ixfSI400.NameHashPosition = 0; ixfSI400.LengthPosition = 1; ixfSI400.OffsetPosition = 2; //??Position = 3; return(ixfSI400); break; case IndexType.SR2AirForgeDemo: BF.SoulReaver2AirForgeDemoFileIndex ixfSoulReaver2AirForgeDemo; ixfSoulReaver2AirForgeDemo = new BF.SoulReaver2AirForgeDemoFileIndex("Index", bigfile, null, 0); ixfSoulReaver2AirForgeDemo.EntryLength = 4; ixfSoulReaver2AirForgeDemo.NameHashPosition = 0; ixfSoulReaver2AirForgeDemo.LengthPosition = 1; ixfSoulReaver2AirForgeDemo.OffsetPosition = 2; ixfSoulReaver2AirForgeDemo.CompressedLengthPosition = 3; return(ixfSoulReaver2AirForgeDemo); break; case IndexType.SR2PS2: BF.SoulReaver2PS2FileIndex ixfSoulReaver2PS2FileIndex; ixfSoulReaver2PS2FileIndex = new BF.SoulReaver2PS2FileIndex("Index", bigfile, null, 0); ixfSoulReaver2PS2FileIndex.EntryLength = 3; ixfSoulReaver2PS2FileIndex.LengthPosition = 0; ixfSoulReaver2PS2FileIndex.OffsetPosition = 1; ixfSoulReaver2PS2FileIndex.CompressedLengthPosition = 2; return(ixfSoulReaver2PS2FileIndex); break; case IndexType.SR2PC: BF.FileIndexWithSeparateHashes ixfSI550; ixfSI550 = new BF.FileIndexWithSeparateHashes("Index", bigfile, null, 0); ixfSI550.EntryLength = 3; ixfSI550.LengthPosition = 0; ixfSI550.OffsetPosition = 1; //??Position = 2; return(ixfSI550); break; case IndexType.TRLPS2Demo: BF.FileIndexWithSeparateHashes ixfSI600; ixfSI600 = new BF.FileIndexWithSeparateHashes("Index", bigfile, null, 0); ixfSI600.EntryLength = 4; ixfSI600.LengthPosition = 0; ixfSI600.OffsetPosition = 1; //??Position = 2; //??Position = 3; return(ixfSI600); break; case IndexType.TRLPS2: BF.FileIndexWithSeparateHashes ixfSI650; ixfSI650 = new BF.FileIndexWithSeparateHashes("Index", bigfile, null, 0); ixfSI650.EntryLength = 4; ixfSI650.LengthPosition = 0; ixfSI650.OffsetPosition = 1; //??Position = 2; //??Position = 3; //this index type uses offset values divided by 2048 ixfSI650.OffsetMultiplier = 2048; return(ixfSI650); break; case IndexType.MadDashRacingBigFile: BF.MadDashRacingBigFileIndex ixfBloodOmen2FileIndex; ixfBloodOmen2FileIndex = new BF.MadDashRacingBigFileIndex("Index", bigfile, null, 0); ixfBloodOmen2FileIndex.FirstEntryOffset = 0; ixfBloodOmen2FileIndex.EntryLength = 10; ixfBloodOmen2FileIndex.OffsetPosition = 0; return(ixfBloodOmen2FileIndex); break; case IndexType.WhiplashBigFile: BF.WhiplashBigFileFileIndex ixfWhiplashBigFileFileIndex; ixfWhiplashBigFileFileIndex = new BF.WhiplashBigFileFileIndex("Index", bigfile, null, 0); ixfWhiplashBigFileFileIndex.FirstEntryOffset = 0; ixfWhiplashBigFileFileIndex.EntryLength = 10; ixfWhiplashBigFileFileIndex.OffsetPosition = 0; return(ixfWhiplashBigFileFileIndex); break; } return(null); }