mirror of https://github.com/ppy/osu
Avoid many many unnecessary enumerations
This commit is contained in:
parent
a9039c71e0
commit
620e9737c3
|
@ -343,9 +343,9 @@ public void Delete(BeatmapSetInfo beatmapSet)
|
||||||
|
|
||||||
public void UndeleteAll()
|
public void UndeleteAll()
|
||||||
{
|
{
|
||||||
var mapSets = QueryBeatmapSets(bs => bs.DeletePending);
|
var deleteMaps = QueryBeatmapSets(bs => bs.DeletePending).ToList();
|
||||||
|
|
||||||
if (!mapSets.Any()) return;
|
if (!deleteMaps.Any()) return;
|
||||||
|
|
||||||
var notification = new ProgressNotification
|
var notification = new ProgressNotification
|
||||||
{
|
{
|
||||||
|
@ -358,14 +358,14 @@ public void UndeleteAll()
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
foreach (var bs in mapSets)
|
foreach (var bs in deleteMaps)
|
||||||
{
|
{
|
||||||
if (notification.State == ProgressNotificationState.Cancelled)
|
if (notification.State == ProgressNotificationState.Cancelled)
|
||||||
// user requested abort
|
// user requested abort
|
||||||
return;
|
return;
|
||||||
|
|
||||||
notification.Text = $"Restoring ({i} of {mapSets.Count()})";
|
notification.Text = $"Restoring ({i} of {deleteMaps.Count})";
|
||||||
notification.Progress = (float)++i / mapSets.Count();
|
notification.Progress = (float)++i / deleteMaps.Count;
|
||||||
Undelete(bs);
|
Undelete(bs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue