public override void Load(string filePath) { RootFolder = new LOFFolder(this); using (var fs = File.OpenRead(filePath)) using (var br = new BinaryReader(fs)) { fs.Seek(16, SeekOrigin.Begin); int fileCount = br.ReadInt32(); fs.Seek(4, SeekOrigin.Current); for (int i = 0; i < fileCount; i++) { fs.Seek(4 * 6, SeekOrigin.Current); // 6 ints readNullTerminated(br); // korean name, can ignore string fileName = readNullTerminated(br); fs.Seek(4 * 3, SeekOrigin.Current); // 3 ints int filePos = br.ReadInt32(); int fileLen = br.ReadInt32(); long tmpPos = fs.Position; fs.Seek(filePos, SeekOrigin.Begin); byte[] data = br.ReadBytes(fileLen); fs.Seek(tmpPos, SeekOrigin.Begin); var newFile = new LOFFile(RootFolder as LOFFolder, fileName, data); RootFolder.Files.Add(newFile); FileList.Add(newFile); } } }
public LOFFile(LOFFolder parent, string name, byte[] data) : base(parent, name) { Data = data; }
public LOFFolder(LOF lof, LOFFolder parent, string name) : base(lof, parent, name) { }