Avoid many many unnecessary enumerations

This commit is contained in:
Dean Herbert 2017-12-21 22:33:16 +09:00
parent a9039c71e0
commit 620e9737c3
1 changed files with 5 additions and 5 deletions

View File

@ -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);
} }