mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 23:12:56 +08:00
Move manager Update
methods to be explicit to where they are still used by legacy code
Also fixes skin hash repopulation being completely broken.
This commit is contained in:
parent
a307f7e90e
commit
a4de0f93fa
@ -220,11 +220,6 @@ namespace osu.Game.Beatmaps
|
||||
return beatmapModelManager.IsAvailableLocally(model);
|
||||
}
|
||||
|
||||
public void Update(BeatmapSetInfo item)
|
||||
{
|
||||
beatmapModelManager.Update(item);
|
||||
}
|
||||
|
||||
public bool Delete(BeatmapSetInfo item)
|
||||
{
|
||||
return beatmapModelManager.Delete(item);
|
||||
|
@ -101,5 +101,14 @@ namespace osu.Game.Beatmaps
|
||||
using (var context = ContextFactory.CreateContext())
|
||||
return context.All<BeatmapInfo>().FirstOrDefault(query)?.Detach();
|
||||
}
|
||||
|
||||
public void Update(BeatmapSetInfo item)
|
||||
{
|
||||
using (var realm = ContextFactory.CreateContext())
|
||||
{
|
||||
var existing = realm.Find<BeatmapSetInfo>(item.ID);
|
||||
realm.Write(r => item.CopyChangesToRealm(existing));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,13 +12,6 @@ namespace osu.Game.Database
|
||||
public interface IModelManager<TModel>
|
||||
where TModel : class
|
||||
{
|
||||
/// <summary>
|
||||
/// Perform an update of the specified item.
|
||||
/// TODO: Support file additions/removals.
|
||||
/// </summary>
|
||||
/// <param name="item">The item to update.</param>
|
||||
void Update(TModel item);
|
||||
|
||||
/// <summary>
|
||||
/// Delete an item from the manager.
|
||||
/// Is a no-op for already deleted items.
|
||||
|
@ -251,11 +251,6 @@ namespace osu.Game.Scoring
|
||||
|
||||
#region Implementation of IModelManager<ScoreInfo>
|
||||
|
||||
public void Update(ScoreInfo item)
|
||||
{
|
||||
scoreModelManager.Update(item);
|
||||
}
|
||||
|
||||
public bool Delete(ScoreInfo item)
|
||||
{
|
||||
return scoreModelManager.Delete(item);
|
||||
|
@ -210,13 +210,13 @@ namespace osu.Game.Skinning
|
||||
{
|
||||
using (var realm = ContextFactory.CreateContext())
|
||||
{
|
||||
var skinsWithoutHashes = realm.All<SkinInfo>().Where(i => string.IsNullOrEmpty(i.Hash)).ToArray();
|
||||
var skinsWithoutHashes = realm.All<SkinInfo>().Where(i => !i.Protected && string.IsNullOrEmpty(i.Hash)).ToArray();
|
||||
|
||||
foreach (SkinInfo skin in skinsWithoutHashes)
|
||||
{
|
||||
try
|
||||
{
|
||||
Update(skin);
|
||||
checkSkinIniMetadata(skin, realm);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -201,14 +201,5 @@ namespace osu.Game.Stores
|
||||
}
|
||||
|
||||
public abstract bool IsAvailableLocally(TModel model);
|
||||
|
||||
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