private void SaveChangeResaveAssets(AssetManager assetManager) { var simpleAsset = new SimpleAsset("Grandpa", new SimpleAsset("Pa", new SimpleAsset("Son", null))); assetManager.Save(simpleAsset); simpleAsset.Dble = 22.0; simpleAsset.Child.Dble = 42.0; assetManager.SaveSingle(simpleAsset); }
private void SaveAssetsAndDeleteAChild(AssetManager assetManager) { var simpleAsset = new SimpleAsset("Pa", new SimpleAsset("Son", null)); assetManager.Save(simpleAsset); var databaseFileProvider = (DatabaseFileProvider)VirtualFileSystem.ResolveProvider("/db", true).Provider; databaseFileProvider.AssetIndexMap.WaitPendingOperations(); ObjectId childId; databaseFileProvider.AssetIndexMap.TryGetValue("SimpleAssets/Son", out childId); VirtualFileSystem.FileDelete(FileOdbBackend.BuildUrl(VirtualFileSystem.ApplicationDatabasePath, childId)); }
private static void SaveSimpleAssets(AssetManager assetManager) { var simpleAsset = new SimpleAsset("Grandpa", new SimpleAsset("Pa", new SimpleAsset("Son", null))); assetManager.Save(simpleAsset); }
private static void SaveCyclicallyReferencedAssets(AssetManager assetManager) { var simpleAsset = new SimpleAsset("First", new SimpleAsset("Second", new SimpleAsset("Third", null))); simpleAsset.Child.Child.Child = simpleAsset; assetManager.Save(simpleAsset); }
public SimpleAsset(string str, SimpleAsset child) { Str = str; Dble = 5.0; Child = child; Url = "SimpleAssets/" + str; }
public unsafe void TestSaveAndLoadAssetAndIndexFileManyTimes() { var assetManager = new AssetManager(); var simpleAsset = new SimpleAsset("Grandpa", null) { Dble = 0.0 }; assetManager.SaveSingle(simpleAsset); assetManager.Unload(simpleAsset); var databaseFileProvider = (DatabaseFileProvider)VirtualFileSystem.ResolveProvider("/db", true).Provider; databaseFileProvider.AssetIndexMap.WaitPendingOperations(); simpleAsset = null; GC.Collect(); for (double d = 0; d < 10.0; ++d) { var anotherAssetManager = new AssetManager(); simpleAsset = anotherAssetManager.Load<SimpleAsset>("SimpleAssets/Grandpa"); Assert.That(simpleAsset.Dble, Is.EqualTo(d)); simpleAsset.Dble += 1.0; anotherAssetManager.SaveSingle(simpleAsset); anotherAssetManager.Unload(simpleAsset); databaseFileProvider.AssetIndexMap.WaitPendingOperations(); simpleAsset = null; GC.Collect(); } }
public unsafe void TestSaveAndLoadAssetManyTimes() { var assetManager = new AssetManager(); var simpleAsset = new SimpleAsset("Grandpa", null) { Dble = 0.0 }; assetManager.SaveSingle(simpleAsset); assetManager.Unload(simpleAsset); simpleAsset = null; GC.Collect(); for (double d = 0; d < 10.0; ++d) { simpleAsset = assetManager.Load<SimpleAsset>("SimpleAssets/Grandpa"); Assert.That(simpleAsset.Dble, Is.EqualTo(d)); simpleAsset.Dble += 1.0; assetManager.SaveSingle(simpleAsset); assetManager.Unload(simpleAsset); simpleAsset = null; GC.Collect(); } }