public CasCat(string catPath, Main handle) { this.mainForm = handle; this.casPath = Path.GetDirectoryName(catPath) + "\\"; this.modName = Path.GetFileName(catPath); this.setUserDefaultDirectory(); this.casWriterNumber = 0; this.guidTable = new Dictionary <byte[], string>(new ByteArrayComparer()); this.casReaders = new Dictionary <int, BinaryReader>(); this.catEntries = new List <CatEntry>(); using (BinaryReader binaryReader = new BinaryReader(File.Open(catPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))) { if (new string(binaryReader.ReadChars(16)) != "NyanNyanNyanNyan") { throw new Exception("No Nyan found. Invalid cat file header."); } while (binaryReader.BaseStream.Position < binaryReader.BaseStream.Length / 1L) { CatEntry catEntry = new CatEntry(binaryReader); this.catEntries.Add(catEntry); BinaryReader binaryReader2 = this.getBinaryReader((int)catEntry.archiveNumber); binaryReader2.BaseStream.Position = (long)((ulong)catEntry.offset); uint num = binaryReader2.ReadUInt32(); if (num == 263377358u) { DbxFile dbxFile = new DbxFile(binaryReader2, catEntry, this); dbxFile.InitializeFilename(binaryReader2); this.guidTable[dbxFile.dbxHeader.fileGuid] = dbxFile.filename; this.addToTreeView(dbxFile); } } } }
public DbxFile(BinaryReader fCas, CatEntry cat, CasCat ct) { this.catHandle = ct; this.catEntry = cat; this.InitializeMetaData(fCas); this.binaryReader = fCas; }
public CasCat(string catPath, Main handle) { this.mainForm = handle; this.casPath = Path.GetDirectoryName(catPath) + "\\"; this.modName = Path.GetFileName(catPath); this.setUserDefaultDirectory(); this.casWriterNumber = 0; this.guidTable = new Dictionary<byte[], string>(new ByteArrayComparer()); this.casReaders = new Dictionary<int, BinaryReader>(); this.catEntries = new List<CatEntry>(); using (BinaryReader binaryReader = new BinaryReader(File.Open(catPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))) { if (new string(binaryReader.ReadChars(16)) != "NyanNyanNyanNyan") { throw new Exception("No Nyan found. Invalid cat file header."); } while (binaryReader.BaseStream.Position < binaryReader.BaseStream.Length / 1L) { CatEntry catEntry = new CatEntry(binaryReader); this.catEntries.Add(catEntry); BinaryReader binaryReader2 = this.getBinaryReader((int)catEntry.archiveNumber); binaryReader2.BaseStream.Position = (long)((ulong)catEntry.offset); uint num = binaryReader2.ReadUInt32(); if (num == 263377358u) { DbxFile dbxFile = new DbxFile(binaryReader2, catEntry, this); dbxFile.InitializeFilename(binaryReader2); this.guidTable[dbxFile.dbxHeader.fileGuid] = dbxFile.filename; this.addToTreeView(dbxFile); } } } }