public void SetupDatabase() { VirtualFileSystem.CreateDirectory(VirtualFileSystem.ApplicationDatabasePath); var databaseFileProvider = new DatabaseFileProvider(AssetIndexMap.NewTool(VirtualFileSystem.ApplicationDatabaseIndexName), new ObjectDatabase(VirtualFileSystem.ApplicationDatabasePath, VirtualFileSystem.ApplicationDatabaseIndexName)); ContentManager.GetFileProvider = () => databaseFileProvider; }
/// <summary> /// Write the generated objects into the index map file. /// </summary> /// <param name="mergeWithCurrentIndexFile">Indicate if old values must be deleted or merged</param> public void WriteIndexFile(bool mergeWithCurrentIndexFile) { if (!mergeWithCurrentIndexFile) { try { VirtualFileSystem.FileDelete(IndexFileFullPath); } catch (IOException) { } } using (var indexFile = AssetIndexMap.NewTool(indexFilename)) { // Filter database Location indexFile.AddValues( Root.OutputObjects.Where(x => x.Key.Type == UrlType.Internal) .Select(x => new KeyValuePair <string, ObjectId>(x.Key.Path, x.Value.ObjectId))); foreach (var x in Root.OutputObjects) { if (x.Key.Type != UrlType.Internal) { continue; } if (x.Value.Tags.Contains(DoNotCompressTag)) { DisableCompressionIds.Add(x.Value.ObjectId); } } } }
public void SetupDatabase() { VirtualFileSystem.CreateDirectory("/data"); VirtualFileSystem.CreateDirectory("/data/db"); var databaseFileProvider = new DatabaseFileProvider(AssetIndexMap.NewTool(), new ObjectDatabase("/data/db")); AssetManager.GetFileProvider = () => databaseFileProvider; }