示例#1
0
        protected override void setChecksums()
        {
            // Check for invalid block lengths
            if (Blocks.Length < 3) // arbitrary...
            {
                Console.WriteLine("Not enough blocks ({0}), aborting setChecksums", Blocks.Length);
                return;
            }
            // Apply checksums
            for (int i = 0; i < Blocks.Length; i++)
            {
                byte[] array = new byte[Blocks[i].Length];
                Array.Copy(Data, Blocks[i].Offset, array, 0, array.Length);
                BitConverter.GetBytes(SaveUtil.check16(array, Blocks[i].ID)).CopyTo(Data, BlockInfoOffset + 6 + i * 8);
            }

            // MemeCrypto -- provided dll is present.
            try
            {
                byte[] mcSAV = SaveUtil.Resign7(Data);
                if (mcSAV == new byte[0])
                    throw new Exception("MemeCrypto is not present. Dll may not be public at this time.");
                if (mcSAV == null)
                    throw new Exception("MemeCrypto received an invalid input.");
                Data = mcSAV;
            }
            catch (Exception e)
            {
                Util.Alert(e.Message, "Checksums have been applied but MemeCrypto has not.");
            }
        }
示例#2
0
        protected override void setChecksums()
        {
            // Check for invalid block lengths
            if (Blocks.Length < 3) // arbitrary...
            {
                Console.WriteLine("Not enough blocks ({0}), aborting setChecksums", Blocks.Length);
                return;
            }
            // Apply checksums
            for (int i = 0; i < Blocks.Length; i++)
            {
                byte[] array = new byte[Blocks[i].Length];
                Array.Copy(Data, Blocks[i].Offset, array, 0, array.Length);
                BitConverter.GetBytes(SaveUtil.check16(array, Blocks[i].ID)).CopyTo(Data, BlockInfoOffset + 6 + i * 8);
            }

            Data = SaveUtil.Resign7(Data);
        }