1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 19:27:31 +08:00

Use "beatmap" as the model name

This commit is contained in:
smoogipoo 2019-06-12 20:41:02 +09:00
parent 412c9646ec
commit a17d480f51
2 changed files with 9 additions and 7 deletions

View File

@ -327,6 +327,8 @@ namespace osu.Game.Beatmaps
/// <returns>Results from the provided query.</returns> /// <returns>Results from the provided query.</returns>
public IQueryable<BeatmapInfo> QueryBeatmaps(Expression<Func<BeatmapInfo, bool>> query) => beatmaps.Beatmaps.AsNoTracking().Where(query); public IQueryable<BeatmapInfo> QueryBeatmaps(Expression<Func<BeatmapInfo, bool>> query) => beatmaps.Beatmaps.AsNoTracking().Where(query);
protected override string HumanisedModelName => "beatmap";
protected override BeatmapSetInfo CreateModel(ArchiveReader reader) protected override BeatmapSetInfo CreateModel(ArchiveReader reader)
{ {
// let's make sure there are actually .osu files to import. // let's make sure there are actually .osu files to import.

View File

@ -163,7 +163,7 @@ namespace osu.Game.Database
imported.Add(model); imported.Add(model);
current++; current++;
notification.Text = $"Imported {current} of {paths.Length} {humanisedModelName}s"; notification.Text = $"Imported {current} of {paths.Length} {HumanisedModelName}s";
notification.Progress = (float)current / paths.Length; notification.Progress = (float)current / paths.Length;
} }
} }
@ -186,7 +186,7 @@ namespace osu.Game.Database
{ {
notification.CompletionText = imported.Count == 1 notification.CompletionText = imported.Count == 1
? $"Imported {imported.First()}!" ? $"Imported {imported.First()}!"
: $"Imported {current} {humanisedModelName}s!"; : $"Imported {current} {HumanisedModelName}s!";
if (imported.Count > 0 && PresentImport != null) if (imported.Count > 0 && PresentImport != null)
{ {
@ -344,7 +344,7 @@ namespace osu.Game.Database
if (CanUndelete(existing, item)) if (CanUndelete(existing, item))
{ {
Undelete(existing); Undelete(existing);
LogForModel(item, $"Found existing {humanisedModelName} for {item} (ID {existing.ID}) skipping import."); LogForModel(item, $"Found existing {HumanisedModelName} for {item} (ID {existing.ID}) skipping import.");
handleEvent(() => ItemAdded?.Invoke(existing, true)); handleEvent(() => ItemAdded?.Invoke(existing, true));
// existing item will be used; rollback new import and exit early. // existing item will be used; rollback new import and exit early.
@ -424,8 +424,8 @@ namespace osu.Game.Database
var notification = new ProgressNotification var notification = new ProgressNotification
{ {
Progress = 0, Progress = 0,
Text = $"Preparing to delete all {humanisedModelName}s...", Text = $"Preparing to delete all {HumanisedModelName}s...",
CompletionText = $"Deleted all {humanisedModelName}s!", CompletionText = $"Deleted all {HumanisedModelName}s!",
State = ProgressNotificationState.Active, State = ProgressNotificationState.Active,
}; };
@ -442,7 +442,7 @@ namespace osu.Game.Database
// user requested abort // user requested abort
return; return;
notification.Text = $"Deleting {humanisedModelName}s ({++i} of {items.Count})"; notification.Text = $"Deleting {HumanisedModelName}s ({++i} of {items.Count})";
Delete(b); Delete(b);
@ -614,7 +614,7 @@ namespace osu.Game.Database
private DbSet<TModel> queryModel() => ContextFactory.Get().Set<TModel>(); private DbSet<TModel> queryModel() => ContextFactory.Get().Set<TModel>();
private string humanisedModelName => $"{typeof(TModel).Name.Replace("Info", "").ToLower()}"; protected virtual string HumanisedModelName => $"{typeof(TModel).Name.Replace("Info", "").ToLower()}";
/// <summary> /// <summary>
/// Creates an <see cref="ArchiveReader"/> from a valid storage path. /// Creates an <see cref="ArchiveReader"/> from a valid storage path.