public byte[] GetAsData() { BigEndianMemoryStream buffer = new BigEndianMemoryStream(GetDataSize()); buffer.WriteBigEndian(signatureType); buffer.Write(signature); buffer.Seek(60, SeekOrigin.Current); buffer.Write(issuer); buffer.WriteByte(version); buffer.WriteByte(CACRLVersion); buffer.WriteByte(signerCRLVersion); buffer.Seek(1, SeekOrigin.Current); buffer.WriteBigEndian(systemVersion); buffer.WriteBigEndian(ticket.titleID); buffer.WriteBigEndian(titleType); buffer.WriteBigEndian(groupID); buffer.WriteBigEndian(appType); buffer.Seek(58, SeekOrigin.Current); buffer.WriteBigEndian(accessRights); buffer.WriteBigEndian(titleVersion); buffer.WriteBigEndian(contentCount); buffer.WriteBigEndian(bootIndex); buffer.Seek(2, SeekOrigin.Current); buffer.Write(SHA2); buffer.Write(contentInfo.GetAsData()); buffer.Write(contents.GetAsData()); return(buffer.GetBuffer()); }
public byte[] GetAsData() { Random rdm = new Random(); BigEndianMemoryStream buffer = new BigEndianMemoryStream(0x350); buffer.Write(Utils.HexStringToByteArray("00010004")); byte[] randomData = new byte[0x100]; rdm.NextBytes(randomData); buffer.Write(randomData); buffer.Seek(0x3C, SeekOrigin.Current); buffer.Write(Utils.HexStringToByteArray("526F6F742D434130303030303030332D58533030303030303063000000000000")); buffer.Seek(0x5C, SeekOrigin.Current); buffer.Write(Utils.HexStringToByteArray("010000")); buffer.Write(GetEncryptedKey().key); buffer.Write(Utils.HexStringToByteArray("000005")); randomData = new byte[0x06]; rdm.NextBytes(randomData); buffer.Write(randomData); buffer.Seek(0x04, SeekOrigin.Current); buffer.WriteBigEndian(titleID); buffer.Write(Utils.HexStringToByteArray("00000011000000000000000000000005")); buffer.Seek(0xB0, SeekOrigin.Current); buffer.Write(Utils.HexStringToByteArray("00010014000000AC000000140001001400000000000000280000000100000084000000840003000000000000FFFFFF01")); buffer.Seek(0x7C, SeekOrigin.Current); return(buffer.GetBuffer()); }
public byte[] GetAsData() { BigEndianMemoryStream buffer = new BigEndianMemoryStream(GetDataSize()); buffer.Write(magicbytes); buffer.WriteBigEndian(unknown); buffer.WriteBigEndian(contentCount); buffer.Seek(20, SeekOrigin.Current); buffer.Write(contents.GetFSTContentHeaderAsData()); buffer.Write(fileEntries.GetAsData()); buffer.Write(strings.ToArray()); return(buffer.GetBuffer()); }
public byte[] GetAsData() { BigEndianMemoryStream buffer = new BigEndianMemoryStream(2304); buffer.WriteBigEndian(indexOffset); buffer.WriteBigEndian(contentCount); buffer.Write(SHA2Hash); return(buffer.GetBuffer()); }
public void WriteBigEndianInt64Array() { var integers = new RandomInt64Generator(1).Structs; using (var extendedStream = new BigEndianMemoryStream(new Reloaded.Memory.Streams.ExtendedMemoryStream())) { extendedStream.Write(integers); Reloaded.Memory.StructArray.FromArrayBigEndianPrimitive <Int64>(extendedStream.ToArray(), out var newStructs); Assert.Equal(integers, newStructs); }; }
public byte[] GetAsData() { BigEndianMemoryStream buffer = new BigEndianMemoryStream(staticDataSize); buffer.WriteBigEndian(ID); buffer.WriteBigEndian(index); buffer.WriteBigEndian(type); buffer.WriteBigEndian(encryptedFileSize); buffer.Write(SHA1); return(buffer.GetBuffer()); }
public byte[] GetAsData() { BigEndianMemoryStream buffer = new BigEndianMemoryStream(GetDataSize()); if (isRoot) { buffer.WriteByte(1); buffer.Seek(7, SeekOrigin.Current); buffer.WriteBigEndian(rootEntryCount); buffer.Seek(4, SeekOrigin.Current); } else { buffer.WriteByte(GetTypeAsByte()); buffer.WriteByte((byte)(nameOffset >> 16)); // We need to write a 24bit int (big endian) buffer.WriteByte((byte)(nameOffset >> 8)); buffer.WriteByte((byte)nameOffset); if (isDir) { buffer.WriteBigEndian(parentOffset); buffer.WriteBigEndian(nextOffset); } else { buffer.WriteBigEndian((int)(fileOffset >> 5)); buffer.WriteBigEndian((int)fileSize); } buffer.WriteBigEndian(flags); buffer.WriteBigEndian((short)content.ID); } foreach (FSTEntry entry in children) { buffer.Write(entry.GetAsData()); } return(buffer.GetBuffer()); }