1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-23 08:27:23 +08:00

Fix exception output to use humanised model name

This commit is contained in:
Dean Herbert 2019-06-10 18:41:56 +09:00
parent f7a699e4a2
commit 6cda2cdb82

View File

@ -146,8 +146,6 @@ namespace osu.Game.Database
notification.Progress = 0;
notification.Text = "Import is initialising...";
var term = $"{typeof(TModel).Name.Replace("Info", "").ToLower()}";
int current = 0;
var imported = new List<TModel>();
@ -164,7 +162,7 @@ namespace osu.Game.Database
{
imported.Add(model);
notification.Text = $"Imported {current} of {paths.Length} {term}s";
notification.Text = $"Imported {current} of {paths.Length} {humanisedModelName}s";
notification.Progress = (float)current / paths.Length;
}
}
@ -191,7 +189,7 @@ namespace osu.Game.Database
{
notification.CompletionText = imported.Count == 1
? $"Imported {imported.First()}!"
: $"Imported {current} {term}s!";
: $"Imported {current} {humanisedModelName}s!";
if (imported.Count > 0 && PresentImport != null)
{
@ -339,7 +337,7 @@ namespace osu.Game.Database
if (CanUndelete(existing, item))
{
Undelete(existing);
Logger.Log($"Found existing {nameof(TModel)} for {item} (ID {existing.ID}). Skipping import.", LoggingTarget.Database);
Logger.Log($"Found existing {humanisedModelName} for {item} (ID {existing.ID}). Skipping import.", LoggingTarget.Database);
handleEvent(() => ItemAdded?.Invoke(existing, true));
// existing item will be used; rollback new import and exit early.
@ -610,6 +608,8 @@ namespace osu.Game.Database
private DbSet<TModel> queryModel() => ContextFactory.Get().Set<TModel>();
private string humanisedModelName => $"{typeof(TModel).Name.Replace("Info", "").ToLower()}";
/// <summary>
/// Creates an <see cref="ArchiveReader"/> from a valid storage path.
/// </summary>