add additional #if-directives

This commit is contained in:
Morilli 2025-04-18 19:45:12 +02:00
parent 7adc5619d7
commit 508aaa4400
4 changed files with 29 additions and 1 deletions

View File

@ -290,7 +290,11 @@ namespace BizHawk.Client.Common
_dest = replacement;
}
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public override void Write(ReadOnlySpan<byte> buffer)
#else
public void Write(ReadOnlySpan<byte> buffer)
#endif
{
var requestedSize = _position + buffer.Length;
MaybeResize(requestedSize);
@ -304,7 +308,11 @@ namespace BizHawk.Client.Common
_dest[_position] = value;
_position = requestedSize;
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public override int Read(Span<byte> buffer) => throw new IOException();
#else
public int Read(Span<byte> buffer) => throw new IOException();
#endif
}
}
}

View File

@ -443,14 +443,22 @@ namespace BizHawk.Client.Common
public override int Read(byte[] buffer, int offset, int count) => throw new IOException();
public override long Seek(long offset, SeekOrigin origin) => throw new IOException();
public override void SetLength(long value) => throw new IOException();
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public override int Read(Span<byte> buffer) => throw new IOException();
#else
public int Read(Span<byte> buffer) => throw new IOException();
#endif
public override void Write(byte[] buffer, int offset, int count)
{
Write(new ReadOnlySpan<byte>(buffer, offset, count));
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public override void Write(ReadOnlySpan<byte> buffer)
#else
public void Write(ReadOnlySpan<byte> buffer)
#endif
{
long requestedSize = _position + buffer.Length;
while (requestedSize > _notifySize)
@ -526,7 +534,11 @@ namespace BizHawk.Client.Common
return Read(new Span<byte>(buffer, offset, count));
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public override int Read(Span<byte> buffer)
#else
public int Read(Span<byte> buffer)
#endif
{
long n = Math.Min(_size - _position, buffer.Length);
int ret = (int)n;
@ -577,7 +589,11 @@ namespace BizHawk.Client.Common
public override void SetLength(long value) => throw new IOException();
public override void Write(byte[] buffer, int offset, int count) => throw new IOException();
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public override void Write(ReadOnlySpan<byte> buffer) => throw new IOException();
#else
public void Write(ReadOnlySpan<byte> buffer) => throw new IOException();
#endif
}
}
}

View File

@ -4796,7 +4796,11 @@ namespace BizHawk.Client.EmuHawk
}
// Create pipe and start the async connection wait
#if NET5_0_OR_GREATER
_singleInstanceServer = NamedPipeServerStreamAcl.Create(
#else
_singleInstanceServer = new NamedPipeServerStream(
#endif
"pipe-{84125ACB-F570-4458-9748-321F887FE795}",
PipeDirection.In,
1,

View File

@ -17,10 +17,10 @@ namespace BizHawk.Common.StringExtensions
#if !(NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER)
public static bool Contains(this string haystack, char needle)
=> haystack.IndexOf(needle) >= 0;
#endif
public static bool Contains(this string haystack, string needle, StringComparison comparisonType)
=> haystack.IndexOf(needle, comparisonType) != -1;
#endif
/// <inheritdoc cref="EqualsIgnoreCase"/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]