mirror of
https://github.com/Ryubing/Ryujinx.git
synced 2025-03-10 09:04:23 +00:00
misc: chore: Use collection expressions in Avalonia project
This commit is contained in:
parent
46a5cafaa8
commit
ae90db2040
@ -975,13 +975,13 @@ namespace Ryujinx.Ava
|
||||
|
||||
private static IHardwareDeviceDriver InitializeAudio()
|
||||
{
|
||||
List<AudioBackend> availableBackends = new()
|
||||
{
|
||||
List<AudioBackend> availableBackends =
|
||||
[
|
||||
AudioBackend.SDL2,
|
||||
AudioBackend.SoundIo,
|
||||
AudioBackend.OpenAl,
|
||||
AudioBackend.Dummy,
|
||||
};
|
||||
AudioBackend.Dummy
|
||||
];
|
||||
|
||||
AudioBackend preferredBackend = ConfigurationState.Instance.System.AudioBackend.Value;
|
||||
|
||||
|
@ -11,7 +11,7 @@ namespace Ryujinx.Ava.Input
|
||||
{
|
||||
internal class AvaloniaKeyboardDriver : IGamepadDriver
|
||||
{
|
||||
private static readonly string[] _keyboardIdentifers = new string[1] { "0" };
|
||||
private static readonly string[] _keyboardIdentifers = ["0"];
|
||||
private readonly Control _control;
|
||||
private readonly HashSet<AvaKey> _pressedKeys;
|
||||
|
||||
@ -25,7 +25,7 @@ namespace Ryujinx.Ava.Input
|
||||
public AvaloniaKeyboardDriver(Control control)
|
||||
{
|
||||
_control = control;
|
||||
_pressedKeys = new HashSet<AvaKey>();
|
||||
_pressedKeys = [];
|
||||
|
||||
_control.KeyDown += OnKeyPress;
|
||||
_control.KeyUp += OnKeyRelease;
|
||||
|
@ -7,7 +7,8 @@ namespace Ryujinx.Ava.Input
|
||||
{
|
||||
internal static class AvaloniaKeyboardMappingHelper
|
||||
{
|
||||
private static readonly AvaKey[] _keyMapping = {
|
||||
private static readonly AvaKey[] _keyMapping =
|
||||
[
|
||||
// NOTE: Invalid
|
||||
AvaKey.None,
|
||||
|
||||
@ -143,8 +144,8 @@ namespace Ryujinx.Ava.Input
|
||||
AvaKey.OemBackslash,
|
||||
|
||||
// NOTE: invalid
|
||||
AvaKey.None,
|
||||
};
|
||||
AvaKey.None
|
||||
];
|
||||
|
||||
private static readonly Dictionary<AvaKey, Key> _avaKeyMapping;
|
||||
|
||||
|
@ -146,7 +146,7 @@ namespace Ryujinx.Ava.UI.Controls
|
||||
DirectoryInfo mainDir = new(Path.Combine(AppDataManager.GamesDirPath, viewModel.SelectedApplication.IdString, "cache", "cpu", "0"));
|
||||
DirectoryInfo backupDir = new(Path.Combine(AppDataManager.GamesDirPath, viewModel.SelectedApplication.IdString, "cache", "cpu", "1"));
|
||||
|
||||
List<FileInfo> cacheFiles = new();
|
||||
List<FileInfo> cacheFiles = [];
|
||||
|
||||
if (mainDir.Exists)
|
||||
{
|
||||
@ -189,8 +189,8 @@ namespace Ryujinx.Ava.UI.Controls
|
||||
{
|
||||
DirectoryInfo shaderCacheDir = new(Path.Combine(AppDataManager.GamesDirPath, viewModel.SelectedApplication.IdString, "cache", "shader"));
|
||||
|
||||
List<DirectoryInfo> oldCacheDirectories = new();
|
||||
List<FileInfo> newCacheFiles = new();
|
||||
List<DirectoryInfo> oldCacheDirectories = [];
|
||||
List<FileInfo> newCacheFiles = [];
|
||||
|
||||
if (shaderCacheDir.Exists)
|
||||
{
|
||||
|
@ -114,7 +114,7 @@ namespace Ryujinx.Ava.UI.Controls
|
||||
|
||||
Span<SaveDataInfo> saveDataInfo = stackalloc SaveDataInfo[10];
|
||||
|
||||
HashSet<UserId> lostAccounts = new();
|
||||
HashSet<UserId> lostAccounts = [];
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ namespace Ryujinx.Ava.UI.Models
|
||||
public class CheatNode : BaseModel
|
||||
{
|
||||
private bool _isEnabled = false;
|
||||
public ObservableCollection<CheatNode> SubNodes { get; } = new();
|
||||
public ObservableCollection<CheatNode> SubNodes { get; } = [];
|
||||
public string CleanName => Name[1..^7];
|
||||
public string BuildIdKey => $"{BuildId}-{Name}";
|
||||
public bool IsRootNode { get; }
|
||||
|
@ -64,9 +64,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
Directory.CreateDirectory(Path.Join(AppDataManager.BaseDirPath, "system", "amiibo"));
|
||||
|
||||
_amiiboJsonPath = Path.Join(AppDataManager.BaseDirPath, "system", "amiibo", "Amiibo.json");
|
||||
_amiiboList = new List<AmiiboApi>();
|
||||
_amiiboSeries = new ObservableCollection<string>();
|
||||
_amiibos = new AvaloniaList<AmiiboApi>();
|
||||
_amiiboList = [];
|
||||
_amiiboSeries = [];
|
||||
_amiibos = [];
|
||||
|
||||
_amiiboLogoBytes = EmbeddedResources.Read("Ryujinx/Assets/UIImages/Logo_Amiibo.png");
|
||||
|
||||
|
@ -22,9 +22,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
public partial class DownloadableContentManagerViewModel : BaseModel
|
||||
{
|
||||
private readonly ApplicationLibrary _applicationLibrary;
|
||||
private AvaloniaList<DownloadableContentModel> _downloadableContents = new();
|
||||
[ObservableProperty] private AvaloniaList<DownloadableContentModel> _selectedDownloadableContents = new();
|
||||
[ObservableProperty] private AvaloniaList<DownloadableContentModel> _views = new();
|
||||
private AvaloniaList<DownloadableContentModel> _downloadableContents = [];
|
||||
[ObservableProperty] private AvaloniaList<DownloadableContentModel> _selectedDownloadableContents = [];
|
||||
[ObservableProperty] private AvaloniaList<DownloadableContentModel> _views = [];
|
||||
[ObservableProperty] private bool _showBundledContentNotice = false;
|
||||
|
||||
private string _search;
|
||||
@ -139,9 +139,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
{
|
||||
new("NSP")
|
||||
{
|
||||
Patterns = new[] { "*.nsp" },
|
||||
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.nsp" },
|
||||
MimeTypes = new[] { "application/x-nx-nsp" },
|
||||
Patterns = ["*.nsp"],
|
||||
AppleUniformTypeIdentifiers = ["com.ryujinx.nsp"],
|
||||
MimeTypes = ["application/x-nx-nsp"],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -257,11 +257,11 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||
|
||||
public InputViewModel()
|
||||
{
|
||||
PlayerIndexes = new ObservableCollection<PlayerModel>();
|
||||
Controllers = new ObservableCollection<ControllerModel>();
|
||||
Devices = new ObservableCollection<(DeviceType Type, string Id, string Name)>();
|
||||
ProfilesList = new AvaloniaList<string>();
|
||||
DeviceList = new AvaloniaList<string>();
|
||||
PlayerIndexes = [];
|
||||
Controllers = [];
|
||||
Devices = [];
|
||||
ProfilesList = [];
|
||||
DeviceList = [];
|
||||
|
||||
ControllerImage = ProControllerResource;
|
||||
|
||||
@ -810,7 +810,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||
{
|
||||
IsModified = false;
|
||||
|
||||
List<InputConfig> newConfig = new();
|
||||
List<InputConfig> newConfig = [];
|
||||
|
||||
newConfig.AddRange(ConfigurationState.Instance.Hid.InputConfig.Value);
|
||||
|
||||
|
@ -1245,21 +1245,21 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
{
|
||||
new(LocaleManager.Instance[LocaleKeys.FileDialogAllTypes])
|
||||
{
|
||||
Patterns = new[] { "*.xci", "*.zip" },
|
||||
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.xci", "public.zip-archive" },
|
||||
MimeTypes = new[] { "application/x-nx-xci", "application/zip" },
|
||||
Patterns = ["*.xci", "*.zip"],
|
||||
AppleUniformTypeIdentifiers = ["com.ryujinx.xci", "public.zip-archive"],
|
||||
MimeTypes = ["application/x-nx-xci", "application/zip"],
|
||||
},
|
||||
new("XCI")
|
||||
{
|
||||
Patterns = new[] { "*.xci" },
|
||||
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.xci" },
|
||||
MimeTypes = new[] { "application/x-nx-xci" },
|
||||
Patterns = ["*.xci"],
|
||||
AppleUniformTypeIdentifiers = ["com.ryujinx.xci"],
|
||||
MimeTypes = ["application/x-nx-xci"],
|
||||
},
|
||||
new("ZIP")
|
||||
{
|
||||
Patterns = new[] { "*.zip" },
|
||||
AppleUniformTypeIdentifiers = new[] { "public.zip-archive" },
|
||||
MimeTypes = new[] { "application/zip" },
|
||||
Patterns = ["*.zip"],
|
||||
AppleUniformTypeIdentifiers = ["public.zip-archive"],
|
||||
MimeTypes = ["application/zip"],
|
||||
},
|
||||
},
|
||||
});
|
||||
@ -1292,21 +1292,21 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
{
|
||||
new(LocaleManager.Instance[LocaleKeys.FileDialogAllTypes])
|
||||
{
|
||||
Patterns = new[] { "*.keys", "*.zip" },
|
||||
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.xci", "public.zip-archive" },
|
||||
MimeTypes = new[] { "application/keys", "application/zip" },
|
||||
Patterns = ["*.keys", "*.zip"],
|
||||
AppleUniformTypeIdentifiers = ["com.ryujinx.xci", "public.zip-archive"],
|
||||
MimeTypes = ["application/keys", "application/zip"],
|
||||
},
|
||||
new("KEYS")
|
||||
{
|
||||
Patterns = new[] { "*.keys" },
|
||||
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.xci" },
|
||||
MimeTypes = new[] { "application/keys" },
|
||||
Patterns = ["*.keys"],
|
||||
AppleUniformTypeIdentifiers = ["com.ryujinx.xci"],
|
||||
MimeTypes = ["application/keys"],
|
||||
},
|
||||
new("ZIP")
|
||||
{
|
||||
Patterns = new[] { "*.zip" },
|
||||
AppleUniformTypeIdentifiers = new[] { "public.zip-archive" },
|
||||
MimeTypes = new[] { "application/zip" },
|
||||
Patterns = ["*.zip"],
|
||||
AppleUniformTypeIdentifiers = ["public.zip-archive"],
|
||||
MimeTypes = ["application/zip"],
|
||||
},
|
||||
},
|
||||
});
|
||||
@ -1418,53 +1418,53 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
{
|
||||
new(LocaleManager.Instance[LocaleKeys.AllSupportedFormats])
|
||||
{
|
||||
Patterns = new[] { "*.nsp", "*.xci", "*.nca", "*.nro", "*.nso" },
|
||||
AppleUniformTypeIdentifiers = new[]
|
||||
{
|
||||
Patterns = ["*.nsp", "*.xci", "*.nca", "*.nro", "*.nso"],
|
||||
AppleUniformTypeIdentifiers =
|
||||
[
|
||||
"com.ryujinx.nsp",
|
||||
"com.ryujinx.xci",
|
||||
"com.ryujinx.nca",
|
||||
"com.ryujinx.nro",
|
||||
"com.ryujinx.nso",
|
||||
},
|
||||
MimeTypes = new[]
|
||||
{
|
||||
"com.ryujinx.nso"
|
||||
],
|
||||
MimeTypes =
|
||||
[
|
||||
"application/x-nx-nsp",
|
||||
"application/x-nx-xci",
|
||||
"application/x-nx-nca",
|
||||
"application/x-nx-nro",
|
||||
"application/x-nx-nso",
|
||||
},
|
||||
"application/x-nx-nso"
|
||||
],
|
||||
},
|
||||
new("NSP")
|
||||
{
|
||||
Patterns = new[] { "*.nsp" },
|
||||
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.nsp" },
|
||||
MimeTypes = new[] { "application/x-nx-nsp" },
|
||||
Patterns = ["*.nsp"],
|
||||
AppleUniformTypeIdentifiers = ["com.ryujinx.nsp"],
|
||||
MimeTypes = ["application/x-nx-nsp"],
|
||||
},
|
||||
new("XCI")
|
||||
{
|
||||
Patterns = new[] { "*.xci" },
|
||||
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.xci" },
|
||||
MimeTypes = new[] { "application/x-nx-xci" },
|
||||
Patterns = ["*.xci"],
|
||||
AppleUniformTypeIdentifiers = ["com.ryujinx.xci"],
|
||||
MimeTypes = ["application/x-nx-xci"],
|
||||
},
|
||||
new("NCA")
|
||||
{
|
||||
Patterns = new[] { "*.nca" },
|
||||
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.nca" },
|
||||
MimeTypes = new[] { "application/x-nx-nca" },
|
||||
Patterns = ["*.nca"],
|
||||
AppleUniformTypeIdentifiers = ["com.ryujinx.nca"],
|
||||
MimeTypes = ["application/x-nx-nca"],
|
||||
},
|
||||
new("NRO")
|
||||
{
|
||||
Patterns = new[] { "*.nro" },
|
||||
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.nro" },
|
||||
MimeTypes = new[] { "application/x-nx-nro" },
|
||||
Patterns = ["*.nro"],
|
||||
AppleUniformTypeIdentifiers = ["com.ryujinx.nro"],
|
||||
MimeTypes = ["application/x-nx-nro"],
|
||||
},
|
||||
new("NSO")
|
||||
{
|
||||
Patterns = new[] { "*.nso" },
|
||||
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.nso" },
|
||||
MimeTypes = new[] { "application/x-nx-nso" },
|
||||
Patterns = ["*.nso"],
|
||||
AppleUniformTypeIdentifiers = ["com.ryujinx.nso"],
|
||||
MimeTypes = ["application/x-nx-nso"],
|
||||
},
|
||||
},
|
||||
});
|
||||
@ -1690,7 +1690,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
{
|
||||
new(LocaleManager.Instance[LocaleKeys.AllSupportedFormats])
|
||||
{
|
||||
Patterns = new[] { "*.bin" },
|
||||
Patterns = ["*.bin"],
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -23,9 +23,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
{
|
||||
private readonly string _modJsonPath;
|
||||
|
||||
private AvaloniaList<ModModel> _mods = new();
|
||||
[ObservableProperty] private AvaloniaList<ModModel> _views = new();
|
||||
[ObservableProperty] private AvaloniaList<ModModel> _selectedMods = new();
|
||||
private AvaloniaList<ModModel> _mods = [];
|
||||
[ObservableProperty] private AvaloniaList<ModModel> _views = [];
|
||||
[ObservableProperty] private AvaloniaList<ModModel> _selectedMods = [];
|
||||
|
||||
private string _search;
|
||||
private readonly ulong _applicationId;
|
||||
|
@ -51,7 +51,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
[ObservableProperty] private bool _isVulkanAvailable = true;
|
||||
[ObservableProperty] private bool _gameDirectoryChanged;
|
||||
[ObservableProperty] private bool _autoloadDirectoryChanged;
|
||||
private readonly List<string> _gpuIds = new();
|
||||
private readonly List<string> _gpuIds = [];
|
||||
private int _graphicsBackendIndex;
|
||||
private int _scalingFilter;
|
||||
private int _scalingFilterLevel;
|
||||
|
@ -21,8 +21,8 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
private ApplicationLibrary ApplicationLibrary { get; }
|
||||
private ApplicationData ApplicationData { get; }
|
||||
|
||||
[ObservableProperty] private AvaloniaList<TitleUpdateModel> _titleUpdates = new();
|
||||
[ObservableProperty] private AvaloniaList<object> _views = new();
|
||||
[ObservableProperty] private AvaloniaList<TitleUpdateModel> _titleUpdates = [];
|
||||
[ObservableProperty] private AvaloniaList<object> _views = [];
|
||||
[ObservableProperty] private object _selectedUpdate = new TitleUpdateViewModelNoUpdate();
|
||||
[ObservableProperty] private bool _showBundledContentNotice;
|
||||
|
||||
@ -149,9 +149,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
{
|
||||
new(LocaleManager.Instance[LocaleKeys.AllSupportedFormats])
|
||||
{
|
||||
Patterns = new[] { "*.nsp" },
|
||||
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.nsp" },
|
||||
MimeTypes = new[] { "application/x-nx-nsp" },
|
||||
Patterns = ["*.nsp"],
|
||||
AppleUniformTypeIdentifiers = ["com.ryujinx.nsp"],
|
||||
MimeTypes = ["application/x-nx-nsp"],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -32,7 +32,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
|
||||
public UserFirmwareAvatarSelectorViewModel()
|
||||
{
|
||||
_images = new ObservableCollection<ProfileImageModel>();
|
||||
_images = [];
|
||||
|
||||
LoadImagesFromStore();
|
||||
PropertyChanged += (_, args) =>
|
||||
|
@ -9,8 +9,8 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
{
|
||||
public UserProfileViewModel()
|
||||
{
|
||||
Profiles = new ObservableCollection<BaseModel>();
|
||||
LostProfiles = new ObservableCollection<UserProfile>();
|
||||
Profiles = [];
|
||||
LostProfiles = [];
|
||||
IsEmpty = !LostProfiles.Any();
|
||||
}
|
||||
|
||||
|
@ -14,8 +14,8 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
[ObservableProperty] private int _sortIndex;
|
||||
[ObservableProperty] private int _orderIndex;
|
||||
[ObservableProperty] private string _search;
|
||||
[ObservableProperty] private ObservableCollection<SaveModel> _saves = new();
|
||||
[ObservableProperty] private ObservableCollection<SaveModel> _views = new();
|
||||
[ObservableProperty] private ObservableCollection<SaveModel> _saves = [];
|
||||
[ObservableProperty] private ObservableCollection<SaveModel> _views = [];
|
||||
private readonly AccountManager _accountManager;
|
||||
|
||||
public string SaveManagerHeading => LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SaveManagerHeading, _accountManager.LastOpenedUser.Name, _accountManager.LastOpenedUser.UserId);
|
||||
|
@ -36,9 +36,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
private readonly Ryujinx.Common.Logging.XCIFileTrimmerLog _logger;
|
||||
private ApplicationLibrary ApplicationLibrary => _mainWindowViewModel.ApplicationLibrary;
|
||||
private Optional<XCITrimmerFileModel> _processingApplication = null;
|
||||
private AvaloniaList<XCITrimmerFileModel> _allXCIFiles = new();
|
||||
private AvaloniaList<XCITrimmerFileModel> _selectedXCIFiles = new();
|
||||
private AvaloniaList<XCITrimmerFileModel> _displayedXCIFiles = new();
|
||||
private AvaloniaList<XCITrimmerFileModel> _allXCIFiles = [];
|
||||
private AvaloniaList<XCITrimmerFileModel> _selectedXCIFiles = [];
|
||||
private AvaloniaList<XCITrimmerFileModel> _displayedXCIFiles = [];
|
||||
private MainWindowViewModel _mainWindowViewModel;
|
||||
private CancellationTokenSource _cancellationTokenSource;
|
||||
private string _search;
|
||||
|
@ -70,9 +70,9 @@ namespace Ryujinx.Ava.UI.Views.User
|
||||
{
|
||||
new(LocaleManager.Instance[LocaleKeys.AllSupportedFormats])
|
||||
{
|
||||
Patterns = new[] { "*.jpg", "*.jpeg", "*.png", "*.bmp" },
|
||||
AppleUniformTypeIdentifiers = new[] { "public.jpeg", "public.png", "com.microsoft.bmp" },
|
||||
MimeTypes = new[] { "image/jpeg", "image/png", "image/bmp" },
|
||||
Patterns = ["*.jpg", "*.jpeg", "*.png", "*.bmp"],
|
||||
AppleUniformTypeIdentifiers = ["public.jpeg", "public.png", "com.microsoft.bmp"],
|
||||
MimeTypes = ["image/jpeg", "image/png", "image/bmp"],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -67,7 +67,7 @@ namespace Ryujinx.Ava.UI.Views.User
|
||||
public void LoadSaves()
|
||||
{
|
||||
ViewModel.Saves.Clear();
|
||||
ObservableCollection<SaveModel> saves = new();
|
||||
ObservableCollection<SaveModel> saves = [];
|
||||
SaveDataFilter saveDataFilter = SaveDataFilter.Make(
|
||||
programId: default,
|
||||
saveType: SaveDataType.Account,
|
||||
|
@ -34,7 +34,7 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
|
||||
public CheatWindow(VirtualFileSystem virtualFileSystem, string titleId, string titleName, string titlePath)
|
||||
{
|
||||
LoadedCheats = new AvaloniaList<CheatNode>();
|
||||
LoadedCheats = [];
|
||||
IntegrityCheckLevel checkLevel = ConfigurationState.Instance.System.EnableFsIntegrityChecks
|
||||
? IntegrityCheckLevel.ErrorOnInvalid
|
||||
: IntegrityCheckLevel.None;
|
||||
|
@ -712,12 +712,13 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
|
||||
private void ShowNewContentAddedDialog(int numDlcAdded, int numDlcRemoved, int numUpdatesAdded, int numUpdatesRemoved)
|
||||
{
|
||||
string[] messages = {
|
||||
string[] messages =
|
||||
[
|
||||
numDlcRemoved > 0 ? string.Format(LocaleManager.Instance[LocaleKeys.AutoloadDlcRemovedMessage], numDlcRemoved): null,
|
||||
numDlcAdded > 0 ? string.Format(LocaleManager.Instance[LocaleKeys.AutoloadDlcAddedMessage], numDlcAdded): null,
|
||||
numUpdatesRemoved > 0 ? string.Format(LocaleManager.Instance[LocaleKeys.AutoloadUpdateRemovedMessage], numUpdatesRemoved): null,
|
||||
numUpdatesAdded > 0 ? string.Format(LocaleManager.Instance[LocaleKeys.AutoloadUpdateAddedMessage], numUpdatesAdded) : null
|
||||
};
|
||||
];
|
||||
|
||||
string msg = String.Join("\r\n", messages);
|
||||
|
||||
|
@ -372,7 +372,7 @@ namespace Ryujinx.Ava
|
||||
|
||||
for (int i = 0; i < ConnectionCount; i++)
|
||||
{
|
||||
list.Add(Array.Empty<byte>());
|
||||
list.Add([]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < ConnectionCount; i++)
|
||||
|
@ -190,7 +190,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary
|
||||
/// <exception cref="HorizonResultException">An error occured while reading PFS data.</exception>
|
||||
private List<ApplicationData> GetApplicationsFromPfs(IFileSystem pfs, string filePath)
|
||||
{
|
||||
List<ApplicationData> applications = new();
|
||||
List<ApplicationData> applications = [];
|
||||
string extension = Path.GetExtension(filePath).ToLower();
|
||||
|
||||
foreach ((ulong titleId, ContentMetaData content) in pfs.GetContentData(ContentMetaType.Application, _virtualFileSystem, _checkLevel))
|
||||
@ -642,7 +642,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary
|
||||
_applications.Clear();
|
||||
|
||||
// Builds the applications list with paths to found applications
|
||||
List<string> applicationPaths = new();
|
||||
List<string> applicationPaths = [];
|
||||
|
||||
try
|
||||
{
|
||||
@ -833,7 +833,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary
|
||||
{
|
||||
_cancellationToken = new CancellationTokenSource();
|
||||
|
||||
List<string> dlcPaths = new();
|
||||
List<string> dlcPaths = [];
|
||||
int newDlcLoaded = 0;
|
||||
numDlcRemoved = 0;
|
||||
|
||||
@ -943,14 +943,14 @@ namespace Ryujinx.Ava.Utilities.AppLibrary
|
||||
{
|
||||
_cancellationToken = new CancellationTokenSource();
|
||||
|
||||
List<string> updatePaths = new();
|
||||
List<string> updatePaths = [];
|
||||
int numUpdatesLoaded = 0;
|
||||
numUpdatesRemoved = 0;
|
||||
|
||||
try
|
||||
{
|
||||
HashSet<ulong> titleIdsToSave = new();
|
||||
HashSet<ulong> titleIdsToRefresh = new();
|
||||
HashSet<ulong> titleIdsToSave = [];
|
||||
HashSet<ulong> titleIdsToRefresh = [];
|
||||
|
||||
// Remove any updates which can no longer be located on disk
|
||||
List<(TitleUpdateModel TitleUpdate, bool IsSelected)> updatesToRemove = _titleUpdates.Items
|
||||
|
@ -20,7 +20,7 @@ namespace Ryujinx.Ava.Utilities
|
||||
|
||||
public static void ParseArguments(string[] args)
|
||||
{
|
||||
List<string> arguments = new();
|
||||
List<string> arguments = [];
|
||||
|
||||
// Parse Arguments.
|
||||
for (int i = 0; i < args.Length; ++i)
|
||||
|
@ -45,7 +45,7 @@ namespace Ryujinx.Ava.Utilities
|
||||
public static void SaveDownloadableContentsJson(ulong applicationIdBase, List<(DownloadableContentModel, bool IsEnabled)> dlcs)
|
||||
{
|
||||
DownloadableContentContainer container = default;
|
||||
List<DownloadableContentContainer> downloadableContentContainerList = new();
|
||||
List<DownloadableContentContainer> downloadableContentContainerList = [];
|
||||
|
||||
foreach ((DownloadableContentModel dlc, bool isEnabled) in dlcs)
|
||||
{
|
||||
@ -82,7 +82,7 @@ namespace Ryujinx.Ava.Utilities
|
||||
|
||||
private static List<(DownloadableContentModel, bool IsEnabled)> LoadDownloadableContents(VirtualFileSystem vfs, List<DownloadableContentContainer> downloadableContentContainers)
|
||||
{
|
||||
List<(DownloadableContentModel, bool IsEnabled)> result = new();
|
||||
List<(DownloadableContentModel, bool IsEnabled)> result = [];
|
||||
|
||||
foreach (DownloadableContentContainer downloadableContentContainer in downloadableContentContainers)
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ namespace Ryujinx.Ava.Utilities
|
||||
private static string GetArgsString(string appFilePath, string applicationId)
|
||||
{
|
||||
// args are first defined as a list, for easier adjustments in the future
|
||||
List<string> argsList = new();
|
||||
List<string> argsList = [];
|
||||
|
||||
if (!string.IsNullOrEmpty(CommandLineState.BaseDirPathArg))
|
||||
{
|
||||
@ -152,7 +152,7 @@ namespace Ryujinx.Ava.Utilities
|
||||
private static void SaveBitmapAsIcon(SKBitmap source, string filePath)
|
||||
{
|
||||
// Code Modified From https://stackoverflow.com/a/11448060/368354 by Benlitz
|
||||
byte[] header = { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 32, 0, 0, 0, 0, 0, 22, 0, 0, 0 };
|
||||
byte[] header = [0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 32, 0, 0, 0, 0, 0, 22, 0, 0, 0];
|
||||
using FileStream fs = new(filePath, FileMode.Create);
|
||||
|
||||
fs.Write(header);
|
||||
|
@ -79,7 +79,7 @@ namespace Ryujinx.Ava.Utilities
|
||||
|
||||
private static List<(TitleUpdateModel Update, bool IsSelected)> LoadTitleUpdates(VirtualFileSystem vfs, TitleUpdateMetadata titleUpdateMetadata, ulong applicationIdBase)
|
||||
{
|
||||
List<(TitleUpdateModel, bool IsSelected)> result = new();
|
||||
List<(TitleUpdateModel, bool IsSelected)> result = [];
|
||||
|
||||
IntegrityCheckLevel checkLevel = ConfigurationState.Instance.System.EnableFsIntegrityChecks
|
||||
? IntegrityCheckLevel.ErrorOnInvalid
|
||||
|
@ -10,10 +10,10 @@ namespace Ryujinx.Ava.Utilities
|
||||
public static class ValueFormatUtils
|
||||
{
|
||||
private static readonly string[] _fileSizeUnitStrings =
|
||||
{
|
||||
[
|
||||
"B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", // Base 10 units, used for formatting and parsing
|
||||
"KB", "MB", "GB", "TB", "PB", "EB", // Base 2 units, used for parsing legacy values
|
||||
};
|
||||
"KB", "MB", "GB", "TB", "PB", "EB" // Base 2 units, used for parsing legacy values
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Used by <see cref="FormatFileSize"/>.
|
||||
|
Loading…
x
Reference in New Issue
Block a user