Make RealmArchiveModelManager.Update work using automapper

This commit is contained in:
Dean Herbert 2022-01-11 18:18:03 +09:00
parent 7509a9ff8f
commit 80eee6d7b0
2 changed files with 7 additions and 6 deletions

View File

@ -123,11 +123,7 @@ namespace osu.Game.Screens.Menu
// this could happen if a user has nuked their files store. for now, reimport to repair this.
var import = beatmaps.Import(new ZipArchiveReader(game.Resources.GetStream($"Tracks/{BeatmapFile}"), BeatmapFile)).GetResultSafely();
import?.PerformWrite(b =>
{
b.Protected = true;
beatmaps.Update(b);
});
import?.PerformWrite(b => b.Protected = true);
loadThemedIntro();
}

View File

@ -202,8 +202,13 @@ namespace osu.Game.Stores
public abstract bool IsAvailableLocally(TModel model);
public void Update(TModel skin)
public void Update(TModel model)
{
using (var realm = ContextFactory.CreateContext())
{
var existing = realm.Find<TModel>(model.ID);
realm.Write(r => model.CopyChangesToRealm(existing));
}
}
}
}