Fixed naming conventions
This commit is contained in:
@@ -14,8 +14,7 @@ namespace AMWD.Common.Packing.Ar
|
||||
{
|
||||
// Source: http://en.wikipedia.org/wiki/Ar_%28Unix%29
|
||||
|
||||
private readonly Stream outStream;
|
||||
private static readonly DateTime unixEpoch = new(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
private readonly Stream _outStream;
|
||||
|
||||
/// <summary>
|
||||
/// Initialises a new instance of the <see cref="ArWriter"/> class.
|
||||
@@ -26,7 +25,7 @@ namespace AMWD.Common.Packing.Ar
|
||||
if (!outStream.CanWrite)
|
||||
throw new ArgumentException("Stream not writable", nameof(outStream));
|
||||
|
||||
this.outStream = outStream;
|
||||
_outStream = outStream;
|
||||
Initialize();
|
||||
}
|
||||
|
||||
@@ -60,13 +59,13 @@ namespace AMWD.Common.Packing.Ar
|
||||
WriteFileHeader(fileName, modifyTime, userId, groupId, mode, stream.Length);
|
||||
|
||||
// Write file contents
|
||||
stream.CopyTo(outStream);
|
||||
stream.CopyTo(_outStream);
|
||||
|
||||
// Align to even offsets, pad with LF bytes
|
||||
if ((outStream.Position % 2) != 0)
|
||||
if ((_outStream.Position % 2) != 0)
|
||||
{
|
||||
byte[] bytes = new byte[] { 0x0A };
|
||||
outStream.Write(bytes, 0, 1);
|
||||
_outStream.Write(bytes, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +89,7 @@ namespace AMWD.Common.Packing.Ar
|
||||
WriteAsciiString(fileName.PadRight(16, ' '));
|
||||
|
||||
// File modification timestamp
|
||||
int unixTime = (int)(modifyTime - unixEpoch).TotalSeconds;
|
||||
long unixTime = ((DateTimeOffset)DateTime.SpecifyKind(modifyTime, DateTimeKind.Utc)).ToUnixTimeSeconds();
|
||||
WriteAsciiString(unixTime.ToString().PadRight(12, ' '));
|
||||
|
||||
// User ID
|
||||
@@ -131,7 +130,7 @@ namespace AMWD.Common.Packing.Ar
|
||||
|
||||
// File magic
|
||||
byte[] bytes = new byte[] { 0x60, 0x0A };
|
||||
outStream.Write(bytes, 0, 2);
|
||||
_outStream.Write(bytes, 0, 2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -141,7 +140,7 @@ namespace AMWD.Common.Packing.Ar
|
||||
private void WriteAsciiString(string str)
|
||||
{
|
||||
byte[] bytes = Encoding.ASCII.GetBytes(str);
|
||||
outStream.Write(bytes, 0, bytes.Length);
|
||||
_outStream.Write(bytes, 0, bytes.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user