Esempio n. 1
0
        public RPF7File(Stream inputStream, String filname = "")
        {
            this.Filename = filname;
            Stream = inputStream;

            Info = new Structs.RPF7Header(Stream);

            if (new string(Info.Magic) != "RPF7")
            {
                throw new Exception("Invalid RPF Magic");
            }

            sixteenRoundsDecrypt = (Info.Flag >> 28) == 0xf;

            if (sixteenRoundsDecrypt)
            {
                throw new Exception("Needed to be tested first");
            }

            using (BinaryReader binaryStream = new BinaryReader(AES.DecryptStream(new StreamKeeper(this.Stream), sixteenRoundsDecrypt)))
            {
                MemoryStream entriesInfo = new MemoryStream(binaryStream.ReadBytes(0x10 * Info.EntriesCount));
                MemoryStream filenames = new MemoryStream(binaryStream.ReadBytes(Info.EntriesNamesLength));
                this.Root = Entry.CreateFromHeader(new Structs.RPF7EntryInfoTemplate(entriesInfo), this, entriesInfo, filenames);
            }

            if (!(this.Root is DirectoryEntry))
            {
                throw new Exception("Expected root to be directory");
            }
        }
Esempio n. 2
0
 public void RemoveEntry(Entry entry)
 {
     Entries.Remove(entry.Name);
 }
Esempio n. 3
0
 public void AddEntry(Entry entry)
 {
     Entries.Add(entry.Name, entry);
     entry.Parent = this;
 }