public PackageFileStreamLZ4(BundleOdbBackend bundleOdbBackend, ObjectLocation objectLocation, Stream innerStream, CompressionMode compressionMode, long uncompressedStreamSize, long compressedSize) : base(innerStream, compressionMode, uncompressedSize: uncompressedStreamSize, compressedSize: compressedSize, disposeInnerStream: false) { this.bundleOdbBackend = bundleOdbBackend; this.objectLocation = objectLocation; this.innerStream = innerStream; }
public void CreateBundle(ObjectId[] objectIds, string bundleName, BundleOdbBackend bundleBackend, ISet <ObjectId> disableCompressionIds, Dictionary <string, ObjectId> indexMap, IList <string> dependencies, bool useIncrementalBundle) { if (bundleBackend == null) { throw new InvalidOperationException("Can't pack files."); } if (objectIds.Length == 0) { return; } var packUrl = bundleBackend.BundleDirectory + bundleName + BundleOdbBackend.BundleExtension; // we don't want the pack to be compressed in the APK on android // Create pack BundleOdbBackend.CreateBundle(packUrl, backendRead1, objectIds, disableCompressionIds, indexMap, dependencies, useIncrementalBundle); }
/// <summary> /// Initializes a new instance of the <see cref="ObjectDatabase" /> class. /// </summary> /// <param name="vfsMainUrl">The VFS main URL.</param> /// <param name="indexName">Name of the index file.</param> /// <param name="vfsAdditionalUrl">The VFS additional URL. It will be used only if vfsMainUrl is read-only.</param> public ObjectDatabase(string vfsMainUrl, string indexName, string vfsAdditionalUrl = null, bool loadDefaultBundle = true) { if (vfsMainUrl == null) { throw new ArgumentNullException(nameof(vfsMainUrl)); } // Create the merged asset index map ContentIndexMap = new ObjectDatabaseContentIndexMap(); // Try to open file backends bool isReadOnly = Platform.Type != PlatformType.Windows; var backend = new FileOdbBackend(vfsMainUrl, indexName, isReadOnly); ContentIndexMap.Merge(backend.ContentIndexMap); if (backend.IsReadOnly) { backendRead1 = backend; if (vfsAdditionalUrl != null) { backendWrite = backendRead2 = new FileOdbBackend(vfsAdditionalUrl, indexName, false); ContentIndexMap.Merge(backendWrite.ContentIndexMap); } } else { backendWrite = backendRead1 = backend; } ContentIndexMap.WriteableContentIndexMap = backendWrite.ContentIndexMap; BundleBackend = new BundleOdbBackend(vfsMainUrl); // Try to open "default" pack file synchronously if (loadDefaultBundle) { try { BundleBackend.LoadBundle("default", ContentIndexMap).GetAwaiter().GetResult(); } catch (FileNotFoundException) { } } }
public PackageFileStream(BundleOdbBackend bundleOdbBackend, ObjectLocation objectLocation, Stream internalStream, long startPosition = 0, long endPosition = -1, bool disposeInternalStream = true, bool seekToBeginning = true) : base(internalStream, startPosition, endPosition, disposeInternalStream, seekToBeginning) { this.bundleOdbBackend = bundleOdbBackend; this.objectLocation = objectLocation; }