aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx/Ui/Windows/UserProfilesManagerWindow.cs
diff options
context:
space:
mode:
authorTSRBerry <20988865+TSRBerry@users.noreply.github.com>2023-07-02 00:25:07 +0200
committerGitHub <noreply@github.com>2023-07-02 00:25:07 +0200
commit0684b00b3c4d000cf627b9c08a49d7469ae50d04 (patch)
treebfa0ae9c17c99694cff51871b864cfc41e1cd057 /src/Ryujinx/Ui/Windows/UserProfilesManagerWindow.cs
parent02b5c7ea89bb6aae1c214b78fb1047872382dc43 (diff)
[Ryujinx] Address dotnet-format issues (#5395)1.1.948
* 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>
Diffstat (limited to 'src/Ryujinx/Ui/Windows/UserProfilesManagerWindow.cs')
-rw-r--r--src/Ryujinx/Ui/Windows/UserProfilesManagerWindow.cs61
1 files changed, 29 insertions, 32 deletions
diff --git a/src/Ryujinx/Ui/Windows/UserProfilesManagerWindow.cs b/src/Ryujinx/Ui/Windows/UserProfilesManagerWindow.cs
index a08b5dd1..c2ca010c 100644
--- a/src/Ryujinx/Ui/Windows/UserProfilesManagerWindow.cs
+++ b/src/Ryujinx/Ui/Windows/UserProfilesManagerWindow.cs
@@ -13,7 +13,6 @@ using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Image = SixLabors.ImageSharp.Image;
-using UserId = Ryujinx.HLE.HOS.Services.Account.Acc.UserId;
namespace Ryujinx.Ui.Windows
{
@@ -29,7 +28,7 @@ namespace Ryujinx.Ui.Windows
private Gdk.RGBA _selectedColor;
- private ManualResetEvent _avatarsPreloadingEvent = new ManualResetEvent(false);
+ private readonly ManualResetEvent _avatarsPreloadingEvent = new(false);
public UserProfilesManagerWindow(AccountManager accountManager, ContentManager contentManager, VirtualFileSystem virtualFileSystem) : base($"Ryujinx {Program.Version} - Manage User Profiles")
{
@@ -37,24 +36,24 @@ namespace Ryujinx.Ui.Windows
InitializeComponent();
- _selectedColor.Red = 0.212;
+ _selectedColor.Red = 0.212;
_selectedColor.Green = 0.843;
- _selectedColor.Blue = 0.718;
+ _selectedColor.Blue = 0.718;
_selectedColor.Alpha = 1;
_accountManager = accountManager;
_contentManager = contentManager;
- CellRendererToggle userSelectedToggle = new CellRendererToggle();
+ CellRendererToggle userSelectedToggle = new();
userSelectedToggle.Toggled += UserSelectedToggle_Toggled;
// NOTE: Uncomment following line when multiple selection of user profiles is supported.
//_usersTreeView.AppendColumn("Selected", userSelectedToggle, "active", 0);
_usersTreeView.AppendColumn("User Icon", new CellRendererPixbuf(), "pixbuf", 1);
- _usersTreeView.AppendColumn("User Info", new CellRendererText(), "text", 2, "background-rgba", 3);
+ _usersTreeView.AppendColumn("User Info", new CellRendererText(), "text", 2, "background-rgba", 3);
_tableStore.SetSortColumnId(0, SortType.Descending);
-
+
RefreshList();
if (_contentManager.GetCurrentFirmwareVersion() != null)
@@ -77,8 +76,8 @@ namespace Ryujinx.Ui.Windows
if (userProfile.AccountState == AccountState.Open)
{
- _selectedUserImage.Pixbuf = new Gdk.Pixbuf(userProfile.Image, 96, 96);
- _selectedUserIdLabel.Text = userProfile.UserId.ToString();
+ _selectedUserImage.Pixbuf = new Gdk.Pixbuf(userProfile.Image, 96, 96);
+ _selectedUserIdLabel.Text = userProfile.UserId.ToString();
_selectedUserNameEntry.Text = userProfile.Name;
_deleteButton.Sensitive = userProfile.UserId != AccountManager.DefaultUserId;
@@ -111,7 +110,7 @@ namespace Ryujinx.Ui.Windows
Gdk.Pixbuf userPicture = (Gdk.Pixbuf)_tableStore.GetValue(selectedIter, 1);
string userName = _tableStore.GetValue(selectedIter, 2).ToString().Split("\n")[0];
- string userId = _tableStore.GetValue(selectedIter, 2).ToString().Split("\n")[1];
+ string userId = _tableStore.GetValue(selectedIter, 2).ToString().Split("\n")[1];
// Unselect the first user.
_usersTreeView.Model.GetIterFirst(out TreeIter firstIter);
@@ -121,9 +120,9 @@ namespace Ryujinx.Ui.Windows
// Set new informations.
_tableStore.SetValue(selectedIter, 0, true);
- _selectedUserImage.Pixbuf = userPicture;
- _selectedUserNameEntry.Text = userName;
- _selectedUserIdLabel.Text = userId;
+ _selectedUserImage.Pixbuf = userPicture;
+ _selectedUserNameEntry.Text = userName;
+ _selectedUserIdLabel.Text = userId;
_saveProfileNameButton.Sensitive = false;
// Open the selected one.
@@ -178,29 +177,27 @@ namespace Ryujinx.Ui.Windows
private void ProcessProfileImage(byte[] buffer)
{
- using (Image image = Image.Load(buffer))
- {
- image.Mutate(x => x.Resize(256, 256));
+ using Image image = Image.Load(buffer);
- using (MemoryStream streamJpg = MemoryStreamManager.Shared.GetStream())
- {
- image.SaveAsJpeg(streamJpg);
+ image.Mutate(x => x.Resize(256, 256));
- _bufferImageProfile = streamJpg.ToArray();
- }
- }
+ using MemoryStream streamJpg = MemoryStreamManager.Shared.GetStream();
+
+ image.SaveAsJpeg(streamJpg);
+
+ _bufferImageProfile = streamJpg.ToArray();
}
private void ProfileImageFileChooser()
{
- FileChooserNative fileChooser = new FileChooserNative("Import Custom Profile Image", this, FileChooserAction.Open, "Import", "Cancel")
+ FileChooserNative fileChooser = new("Import Custom Profile Image", this, FileChooserAction.Open, "Import", "Cancel")
{
- SelectMultiple = false
+ SelectMultiple = false,
};
- FileFilter filter = new FileFilter()
+ FileFilter filter = new()
{
- Name = "Custom Profile Images"
+ Name = "Custom Profile Images",
};
filter.AddPattern("*.jpg");
filter.AddPattern("*.jpeg");
@@ -225,15 +222,15 @@ namespace Ryujinx.Ui.Windows
}
else
{
- Dictionary<int, string> buttons = new Dictionary<int, string>()
+ Dictionary<int, string> buttons = new()
{
{ 0, "Import Image File" },
- { 1, "Select Firmware Avatar" }
+ { 1, "Select Firmware Avatar" },
};
ResponseType responseDialog = GtkDialog.CreateCustomDialog("Profile Image Selection",
"Choose a Profile Image",
- "You may import a custom profile image, or select an avatar from the system firmware.",
+ "You may import a custom profile image, or select an avatar from the system firmware.",
buttons, MessageType.Question);
if (responseDialog == 0)
@@ -242,9 +239,9 @@ namespace Ryujinx.Ui.Windows
}
else if (responseDialog == (ResponseType)1)
{
- AvatarWindow avatarWindow = new AvatarWindow()
+ AvatarWindow avatarWindow = new()
{
- NewUser = newUser
+ NewUser = newUser,
};
avatarWindow.DeleteEvent += AvatarWindow_DeleteEvent;
@@ -328,4 +325,4 @@ namespace Ryujinx.Ui.Windows
Close();
}
}
-} \ No newline at end of file
+}