1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 15:12:57 +08:00

Merge branch 'localisable-filter-items' into update-framework

This commit is contained in:
Dean Herbert 2022-05-21 15:17:51 +09:00
commit 982856a8b2
36 changed files with 57 additions and 46 deletions

View File

@ -52,7 +52,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.513.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2022.513.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.511.0" /> <PackageReference Include="ppy.osu.Framework.Android" Version="2022.520.0" />
</ItemGroup> </ItemGroup>
<ItemGroup Label="Transitive Dependencies"> <ItemGroup Label="Transitive Dependencies">
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. --> <!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->

View File

@ -507,7 +507,7 @@ namespace osu.Game.Tests.Database
using (var stream = storage.GetStream(firstFile.File.GetStoragePath())) using (var stream = storage.GetStream(firstFile.File.GetStoragePath()))
originalLength = stream.Length; originalLength = stream.Length;
using (var stream = storage.GetStream(firstFile.File.GetStoragePath(), FileAccess.Write, FileMode.Create)) using (var stream = storage.CreateFileSafely(firstFile.File.GetStoragePath()))
stream.WriteByte(0); stream.WriteByte(0);
var importedSecondTime = await LoadOszIntoStore(importer, realm.Realm); var importedSecondTime = await LoadOszIntoStore(importer, realm.Realm);

View File

@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using NUnit.Framework; using NUnit.Framework;
@ -25,7 +24,7 @@ namespace osu.Game.Tests.Visual.Navigation
if (isDisposing) if (isDisposing)
return; return;
using (var outStream = LocalStorage.GetStream(DatabaseContextFactory.DATABASE_NAME, FileAccess.Write, FileMode.Create)) using (var outStream = LocalStorage.CreateFileSafely(DatabaseContextFactory.DATABASE_NAME))
using (var stream = TestResources.OpenResource(DatabaseContextFactory.DATABASE_NAME)) using (var stream = TestResources.OpenResource(DatabaseContextFactory.DATABASE_NAME))
stream.CopyTo(outStream); stream.CopyTo(outStream);
} }

View File

@ -55,7 +55,7 @@ namespace osu.Game.Tests.Visual.Settings
.OfType<ISettingsItem>() .OfType<ISettingsItem>()
.OfType<IFilterable>() .OfType<IFilterable>()
.Where(f => !(f is IHasFilterableChildren)) .Where(f => !(f is IHasFilterableChildren))
.All(f => f.FilterTerms.Any(t => t.Contains("scaling"))) .All(f => f.FilterTerms.Any(t => t.ToString().Contains("scaling")))
)); ));
AddAssert("ensure section is current", () => settings.CurrentSection.Value is GraphicsSection); AddAssert("ensure section is current", () => settings.CurrentSection.Value is GraphicsSection);

View File

@ -89,7 +89,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AddAssert("results filtered correctly", AddAssert("results filtered correctly",
() => playlistOverlay.ChildrenOfType<PlaylistItem>() () => playlistOverlay.ChildrenOfType<PlaylistItem>()
.Where(item => item.MatchingFilter) .Where(item => item.MatchingFilter)
.All(item => item.FilterTerms.Any(term => term.Contains("10")))); .All(item => item.FilterTerms.Any(term => term.ToString().Contains("10"))));
} }
} }
} }

View File

