Skip to content

Commit

Permalink
Fix: beatmap search not being preserved between collection changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotrekol committed Sep 21, 2018
1 parent 64f11c8 commit 1dc0e7b
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class BeatmapFilter
");

private bool BeatmapExtensionIsUsed = false;
private string _lastSearchString = String.Empty;
public BeatmapFilter(Beatmaps beatmaps, Beatmap baseBeatmap)
{
BeatmapExtensionIsUsed = baseBeatmap.GetType().IsAssignableFrom(typeof(BeatmapExtension));
Expand All @@ -42,11 +43,15 @@ public BeatmapFilter(Beatmaps beatmaps, Beatmap baseBeatmap)
public void SetBeatmaps(Beatmaps beatmaps)
{
_beatmaps = beatmaps;
UpdateSearch(_lastSearchString);
}
public void UpdateSearch(string searchString)
{
_lastSearchString = searchString;
searchString = searchString.ToLower();
string[] words = searchString.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
if (_beatmaps == null)
return;
lock (_beatmaps)
{
foreach (var beatmap in _beatmaps)
Expand Down

0 comments on commit 1dc0e7b

Please sign in to comment.