public string[] ListFiles() { if (Open == -1) { BIN.BaseStream.Position = 0; var tmp = new BINHeader(); BIN.ReadStruct(ref tmp); return((from x in tmp.Offsets select GetFileName(x)).ToArray()); } HEDFormat Header = LoadHeader(); return((from x in Header.Offsets select GetFileName(x)).ToArray()); }
public Stream OpenFile(string FileName) { if (Open == -1) { BIN.BaseStream.Position = 0; var Header = new BINHeader(); BIN.ReadStruct(ref Header); for (int i = 0; i < Header.Offsets.Length; i++) { string FN = GetFileName(Header.Offsets[i]); if (Path.GetFileNameWithoutExtension(FN).ToLower() != Path.GetFileNameWithoutExtension(FileName).ToLower()) { continue; } uint FileEnd = (i + 1 < Header.Offsets.Length) ? Header.Offsets[i + 1] : (uint)(Header.BinLen + BIN.BaseStream.Position); return(new VirtStream(BIN.BaseStream, Header.Offsets[i], FileEnd - Header.Offsets[i])); } throw new Exception("File Not Found"); } var Info = LoadHeader(); for (int i = 0; i < Info.Offsets.Length; i++) { string FN = GetFileName(Info.Offsets[i]); if (Path.GetFileNameWithoutExtension(FN).ToLower() != Path.GetFileNameWithoutExtension(FileName).ToLower()) { continue; } uint FileEnd = (i + 1 < Info.Offsets.Length) ? Info.Offsets[i + 1] : (uint)LBA[Open].BaseStream.Length; return(new VirtStream(LBA[Open].BaseStream, Info.Offsets[i], FileEnd - Info.Offsets[i])); } throw new Exception("File Not Found"); }