@ -28,7 +28,7 @@ namespace osu.Game.Tournament.Tests.NonVisual
// ReSharper disable once AccessToDisposedClosure // ReSharper disable once AccessToDisposedClosure
var storage = host.Storage.GetStorageForDirectory(Path.Combine("tournaments", "default")); var storage = host.Storage.GetStorageForDirectory(Path.Combine("tournaments", "default"));
using (var stream = storage.GetStream("bracket.json", FileAccess.Write, FileMode.Create)) using (var stream = storage.CreateFileSafely("bracket.json"))
using (var writer = new StreamWriter(stream)) using (var writer = new StreamWriter(stream))
{ {
writer.Write(@"{ writer.Write(@"{

View File

@ -15,7 +15,7 @@ namespace osu.Game.Tournament.Tests.Screens
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(Storage storage) private void load(Storage storage)
{ {
using (var stream = storage.GetStream("drawings.txt", FileAccess.Write)) using (var stream = storage.CreateFileSafely("drawings.txt"))
using (var writer = new StreamWriter(stream)) using (var writer = new StreamWriter(stream))
{ {
writer.WriteLine("KR : South Korea : KOR"); writer.WriteLine("KR : South Korea : KOR");

View File

@ -45,7 +45,7 @@ namespace osu.Game.Tournament.Models
public void SaveChanges() public void SaveChanges()
{ {
using (var stream = configStorage.GetStream(config_path, FileAccess.Write, FileMode.Create)) using (var stream = configStorage.CreateFileSafely(config_path))
using (var sw = new StreamWriter(stream)) using (var sw = new StreamWriter(stream))
{ {
sw.Write(JsonConvert.SerializeObject(this, sw.Write(JsonConvert.SerializeObject(this,

View File

@ -205,7 +205,7 @@ namespace osu.Game.Tournament.Screens.Drawings
try try
{ {
// Write to drawings_results // Write to drawings_results
using (Stream stream = storage.GetStream(results_filename, FileAccess.Write, FileMode.Create)) using (Stream stream = storage.CreateFileSafely(results_filename))
using (StreamWriter sw = new StreamWriter(stream)) using (StreamWriter sw = new StreamWriter(stream))
{ {
sw.Write(text); sw.Write(text);

View File

@ -321,7 +321,7 @@ namespace osu.Game.Tournament
Converters = new JsonConverter[] { new JsonPointConverter() } Converters = new JsonConverter[] { new JsonPointConverter() }
}); });
using (var stream = storage.GetStream(BRACKET_FILENAME, FileAccess.Write, FileMode.Create)) using (var stream = storage.CreateFileSafely(BRACKET_FILENAME))
using (var sw = new StreamWriter(stream)) using (var sw = new StreamWriter(stream))
sw.Write(serialisedLadder); sw.Write(serialisedLadder);
} }

View File

@ -37,7 +37,7 @@ namespace osu.Game.Database
{ {
string filename = $"{item.GetDisplayString().GetValidArchiveContentFilename()}{FileExtension}"; string filename = $"{item.GetDisplayString().GetValidArchiveContentFilename()}{FileExtension}";
using (var stream = exportStorage.GetStream(filename, FileAccess.Write, FileMode.Create)) using (var stream = exportStorage.CreateFileSafely(filename))
ExportModelTo(item, stream); ExportModelTo(item, stream);
exportStorage.PresentFileExternally(filename); exportStorage.PresentFileExternally(filename);

View File

@ -242,7 +242,7 @@ namespace osu.Game.Database
storage.Delete(Filename); storage.Delete(Filename);
using (var inputStream = storage.GetStream(recoveryFilename)) using (var inputStream = storage.GetStream(recoveryFilename))
using (var outputStream = storage.GetStream(Filename, FileAccess.Write, FileMode.Create)) using (var outputStream = storage.CreateFileSafely(Filename))
inputStream.CopyTo(outputStream); inputStream.CopyTo(outputStream);
storage.Delete(recoveryFilename); storage.Delete(recoveryFilename);

View File

@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System; using System;
using System.IO;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using osu.Framework.Allocation; using osu.Framework.Allocation;
@ -118,7 +117,7 @@ namespace osu.Game.Graphics
if (filename == null) return; if (filename == null) return;
using (var stream = storage.GetStream(filename, FileAccess.Write)) using (var stream = storage.CreateFileSafely(filename))
{ {
switch (screenshotFormat.Value) switch (screenshotFormat.Value)
{ {

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Localisation;
using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Backgrounds;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
@ -27,7 +28,7 @@ namespace osu.Game.Graphics.UserInterface
}); });
} }
public virtual IEnumerable<string> FilterTerms => new[] { Text.ToString() }; public virtual IEnumerable<LocalisableString> FilterTerms => new[] { Text };
public bool MatchingFilter public bool MatchingFilter
{ {

View File

@ -6,6 +6,7 @@ using JetBrains.Annotations;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays; using osu.Game.Overlays;
@ -39,7 +40,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
private void updateCornerRadius() => Content.CornerRadius = DrawHeight / 2; private void updateCornerRadius() => Content.CornerRadius = DrawHeight / 2;
public virtual IEnumerable<string> FilterTerms => new[] { Text.ToString() }; public virtual IEnumerable<LocalisableString> FilterTerms => new[] { Text };
public bool MatchingFilter public bool MatchingFilter
{ {

View File

@ -67,9 +67,13 @@ namespace osu.Game.IO
public override IEnumerable<string> GetFiles(string path, string pattern = "*") => public override IEnumerable<string> GetFiles(string path, string pattern = "*") =>
ToLocalRelative(UnderlyingStorage.GetFiles(MutatePath(path), pattern)); ToLocalRelative(UnderlyingStorage.GetFiles(MutatePath(path), pattern));
public override Stream CreateFileSafely(string path) => UnderlyingStorage.CreateFileSafely(path);
public override Stream GetStream(string path, FileAccess access = FileAccess.Read, FileMode mode = FileMode.OpenOrCreate) => public override Stream GetStream(string path, FileAccess access = FileAccess.Read, FileMode mode = FileMode.OpenOrCreate) =>
UnderlyingStorage.GetStream(MutatePath(path), access, mode); UnderlyingStorage.GetStream(MutatePath(path), access, mode);
public override void Move(string from, string to) => UnderlyingStorage.Move(from, to);
public override bool OpenFileExternally(string filename) => UnderlyingStorage.OpenFileExternally(MutatePath(filename)); public override bool OpenFileExternally(string filename) => UnderlyingStorage.OpenFileExternally(MutatePath(filename));
public override bool PresentFileExternally(string filename) => UnderlyingStorage.PresentFileExternally(MutatePath(filename)); public override bool PresentFileExternally(string filename) => UnderlyingStorage.PresentFileExternally(MutatePath(filename));

View File

@ -243,7 +243,7 @@ namespace osu.Game
{ {
if (source != null) if (source != null)
{ {
using (var destination = Storage.GetStream(Path.Combine(backup_folder, $"collection.{migration}.db"), FileAccess.Write, FileMode.CreateNew)) using (var destination = Storage.CreateFileSafely(Path.Combine(backup_folder, $"collection.{migration}.db")))
source.CopyTo(destination); source.CopyTo(destination);
} }
} }

View File

@ -12,6 +12,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
@ -28,7 +29,7 @@ namespace osu.Game.Overlays.Chat.Listing
public readonly Channel Channel; public readonly Channel Channel;
public bool FilteringActive { get; set; } public bool FilteringActive { get; set; }
public IEnumerable<string> FilterTerms => new[] { Channel.Name, Channel.Topic ?? string.Empty }; public IEnumerable<LocalisableString> FilterTerms => new LocalisableString[] { Channel.Name, Channel.Topic ?? string.Empty };
public bool MatchingFilter { set => this.FadeTo(value ? 1f : 0f, 100); } public bool MatchingFilter { set => this.FadeTo(value ? 1f : 0f, 100); }
private Box hoverBox = null!; private Box hoverBox = null!;

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Online.Chat; using osu.Game.Online.Chat;
@ -36,7 +37,7 @@ namespace osu.Game.Overlays.Chat.Selection
private Color4 topicColour; private Color4 topicColour;
private Color4 hoverColour; private Color4 hoverColour;
public IEnumerable<string> FilterTerms => new[] { Channel.Name, Channel.Topic ?? string.Empty }; public IEnumerable<LocalisableString> FilterTerms => new LocalisableString[] { Channel.Name, Channel.Topic ?? string.Empty };
public bool MatchingFilter public bool MatchingFilter
{ {

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Localisation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Online.Chat; using osu.Game.Online.Chat;
@ -18,7 +19,7 @@ namespace osu.Game.Overlays.Chat.Selection
public readonly FillFlowContainer<ChannelListItem> ChannelFlow; public readonly FillFlowContainer<ChannelListItem> ChannelFlow;
public IEnumerable<IFilterable> FilterableChildren => ChannelFlow.Children; public IEnumerable<IFilterable> FilterableChildren => ChannelFlow.Children;
public IEnumerable<string> FilterTerms => Array.Empty<string>(); public IEnumerable<LocalisableString> FilterTerms => Array.Empty<LocalisableString>();
public bool MatchingFilter public bool MatchingFilter
{ {

View File

@ -3,6 +3,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -113,7 +114,7 @@ namespace osu.Game.Overlays.Music
} }
} }
public IEnumerable<string> FilterTerms => Model.PerformRead(m => m.Metadata.GetSearchableTerms()); public IEnumerable<LocalisableString> FilterTerms => Model.PerformRead(m => m.Metadata.GetSearchableTerms()).Select(s => (LocalisableString)s).ToArray();
private bool matchingFilter = true; private bool matchingFilter = true;

View File

@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
{ {
protected override LocalisableString Header => AudioSettingsStrings.OffsetHeader; protected override LocalisableString Header => AudioSettingsStrings.OffsetHeader;
public override IEnumerable<string> FilterTerms => base.FilterTerms.Concat(new[] { "universal", "uo", "timing" }); public override IEnumerable<LocalisableString> FilterTerms => base.FilterTerms.Concat(new LocalisableString[] { "universal", "uo", "timing" });
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config) private void load(OsuConfigManager config)

View File

@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Settings.Sections
Icon = FontAwesome.Solid.VolumeUp Icon = FontAwesome.Solid.VolumeUp
}; };
public override IEnumerable<string> FilterTerms => base.FilterTerms.Concat(new[] { "sound" }); public override IEnumerable<LocalisableString> FilterTerms => base.FilterTerms.Concat(new LocalisableString[] { "sound" });
public AudioSection() public AudioSection()
{ {

View File

@ -14,7 +14,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
{ {
protected override LocalisableString Header => GameplaySettingsStrings.ModsHeader; protected override LocalisableString Header => GameplaySettingsStrings.ModsHeader;
public override IEnumerable<string> FilterTerms => base.FilterTerms.Concat(new[] { "mod" }); public override IEnumerable<LocalisableString> FilterTerms => base.FilterTerms.Concat(new LocalisableString[] { "mod" });
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config) private void load(OsuConfigManager config)

View File

@ -15,6 +15,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
@ -67,7 +68,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
private Bindable<bool> isDefault { get; } = new BindableBool(true); private Bindable<bool> isDefault { get; } = new BindableBool(true);
public IEnumerable<string> FilterTerms => bindings.Select(b => keyCombinationProvider.GetReadableString(b.KeyCombination)).Prepend(text.Text.ToString()); public IEnumerable<LocalisableString> FilterTerms => bindings.Select(b => (LocalisableString)keyCombinationProvider.GetReadableString(b.KeyCombination)).Prepend(text.Text);
public KeyBindingRow(object action, List<RealmKeyBinding> bindings) public KeyBindingRow(object action, List<RealmKeyBinding> bindings)
{ {

View File

@ -6,6 +6,7 @@ using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using osu.Game.Rulesets; using osu.Game.Rulesets;
@ -74,6 +75,6 @@ namespace osu.Game.Overlays.Settings.Sections.Input
} }
// Empty FilterTerms so that the ResetButton is visible only when the whole subsection is visible. // Empty FilterTerms so that the ResetButton is visible only when the whole subsection is visible.
public override IEnumerable<string> FilterTerms => Enumerable.Empty<string>(); public override IEnumerable<LocalisableString> FilterTerms => Enumerable.Empty<LocalisableString>();
} }
} }

View File

@ -20,13 +20,12 @@ namespace osu.Game.Overlays.Settings
public LocalisableString TooltipText { get; set; } public LocalisableString TooltipText { get; set; }
public override IEnumerable<string> FilterTerms public override IEnumerable<LocalisableString> FilterTerms
{ {
get get
{ {
if (TooltipText != default) if (TooltipText != default)
// TODO: this won't work as intended once the tooltip text is translated. return base.FilterTerms.Append(TooltipText);
return base.FilterTerms.Append(TooltipText.ToString());
return base.FilterTerms; return base.FilterTerms;
} }

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings namespace osu.Game.Overlays.Settings
@ -25,7 +26,7 @@ namespace osu.Game.Overlays.Settings
set => Control.ItemSource = value; set => Control.ItemSource = value;
} }
public override IEnumerable<string> FilterTerms => base.FilterTerms.Concat(Control.Items.Select(i => i.ToString())); public override IEnumerable<LocalisableString> FilterTerms => base.FilterTerms.Concat(Control.Items.Select(i => (LocalisableString)i.ToString()));
protected sealed override Drawable CreateControl() => CreateDropdown(); protected sealed override Drawable CreateControl() => CreateDropdown();

View File

@ -3,6 +3,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -98,13 +99,13 @@ namespace osu.Game.Overlays.Settings
set => controlWithCurrent.Current = value; set => controlWithCurrent.Current = value;
} }
public virtual IEnumerable<string> FilterTerms public virtual IEnumerable<LocalisableString> FilterTerms
{ {
get get
{ {
var keywords = new List<string>(Keywords ?? Array.Empty<string>()) var keywords = new List<LocalisableString>(Keywords?.Select(k => (LocalisableString)k) ?? Array.Empty<LocalisableString>())
{ {
LabelText.ToString() LabelText
}; };
if (HasClassicDefault) if (HasClassicDefault)

View File

@ -32,7 +32,7 @@ namespace osu.Game.Overlays.Settings
public abstract LocalisableString Header { get; } public abstract LocalisableString Header { get; }
public IEnumerable<IFilterable> FilterableChildren => Children.OfType<IFilterable>(); public IEnumerable<IFilterable> FilterableChildren => Children.OfType<IFilterable>();
public virtual IEnumerable<string> FilterTerms => new[] { Header.ToString() }; public virtual IEnumerable<LocalisableString> FilterTerms => new[] { Header };
public const int ITEM_SPACING = 14; public const int ITEM_SPACING = 14;

View File

@ -25,11 +25,7 @@ namespace osu.Game.Overlays.Settings
public IEnumerable<IFilterable> FilterableChildren => Children.OfType<IFilterable>(); public IEnumerable<IFilterable> FilterableChildren => Children.OfType<IFilterable>();
// FilterTerms should contains both original string and localised string for user to search. public virtual IEnumerable<LocalisableString> FilterTerms => new[] { Header };
// Since LocalisableString is unable to get original string at this time (2021-08-14),
// only call .ToString() to use localised one.
// TODO: Update here when FilterTerms accept LocalisableString.
public virtual IEnumerable<string> FilterTerms => new[] { Header.ToString() };
public bool MatchingFilter public bool MatchingFilter
{ {

View File

@ -80,7 +80,10 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
matchingFilter &= criteria.Ruleset == null || r.Room.PlaylistItemStats.Value?.RulesetIDs.Any(id => id == criteria.Ruleset.OnlineID) != false; matchingFilter &= criteria.Ruleset == null || r.Room.PlaylistItemStats.Value?.RulesetIDs.Any(id => id == criteria.Ruleset.OnlineID) != false;
if (!string.IsNullOrEmpty(criteria.SearchString)) if (!string.IsNullOrEmpty(criteria.SearchString))
matchingFilter &= r.FilterTerms.Any(term => term.Contains(criteria.SearchString, StringComparison.InvariantCultureIgnoreCase)); {
// Room name isn't translatable, so ToString() is used here for simplicity.
matchingFilter &= r.FilterTerms.Any(term => term.ToString().Contains(criteria.SearchString, StringComparison.InvariantCultureIgnoreCase));
}
r.MatchingFilter = matchingFilter; r.MatchingFilter = matchingFilter;
} }

View File

@ -14,6 +14,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Extensions; using osu.Game.Extensions;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
@ -101,7 +102,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
public bool FilteringActive { get; set; } public bool FilteringActive { get; set; }
public IEnumerable<string> FilterTerms => new[] { Room.Name.Value }; public IEnumerable<LocalisableString> FilterTerms => new LocalisableString[] { Room.Name.Value };
private bool matchingFilter = true; private bool matchingFilter = true;

View File

@ -65,7 +65,7 @@ namespace osu.Game.Stores
{ {
data.Seek(0, SeekOrigin.Begin); data.Seek(0, SeekOrigin.Begin);
using (var output = Storage.GetStream(file.GetStoragePath(), FileAccess.Write)) using (var output = Storage.CreateFileSafely(file.GetStoragePath()))
data.CopyTo(output); data.CopyTo(output);
data.Seek(0, SeekOrigin.Begin); data.Seek(0, SeekOrigin.Begin);

View File

@ -35,7 +35,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Realm" Version="10.11.2" /> <PackageReference Include="Realm" Version="10.11.2" />
<PackageReference Include="ppy.osu.Framework" Version="2022.511.0" /> <PackageReference Include="ppy.osu.Framework" Version="2022.520.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.513.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2022.513.0" />
<PackageReference Include="Sentry" Version="3.17.1" /> <PackageReference Include="Sentry" Version="3.17.1" />
<PackageReference Include="SharpCompress" Version="0.31.0" /> <PackageReference Include="SharpCompress" Version="0.31.0" />

View File

@ -61,7 +61,7 @@
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
</ItemGroup> </ItemGroup>
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2022.511.0" /> <PackageReference Include="ppy.osu.Framework.iOS" Version="2022.520.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.513.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2022.513.0" />
</ItemGroup> </ItemGroup>
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net6.0) --> <!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net6.0) -->
@ -84,7 +84,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.14" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="5.0.14" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="5.0.14" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="ppy.osu.Framework" Version="2022.511.0" /> <PackageReference Include="ppy.osu.Framework" Version="2022.520.0" />
<PackageReference Include="SharpCompress" Version="0.31.0" /> <PackageReference Include="SharpCompress" Version="0.31.0" />
<PackageReference Include="NUnit" Version="3.13.3" /> <PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" /> <PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />