Skip to content

Commit

Permalink
Merge pull request #273 from andy840119/upgrade-csharp-language-version
Browse files Browse the repository at this point in the history
Upgrade csharp language version
  • Loading branch information
andy840119 authored Dec 20, 2022
2 parents 3ae2396 + 28196b2 commit ba6d35a
Show file tree
Hide file tree
Showing 31 changed files with 516 additions and 537 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ csharp_style_prefer_index_operator = true:warning
csharp_style_prefer_range_operator = true:warning
csharp_style_prefer_switch_expression = false:none

#Style - C# 10 features
csharp_style_namespace_declarations = file_scoped:warning

[*.{yaml,yml}]
insert_final_newline = true
indent_style = space
Expand Down
4 changes: 3 additions & 1 deletion .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Make everything partial
35abcde7a4eeb823067b9cd0ef4b84c81e4e35cd
35abcde7a4eeb823067b9cd0ef4b84c81e4e35cd
# Apply the file-scope namespace
4f9de16847716c1d51ba84ef4a5ceba373908842
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- Contains required properties for osu!framework projects. -->
<Project>
<PropertyGroup Label="C#">
<LangVersion>9.0</LangVersion>
<LangVersion>10.0</LangVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion osu.Framework.Microphone.Android.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<LangVersion>9.0</LangVersion>
<LangVersion>10.0</LangVersion>
<SupportedOSPlatformVersion>21.0</SupportedOSPlatformVersion>
<RuntimeIdentifiers>android-x86;android-arm;android-arm64</RuntimeIdentifiers>
<AndroidPackageFormat>apk</AndroidPackageFormat>
Expand Down
13 changes: 6 additions & 7 deletions osu.Framework.Microphone.Tests.Android/TestGameActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
using Android.Content.PM;
using osu.Framework.Android;

namespace osu.Framework.Tests.Android
namespace osu.Framework.Tests.Android;

[Activity(MainLauncher = true, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, Theme = "@android:style/Theme.NoTitleBar")]
public class TestGameActivity : AndroidGameActivity
{
[Activity(MainLauncher = true, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, Theme = "@android:style/Theme.NoTitleBar")]
public class TestGameActivity : AndroidGameActivity
{
protected override Game CreateGame()
=> new VisualTestGame();
}
protected override Game CreateGame()
=> new VisualTestGame();
}
11 changes: 5 additions & 6 deletions osu.Framework.Microphone.Tests.iOS/AppDelegate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
using Foundation;
using osu.Framework.iOS;

namespace osu.Framework.Tests
namespace osu.Framework.Tests;

[Register("AppDelegate")]
public class AppDelegate : GameAppDelegate
{
[Register("AppDelegate")]
public class AppDelegate : GameAppDelegate
{
protected override Game CreateGame() => new VisualTestGame();
}
protected override Game CreateGame() => new VisualTestGame();
}
11 changes: 5 additions & 6 deletions osu.Framework.Microphone.Tests.iOS/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@

using UIKit;

namespace osu.Framework.Tests
namespace osu.Framework.Tests;

public static class Application
{
public static class Application
public static void Main(string[] args)
{
public static void Main(string[] args)
{
UIApplication.Main(args, null, typeof(AppDelegate));
}
UIApplication.Main(args, null, typeof(AppDelegate));
}
}
11 changes: 5 additions & 6 deletions osu.Framework.Microphone.Tests/AutomatedVisualTestGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@

using osu.Framework.Testing;

namespace osu.Framework.Tests
namespace osu.Framework.Tests;

internal partial class AutomatedVisualTestGame : TestGame
{
internal partial class AutomatedVisualTestGame : TestGame
public AutomatedVisualTestGame()
{
public AutomatedVisualTestGame()
{
Add(new TestBrowserTestRunner(new TestBrowser()));
}
Add(new TestBrowserTestRunner(new TestBrowser()));
}
}
25 changes: 12 additions & 13 deletions osu.Framework.Microphone.Tests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,21 @@
using System;
using osu.Framework.Platform;

namespace osu.Framework.Tests
namespace osu.Framework.Tests;

public static class Program
{
public static class Program
[STAThread]
public static void Main(string[] args)
{
[STAThread]
public static void Main(string[] args)
{
bool benchmark = args.Length > 0 && args[0] == @"-benchmark";
bool benchmark = args.Length > 0 && args[0] == @"-benchmark";

using (GameHost host = Host.GetSuitableDesktopHost(@"microphone-tests"))
{
if (benchmark)
host.Run(new AutomatedVisualTestGame());
else
host.Run(new VisualTestGame());
}
using (GameHost host = Host.GetSuitableDesktopHost(@"microphone-tests"))
{
if (benchmark)
host.Run(new AutomatedVisualTestGame());
else
host.Run(new VisualTestGame());
}
}
}
13 changes: 6 additions & 7 deletions osu.Framework.Microphone.Tests/TestGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
using osu.Framework.Allocation;
using osu.Framework.IO.Stores;

namespace osu.Framework.Tests
namespace osu.Framework.Tests;

internal partial class TestGame : Game
{
internal partial class TestGame : Game
[BackgroundDependencyLoader]
private void load()
{
[BackgroundDependencyLoader]
private void load()
{
Resources.AddStore(new NamespacedResourceStore<byte[]>(new DllResourceStore(typeof(TestGame).Assembly), "Resources"));
}
Resources.AddStore(new NamespacedResourceStore<byte[]>(new DllResourceStore(typeof(TestGame).Assembly), "Resources"));
}
}
19 changes: 9 additions & 10 deletions osu.Framework.Microphone.Tests/Visual/FrameworkTestScene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,18 @@
using osu.Framework.IO.Stores;
using osu.Framework.Testing;

namespace osu.Framework.Tests.Visual
namespace osu.Framework.Tests.Visual;

public abstract partial class FrameworkTestScene : TestScene
{
public abstract partial class FrameworkTestScene : TestScene
{
protected override ITestSceneTestRunner CreateRunner() => new FrameworkTestSceneTestRunner();
protected override ITestSceneTestRunner CreateRunner() => new FrameworkTestSceneTestRunner();

private partial class FrameworkTestSceneTestRunner : TestSceneTestRunner
private partial class FrameworkTestSceneTestRunner : TestSceneTestRunner
{
[BackgroundDependencyLoader]
private void load()
{
[BackgroundDependencyLoader]
private void load()
{
Resources.AddStore(new NamespacedResourceStore<byte[]>(new DllResourceStore(typeof(FrameworkTestScene).Assembly), "Resources"));
}
Resources.AddStore(new NamespacedResourceStore<byte[]>(new DllResourceStore(typeof(FrameworkTestScene).Assembly), "Resources"));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,20 @@
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;

namespace osu.Framework.Tests.Visual.Input
namespace osu.Framework.Tests.Visual.Input;

[TestFixture]
public partial class TestSceneGetMicrophoneList : FrameworkTestScene
{
[TestFixture]
public partial class TestSceneGetMicrophoneList : FrameworkTestScene
public TestSceneGetMicrophoneList()
{
public TestSceneGetMicrophoneList()
var manager = new MicrophoneManager();
Child = new BasicDropdown<string>
{
var manager = new MicrophoneManager();
Child = new BasicDropdown<string>
{
X = 100,
Y = 100,
Width = 300,
Items = manager.MicrophoneDeviceNames
};
}
X = 100,
Y = 100,
Width = 300,
Items = manager.MicrophoneDeviceNames
};
}
}
Loading

0 comments on commit ba6d35a

Please sign in to comment.