Example #1
0
        public PackFile(string filename)
        {
            this.FileName = filename;

            using (FileStream s = File.Open(filename, FileMode.Open, FileAccess.Read))
                using (BinaryReader reader = new BEBinaryReader(s)) {
                    while (true)
                    {
                        header = reader.ReadInt32();
                        //if (header == 0) break;
                        int files = reader.ReadInt32();
                        //packData.header.i3 = reader.ReadInt32();
                        if (files == 0)
                        {
                            break;
                        }

                        for (int i = 0; i < files; i++)
                        {
                            string readName = reader.ReadString();

                            FileData fileDat = new FileData();
                            fileDat.offset   = reader.ReadInt32();
                            fileDat.size     = reader.ReadInt32();
                            fileDat.i3       = reader.ReadInt32();
                            fileDat.filename = filename;

                            Files.Add(readName, fileDat);
                        }
                    }
                }
        }
Example #2
0
        public PackFile(string filename)
        {
            this.filename = filename;
            int files    = 5;
            int subpacks = 2;

            using (FileStream s = File.Open(filename, FileMode.Open, FileAccess.Read))
                using (BinaryReader reader = new BEBinaryReader(s))
                {
                    while (true)
                    {
                        header = reader.ReadInt32();
                        if (header == 0)
                        {
                            break;
                        }
                        filesInPack = reader.ReadInt32();
                        //packData.header.i3 = reader.ReadInt32();


                        files = filesInPack;

                        for (int i = 0; i < files; i++)
                        {
                            string readName = reader.ReadString();
                            filenames.Add(readName);



                            FileData fileDat = new FileData();
                            fileDat.offset = reader.ReadInt32();
                            fileDat.size   = reader.ReadInt32();
                            fileDat.i3     = reader.ReadInt32();
                            fileData.Add(fileDat);

                            this.files++;
                        }

                        s.Seek(header, SeekOrigin.Begin);
                    }
                }
        }