Archived
1
0
Fork 0
forked from Mirror/Ryujinx

Use new C# 11 u8 string literals (#3854)

This commit is contained in:
Berkan Diler 2022-11-16 20:30:12 +01:00 committed by GitHub
parent 11aae9cfbc
commit d751da84f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 12 deletions

View file

@ -34,10 +34,10 @@ namespace Ryujinx.Audio.Renderer.Utils
writer.Seek(0, SeekOrigin.Begin); writer.Seek(0, SeekOrigin.Begin);
writer.Write(Encoding.ASCII.GetBytes("RIFF")); writer.Write("RIFF"u8);
writer.Write((int)(writer.BaseStream.Length - 8)); writer.Write((int)(writer.BaseStream.Length - 8));
writer.Write(Encoding.ASCII.GetBytes("WAVE")); writer.Write("WAVE"u8);
writer.Write(Encoding.ASCII.GetBytes("fmt ")); writer.Write("fmt "u8);
writer.Write(16); writer.Write(16);
writer.Write((short)1); writer.Write((short)1);
writer.Write((short)GetChannelCount()); writer.Write((short)GetChannelCount());
@ -45,7 +45,7 @@ namespace Ryujinx.Audio.Renderer.Utils
writer.Write(GetSampleRate() * GetChannelCount() * sizeof(short)); writer.Write(GetSampleRate() * GetChannelCount() * sizeof(short));
writer.Write((short)(GetChannelCount() * sizeof(short))); writer.Write((short)(GetChannelCount() * sizeof(short)));
writer.Write((short)(sizeof(short) * 8)); writer.Write((short)(sizeof(short) * 8));
writer.Write(Encoding.ASCII.GetBytes("data")); writer.Write("data"u8);
writer.Write((int)(writer.BaseStream.Length - HeaderSize)); writer.Write((int)(writer.BaseStream.Length - HeaderSize));
writer.Seek((int)currentPos, SeekOrigin.Begin); writer.Seek((int)currentPos, SeekOrigin.Begin);

View file

@ -85,7 +85,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
Reserved1 = new Array64<byte>(), Reserved1 = new Array64<byte>(),
Reserved2 = new Array58<byte>() Reserved2 = new Array58<byte>()
}; };
Encoding.ASCII.GetBytes("Ryujinx").CopyTo(registerInfo.Nickname.AsSpan()); "Ryujinx"u8.CopyTo(registerInfo.Nickname.AsSpan());
return registerInfo; return registerInfo;
} }

View file

@ -84,7 +84,7 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService
networkProfile.IpSettingData.IpAddressSetting = new IpAddressSetting(interfaceProperties, unicastAddress); networkProfile.IpSettingData.IpAddressSetting = new IpAddressSetting(interfaceProperties, unicastAddress);
networkProfile.IpSettingData.DnsSetting = new DnsSetting(interfaceProperties); networkProfile.IpSettingData.DnsSetting = new DnsSetting(interfaceProperties);
Encoding.ASCII.GetBytes("RyujinxNetwork").CopyTo(networkProfile.Name.AsSpan()); "RyujinxNetwork"u8.CopyTo(networkProfile.Name.AsSpan());
context.Memory.Write(networkProfileDataPosition, networkProfile); context.Memory.Write(networkProfileDataPosition, networkProfile);

View file

@ -39,7 +39,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
new int[] { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } new int[] { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
}; };
private static readonly byte[] TimeZoneDefaultRule = Encoding.ASCII.GetBytes(",M4.1.0,M10.5.0"); private static ReadOnlySpan<byte> TimeZoneDefaultRule => ",M4.1.0,M10.5.0"u8;
[StructLayout(LayoutKind.Sequential, Pack = 0x4, Size = 0x10)] [StructLayout(LayoutKind.Sequential, Pack = 0x4, Size = 0x10)]
private struct CalendarTimeInternal private struct CalendarTimeInternal

View file

@ -20,10 +20,10 @@ namespace Ryujinx.HLE.Loaders.Mods
private static MemPatch ParseIps(BinaryReader reader) private static MemPatch ParseIps(BinaryReader reader)
{ {
Span<byte> IpsHeaderMagic = Encoding.ASCII.GetBytes("PATCH").AsSpan(); ReadOnlySpan<byte> IpsHeaderMagic = "PATCH"u8;
Span<byte> IpsTailMagic = Encoding.ASCII.GetBytes("EOF").AsSpan(); ReadOnlySpan<byte> IpsTailMagic = "EOF"u8;
Span<byte> Ips32HeaderMagic = Encoding.ASCII.GetBytes("IPS32").AsSpan(); ReadOnlySpan<byte> Ips32HeaderMagic = "IPS32"u8;
Span<byte> Ips32TailMagic = Encoding.ASCII.GetBytes("EEOF").AsSpan(); ReadOnlySpan<byte> Ips32TailMagic = "EEOF"u8;
MemPatch patches = new MemPatch(); MemPatch patches = new MemPatch();
var header = reader.ReadBytes(IpsHeaderMagic.Length).AsSpan(); var header = reader.ReadBytes(IpsHeaderMagic.Length).AsSpan();
@ -34,7 +34,7 @@ namespace Ryujinx.HLE.Loaders.Mods
} }
bool is32; bool is32;
Span<byte> tailSpan; ReadOnlySpan<byte> tailSpan;
if (header.SequenceEqual(IpsHeaderMagic)) if (header.SequenceEqual(IpsHeaderMagic))
{ {