mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 08:49:59 +09: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:
@ -220,11 +220,6 @@ namespace osu.Game.Beatmaps
|
|||||||
return beatmapModelManager.IsAvailableLocally(model);
|
return beatmapModelManager.IsAvailableLocally(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(BeatmapSetInfo item)
|
|
||||||
{
|
|
||||||
beatmapModelManager.Update(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Delete(BeatmapSetInfo item)
|
public bool Delete(BeatmapSetInfo item)
|
||||||
{
|
{
|
||||||
return beatmapModelManager.Delete(item);
|
return beatmapModelManager.Delete(item);
|
||||||
|
@ -101,5 +101,14 @@ namespace osu.Game.Beatmaps
|
|||||||
using (var context = ContextFactory.CreateContext())
|
using (var context = ContextFactory.CreateContext())
|
||||||
return context.All<BeatmapInfo>().FirstOrDefault(query)?.Detach();
|
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>
|
public interface IModelManager<TModel>
|
||||||
where TModel : class
|
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>
|
/// <summary>
|
||||||
/// Delete an item from the manager.
|
/// Delete an item from the manager.
|
||||||
/// Is a no-op for already deleted items.
|
/// Is a no-op for already deleted items.
|
||||||
|
@ -251,11 +251,6 @@ namespace osu.Game.Scoring
|
|||||||
|
|
||||||
#region Implementation of IModelManager<ScoreInfo>
|
#region Implementation of IModelManager<ScoreInfo>
|
||||||
|
|
||||||
public void Update(ScoreInfo item)
|
|
||||||
{
|
|
||||||
scoreModelManager.Update(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Delete(ScoreInfo item)
|
public bool Delete(ScoreInfo item)
|
||||||
{
|
{
|
||||||
return scoreModelManager.Delete(item);
|
return scoreModelManager.Delete(item);
|
||||||
|
@ -210,13 +210,13 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
using (var realm = ContextFactory.CreateContext())
|
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)
|
foreach (SkinInfo skin in skinsWithoutHashes)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Update(skin);
|
checkSkinIniMetadata(skin, realm);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -201,14 +201,5 @@ namespace osu.Game.Stores
|
|||||||
}
|
}
|
||||||
|
|
||||||
public abstract bool IsAvailableLocally(TModel model);
|
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user