mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 19:42:55 +08:00
Make RealmArchiveModelManager.Update
work using automapper
This commit is contained in:
parent
7509a9ff8f
commit
80eee6d7b0
@ -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.
|
// 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();
|
var import = beatmaps.Import(new ZipArchiveReader(game.Resources.GetStream($"Tracks/{BeatmapFile}"), BeatmapFile)).GetResultSafely();
|
||||||
|
|
||||||
import?.PerformWrite(b =>
|
import?.PerformWrite(b => b.Protected = true);
|
||||||
{
|
|
||||||
b.Protected = true;
|
|
||||||
beatmaps.Update(b);
|
|
||||||
});
|
|
||||||
|
|
||||||
loadThemedIntro();
|
loadThemedIntro();
|
||||||
}
|
}
|
||||||
|
@ -202,8 +202,13 @@ namespace osu.Game.Stores
|
|||||||
|
|
||||||
public abstract bool IsAvailableLocally(TModel model);
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user