mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-06 16:16:26 +02:00
[Ryujinx.Ui.Common] Address dotnet-format issues (#5392)
* dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Silence dotnet format IDE0060 warnings * Address dotnet format CA1401 warnings * dotnet-format fixes after rebase * 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 * Another rebase, another dotnet format run * Run dotnet format style after rebase * Add comments to disabled warnings * Remove a few unused parameters * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Address IDE0251 warnings * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * Small optimizations * Remove alignment * Apply formatting * Fix build issues * Final pass for dotnet format * Add trailing commas Co-authored-by: Ac_K <Acoustik666@gmail.com> * Add trailing commas --------- Co-authored-by: Ac_K <Acoustik666@gmail.com>
This commit is contained in:
parent
7c989f88bd
commit
6e28a4dd13
41 changed files with 761 additions and 696 deletions
|
@ -7,13 +7,13 @@ namespace Ryujinx.Ui.Common.Helper
|
|||
{
|
||||
public static string[] Arguments { get; private set; }
|
||||
|
||||
public static bool? OverrideDockedMode { get; private set; }
|
||||
public static bool? OverrideDockedMode { get; private set; }
|
||||
public static string OverrideGraphicsBackend { get; private set; }
|
||||
public static string OverrideHideCursor { get; private set; }
|
||||
public static string BaseDirPathArg { get; private set; }
|
||||
public static string Profile { get; private set; }
|
||||
public static string LaunchPathArg { get; private set; }
|
||||
public static bool StartFullscreenArg { get; private set; }
|
||||
public static string OverrideHideCursor { get; private set; }
|
||||
public static string BaseDirPathArg { get; private set; }
|
||||
public static string Profile { get; private set; }
|
||||
public static string LaunchPathArg { get; private set; }
|
||||
public static bool StartFullscreenArg { get; private set; }
|
||||
|
||||
public static void ParseArguments(string[] args)
|
||||
{
|
||||
|
@ -96,4 +96,4 @@ namespace Ryujinx.Ui.Common.Helper
|
|||
Arguments = arguments.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,4 +47,4 @@ namespace Ryujinx.Ui.Common.Helper
|
|||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
private static partial bool ShowWindow(IntPtr hWnd, int nCmdShow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Ryujinx.Ui.Common.Helper
|
|||
private static readonly string _mimeDbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".local", "share", "mime");
|
||||
|
||||
private const int SHCNE_ASSOCCHANGED = 0x8000000;
|
||||
private const int SHCNF_FLUSH = 0x1000;
|
||||
private const int SHCNF_FLUSH = 0x1000;
|
||||
|
||||
[LibraryImport("shell32.dll", SetLastError = true)]
|
||||
public static partial void SHChangeNotify(uint wEventId, uint uFlags, IntPtr dwItem1, IntPtr dwItem2);
|
||||
|
@ -199,4 +199,4 @@ namespace Ryujinx.Ui.Common.Helper
|
|||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,8 +49,8 @@ namespace Ryujinx.Ui.Common.Helper
|
|||
StartInfo =
|
||||
{
|
||||
FileName = PkExecPath,
|
||||
ArgumentList = { "sh", "-c", command }
|
||||
}
|
||||
ArgumentList = { "sh", "-c", command },
|
||||
},
|
||||
};
|
||||
|
||||
process.Start();
|
||||
|
@ -59,4 +59,4 @@ namespace Ryujinx.Ui.Common.Helper
|
|||
return process.ExitCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Text;
|
||||
|
||||
namespace Ryujinx.Ui.Common.Helper
|
||||
{
|
||||
|
@ -12,44 +10,109 @@ namespace Ryujinx.Ui.Common.Helper
|
|||
private const string ObjCRuntime = "/usr/lib/libobjc.A.dylib";
|
||||
|
||||
[LibraryImport(ObjCRuntime, StringMarshalling = StringMarshalling.Utf8)]
|
||||
private static unsafe partial IntPtr sel_getUid(string name);
|
||||
private static partial IntPtr sel_getUid(string name);
|
||||
|
||||
[LibraryImport(ObjCRuntime, StringMarshalling = StringMarshalling.Utf8)]
|
||||
public static partial IntPtr objc_getClass(string name);
|
||||
private static partial IntPtr objc_getClass(string name);
|
||||
|
||||
[LibraryImport(ObjCRuntime)]
|
||||
public static partial void objc_msgSend(IntPtr receiver, Selector selector);
|
||||
private static partial void objc_msgSend(IntPtr receiver, Selector selector);
|
||||
|
||||
[LibraryImport(ObjCRuntime)]
|
||||
public static partial void objc_msgSend(IntPtr receiver, Selector selector, byte value);
|
||||
private static partial void objc_msgSend(IntPtr receiver, Selector selector, byte value);
|
||||
|
||||
[LibraryImport(ObjCRuntime)]
|
||||
public static partial void objc_msgSend(IntPtr receiver, Selector selector, IntPtr value);
|
||||
private static partial void objc_msgSend(IntPtr receiver, Selector selector, IntPtr value);
|
||||
|
||||
[LibraryImport(ObjCRuntime)]
|
||||
public static partial void objc_msgSend(IntPtr receiver, Selector selector, NSRect point);
|
||||
private static partial void objc_msgSend(IntPtr receiver, Selector selector, NSRect point);
|
||||
|
||||
[LibraryImport(ObjCRuntime)]
|
||||
public static partial void objc_msgSend(IntPtr receiver, Selector selector, double value);
|
||||
private static partial void objc_msgSend(IntPtr receiver, Selector selector, double value);
|
||||
|
||||
[LibraryImport(ObjCRuntime, EntryPoint = "objc_msgSend")]
|
||||
public static partial IntPtr IntPtr_objc_msgSend(IntPtr receiver, Selector selector);
|
||||
private static partial IntPtr IntPtr_objc_msgSend(IntPtr receiver, Selector selector);
|
||||
|
||||
[LibraryImport(ObjCRuntime, EntryPoint = "objc_msgSend")]
|
||||
public static partial IntPtr IntPtr_objc_msgSend(IntPtr receiver, Selector selector, IntPtr param);
|
||||
private static partial IntPtr IntPtr_objc_msgSend(IntPtr receiver, Selector selector, IntPtr param);
|
||||
|
||||
[LibraryImport(ObjCRuntime, EntryPoint = "objc_msgSend", StringMarshalling = StringMarshalling.Utf8)]
|
||||
public static partial IntPtr IntPtr_objc_msgSend(IntPtr receiver, Selector selector, string param);
|
||||
private static partial IntPtr IntPtr_objc_msgSend(IntPtr receiver, Selector selector, string param);
|
||||
|
||||
[LibraryImport(ObjCRuntime, EntryPoint = "objc_msgSend")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static partial bool bool_objc_msgSend(IntPtr receiver, Selector selector, IntPtr param);
|
||||
private static partial bool bool_objc_msgSend(IntPtr receiver, Selector selector, IntPtr param);
|
||||
|
||||
public struct Selector
|
||||
public readonly struct Object
|
||||
{
|
||||
public readonly IntPtr ObjPtr;
|
||||
|
||||
private Object(IntPtr pointer)
|
||||
{
|
||||
ObjPtr = pointer;
|
||||
}
|
||||
|
||||
public Object(string name)
|
||||
{
|
||||
ObjPtr = objc_getClass(name);
|
||||
}
|
||||
|
||||
public void SendMessage(Selector selector)
|
||||
{
|
||||
objc_msgSend(ObjPtr, selector);
|
||||
}
|
||||
|
||||
public void SendMessage(Selector selector, byte value)
|
||||
{
|
||||
objc_msgSend(ObjPtr, selector, value);
|
||||
}
|
||||
|
||||
public void SendMessage(Selector selector, Object obj)
|
||||
{
|
||||
objc_msgSend(ObjPtr, selector, obj.ObjPtr);
|
||||
}
|
||||
|
||||
public void SendMessage(Selector selector, NSRect point)
|
||||
{
|
||||
objc_msgSend(ObjPtr, selector, point);
|
||||
}
|
||||
|
||||
public void SendMessage(Selector selector, double value)
|
||||
{
|
||||
objc_msgSend(ObjPtr, selector, value);
|
||||
}
|
||||
|
||||
public Object GetFromMessage(Selector selector)
|
||||
{
|
||||
return new Object(IntPtr_objc_msgSend(ObjPtr, selector));
|
||||
}
|
||||
|
||||
public Object GetFromMessage(Selector selector, Object obj)
|
||||
{
|
||||
return new Object(IntPtr_objc_msgSend(ObjPtr, selector, obj.ObjPtr));
|
||||
}
|
||||
|
||||
public Object GetFromMessage(Selector selector, NSString nsString)
|
||||
{
|
||||
return new Object(IntPtr_objc_msgSend(ObjPtr, selector, nsString.StrPtr));
|
||||
}
|
||||
|
||||
public Object GetFromMessage(Selector selector, string param)
|
||||
{
|
||||
return new Object(IntPtr_objc_msgSend(ObjPtr, selector, param));
|
||||
}
|
||||
|
||||
public bool GetBoolFromMessage(Selector selector, Object obj)
|
||||
{
|
||||
return bool_objc_msgSend(ObjPtr, selector, obj.ObjPtr);
|
||||
}
|
||||
}
|
||||
|
||||
public readonly struct Selector
|
||||
{
|
||||
public readonly IntPtr SelPtr;
|
||||
|
||||
public unsafe Selector(string name)
|
||||
private Selector(string name)
|
||||
{
|
||||
SelPtr = sel_getUid(name);
|
||||
}
|
||||
|
@ -57,7 +120,7 @@ namespace Ryujinx.Ui.Common.Helper
|
|||
public static implicit operator Selector(string value) => new(value);
|
||||
}
|
||||
|
||||
public struct NSString
|
||||
public readonly struct NSString
|
||||
{
|
||||
public readonly IntPtr StrPtr;
|
||||
|
||||
|
@ -94,4 +157,4 @@ namespace Ryujinx.Ui.Common.Helper
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,13 +9,13 @@ namespace Ryujinx.Ui.Common.Helper
|
|||
public static partial class OpenHelper
|
||||
{
|
||||
[LibraryImport("shell32.dll", SetLastError = true)]
|
||||
public static partial int SHOpenFolderAndSelectItems(IntPtr pidlFolder, uint cidl, IntPtr apidl, uint dwFlags);
|
||||
private static partial int SHOpenFolderAndSelectItems(IntPtr pidlFolder, uint cidl, IntPtr apidl, uint dwFlags);
|
||||
|
||||
[LibraryImport("shell32.dll", SetLastError = true)]
|
||||
public static partial void ILFree(IntPtr pidlList);
|
||||
private static partial void ILFree(IntPtr pidlList);
|
||||
|
||||
[LibraryImport("shell32.dll", SetLastError = true)]
|
||||
public static partial IntPtr ILCreateFromPathW([MarshalAs(UnmanagedType.LPWStr)] string pszPath);
|
||||
private static partial IntPtr ILCreateFromPathW([MarshalAs(UnmanagedType.LPWStr)] string pszPath);
|
||||
|
||||
public static void OpenFolder(string path)
|
||||
{
|
||||
|
@ -23,9 +23,9 @@ namespace Ryujinx.Ui.Common.Helper
|
|||
{
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = path,
|
||||
FileName = path,
|
||||
UseShellExecute = true,
|
||||
Verb = "open"
|
||||
Verb = "open",
|
||||
});
|
||||
}
|
||||
else
|
||||
|
@ -56,16 +56,16 @@ namespace Ryujinx.Ui.Common.Helper
|
|||
else if (OperatingSystem.IsMacOS())
|
||||
{
|
||||
ObjectiveC.NSString nsStringPath = new(path);
|
||||
IntPtr nsUrl = ObjectiveC.objc_getClass("NSURL");
|
||||
var urlPtr = ObjectiveC.IntPtr_objc_msgSend(nsUrl, "fileURLWithPath:", nsStringPath);
|
||||
ObjectiveC.Object nsUrl = new("NSURL");
|
||||
var urlPtr = nsUrl.GetFromMessage("fileURLWithPath:", nsStringPath);
|
||||
|
||||
IntPtr nsArray = ObjectiveC.objc_getClass("NSArray");
|
||||
IntPtr urlArray = ObjectiveC.IntPtr_objc_msgSend(nsArray, "arrayWithObject:", urlPtr);
|
||||
ObjectiveC.Object nsArray = new("NSArray");
|
||||
ObjectiveC.Object urlArray = nsArray.GetFromMessage("arrayWithObject:", urlPtr);
|
||||
|
||||
IntPtr nsWorkspace = ObjectiveC.objc_getClass("NSWorkspace");
|
||||
IntPtr sharedWorkspace = ObjectiveC.IntPtr_objc_msgSend(nsWorkspace, "sharedWorkspace");
|
||||
ObjectiveC.Object nsWorkspace = new("NSWorkspace");
|
||||
ObjectiveC.Object sharedWorkspace = nsWorkspace.GetFromMessage("sharedWorkspace");
|
||||
|
||||
ObjectiveC.objc_msgSend(sharedWorkspace, "activateFileViewerSelectingURLs:", urlArray);
|
||||
sharedWorkspace.SendMessage("activateFileViewerSelectingURLs:", urlArray);
|
||||
}
|
||||
else if (OperatingSystem.IsLinux())
|
||||
{
|
||||
|
@ -95,13 +95,13 @@ namespace Ryujinx.Ui.Common.Helper
|
|||
else if (OperatingSystem.IsMacOS())
|
||||
{
|
||||
ObjectiveC.NSString nsStringPath = new(url);
|
||||
IntPtr nsUrl = ObjectiveC.objc_getClass("NSURL");
|
||||
var urlPtr = ObjectiveC.IntPtr_objc_msgSend(nsUrl, "URLWithString:", nsStringPath);
|
||||
ObjectiveC.Object nsUrl = new("NSURL");
|
||||
var urlPtr = nsUrl.GetFromMessage("URLWithString:", nsStringPath);
|
||||
|
||||
IntPtr nsWorkspace = ObjectiveC.objc_getClass("NSWorkspace");
|
||||
IntPtr sharedWorkspace = ObjectiveC.IntPtr_objc_msgSend(nsWorkspace, "sharedWorkspace");
|
||||
ObjectiveC.Object nsWorkspace = new("NSWorkspace");
|
||||
ObjectiveC.Object sharedWorkspace = nsWorkspace.GetFromMessage("sharedWorkspace");
|
||||
|
||||
ObjectiveC.bool_objc_msgSend(sharedWorkspace, "openURL:", urlPtr);
|
||||
sharedWorkspace.GetBoolFromMessage("openURL:", urlPtr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -109,4 +109,4 @@ namespace Ryujinx.Ui.Common.Helper
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,12 +20,10 @@ namespace Ryujinx.Ui.Common.Helper
|
|||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
error = UserError.NoFirmware;
|
||||
|
||||
return false;
|
||||
}
|
||||
error = UserError.NoFirmware;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool CanFixStartApplication(ContentManager contentManager, string baseApplicationPath, UserError error, out SystemVersion firmwareVersion)
|
||||
|
@ -107,12 +105,10 @@ namespace Ryujinx.Ui.Common.Helper
|
|||
|
||||
return IsFirmwareValid(contentManager, out error);
|
||||
}
|
||||
else
|
||||
{
|
||||
error = UserError.ApplicationNotFound;
|
||||
|
||||
return false;
|
||||
}
|
||||
error = UserError.ApplicationNotFound;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue