diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs index 9bad8a457..adf8a1355 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs @@ -230,7 +230,7 @@ private void processTranslate(Beatmap beatmap, IEnumerable translateLine var translations = translateLines.Select(translate => new { key = translate.Split('=').FirstOrDefault()?.Split('[').LastOrDefault()?.Split(']').FirstOrDefault(), - value = translate.Split('=').LastOrDefault() + value = translate.Split('=').LastOrDefault() ?? string.Empty }).GroupBy(x => x.key, y => y.value).ToList(); foreach (var translation in translations) diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapEncoder.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapEncoder.cs index 7c75263c2..4123dda28 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapEncoder.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapEncoder.cs @@ -32,7 +32,7 @@ private IEnumerable encodeNote(Beatmap output) { var lyric = g.Key; if (lyric == null) - throw new NullReferenceException(); + throw new ArgumentNullException(); // Get note group var noteGroup = g.ToList().GroupBy(n => n.ReferenceTimeTagIndex); @@ -75,7 +75,7 @@ private IEnumerable encodeTranslate(Beatmap output) { foreach (var lyric in lyrics) { - string translateString = lyric.Translates.TryGetValue(translate, out string value) ? value : string.Empty; + string translateString = lyric.Translates.TryGetValue(translate, out string? value) ? value : string.Empty; yield return $"@tr[{translate.Name}]={translateString}"; } } diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapResourcesProvider.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapResourcesProvider.cs index 35fcd2a6e..508e87351 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapResourcesProvider.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapResourcesProvider.cs @@ -45,7 +45,7 @@ private IBeatmapResourceProvider getBeatmapResourceProvider() // todo : use better way to get the resource provider. var prop = typeof(BeatmapManager).GetField("workingBeatmapCache", BindingFlags.Instance | BindingFlags.NonPublic); if (prop == null) - throw new NullReferenceException(); + throw new ArgumentNullException(); return prop.GetValue(beatmapManager) as WorkingBeatmapCache; } diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/Metadatas/Page.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/Metadatas/Page.cs index dbcbb53dd..5682820c0 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/Metadatas/Page.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/Metadatas/Page.cs @@ -27,7 +27,7 @@ public Page DeepClone() }; } - public int CompareTo(Page other) => Time.CompareTo(other.Time); + public int CompareTo(Page? other) => Time.CompareTo(other?.Time); public override int GetHashCode() => Time.GetHashCode(); } diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/Metadatas/PageInfo.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/Metadatas/PageInfo.cs index 3456e5ab9..eab58a480 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/Metadatas/PageInfo.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/Metadatas/PageInfo.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Collections.Specialized; +using System.Diagnostics; using System.Linq; using Newtonsoft.Json; using osu.Framework.Bindables; @@ -30,12 +31,16 @@ public PageInfo() switch (args.Action) { case NotifyCollectionChangedAction.Add: + Debug.Assert(args.NewItems != null); + foreach (var c in args.NewItems.Cast()) c.TimeBindable.ValueChanged += timeValueChanged; break; case NotifyCollectionChangedAction.Reset: case NotifyCollectionChangedAction.Remove: + Debug.Assert(args.OldItems != null); + foreach (var c in args.OldItems.Cast()) c.TimeBindable.ValueChanged -= timeValueChanged; break; @@ -85,7 +90,7 @@ void onPageChanged() public PageInfo DeepClone() { - var controlPointInfo = (PageInfo)Activator.CreateInstance(GetType()); + var controlPointInfo = (PageInfo)Activator.CreateInstance(GetType())!; return controlPointInfo; } diff --git a/osu.Game.Rulesets.Karaoke/Bindables/BindableCultureInfo.cs b/osu.Game.Rulesets.Karaoke/Bindables/BindableCultureInfo.cs index da9a1a5a5..4be103e91 100644 --- a/osu.Game.Rulesets.Karaoke/Bindables/BindableCultureInfo.cs +++ b/osu.Game.Rulesets.Karaoke/Bindables/BindableCultureInfo.cs @@ -26,11 +26,11 @@ public override void Parse(object? input) switch (input) { case string str: - Value = new CultureInfo(str); + Value = CultureInfoUtils.CreateLoadCultureInfoByCode(str); break; case int lcid: - Value = new CultureInfo(lcid); + Value = CultureInfoUtils.CreateLoadCultureInfoById(lcid); break; case CultureInfo cultureInfo: @@ -46,6 +46,6 @@ public override void Parse(object? input) protected override Bindable CreateInstance() => new BindableCultureInfo(); public override string ToString(string format, IFormatProvider formatProvider) - => CultureInfoUtils.GetLanguageDisplayText(Value); + => Value != null ? CultureInfoUtils.GetSaveCultureInfoCode(Value) : string.Empty; } } diff --git a/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/LyricTimeTagsChangeHandler.cs b/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/LyricTimeTagsChangeHandler.cs index aeaaef4f3..1023dfc4f 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/LyricTimeTagsChangeHandler.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/LyricTimeTagsChangeHandler.cs @@ -149,7 +149,8 @@ public void RemoveByPosition(TextIndex index) return; var removedTimeTag = matchedTimeTags.OrderBy(x => x.Time).FirstOrDefault(); - lyric.TimeTags.Remove(removedTimeTag); + if (removedTimeTag != null) + lyric.TimeTags.Remove(removedTimeTag); }); } diff --git a/osu.Game.Rulesets.Karaoke/Extensions/TrickyCompositeDrawableExtension.cs b/osu.Game.Rulesets.Karaoke/Extensions/TrickyCompositeDrawableExtension.cs index e1a6abf26..c00e9b52f 100644 --- a/osu.Game.Rulesets.Karaoke/Extensions/TrickyCompositeDrawableExtension.cs +++ b/osu.Game.Rulesets.Karaoke/Extensions/TrickyCompositeDrawableExtension.cs @@ -24,7 +24,7 @@ public static class TrickyCompositeDrawableExtension if (prop == null) return null; - return (IReadOnlyList)prop.GetValue(compositeDrawable); + return (IReadOnlyList)prop.GetValue(compositeDrawable)!; } } } diff --git a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/DictionaryConverter.cs b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/DictionaryConverter.cs index 1263a8ce0..b412afb38 100644 --- a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/DictionaryConverter.cs +++ b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/DictionaryConverter.cs @@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Karaoke.IO.Serialization.Converters { - public abstract class DictionaryConverter : JsonConverter> + public abstract class DictionaryConverter : JsonConverter> where TKey : notnull { public sealed override IDictionary ReadJson(JsonReader reader, Type objectType, IDictionary? existingValue, bool hasExistingValue, JsonSerializer serializer) { diff --git a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/GenericTypeConvertor.cs b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/GenericTypeConvertor.cs index 5d29de9cf..611f0108f 100644 --- a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/GenericTypeConvertor.cs +++ b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/GenericTypeConvertor.cs @@ -24,7 +24,7 @@ public sealed override TType ReadJson(JsonReader reader, Type objectType, TType? var newReader = jObject.CreateReader(); - var instance = (TType)Activator.CreateInstance(type); + var instance = (TType)Activator.CreateInstance(type)!; serializer.Populate(newReader, instance); PostProcessValue(instance, jObject, serializer); return instance; diff --git a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/KaraokeSkinGroupConvertor.cs b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/KaraokeSkinGroupConvertor.cs index 973851785..daaccc84f 100644 --- a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/KaraokeSkinGroupConvertor.cs +++ b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/KaraokeSkinGroupConvertor.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Diagnostics; using System.Reflection; using osu.Game.Rulesets.Karaoke.Skinning.Groups; @@ -13,7 +14,9 @@ protected override Type GetTypeByName(string name) { // only get name from font var assembly = Assembly.GetExecutingAssembly(); - return assembly.GetType($"osu.Game.Rulesets.Karaoke.Skinning.Groups.{name}"); + var type = assembly.GetType($"osu.Game.Rulesets.Karaoke.Skinning.Groups.{name}"); + Debug.Assert(type != null); + return type; } } } diff --git a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/KaraokeSkinMappingRoleConvertor.cs b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/KaraokeSkinMappingRoleConvertor.cs index 23fde8b50..64d5cc450 100644 --- a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/KaraokeSkinMappingRoleConvertor.cs +++ b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/KaraokeSkinMappingRoleConvertor.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Diagnostics; using System.Reflection; using osu.Game.Rulesets.Karaoke.Skinning.MappingRoles; @@ -13,7 +14,9 @@ protected override Type GetTypeByName(string name) { // only get name from font var assembly = Assembly.GetExecutingAssembly(); - return assembly.GetType($"osu.Game.Rulesets.Karaoke.Skinning.MappingRoles.{name}"); + var type = assembly.GetType($"osu.Game.Rulesets.Karaoke.Skinning.MappingRoles.{name}"); + Debug.Assert(type != null); + return type; } } } diff --git a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/LyricConvertor.cs b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/LyricConvertor.cs index 8d2a88b7d..6f8f31105 100644 --- a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/LyricConvertor.cs +++ b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/LyricConvertor.cs @@ -21,7 +21,7 @@ public override Lyric ReadJson(JsonReader reader, Type objectType, Lyric? existi var newReader = jObject.CreateReader(); - var instance = (Lyric)Activator.CreateInstance(objectType); + var instance = (Lyric)Activator.CreateInstance(objectType)!; serializer.Populate(newReader, instance); return instance; } diff --git a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/ReferenceLyricPropertyConfigConvertor.cs b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/ReferenceLyricPropertyConfigConvertor.cs index 09676bb2c..921339aab 100644 --- a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/ReferenceLyricPropertyConfigConvertor.cs +++ b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/ReferenceLyricPropertyConfigConvertor.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Diagnostics; using System.Reflection; using osu.Game.Rulesets.Karaoke.Objects.Properties; @@ -12,7 +13,9 @@ public class ReferenceLyricPropertyConfigConvertor : GenericTypeConvertor()) c.Changed += invalidate; break; case NotifyCollectionChangedAction.Reset: case NotifyCollectionChangedAction.Remove: + Debug.Assert(args.OldItems != null); + foreach (var c in args.OldItems.Cast()) c.Changed -= invalidate; break; @@ -50,12 +54,16 @@ private void initInternalBindingEvent() switch (args.Action) { case NotifyCollectionChangedAction.Add: + Debug.Assert(args.NewItems != null); + foreach (var c in args.NewItems.Cast()) c.Changed += invalidate; break; case NotifyCollectionChangedAction.Reset: case NotifyCollectionChangedAction.Remove: + Debug.Assert(args.OldItems != null); + foreach (var c in args.OldItems.Cast()) c.Changed -= invalidate; break; @@ -69,12 +77,16 @@ private void initInternalBindingEvent() switch (args.Action) { case NotifyCollectionChangedAction.Add: + Debug.Assert(args.NewItems != null); + foreach (var c in args.NewItems.Cast()) c.Changed += invalidate; break; case NotifyCollectionChangedAction.Reset: case NotifyCollectionChangedAction.Remove: + Debug.Assert(args.OldItems != null); + foreach (var c in args.OldItems.Cast()) c.Changed -= invalidate; break; @@ -281,7 +293,7 @@ private void bindListValueChange(ValueChangedEvent e, Func triggerPropertyChanged(); + void propertyChanged(object? sender, NotifyCollectionChangedEventArgs _) => triggerPropertyChanged(); void triggerPropertyChanged() { diff --git a/osu.Game.Rulesets.Karaoke/Objects/Tone.cs b/osu.Game.Rulesets.Karaoke/Objects/Tone.cs index 6c30a4ebb..9b50e6856 100644 --- a/osu.Game.Rulesets.Karaoke/Objects/Tone.cs +++ b/osu.Game.Rulesets.Karaoke/Objects/Tone.cs @@ -49,7 +49,7 @@ public int CompareTo(int other) public bool Equals(int other) => Scale == other && Half == false; - public override bool Equals(object obj) + public override bool Equals(object? obj) { return obj switch { diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/AutoGenerateSubsection.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/AutoGenerateSubsection.cs index db86bfe0b..b81d541ec 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/AutoGenerateSubsection.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/AutoGenerateSubsection.cs @@ -132,7 +132,7 @@ private Popover createSelectionPopover() Children = AvailableSettings.Select(x => { string name = GetDisplayName(x); - return new OsuButton + return new AutoGenerateButton { Text = name, Width = 150, @@ -148,5 +148,9 @@ private Popover createSelectionPopover() }).ToList() } }; + + private partial class AutoGenerateButton : EditorSectionButton + { + } } } diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/BindableBlueprintContainer.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/BindableBlueprintContainer.cs index 3b24d9221..cdf30b89d 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/BindableBlueprintContainer.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/BindableBlueprintContainer.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Specialized; +using System.Diagnostics; using System.Linq; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -20,7 +21,7 @@ public abstract partial class BindableBlueprintContainer : BlueprintContainer protected void RegisterBindable(BindableList bindable) { if (bindableList != null) - throw new Exception(); + throw new InvalidOperationException("Already have bindable."); bindableList = bindable; @@ -30,12 +31,16 @@ protected void RegisterBindable(BindableList bindable) switch (args.Action) { case NotifyCollectionChangedAction.Add: + Debug.Assert(args.NewItems != null); + foreach (var obj in args.NewItems.OfType()) AddBlueprintFor(obj); break; case NotifyCollectionChangedAction.Remove: + Debug.Assert(args.OldItems != null); + foreach (var obj in args.OldItems.OfType()) RemoveBlueprintFor(obj); diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/BottomEditor/Notes/NoteEditor.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/BottomEditor/Notes/NoteEditor.cs index 0975313d5..c3fff33cc 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/BottomEditor/Notes/NoteEditor.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/BottomEditor/Notes/NoteEditor.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Specialized; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using osu.Framework.Allocation; @@ -83,12 +84,16 @@ public NoteEditor() switch (args.Action) { case NotifyCollectionChangedAction.Add: + Debug.Assert(args.NewItems != null); + foreach (var obj in args.NewItems.OfType()) Playfield.Add(obj); break; case NotifyCollectionChangedAction.Remove: + Debug.Assert(args.OldItems != null); + foreach (var obj in args.OldItems.OfType()) Playfield.Remove(obj); diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricEditor.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricEditor.cs index 224cb262b..84c6e871a 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricEditor.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricEditor.cs @@ -184,7 +184,7 @@ private void initialSubModeChanged() where TSubMode : Enum { var editModeState = getEditModeState(); if (editModeState == null) - throw new NullReferenceException("Unknows sub mode."); + throw new ArgumentNullException(); editModeState.BindableEditMode.BindValueChanged(e => { @@ -448,7 +448,7 @@ public void SwitchSubMode(TSubMode subMode) where TSubMode : Enum { var editModeState = getEditModeState(); if (editModeState == null) - throw new NullReferenceException("Unknows sub mode."); + throw new ArgumentNullException(); editModeState.ChangeEditMode(subMode); } diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricList/Rows/Info/InfoControl.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricList/Rows/Info/InfoControl.cs index 7ab9f5130..caaed19e0 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricList/Rows/Info/InfoControl.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricList/Rows/Info/InfoControl.cs @@ -191,7 +191,7 @@ private void initializeBadge(LyricEditorMode mode, Enum? subMode) case LyricEditorMode.EditTimeTag: if (subMode is not TimeTagEditMode timeTagEditMode) - throw new NullReferenceException(); + throw new ArgumentNullException(); return createTimeTagModeSubInfo(timeTagEditMode, Lyric); diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Reference/ReferenceLyricConfigSection.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Reference/ReferenceLyricConfigSection.cs index b34accbc5..3f61160ec 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Reference/ReferenceLyricConfigSection.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Reference/ReferenceLyricConfigSection.cs @@ -92,7 +92,7 @@ public ReferenceLyricConfigSection() break; default: - throw new IndexOutOfRangeException(); + throw new InvalidOperationException(); } }); @@ -166,7 +166,7 @@ private void onConfigChanged() break; default: - throw new IndexOutOfRangeException(); + throw new ArgumentOutOfRangeException(nameof(config), config, "unknown config."); } isConfigChanging = false; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/States/Modes/ModeStateWithBlueprintContainer.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/States/Modes/ModeStateWithBlueprintContainer.cs index 1619669b8..17d4cbc50 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/States/Modes/ModeStateWithBlueprintContainer.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/States/Modes/ModeStateWithBlueprintContainer.cs @@ -64,7 +64,13 @@ protected virtual void TriggerDisableStateChanged() { case CaretGenerateType.Action: if (SelectFirstProperty(lyric)) - SelectedItems.Add(SelectableProperties(lyric).FirstOrDefault()); + { + var firstItem = SelectableProperties(lyric).FirstOrDefault(); + + if (firstItem != null) + SelectedItems.Add(firstItem); + } + break; case CaretGenerateType.TargetLyric: diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Pages/Settings/PagesSection.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Pages/Settings/PagesSection.cs index 9b9e738ab..2183cdba6 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Pages/Settings/PagesSection.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Pages/Settings/PagesSection.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Specialized; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using osu.Framework.Allocation; @@ -43,6 +44,8 @@ public PagesSection() switch (args.Action) { case NotifyCollectionChangedAction.Add: + Debug.Assert(args.NewItems != null); + foreach (var obj in args.NewItems.OfType()) { Add(new LabelledPage(obj) @@ -54,6 +57,8 @@ public PagesSection() break; case NotifyCollectionChangedAction.Remove: + Debug.Assert(args.OldItems != null); + foreach (var obj in args.OldItems.OfType()) { var drawable = Children.OfType().FirstOrDefault(x => x.Page == obj); diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Singers/Rows/Components/SingerAvatar.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Singers/Rows/Components/SingerAvatar.cs index 97cd6f49b..b7bf059f7 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Singers/Rows/Components/SingerAvatar.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Singers/Rows/Components/SingerAvatar.cs @@ -86,7 +86,7 @@ Task ICanAcceptFiles.Import(params string[] paths) return Task.CompletedTask; } - Task ICanAcceptFiles.Import(params ImportTask[] tasks) => throw new NotImplementedException(); + Task ICanAcceptFiles.Import(ImportTask[] tasks, ImportParameters parameters) => throw new NotImplementedException(); protected override void Dispose(bool isDisposing) { diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/DragFile/DragFileStepScreen.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/DragFile/DragFileStepScreen.cs index 2566eb8f1..d73d6532e 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/DragFile/DragFileStepScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/DragFile/DragFileStepScreen.cs @@ -59,7 +59,7 @@ public Task Import(params string[] paths) return Task.CompletedTask; } - public Task Import(params ImportTask[] tasks) + public Task Import(ImportTask[] tasks, ImportParameters parameters = default) { // todo : wail until really implement needed. throw new NotImplementedException("Report to https://github.com/karaoke-dev/karaoke and i will implement it."); diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/LyricImporterStepScreen.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/LyricImporterStepScreen.cs index 9e4e2b6db..661e088f7 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/LyricImporterStepScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/LyricImporterStepScreen.cs @@ -42,7 +42,7 @@ protected LyricImporterStepScreen() InternalChildren = new Drawable[] { - new OsuButton + new LyricImporterStepButton { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -89,5 +89,9 @@ public virtual void ConfirmRollBackFromStep(ILyricImporterStepScreen fromScreen, } public override string ToString() => Title; + + private partial class LyricImporterStepButton : OsuButton + { + } } } diff --git a/osu.Game.Rulesets.Karaoke/Utils/AssemblyUtils.cs b/osu.Game.Rulesets.Karaoke/Utils/AssemblyUtils.cs index f7ec16875..cc1c96875 100644 --- a/osu.Game.Rulesets.Karaoke/Utils/AssemblyUtils.cs +++ b/osu.Game.Rulesets.Karaoke/Utils/AssemblyUtils.cs @@ -17,7 +17,7 @@ public static class AssemblyUtils return defaultAssembly; // Note: because multiple assembly might be wrapped into single one by ILRepack, so should find by main dll again if not found. - return AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(x => x.FullName.Contains("osu.Game.Rulesets.Karaoke")); + return AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(x => x.FullName?.Contains("osu.Game.Rulesets.Karaoke") ?? false); } } } diff --git a/osu.Game.Rulesets.Karaoke/Utils/BindablesUtils.cs b/osu.Game.Rulesets.Karaoke/Utils/BindablesUtils.cs index c743d4073..d0f17a2fb 100644 --- a/osu.Game.Rulesets.Karaoke/Utils/BindablesUtils.cs +++ b/osu.Game.Rulesets.Karaoke/Utils/BindablesUtils.cs @@ -34,7 +34,7 @@ public static void OnyWaySync(BindableList firstBindableList, Bindab if (oldItems != null && oldItems.Count > 0) { // remove objects from second list if exist items has been removed. - secondBindableList.RemoveAll(x => args.OldItems.Contains(x)); + secondBindableList.RemoveAll(x => oldItems.Contains(x)); } }; } diff --git a/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj b/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj index 798570604..78cabbe4b 100644 --- a/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj +++ b/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj @@ -1,6 +1,6 @@  - netstandard2.1 + net6.0 osu.Game.Rulesets.Karaoke Library AnyCPU @@ -12,13 +12,13 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - +