mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-29 07:47:11 +02:00
misc: chore: Use explicit types in the Avalonia project
This commit is contained in:
parent
3b5f6170d1
commit
be3bd0bcb5
69 changed files with 367 additions and 348 deletions
|
@ -144,7 +144,7 @@ namespace Ryujinx.Ava.Common
|
|||
|
||||
public static void ExtractSection(string destination, NcaSectionType ncaSectionType, string titleFilePath, string titleName, int programIndex = 0)
|
||||
{
|
||||
var cancellationToken = new CancellationTokenSource();
|
||||
CancellationTokenSource cancellationToken = new CancellationTokenSource();
|
||||
|
||||
UpdateWaitWindow waitingDialog = new(
|
||||
RyujinxApp.FormatTitle(LocaleKeys.DialogNcaExtractionTitle),
|
||||
|
@ -171,14 +171,14 @@ namespace Ryujinx.Ava.Common
|
|||
}
|
||||
else
|
||||
{
|
||||
var pfsTemp = new PartitionFileSystem();
|
||||
PartitionFileSystem pfsTemp = new PartitionFileSystem();
|
||||
pfsTemp.Initialize(file.AsStorage()).ThrowIfFailure();
|
||||
pfs = pfsTemp;
|
||||
}
|
||||
|
||||
foreach (DirectoryEntryEx fileEntry in pfs.EnumerateEntries("/", "*.nca"))
|
||||
{
|
||||
using var ncaFile = new UniqueRef<IFile>();
|
||||
using UniqueRef<IFile> ncaFile = new UniqueRef<IFile>();
|
||||
|
||||
pfs.OpenFile(ref ncaFile.Ref, fileEntry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
|
||||
|
@ -244,8 +244,8 @@ namespace Ryujinx.Ava.Common
|
|||
string source = DateTime.Now.ToFileTime().ToString()[10..];
|
||||
string output = DateTime.Now.ToFileTime().ToString()[10..];
|
||||
|
||||
using var uniqueSourceFs = new UniqueRef<IFileSystem>(ncaFileSystem);
|
||||
using var uniqueOutputFs = new UniqueRef<IFileSystem>(new LocalFileSystem(destination));
|
||||
using UniqueRef<IFileSystem> uniqueSourceFs = new UniqueRef<IFileSystem>(ncaFileSystem);
|
||||
using UniqueRef<IFileSystem> uniqueOutputFs = new UniqueRef<IFileSystem>(new LocalFileSystem(destination));
|
||||
|
||||
fsClient.Register(source.ToU8Span(), ref uniqueSourceFs.Ref);
|
||||
fsClient.Register(output.ToU8Span(), ref uniqueOutputFs.Ref);
|
||||
|
@ -299,7 +299,7 @@ namespace Ryujinx.Ava.Common
|
|||
|
||||
public static void ExtractAoc(string destination, string updateFilePath, string updateName)
|
||||
{
|
||||
var cancellationToken = new CancellationTokenSource();
|
||||
CancellationTokenSource cancellationToken = new CancellationTokenSource();
|
||||
|
||||
UpdateWaitWindow waitingDialog = new(
|
||||
RyujinxApp.FormatTitle(LocaleKeys.DialogNcaExtractionTitle),
|
||||
|
@ -317,13 +317,13 @@ namespace Ryujinx.Ava.Common
|
|||
string extension = Path.GetExtension(updateFilePath).ToLower();
|
||||
if (extension is ".nsp")
|
||||
{
|
||||
var pfsTemp = new PartitionFileSystem();
|
||||
PartitionFileSystem pfsTemp = new PartitionFileSystem();
|
||||
pfsTemp.Initialize(file.AsStorage()).ThrowIfFailure();
|
||||
IFileSystem pfs = pfsTemp;
|
||||
|
||||
foreach (DirectoryEntryEx fileEntry in pfs.EnumerateEntries("/", "*.nca"))
|
||||
{
|
||||
using var ncaFile = new UniqueRef<IFile>();
|
||||
using UniqueRef<IFile> ncaFile = new UniqueRef<IFile>();
|
||||
|
||||
pfs.OpenFile(ref ncaFile.Ref, fileEntry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
|
||||
|
@ -364,8 +364,8 @@ namespace Ryujinx.Ava.Common
|
|||
string source = DateTime.Now.ToFileTime().ToString()[10..];
|
||||
string output = DateTime.Now.ToFileTime().ToString()[10..];
|
||||
|
||||
using var uniqueSourceFs = new UniqueRef<IFileSystem>(ncaFileSystem);
|
||||
using var uniqueOutputFs = new UniqueRef<IFileSystem>(new LocalFileSystem(destination));
|
||||
using UniqueRef<IFileSystem> uniqueSourceFs = new UniqueRef<IFileSystem>(ncaFileSystem);
|
||||
using UniqueRef<IFileSystem> uniqueOutputFs = new UniqueRef<IFileSystem>(new LocalFileSystem(destination));
|
||||
|
||||
fsClient.Register(source.ToU8Span(), ref uniqueSourceFs.Ref);
|
||||
fsClient.Register(output.ToU8Span(), ref uniqueOutputFs.Ref);
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Ryujinx.Ava.Common.Locale
|
|||
|
||||
private void Load()
|
||||
{
|
||||
var localeLanguageCode = !string.IsNullOrEmpty(ConfigurationState.Instance.UI.LanguageCode.Value) ?
|
||||
string localeLanguageCode = !string.IsNullOrEmpty(ConfigurationState.Instance.UI.LanguageCode.Value) ?
|
||||
ConfigurationState.Instance.UI.LanguageCode.Value : CultureInfo.CurrentCulture.Name.Replace('-', '_');
|
||||
|
||||
LoadLanguage(localeLanguageCode);
|
||||
|
@ -54,7 +54,7 @@ namespace Ryujinx.Ava.Common.Locale
|
|||
if (_localeStrings.TryGetValue(key, out string value))
|
||||
{
|
||||
// Check if the localized string needs to be formatted.
|
||||
if (_dynamicValues.TryGetValue(key, out var dynamicValue))
|
||||
if (_dynamicValues.TryGetValue(key, out object[] dynamicValue))
|
||||
try
|
||||
{
|
||||
return string.Format(value, dynamicValue);
|
||||
|
@ -99,7 +99,7 @@ namespace Ryujinx.Ava.Common.Locale
|
|||
|
||||
public void LoadLanguage(string languageCode)
|
||||
{
|
||||
var locale = LoadJsonLanguage(languageCode);
|
||||
Dictionary<LocaleKeys, string> locale = LoadJsonLanguage(languageCode);
|
||||
|
||||
if (locale == null)
|
||||
{
|
||||
|
@ -125,7 +125,7 @@ namespace Ryujinx.Ava.Common.Locale
|
|||
|
||||
private static Dictionary<LocaleKeys, string> LoadJsonLanguage(string languageCode)
|
||||
{
|
||||
var localeStrings = new Dictionary<LocaleKeys, string>();
|
||||
Dictionary<LocaleKeys, string> localeStrings = new Dictionary<LocaleKeys, string>();
|
||||
|
||||
_localeData ??= EmbeddedResources.ReadAllText("Ryujinx/Assets/locales.json")
|
||||
.Into(it => JsonHelper.Deserialize(it, LocalesJsonContext.Default.LocalesJson));
|
||||
|
@ -142,10 +142,10 @@ namespace Ryujinx.Ava.Common.Locale
|
|||
throw new Exception($"Locale key {{{locale.ID}}} has too many languages! Has {locale.Translations.Count} translations, expected {_localeData.Value.Languages.Count}!");
|
||||
}
|
||||
|
||||
if (!Enum.TryParse<LocaleKeys>(locale.ID, out var localeKey))
|
||||
if (!Enum.TryParse<LocaleKeys>(locale.ID, out LocaleKeys localeKey))
|
||||
continue;
|
||||
|
||||
var str = locale.Translations.TryGetValue(languageCode, out string val) && !string.IsNullOrEmpty(val)
|
||||
string str = locale.Translations.TryGetValue(languageCode, out string val) && !string.IsNullOrEmpty(val)
|
||||
? val
|
||||
: locale.Translations[DefaultLanguageCode];
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Ryujinx.Ava.Common.Models
|
|||
{
|
||||
public static XCITrimmerFileModel FromApplicationData(ApplicationData applicationData, XCIFileTrimmerLog logger)
|
||||
{
|
||||
var trimmer = new XCIFileTrimmer(applicationData.Path, logger);
|
||||
XCIFileTrimmer trimmer = new XCIFileTrimmer(applicationData.Path, logger);
|
||||
|
||||
return new XCITrimmerFileModel(
|
||||
applicationData.Name,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue