diff --git a/.editorconfig b/.editorconfig index 0ec2619de..f3b4d23de 100644 --- a/.editorconfig +++ b/.editorconfig @@ -191,6 +191,9 @@ csharp_style_prefer_index_operator = false:silent csharp_style_prefer_range_operator = false:silent csharp_style_prefer_switch_expression = false:none +#Style - C# 10 features +csharp_style_namespace_declarations = file_scoped:none + [*.{yaml,yml}] insert_final_newline = true indent_style = space diff --git a/Directory.Build.props b/Directory.Build.props index eddeaf332..863b7e0b2 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - 9.0 + 10.0 true enable diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Notes/NotesChangeHandlerTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Notes/NotesChangeHandlerTest.cs index 1728fb75b..eb3945b22 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Notes/NotesChangeHandlerTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Notes/NotesChangeHandlerTest.cs @@ -1,10 +1,8 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. -using System.Collections.Generic; using System.Linq; using NUnit.Framework; -using osu.Framework.Graphics.Sprites; using osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Notes; using osu.Game.Rulesets.Karaoke.Objects; using osu.Game.Rulesets.Karaoke.Tests.Helper; diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs index 9e8cf5bcc..caf28113e 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs @@ -11,7 +11,6 @@ using osu.Game.IO; using osu.Game.Rulesets.Karaoke.Edit.Generator.Notes; using osu.Game.Rulesets.Karaoke.Objects; -using osu.Game.Rulesets.Karaoke.Utils; namespace osu.Game.Rulesets.Karaoke.Beatmaps.Formats { diff --git a/osu.Game.Rulesets.Karaoke/Edit/Components/Containers/EditorScrollContainer.cs b/osu.Game.Rulesets.Karaoke/Edit/Components/Containers/EditorScrollContainer.cs index 1aef044ae..8704ea7a5 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Components/Containers/EditorScrollContainer.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Components/Containers/EditorScrollContainer.cs @@ -3,7 +3,6 @@ #nullable disable -using System; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Input.Events; diff --git a/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/LyricImporterStepScreenWithLyricEditor.cs b/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/LyricImporterStepScreenWithLyricEditor.cs index 2a30c3608..3d5f39678 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/LyricImporterStepScreenWithLyricEditor.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/LyricImporterStepScreenWithLyricEditor.cs @@ -87,17 +87,12 @@ protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnl return dependencies; } - public T GetLyricEditorModeState() where T : Enum - { - switch (typeof(T)) + public T GetLyricEditorModeState() where T : Enum => + typeof(T) switch { - case Type t when t == typeof(TextingEditMode): - return EnumUtils.Casting(textingModeState.EditMode); - - default: - throw new NotSupportedException(); - } - } + Type t when t == typeof(TextingEditMode) => EnumUtils.Casting(textingModeState.EditMode), + _ => throw new NotSupportedException() + }; public void SwitchToEditModeState(T mode) where T : Enum { diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Texting/TextingEditModeSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Texting/TextingEditModeSection.cs index 3ba4ca7a9..608802848 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Texting/TextingEditModeSection.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Texting/TextingEditModeSection.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Collections.Generic; using osu.Game.Graphics; using osu.Game.Overlays; using osu.Game.Rulesets.Karaoke.Edit.Lyrics.Extends.Components; diff --git a/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableNote.cs b/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableNote.cs index b1052ef9a..677b7f786 100644 --- a/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableNote.cs +++ b/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableNote.cs @@ -182,7 +182,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset) public bool OnPressed(KeyBindingPressEvent e) { // Make sure the action happened within the body of the hold note - if (Time.Current < HitObject.StartTime && holdStartTime == null || Time.Current > HitObject.EndTime && holdStartTime == null) + if ((Time.Current < HitObject.StartTime && holdStartTime == null) || (Time.Current > HitObject.EndTime && holdStartTime == null)) return false; if (holdStartTime == null) diff --git a/osu.Game.Rulesets.Karaoke/Objects/Tone.cs b/osu.Game.Rulesets.Karaoke/Objects/Tone.cs index 0db37a994..6c30a4ebb 100644 --- a/osu.Game.Rulesets.Karaoke/Objects/Tone.cs +++ b/osu.Game.Rulesets.Karaoke/Objects/Tone.cs @@ -79,10 +79,9 @@ public override bool Equals(object obj) public static Tone operator -(Tone tone) => negate(tone); - private static Tone negate(Tone tone) => new() + private static Tone negate(Tone tone) => tone with { - Scale = -tone.Scale + (tone.Half ? -1 : 0), - Half = tone.Half + Scale = -tone.Scale + (tone.Half ? -1 : 0) }; public static bool operator ==(Tone tone1, Tone tone2) => tone1.Equals(tone2); diff --git a/osu.Game.Rulesets.Karaoke/Skinning/Fonts/BitmapFontCompressor.cs b/osu.Game.Rulesets.Karaoke/Skinning/Fonts/BitmapFontCompressor.cs index 32295f06c..7d5770f7b 100644 --- a/osu.Game.Rulesets.Karaoke/Skinning/Fonts/BitmapFontCompressor.cs +++ b/osu.Game.Rulesets.Karaoke/Skinning/Fonts/BitmapFontCompressor.cs @@ -117,9 +117,9 @@ internal static IDictionary GenerateCharacters(BitmapFontInfo or character.Y = currentTopLeftPosition.Y; // assign next position for drawing. - currentTopLeftPosition = new + currentTopLeftPosition = currentTopLeftPosition with { - X = currentTopLeftPosition.X + character.Width + spacing.X, currentTopLeftPosition.Y, + X = currentTopLeftPosition.X + character.Width + spacing.X }; }