misc: chore: Use explicit types in the Avalonia project

This commit is contained in:
Evan Husted 2025-01-25 14:00:23 -06:00
parent 3b5f6170d1
commit be3bd0bcb5
69 changed files with 367 additions and 348 deletions

View file

@ -21,7 +21,7 @@ namespace Ryujinx.Ava.UI.Helpers
/// </remarks>
public static bool ReplaceWith<T>(this AvaloniaList<T> list, T item, bool addIfNotFound = true)
{
var index = list.IndexOf(item);
int index = list.IndexOf(item);
if (index != -1)
{
@ -45,9 +45,9 @@ namespace Ryujinx.Ava.UI.Helpers
/// <param name="matchingList">The items to use as matching records to search for in the `sourceList', if not found this item will be added instead</params>
public static void AddOrReplaceMatching<T>(this AvaloniaList<T> list, IList<T> sourceList, IList<T> matchingList)
{
foreach (var match in matchingList)
foreach (T match in matchingList)
{
var index = sourceList.IndexOf(match);
int index = sourceList.IndexOf(match);
if (index != -1)
{
list.ReplaceWith(sourceList[index]);

View file

@ -121,7 +121,7 @@ namespace Ryujinx.Ava.UI.Helpers
startedDeferring = true;
var deferral = args.GetDeferral();
Deferral deferral = args.GetDeferral();
sender.PrimaryButtonClick -= DeferClose;

View file

@ -23,7 +23,7 @@ namespace Ryujinx.Ava.UI.Helpers
}
public string this[string key] =>
_glyphs.TryGetValue(Enum.Parse<Glyph>(key), out var val)
_glyphs.TryGetValue(Enum.Parse<Glyph>(key), out string val)
? val
: string.Empty;

View file

@ -30,7 +30,7 @@ namespace Ryujinx.Ava.UI.Helpers
return null;
}
var key = isBundled ? LocaleKeys.TitleBundledUpdateVersionLabel : LocaleKeys.TitleUpdateVersionLabel;
LocaleKeys key = isBundled ? LocaleKeys.TitleBundledUpdateVersionLabel : LocaleKeys.TitleUpdateVersionLabel;
return LocaleManager.Instance.UpdateAndGetDynamicValue(key, label);
}

View file

@ -50,8 +50,8 @@ namespace Ryujinx.Ava.UI.Helpers
private static string Format(AvaLogLevel level, string area, string template, object source, object[] v)
{
var result = new StringBuilder();
var r = new CharacterReader(template.AsSpan());
StringBuilder result = new StringBuilder();
CharacterReader r = new CharacterReader(template.AsSpan());
int i = 0;
result.Append('[');
@ -64,7 +64,7 @@ namespace Ryujinx.Ava.UI.Helpers
while (!r.End)
{
var c = r.Take();
char c = r.Take();
if (c != '{')
{

View file

@ -28,7 +28,7 @@ namespace Ryujinx.Ava.UI.Helpers
Margin = new Thickness(0, 0, 15, 40),
};
var maybeAsyncWorkQueue = new Lazy<AsyncWorkQueue<Notification>>(
Lazy<AsyncWorkQueue<Notification>> maybeAsyncWorkQueue = new Lazy<AsyncWorkQueue<Notification>>(
() => new AsyncWorkQueue<Notification>(notification =>
{
Dispatcher.UIThread.Post(() =>
@ -57,7 +57,7 @@ namespace Ryujinx.Ava.UI.Helpers
public static void Show(string title, string text, NotificationType type, bool waitingExit = false, Action onClick = null, Action onClose = null)
{
var delay = waitingExit ? TimeSpan.FromMilliseconds(0) : TimeSpan.FromMilliseconds(NotificationDelayInMs);
TimeSpan delay = waitingExit ? TimeSpan.FromMilliseconds(0) : TimeSpan.FromMilliseconds(NotificationDelayInMs);
_notifications.Add(new Notification(title, text, type, delay, onClick, onClose));
}