Ejemplo 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);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public bool ReplaceFile(string file, byte[] data)
        {
            int partNum = 0;

            if (file.Contains("["))
            {
                partNum = int.Parse(Regex.Match(file, @"\[([^]]*)\]").Groups[1].Value);
                file    = file.Remove(file.IndexOf("["));
            }

            if (!Entries.ContainsKey(file))
            {
                return(false);
            }

            DRPEntry entry = Entries[file];

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

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