mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-23 19:37:36 +02:00
misc: chore: Fix object creation in Avalonia project
This commit is contained in:
parent
5f023ca49b
commit
3cdaaa0b69
25 changed files with 63 additions and 63 deletions
|
@ -172,7 +172,7 @@ namespace Ryujinx.Ava.UI.Applet
|
|||
try
|
||||
{
|
||||
_parent.ViewModel.AppHost.NpadManager.BlockInputUpdates();
|
||||
SoftwareKeyboardUIArgs args = new SoftwareKeyboardUIArgs();
|
||||
SoftwareKeyboardUIArgs args = new();
|
||||
args.KeyboardMode = KeyboardMode.Default;
|
||||
args.InitialText = "Ryujinx";
|
||||
args.StringLengthMin = 1;
|
||||
|
@ -264,7 +264,7 @@ namespace Ryujinx.Ava.UI.Applet
|
|||
{
|
||||
UserId selected = UserId.Null;
|
||||
byte[] defaultGuestImage = EmbeddedResources.Read("Ryujinx.HLE/HOS/Services/Account/Acc/GuestUserImage.jpg");
|
||||
UserProfile guest = new UserProfile(new UserId("00000000000000000000000000000080"), "Guest", defaultGuestImage);
|
||||
UserProfile guest = new(new UserId("00000000000000000000000000000080"), "Guest", defaultGuestImage);
|
||||
|
||||
ManualResetEvent dialogCloseEvent = new(false);
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace Ryujinx.Ava.UI.Applet
|
|||
{
|
||||
if (item is UserProfile originalItem)
|
||||
{
|
||||
UserProfileSft profile = new UserProfileSft(originalItem.UserId, originalItem.Name, originalItem.Image);
|
||||
UserProfileSft profile = new(originalItem.UserId, originalItem.Name, originalItem.Image);
|
||||
|
||||
if (profile.UserId == ViewModel.SelectedUserId)
|
||||
{
|
||||
|
|
|
@ -108,7 +108,7 @@ namespace Ryujinx.Ava.UI.Controls
|
|||
|
||||
SaveDataFilter saveDataFilter = SaveDataFilter.Make(programId: default, saveType: SaveDataType.Account, default, saveDataId: default, index: default);
|
||||
|
||||
using UniqueRef<SaveDataIterator> saveDataIterator = new UniqueRef<SaveDataIterator>();
|
||||
using UniqueRef<SaveDataIterator> saveDataIterator = new();
|
||||
|
||||
HorizonClient.Fs.OpenSaveDataIterator(ref saveDataIterator.Ref, SaveDataSpaceId.User, in saveDataFilter).ThrowIfFailure();
|
||||
|
||||
|
@ -128,7 +128,7 @@ namespace Ryujinx.Ava.UI.Controls
|
|||
for (int i = 0; i < readCount; i++)
|
||||
{
|
||||
SaveDataInfo save = saveDataInfo[i];
|
||||
UserId id = new UserId((long)save.UserId.Id.Low, (long)save.UserId.Id.High);
|
||||
UserId id = new((long)save.UserId.Id.Low, (long)save.UserId.Id.High);
|
||||
if (ViewModel.Profiles.Cast<UserProfile>().FirstOrDefault(x => x.UserId == id) == null)
|
||||
{
|
||||
lostAccounts.Add(id);
|
||||
|
|
|
@ -50,8 +50,8 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
|
||||
private static string Format(AvaLogLevel level, string area, string template, object source, object[] v)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
CharacterReader r = new CharacterReader(template.AsSpan());
|
||||
StringBuilder result = new();
|
||||
CharacterReader r = new(template.AsSpan());
|
||||
int i = 0;
|
||||
|
||||
result.Append('[');
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
Margin = new Thickness(0, 0, 15, 40),
|
||||
};
|
||||
|
||||
Lazy<AsyncWorkQueue<Notification>> maybeAsyncWorkQueue = new Lazy<AsyncWorkQueue<Notification>>(
|
||||
Lazy<AsyncWorkQueue<Notification>> maybeAsyncWorkQueue = new(
|
||||
() => new AsyncWorkQueue<Notification>(notification =>
|
||||
{
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
|
|
|
@ -367,7 +367,7 @@ namespace Ryujinx.Ava.UI.Models.Input
|
|||
|
||||
public InputConfig GetConfig()
|
||||
{
|
||||
StandardKeyboardInputConfig config = new StandardKeyboardInputConfig
|
||||
StandardKeyboardInputConfig config = new()
|
||||
{
|
||||
Id = Id,
|
||||
Backend = InputBackendType.WindowKeyboard,
|
||||
|
|
|
@ -1802,7 +1802,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
return;
|
||||
}
|
||||
|
||||
XCIFileTrimmer trimmer = new XCIFileTrimmer(filename, new XCITrimmerLog.MainWindow(this));
|
||||
XCIFileTrimmer trimmer = new(filename, new XCITrimmerLog.MainWindow(this));
|
||||
|
||||
if (trimmer.CanBeTrimmed)
|
||||
{
|
||||
|
|
|
@ -82,13 +82,13 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
foreach (string path in modsBasePaths)
|
||||
{
|
||||
bool inSd = path == ModLoader.GetSdModsBasePath();
|
||||
ModLoader.ModCache modCache = new ModLoader.ModCache();
|
||||
ModLoader.ModCache modCache = new();
|
||||
|
||||
ModLoader.QueryContentsDir(modCache, new DirectoryInfo(Path.Combine(path, "contents")), applicationId);
|
||||
|
||||
foreach (ModLoader.Mod<DirectoryInfo> mod in modCache.RomfsDirs)
|
||||
{
|
||||
ModModel modModel = new ModModel(mod.Path.Parent.FullName, mod.Name, mod.Enabled, inSd);
|
||||
ModModel modModel = new(mod.Path.Parent.FullName, mod.Name, mod.Enabled, inSd);
|
||||
if (Mods.All(x => x.Path != mod.Path.Parent.FullName))
|
||||
{
|
||||
Mods.Add(modModel);
|
||||
|
@ -102,7 +102,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
|
||||
foreach (ModLoader.Mod<DirectoryInfo> mod in modCache.ExefsDirs)
|
||||
{
|
||||
ModModel modModel = new ModModel(mod.Path.Parent.FullName, mod.Name, mod.Enabled, inSd);
|
||||
ModModel modModel = new(mod.Path.Parent.FullName, mod.Name, mod.Enabled, inSd);
|
||||
if (Mods.All(x => x.Path != mod.Path.Parent.FullName))
|
||||
{
|
||||
Mods.Add(modModel);
|
||||
|
|
|
@ -104,7 +104,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
// TODO: Parse DatabaseInfo.bin and table.bin files for more accuracy.
|
||||
if (item.Type == DirectoryEntryType.File && item.FullPath.Contains("chara") && item.FullPath.Contains("szs"))
|
||||
{
|
||||
using UniqueRef<IFile> file = new UniqueRef<IFile>();
|
||||
using UniqueRef<IFile> file = new();
|
||||
|
||||
romfs.OpenFile(ref file.Ref, ("/" + item.FullPath).ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
if (cancellationToken.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
XCIFileTrimmer trimmer = new XCIFileTrimmer(xciApp.Path, _logger);
|
||||
XCIFileTrimmer trimmer = new(xciApp.Path, _logger);
|
||||
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
|
|
|
@ -66,11 +66,11 @@ namespace Ryujinx.Ava.UI.Views.User
|
|||
{
|
||||
if (ViewModel.SelectedImage != null)
|
||||
{
|
||||
using MemoryStream streamJpg = new MemoryStream();
|
||||
using MemoryStream streamJpg = new();
|
||||
using SKBitmap bitmap = SKBitmap.Decode(ViewModel.SelectedImage);
|
||||
using SKBitmap newBitmap = new SKBitmap(bitmap.Width, bitmap.Height);
|
||||
using SKBitmap newBitmap = new(bitmap.Width, bitmap.Height);
|
||||
|
||||
using (SKCanvas canvas = new SKCanvas(newBitmap))
|
||||
using (SKCanvas canvas = new(newBitmap))
|
||||
{
|
||||
canvas.Clear(new SKColor(
|
||||
ViewModel.BackgroundColor.R,
|
||||
|
|
|
@ -103,7 +103,7 @@ namespace Ryujinx.Ava.UI.Views.User
|
|||
|
||||
SKBitmap resizedBitmap = bitmap.Resize(new SKImageInfo(256, 256), SKFilterQuality.High);
|
||||
|
||||
using MemoryStream streamJpg = new MemoryStream();
|
||||
using MemoryStream streamJpg = new();
|
||||
|
||||
if (resizedBitmap != null)
|
||||
{
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace Ryujinx.Ava.UI.Views.User
|
|||
public void LoadSaves()
|
||||
{
|
||||
ViewModel.Saves.Clear();
|
||||
ObservableCollection<SaveModel> saves = new ObservableCollection<SaveModel>();
|
||||
ObservableCollection<SaveModel> saves = new();
|
||||
SaveDataFilter saveDataFilter = SaveDataFilter.Make(
|
||||
programId: default,
|
||||
saveType: SaveDataType.Account,
|
||||
|
@ -75,7 +75,7 @@ namespace Ryujinx.Ava.UI.Views.User
|
|||
saveDataId: default,
|
||||
index: default);
|
||||
|
||||
using UniqueRef<SaveDataIterator> saveDataIterator = new UniqueRef<SaveDataIterator>();
|
||||
using UniqueRef<SaveDataIterator> saveDataIterator = new();
|
||||
|
||||
_horizonClient.Fs.OpenSaveDataIterator(ref saveDataIterator.Ref, SaveDataSpaceId.User, in saveDataFilter).ThrowIfFailure();
|
||||
|
||||
|
@ -95,7 +95,7 @@ namespace Ryujinx.Ava.UI.Views.User
|
|||
SaveDataInfo save = saveDataInfo[i];
|
||||
if (save.ProgramId.Value != 0)
|
||||
{
|
||||
SaveModel saveModel = new SaveModel(save);
|
||||
SaveModel saveModel = new(save);
|
||||
saves.Add(saveModel);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
|
||||
int cheatAdded = 0;
|
||||
|
||||
ModLoader.ModCache mods = new ModLoader.ModCache();
|
||||
ModLoader.ModCache mods = new();
|
||||
|
||||
ModLoader.QueryContentsDir(mods, new DirectoryInfo(Path.Combine(modsBasePath, "contents")), titleIdValue);
|
||||
|
||||
|
@ -81,7 +81,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
LoadedCheats.Add(currentGroup);
|
||||
}
|
||||
|
||||
CheatNode model = new CheatNode(cheat.Name, buildId, string.Empty, false, enabled.Contains($"{buildId}-{cheat.Name}"));
|
||||
CheatNode model = new(cheat.Name, buildId, string.Empty, false, enabled.Contains($"{buildId}-{cheat.Name}"));
|
||||
currentGroup?.SubNodes.Add(model);
|
||||
|
||||
cheatAdded++;
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
public static SKColor GetColor(SKBitmap image)
|
||||
{
|
||||
PaletteColor[] colors = new PaletteColor[TotalColors];
|
||||
Dictionary<int, int> dominantColorBin = new Dictionary<int, int>();
|
||||
Dictionary<int, int> dominantColorBin = new();
|
||||
|
||||
SKColor[] buffer = GetBuffer(image);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue