public DbCachedDataId Open(DbRecordId dbRecordId) { if (!_indices.TryGetResourcePath(dbRecordId, out var resourcePath)) { throw new FileNotFoundException($"Cannot load unknown resource: {dbRecordId}"); } DbCachedDataId dbRecordIndex; Byte[] fileContent = NativeFormatProvider.ReadAllBytes(resourcePath); lock (_byId) { dbRecordIndex = new DbCachedDataId(_currentIndex++); DbCachedData data = new DbCachedData(dbRecordId, resourcePath, fileContent); _byId[dbRecordIndex] = data; } Log.Message($"Loaded resource {dbRecordIndex}: [0x{dbRecordId}, {resourcePath}]."); return(dbRecordIndex); }
public unsafe Int32 Read(DbCachedDataId dbRecordIndex, Byte *output, Int32 outputSize) { DbCachedData data = GetCachedData(dbRecordIndex); return(data.Read(output, outputSize)); }
public void Seek(DbCachedDataId dbRecordIndex, Int32 offset) { DbCachedData data = GetCachedData(dbRecordIndex); data.Seek(offset); }
public Int32 GetDecompressedSize(DbCachedDataId dbRecordIndex) { DbCachedData data = GetCachedData(dbRecordIndex); return(data.Size); }