Shush, IDE0057
Since Memory<byte> is initialized with a fixed size, `.Slice(0, readSize)` and `.Slice(0, bytesRead)` are necessary to ensure that only the part of the buffer that contains data is written to the file stream. So IDE0057 is not appropriate in this context.
This commit is contained in:
parent
3a1c722947
commit
942f02ffbc
2 changed files with 4 additions and 0 deletions
|
@ -108,7 +108,9 @@ namespace Ryujinx.Modules
|
|||
|
||||
while ((bytesRead = await stream.ReadAsync(buffer, CancellationToken.None)) > 0)
|
||||
{
|
||||
#pragma warning disable IDE0057 // Disable the warning for unnecessary slicing
|
||||
memoryStream.Write(buffer.Slice(0, bytesRead).ToArray(), 0, bytesRead);
|
||||
#pragma warning restore IDE0057
|
||||
totalRead += bytesRead;
|
||||
int progress = (int)((totalRead * 100) / (end - start + 1));
|
||||
progressPercentage[index] = progress;
|
||||
|
|
|
@ -42,7 +42,9 @@ namespace Ryujinx.Modules
|
|||
|
||||
while ((readSize = await remoteFileStream.ReadAsync(buffer, CancellationToken.None)) > 0)
|
||||
{
|
||||
#pragma warning disable IDE0057 // Disable the warning for unnecessary slicing
|
||||
updateFileStream.Write(buffer.Slice(0, readSize).ToArray(), 0, readSize);
|
||||
#pragma warning restore IDE0057
|
||||
byteWritten += readSize;
|
||||
|
||||
int progress = GetPercentage(byteWritten, totalBytes);
|
||||
|
|
Loading…
Reference in a new issue