misc: chore: Android: Clean up .NET code, resolve warnings

This commit is contained in:
KeatonTheBot 2025-06-21 18:11:23 -05:00
parent 9955191651
commit a9954c23cc
33 changed files with 166 additions and 156 deletions

View file

@ -1,10 +1,8 @@
using LibKenjinx.Jni.References;
using Rxmxnx.PInvoke;
using System;
using System.Runtime.CompilerServices;
using LibKenjinx.Jni.References;
using Rxmxnx.PInvoke;
namespace LibKenjinx.Jni.Values;
internal readonly struct JValue
@ -13,7 +11,7 @@ internal readonly struct JValue
private static readonly Int32 size = NativeUtilities.SizeOf<JValue>();
private static readonly IsDefaultDelegate isDefault = JValue.GetIsDefault();
private static readonly IsDefaultDelegate isDefault = GetIsDefault();
#pragma warning disable 0649
#pragma warning disable 0169
@ -24,17 +22,17 @@ internal readonly struct JValue
#pragma warning restore 0169
#pragma warning restore 0649
public Boolean IsDefault => JValue.isDefault(this);
public Boolean IsDefault => isDefault(this);
public static JValue Create(in ReadOnlySpan<Byte> source)
{
Byte[] result = new Byte[JValue.size];
Byte[] result = new Byte[size];
for (Int32 i = 0; i < source.Length; i++)
result[i] = source[i];
return result.ToValue<JValue>();
}
private static IsDefaultDelegate GetIsDefault() => Environment.Is64BitProcess ? JValue.DefaultLong : JValue.Default;
private static IsDefaultDelegate GetIsDefault() => Environment.Is64BitProcess ? DefaultLong : Default;
private static Boolean Default(in JValue jValue)
=> jValue._value1 + jValue._value2 + jValue._value3 == default && jValue._value4 == default;
@ -42,5 +40,5 @@ internal readonly struct JValue
private static Boolean DefaultLong(in JValue jValue)
=> Unsafe.AsRef(in jValue).Transform<JValue, Int64>() == default;
public static explicit operator JValue(JObjectLocalRef a) => JValue.Create(NativeUtilities.AsBytes(in a));
public static explicit operator JValue(JObjectLocalRef a) => Create(NativeUtilities.AsBytes(in a));
}