public static async Task <DirectoryMetadata> Load(IBinaryDataAccessor data, IvfcLevelHeader header, int offsetOffDirTable) { var offset = header.DirectoryMetadataTableOffset + offsetOffDirTable; var metadata = new DirectoryMetadata(data, header); metadata.ParentDirectoryOffset = await data.ReadInt32Async(offset + 0); metadata.SiblingDirectoryOffset = await data.ReadInt32Async(offset + 4); metadata.FirstChildDirectoryOffset = await data.ReadInt32Async(offset + 8); metadata.FirstFileOffset = await data.ReadInt32Async(offset + 0xC); metadata.NextDirectoryOffset = await data.ReadInt32Async(offset + 0x10); metadata.NameLength = await data.ReadInt32Async(offset + 0x14); if (metadata.NameLength > 0) { metadata.Name = Encoding.Unicode.GetString(await data.ReadArrayAsync(offset + 0x18, Math.Min(metadata.NameLength, MaxFilenameLength))); } await Task.WhenAll( metadata.LoadChildDirectories(), metadata.LoadChildFiles() ); return(metadata); }
public static async Task <IvfcLevel> Load(IBinaryDataAccessor romfsData, IvfcLevelLocation location) { var header = new IvfcLevelHeader(await romfsData.ReadArrayAsync(location.DataOffset, 0x28)); var level = new IvfcLevel(romfsData.GetDataReference(location.DataOffset, location.DataSize), header); await level.Initialize(); return(level); }
public static async Task <RomFs> Load(IBinaryDataAccessor data) { var header = new RomFsHeader(await data.ReadArrayAsync(0, 0x6B)); var romfs = new RomFs(data, header); await romfs.Initialize(); return(romfs); }
public static async Task <NcchPartition> Load(IBinaryDataAccessor data) { NcchHeader header = null; if (data.Length > 0) { header = new NcchHeader(await data.ReadArrayAsync(0, 0x200)); } var partition = new NcchPartition(header); await partition.Initialize(data); return(partition); }
public static async Task <FileMetadata> Load(IBinaryDataAccessor data, IvfcLevelHeader header, long offsetFromMetadataTable) { var offset = header.FileMetadataTableOffset + offsetFromMetadataTable; var metadata = new FileMetadata(data, header); metadata.ContainingDirectoryOffset = await data.ReadInt32Async(offset + 0); metadata.NextSiblingFileOffset = await data.ReadInt32Async(offset + 4); metadata.FileDataOffset = await data.ReadInt64Async(offset + 8); metadata.FileDataLength = await data.ReadInt64Async(offset + 0x10); metadata.NextFileOffset = await data.ReadInt32Async(offset + 0x18); metadata.NameLength = await data.ReadInt32Async(offset + 0x1C); if (metadata.NameLength > 0) { metadata.Name = Encoding.Unicode.GetString(await data.ReadArrayAsync(offset + 0x20, Math.Min(metadata.NameLength, MaxFilenameLength))); } return(metadata); }