1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 23:12:56 +08:00

Further improvements to messaging

This commit is contained in:
Dean Herbert 2018-03-19 20:30:45 +09:00
parent 18368d2446
commit 994c7bfabd

View File

@ -79,7 +79,6 @@ namespace osu.Game.Database
var notification = new ProgressNotification
{
Text = "Import is initialising...",
CompletionText = "Import successful!",
Progress = 0,
State = ProgressNotificationState.Active,
};
@ -88,7 +87,7 @@ namespace osu.Game.Database
List<TModel> imported = new List<TModel>();
int success = 0;
int current = 0;
int errors = 0;
foreach (string path in paths)
{
@ -98,11 +97,11 @@ namespace osu.Game.Database
try
{
notification.Text = $"Importing ({success} of {paths.Length})\n{Path.GetFileName(path)}";
notification.Text = $"Importing ({++current} of {paths.Length})\n{Path.GetFileName(path)}";
using (ArchiveReader reader = getReaderFrom(path))
imported.Add(Import(reader));
notification.Progress = (float)++success / paths.Length;
notification.Progress = (float)(current - 1) / paths.Length;
// We may or may not want to delete the file depending on where it is stored.
// e.g. reconstructing/repairing database with items from default storage.
@ -126,7 +125,8 @@ namespace osu.Game.Database
}
}
notification.State = errors == 0 ? ProgressNotificationState.Completed : ProgressNotificationState.Cancelled;
notification.Text = errors > 0 ? $"Import complete with {errors} errors" : "Import successful!";
notification.State = ProgressNotificationState.Completed;
}
/// <summary>