示例#1
0
        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);
                    }
                }
        }
示例#2
0
 public LOFFile(LOFFolder parent, string name, byte[] data) : base(parent, name)
 {
     Data = data;
 }
示例#3
0
 public LOFFolder(LOF lof, LOFFolder parent, string name) : base(lof, parent, name)
 {
 }