Ejemplo n.º 1
0
            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);
            }
Ejemplo n.º 2
0
 public IvfcLevel(IBinaryDataAccessor data, IvfcLevelHeader header)
 {
     LevelData = data ?? throw new ArgumentNullException(nameof(data));
     Header    = header ?? throw new ArgumentNullException(nameof(header));
 }
Ejemplo n.º 3
0
            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);
            }
Ejemplo n.º 4
0
 public DirectoryMetadata(IBinaryDataAccessor data, IvfcLevelHeader header)
 {
     LevelData       = data ?? throw new ArgumentNullException(nameof(data));
     IvfcLevelHeader = header ?? throw new ArgumentNullException(nameof(data));
 }
Ejemplo n.º 5
0
 public FileMetadata(IReadOnlyBinaryDataAccessor data, IvfcLevelHeader header)
 {
     LevelData = data ?? throw new ArgumentNullException(nameof(data));
     Header    = header ?? throw new ArgumentNullException(nameof(header));
 }