PirsEntry getEntry() { PirsEntry entry = new PirsEntry(); entry.Filename = readString(0x27); //Console.WriteLine(entry.FileName.Length); if (!String.IsNullOrWhiteSpace(entry.Filename.Trim())) { entry.Flags = br.ReadByte(); if (getBit(entry.Flags, 7)) { entry.Folder = true; } else { entry.Folder = false; } br.ReadBytes(0x3); entry.Blocklen = Oper.ByteArrayToInt(br.ReadBytes(0x3)); entry.Cluster = br.ReadInt32() >> 8; entry.Parent = (ushort)Convert.ToUInt32(Oper.ByteArrayToString(br.ReadBytes(2)), 16); entry.Size = Oper.ByteArrayToInt(br.ReadBytes(0x4)); entry.UpdateTime = dosDateTime(Oper.ByteArrayToInt(br.ReadBytes(0x4))); entry.AccessTime = dosDateTime(Oper.ByteArrayToInt(br.ReadBytes(0x4))); long pos = br.BaseStream.Position; entry.CRC = getCRC(br, entry.Cluster, entry.Size); br.BaseStream.Seek(pos, SeekOrigin.Begin); } return(entry); }
void openfile() { if (this.br != null) { this.br.Close(); } if (this.fs != null) { this.fs.Dispose(); } if (!File.Exists(_filename)) { return; } this.fs = new FileStream(_filename, FileMode.Open, FileAccess.Read, FileShare.Read); br = new BinaryReader(fs); getDescription(); br.BaseStream.Seek(0L, SeekOrigin.Begin); int num = Oper.ByteArrayToInt(br.ReadBytes(4)); if (((num != MAGIC_PIRS) && (num != MAGIC_LIVE)) && (num != MAGIC_CON_)) { Console.WriteLine("Not a PIRS/LIVE file!\r\n"); } else { br.BaseStream.Seek(0xc030L, SeekOrigin.Begin); int num2 = Oper.ByteArrayToInt(br.ReadBytes(4)); if (num == MAGIC_CON_) { pirs_offset = PIRS_TYPE2; pirs_start = 0xc000L; } else if (num2 == 0xffff) { pirs_offset = PIRS_TYPE1; pirs_start = PIRS_BASE + pirs_offset; } else { pirs_offset = PIRS_TYPE2; pirs_start = PIRS_BASE + pirs_offset; } if (variables.debugme) { Console.WriteLine("offset: {0:X} - start: {1:X}", pirs_offset, pirs_start); } parse(); } //br.Close(); }