[Ryujinx] Address dotnet-format issues (#5395)

* dotnet format style --severity info

Some changes were manually reverted.

* dotnet format analyzers --serverity info

Some changes have been minimally adapted.

* Restore a few unused methods and variables

* Address dotnet format CA1816 warnings

* Address or silence dotnet format CA2208 warnings

* Address or silence dotnet format CA1806 and a few CA1854 warnings

* Address dotnet format CA1822 warnings

* Make dotnet format succeed in style mode

* Address dotnet format CA2208 warnings properly

* Address most dotnet format whitespace warnings

* Apply dotnet format whitespace formatting

A few of them have been manually reverted and the corresponding warning was silenced

* Format if-blocks correctly

* Another rebase, another dotnet format run

* Run dotnet format whitespace after rebase

* Run dotnet format after rebase and remove unused usings

- analyzers
- style
- whitespace

* Add comments to disabled warnings

* Simplify properties and array initialization, Use const when possible, Remove trailing commas

* Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas"

This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e.

* dotnet format whitespace after rebase

* First dotnet format pass

* Fix build issues

* Apply suggestions from code review

Co-authored-by: Ac_K <Acoustik666@gmail.com>

* Second dotnet format pass

* Update src/Ryujinx/Modules/Updater/Updater.cs

Co-authored-by: Ac_K <Acoustik666@gmail.com>

* Add trailing commas and improve formatting

* Fix formatting and naming issues

* Rename nvStutterWorkaround to nvidiaStutterWorkaround

* Use using declarations and extend resource lifetimes

* Fix GTK issues

* Add formatting for generated files

* Add trailing commas

---------

Co-authored-by: Ac_K <Acoustik666@gmail.com>
This commit is contained in:
TSRBerry
2023-07-02 00:25:07 +02:00
committed by GitHub
parent 02b5c7ea89
commit 0684b00b3c
39 changed files with 1891 additions and 1830 deletions

View File

@@ -12,7 +12,7 @@ namespace Ryujinx.Ui.Helper
{
private const string LibObjCImport = "/usr/lib/libobjc.A.dylib";
private struct Selector
private readonly struct Selector
{
public readonly IntPtr NativePtr;
@@ -29,7 +29,7 @@ namespace Ryujinx.Ui.Helper
NativePtr = sel_registerName(data);
}
public static implicit operator Selector(string value) => new Selector(value);
public static implicit operator Selector(string value) => new(value);
}
private static unsafe IntPtr GetClass(string value)
@@ -45,27 +45,27 @@ namespace Ryujinx.Ui.Helper
return objc_getClass(data);
}
private struct NSPoint
private struct NsPoint
{
public double X;
public double Y;
public NSPoint(double x, double y)
public NsPoint(double x, double y)
{
X = x;
Y = y;
}
}
private struct NSRect
private struct NsRect
{
public NSPoint Pos;
public NSPoint Size;
public NsPoint Pos;
public NsPoint Size;
public NSRect(double x, double y, double width, double height)
public NsRect(double x, double y, double width, double height)
{
Pos = new NSPoint(x, y);
Size = new NSPoint(width, height);
Pos = new NsPoint(x, y);
Size = new NsPoint(width, height);
}
}
@@ -81,7 +81,7 @@ namespace Ryujinx.Ui.Helper
// Create a child NSView to render into.
IntPtr nsViewClass = GetClass("NSView");
IntPtr child = IntPtr_objc_msgSend(nsViewClass, "alloc");
objc_msgSend(child, "init", new NSRect());
objc_msgSend(child, "init", new NsRect());
// Add it as a child.
objc_msgSend(nsView, "addSubview:", child);
@@ -92,11 +92,12 @@ namespace Ryujinx.Ui.Helper
objc_msgSend(metalLayer, "setContentsScale:", (double)display.GetMonitorAtWindow(window).ScaleFactor);
// Set the frame position/location.
updateBounds = (Window window) => {
updateBounds = (Window window) =>
{
window.GetPosition(out int x, out int y);
int width = window.Width;
int height = window.Height;
objc_msgSend(child, "setFrame:", new NSRect(x, y, width, height));
objc_msgSend(child, "setFrame:", new NsRect(x, y, width, height));
};
updateBounds(window);
@@ -120,7 +121,7 @@ namespace Ryujinx.Ui.Helper
private static partial void objc_msgSend(IntPtr receiver, Selector selector, IntPtr value);
[LibraryImport(LibObjCImport)]
private static partial void objc_msgSend(IntPtr receiver, Selector selector, NSRect point);
private static partial void objc_msgSend(IntPtr receiver, Selector selector, NsRect point);
[LibraryImport(LibObjCImport)]
private static partial void objc_msgSend(IntPtr receiver, Selector selector, double value);
@@ -131,4 +132,4 @@ namespace Ryujinx.Ui.Helper
[LibraryImport("libgdk-3.0.dylib")]
private static partial IntPtr gdk_quartz_window_get_nsview(IntPtr gdkWindow);
}
}
}

View File

@@ -16,7 +16,7 @@ namespace Ryujinx.Ui.Helper
if (File.Exists(ConfigurationState.Instance.Ui.CustomThemePath) && (Path.GetExtension(ConfigurationState.Instance.Ui.CustomThemePath) == ".css"))
{
CssProvider cssProvider = new CssProvider();
CssProvider cssProvider = new();
cssProvider.LoadFromPath(ConfigurationState.Instance.Ui.CustomThemePath);
@@ -26,10 +26,10 @@ namespace Ryujinx.Ui.Helper
{
Logger.Warning?.Print(LogClass.Application, $"The \"custom_theme_path\" section in \"Config.json\" contains an invalid path: \"{ConfigurationState.Instance.Ui.CustomThemePath}\".");
ConfigurationState.Instance.Ui.CustomThemePath.Value = "";
ConfigurationState.Instance.Ui.CustomThemePath.Value = "";
ConfigurationState.Instance.Ui.EnableCustomTheme.Value = false;
ConfigurationState.Instance.ToFileFormat().SaveConfig(Program.ConfigurationPath);
}
}
}
}
}