mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Fix exception output to use humanised model name
This commit is contained in:
@ -146,8 +146,6 @@ namespace osu.Game.Database
|
|||||||
notification.Progress = 0;
|
notification.Progress = 0;
|
||||||
notification.Text = "Import is initialising...";
|
notification.Text = "Import is initialising...";
|
||||||
|
|
||||||
var term = $"{typeof(TModel).Name.Replace("Info", "").ToLower()}";
|
|
||||||
|
|
||||||
int current = 0;
|
int current = 0;
|
||||||
|
|
||||||
var imported = new List<TModel>();
|
var imported = new List<TModel>();
|
||||||
@ -164,7 +162,7 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
imported.Add(model);
|
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;
|
notification.Progress = (float)current / paths.Length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -191,7 +189,7 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
notification.CompletionText = imported.Count == 1
|
notification.CompletionText = imported.Count == 1
|
||||||
? $"Imported {imported.First()}!"
|
? $"Imported {imported.First()}!"
|
||||||
: $"Imported {current} {term}s!";
|
: $"Imported {current} {humanisedModelName}s!";
|
||||||
|
|
||||||
if (imported.Count > 0 && PresentImport != null)
|
if (imported.Count > 0 && PresentImport != null)
|
||||||
{
|
{
|
||||||
@ -339,7 +337,7 @@ namespace osu.Game.Database
|
|||||||
if (CanUndelete(existing, item))
|
if (CanUndelete(existing, item))
|
||||||
{
|
{
|
||||||
Undelete(existing);
|
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));
|
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.
|
||||||
@ -610,6 +608,8 @@ 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()}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates an <see cref="ArchiveReader"/> from a valid storage path.
|
/// Creates an <see cref="ArchiveReader"/> from a valid storage path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Reference in New Issue
Block a user