Пример #1
0
        /// <summary>Checks to see if the data belongs to a Gen7 save</summary>
        /// <param name="data">Save data of which to determine the type</param>
        /// <returns>Version Identifier or Invalid if type cannot be determined.</returns>
        private static GameVersion GetIsG8SAV(byte[] data)
        {
            if (data.Length != SIZE_G8SWSH)
                return Invalid;

            return SwishCrypto.GetIsHashValid(data) ? SWSH : Invalid;
        }
Пример #2
0
 public SAV8SWSH(byte[] data) : base(data)
 {
     Data         = Array.Empty <byte>();
     AllBlocks    = SwishCrypto.Decrypt(data);
     Blocks       = new SaveBlockAccessor8SWSH(this);
     SaveRevision = Zukan.GetRevision();
     Initialize();
 }
Пример #3
0
        /// <summary>Checks to see if the data belongs to a Gen7 save</summary>
        /// <param name="data">Save data of which to determine the type</param>
        /// <returns>Version Identifier or Invalid if type cannot be determined.</returns>
        private static GameVersion GetIsG8SAV(byte[] data)
        {
            if (!SizesSWSH.Contains(data.Length))
            {
                return(Invalid);
            }

            return(SwishCrypto.GetIsHashValid(data) ? SWSH : Invalid);
        }
Пример #4
0
        /// <summary>Checks to see if the data belongs to a Gen7 save</summary>
        /// <param name="data">Save data of which to determine the type</param>
        /// <returns>Version Identifier or Invalid if type cannot be determined.</returns>
        private static GameVersion GetIsG8SAV(byte[] data)
        {
            if (data.Length != SIZE_G8SWSH && data.Length != SIZE_G8SWSH_1)
            {
                return(Invalid);
            }

            return(SwishCrypto.GetIsHashValid(data) ? SWSH : Invalid);
        }
Пример #5
0
        public static byte[] ExportAllBlocks(IReadOnlyList <SCBlock> blocks, SCBlockExportOption option = SCBlockExportOption.None)
        {
            if (option == SCBlockExportOption.None)
            {
                return(SwishCrypto.GetDecryptedRawData(blocks));
            }

            using var stream = new MemoryStream();
            using var bw     = new BinaryWriter(stream);
            for (var i = 0; i < blocks.Count; i++)
            {
                ExportBlock(blocks[i], bw, i, option);
            }
            return(stream.ToArray());
        }
Пример #6
0
        }                                          // None!

        protected override byte[] GetFinalData() => SwishCrypto.Encrypt(AllBlocks);
Пример #7
0
 public SAV8SWSH(byte[] data) : this(data, SwishCrypto.Decrypt(data))
 {
 }