Beispiel #1
0
        public static void ExtractFile(string file)
        {
            var index = SaveReader.GetIndex(Path.GetFileNameWithoutExtension(file));
            var p     = Directory.GetParent(Path.GetFullPath(file)).FullName;
            var dest  = Path.Combine(p, $"{index:00}");

            ExtractFiles(file, dest, index);
        }
Beispiel #2
0
        public SaveFile(Stream stream, int index)
        {
            Stream          = stream;
            SaveIndex       = index;
            stream.Position = 0;
            Span <byte> hdr = stackalloc byte[0x30];

            stream.Read(hdr);

            Header = SaveReader.GetSaveFileHeader(hdr, index);
        }
Beispiel #3
0
        public byte[] GetEntry(int index)
        {
            if ((uint)index >= Header.EntryCount)
            {
                throw new ArgumentOutOfRangeException(nameof(index));
            }

            var size  = Header.EncryptedEntrySize;
            var start = 0x30 + (index * size);

            Span <byte> encEntry = stackalloc byte[size];

            Stream.Position = start;
            Stream.Read(encEntry);

            if (BitConverter.ToUInt64(encEntry) == 0)
            {
                return(Array.Empty <byte>());
            }

            var e = SaveReader.GetSaveFileEntry(encEntry, SaveIndex, index);

            return(e.Data[..Header.DecryptedEntrySize]);