1
0

Fixed naming conventions

This commit is contained in:
2024-01-10 09:33:51 +01:00
parent 68dd0839eb
commit 9cd1344266
11 changed files with 218 additions and 241 deletions

View File

@@ -5,39 +5,39 @@ namespace AMWD.Common.Packing.Tar.Utils
{
internal class DataWriter : IArchiveDataWriter
{
private readonly long size;
private long remainingBytes;
private readonly Stream stream;
private readonly long _size;
private long _remainingBytes;
private readonly Stream _stream;
public DataWriter(Stream data, long dataSizeInBytes)
{
size = dataSizeInBytes;
remainingBytes = size;
stream = data;
_size = dataSizeInBytes;
_remainingBytes = _size;
_stream = data;
}
public bool CanWrite { get; private set; } = true;
public int Write(byte[] buffer, int count)
{
if (remainingBytes == 0)
if (_remainingBytes == 0)
{
CanWrite = false;
return -1;
}
int bytesToWrite;
if (remainingBytes - count < 0)
if (_remainingBytes - count < 0)
{
bytesToWrite = (int)remainingBytes;
bytesToWrite = (int)_remainingBytes;
}
else
{
bytesToWrite = count;
}
stream.Write(buffer, 0, bytesToWrite);
remainingBytes -= bytesToWrite;
_stream.Write(buffer, 0, bytesToWrite);
_remainingBytes -= bytesToWrite;
return bytesToWrite;
}