public NsoHeader(ReadOnlySpan <byte> data) { var index = 0; Magic = data.Slice(0, 4).ToArray(); index += 4; Unk1 = BinaryPrimitives.ReadUInt32LittleEndian(data.Slice(index)); index += 4; Unk2 = BinaryPrimitives.ReadUInt32LittleEndian(data.Slice(index)); index += 4; Unk3 = BinaryPrimitives.ReadUInt32LittleEndian(data.Slice(index)); index += 4; Segments = new NsoSegment[3]; for (int i = 0; i < 3; i++) { Segments[i] = new NsoSegment(data.Slice(index, NsoSegment.Length)); index += NsoSegment.Length; } BuildId = data.Slice(index, 0x20).ToArray(); index += 0x20; SegmentFileSizes = new uint[3]; for (int i = 0; i < 3; i++) { SegmentFileSizes[i] = BinaryPrimitives.ReadUInt32LittleEndian(data.Slice(index)); index += 4; } Padding = data.Slice(index, 0x24).ToArray(); index += 0x24; DynStr = (DataExtent)BinaryPrimitives.ReadUInt64LittleEndian(data.Slice(index)); index += 8; DynSym = (DataExtent)BinaryPrimitives.ReadUInt64LittleEndian(data.Slice(index)); index += 8; Hashes = new List <byte[]>(3); for (int i = 0; i < 3; i++) { Hashes.Add(data.Slice(index, 0x20).ToArray()); index += 0x20; } }
public NsoHeader() { Magic = Encoding.ASCII.GetBytes("NSO0"); Unk3 = 0x3f; Segments = new NsoSegment[3]; BuildId = new byte[0x20]; SegmentFileSizes = new uint[3]; Padding = new byte[0x24]; this.Hashes = new List <byte[]> { new byte[0x20], new byte[0x20], new byte[0x20] }; }