Exemplo n.º 1
0
        public void Read(string filepath)
        {
            using (var stream = File.Open(filepath, FileMode.Open))
            {
                using (var reader = new BinaryReader(stream))
                {
                    CRC = reader.ReadBuint32();

                    stream.Seek(0x14, SeekOrigin.Begin);
                    Unk1 = reader.ReadBint16();
                    int _filecount = reader.ReadBint16();

                    stream.Seek(0x1C, SeekOrigin.Begin);
                    RANDXS_SEED = reader.ReadBuint32();

                    stream.Seek(0x60, SeekOrigin.Begin); // Data start

                    for (int i = 0; i < _filecount; i++)
                    {
                        var entry = new DRPEntry(reader);
                        Entries.Add(entry.Filename, entry);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public bool ReplaceFile(string file, byte[] data)
        {
            if (!Entries.ContainsKey(file))
            {
                return(false);
            }

            int partNum = 0;

            if (file.Contains("["))
            {
                partNum = int.Parse(file.Substring(file.IndexOf("["), file.IndexOf("]")));
                file    = file.Remove(file.IndexOf("_["));
            }
            DRPEntry entry = Entries[file];

            byte[] cdata = Util.Compress(data);

            entry.Files[partNum] = new DRPFileEntry(cdata, data.Length);
            return(true);
        }