private void CollectBundle(ResolvedBundle resolvedBundle, string assetUrl, IContentIndexMap contentIndexMap) { // Check if index map contains it already (that also means object id has been stored as well) if (resolvedBundle.DependencyIndexMap.ContainsKey(assetUrl) || resolvedBundle.IndexMap.ContainsKey(assetUrl)) { return; } ObjectId objectId; if (!contentIndexMap.TryGetValue(assetUrl, out objectId)) { throw new InvalidOperationException(string.Format("Could not find asset {0} for bundle {1}", assetUrl, resolvedBundle.Name)); } // Add asset to index map resolvedBundle.IndexMap.Add(assetUrl, objectId); // Check if object id has already been added (either as dependency or inside this actual pack) // As a consequence, no need to check references since they will somehow be part of this package or one of its dependencies. if (resolvedBundle.DependencyObjectIds.Contains(objectId) || !resolvedBundle.ObjectIds.Add(objectId)) { return; } foreach (var reference in GetChunkReferences(ref objectId)) { CollectBundle(resolvedBundle, reference, contentIndexMap); } }
private void CollectReferences(Bundle bundle, HashSet <string> assets, string assetUrl, IContentIndexMap contentIndexMap) { // Already included? if (!assets.Add(assetUrl)) { return; } ObjectId objectId; if (!contentIndexMap.TryGetValue(assetUrl, out objectId)) { throw new InvalidOperationException(string.Format("Could not find asset {0} for bundle {1}", assetUrl, bundle.Name)); } // Include references foreach (var reference in GetChunkReferences(ref objectId)) { CollectReferences(bundle, assets, reference, contentIndexMap); } }