78 references to TarHelpers
System.Formats.Tar (78)
System\Formats\Tar\PaxTarEntry.cs (2)
99
_header.ExtendedAttributes[TarHeader.PaxEaATime] =
TarHelpers
.GetTimestampStringFromDateTimeOffset(gnuOther.AccessTime);
103
_header.ExtendedAttributes[TarHeader.PaxEaCTime] =
TarHelpers
.GetTimestampStringFromDateTimeOffset(gnuOther.ChangeTime);
System\Formats\Tar\SubReadStream.cs (2)
77
return
TarHelpers
.AdvanceStreamAsync(_superStream, remaining, cancellationToken);
86
TarHelpers
.AdvanceStream(_superStream, remaining);
System\Formats\Tar\TarEntry.cs (12)
45
TarHelpers
.ThrowIfEntryTypeNotSupported(entryType, format);
49
_header = new TarHeader(format, entryName,
TarHelpers
.GetDefaultMode(entryType), DateTimeOffset.UtcNow, entryType);
60
TarEntryType compatibleEntryType =
TarHelpers
.GetCorrectTypeFlagForFormat(format, other.EntryType);
62
TarHelpers
.ThrowIfEntryTypeNotSupported(compatibleEntryType, format, nameof(other));
146
get => (UnixFileMode)(_header._mode & (int)
TarHelpers
.ValidUnixFileModes);
149
if ((value & ~
TarHelpers
.ValidUnixFileModes) != 0) // throw on invalid UnixFileModes
309
TarHelpers
.CreateDirectory(destinationFullPath, Mode, pendingModes);
310
TarHelpers
.UpdatePendingModificationTimes(directoryModificationTimes, destinationFullPath, ModificationTime);
315
TarHelpers
.CreateDirectory(Path.GetDirectoryName(destinationFullPath)!, mode: null, pendingModes);
332
TarHelpers
.CreateDirectory(destinationFullPath, Mode, pendingModes);
333
TarHelpers
.UpdatePendingModificationTimes(directoryModificationTimes, destinationFullPath, ModificationTime);
339
TarHelpers
.CreateDirectory(Path.GetDirectoryName(destinationFullPath)!, mode: null, pendingModes);
System\Formats\Tar\TarFile.cs (6)
460
SortedDictionary<string, UnixFileMode>? pendingModes =
TarHelpers
.CreatePendingModesDictionary();
470
TarHelpers
.SetPendingModes(pendingModes);
471
TarHelpers
.SetPendingModificationTimes(directoryModificationTimes);
502
SortedDictionary<string, UnixFileMode>? pendingModes =
TarHelpers
.CreatePendingModesDictionary();
516
TarHelpers
.SetPendingModes(pendingModes);
517
TarHelpers
.SetPendingModificationTimes(directoryModificationTimes);
System\Formats\Tar\TarHeader.Read.cs (34)
25
Span<byte> buffer = stackalloc byte[
TarHelpers
.RecordSize];
46
byte[] rented = ArrayPool<byte>.Shared.Rent(minimumLength:
TarHelpers
.RecordSize);
47
Memory<byte> buffer = rented.AsMemory(0,
TarHelpers
.RecordSize); // minimumLength means the array could've been larger
125
if (
TarHelpers
.TryGetDateTimeOffsetFromTimestampString(ExtendedAttributes, PaxEaMTime, out DateTimeOffset mTime))
131
if (
TarHelpers
.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaMode, out int mode))
137
if (
TarHelpers
.TryGetStringAsBaseTenLong(ExtendedAttributes, PaxEaSize, out long size))
143
if (
TarHelpers
.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaUid, out int uid))
149
if (
TarHelpers
.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaGid, out int gid))
167
if (
TarHelpers
.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaDevMajor, out int devMajor))
173
if (
TarHelpers
.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaDevMinor, out int devMinor))
220
TarHelpers
.AdvanceStream(archiveStream, _size);
236
TarHelpers
.SkipBlockAlignmentPadding(archiveStream, _size);
282
await
TarHelpers
.AdvanceStreamAsync(archiveStream, _size, cancellationToken).ConfigureAwait(false);
298
await
TarHelpers
.SkipBlockAlignmentPaddingAsync(archiveStream, _size, cancellationToken).ConfigureAwait(false);
322
TarHelpers
.CopyBytes(archiveStream, copiedData, _size);
349
await
TarHelpers
.CopyBytesAsync(archiveStream, copiedData, size, cancellationToken).ConfigureAwait(false);
369
if (
TarHelpers
.IsAllNullBytes(spanChecksum))
373
int checksum = (int)
TarHelpers
.ParseOctal<uint>(spanChecksum);
387
long size =
TarHelpers
.ParseNumeric<long>(buffer.Slice(FieldLocations.Size, FieldLengths.Size));
395
name:
TarHelpers
.ParseUtf8String(buffer.Slice(FieldLocations.Name, FieldLengths.Name)),
396
mode:
TarHelpers
.ParseNumeric<int>(buffer.Slice(FieldLocations.Mode, FieldLengths.Mode)),
402
_uid =
TarHelpers
.ParseNumeric<int>(buffer.Slice(FieldLocations.Uid, FieldLengths.Uid)),
403
_gid =
TarHelpers
.ParseNumeric<int>(buffer.Slice(FieldLocations.Gid, FieldLengths.Gid)),
404
_linkName =
TarHelpers
.ParseUtf8String(buffer.Slice(FieldLocations.LinkName, FieldLengths.LinkName))
448
calculatedChecksum += Checksum(buffer.Slice(FieldLocations.Checksum + FieldLengths.Checksum,
TarHelpers
.RecordSize - (FieldLocations.Checksum + FieldLengths.Checksum)));
460
if (
TarHelpers
.IsAllNullBytes(magic))
546
_uName =
TarHelpers
.ParseUtf8String(buffer.Slice(FieldLocations.UName, FieldLengths.UName));
547
_gName =
TarHelpers
.ParseUtf8String(buffer.Slice(FieldLocations.GName, FieldLengths.GName));
554
_devMajor =
TarHelpers
.ParseNumeric<int>(buffer.Slice(FieldLocations.DevMajor, FieldLengths.DevMajor));
557
_devMinor =
TarHelpers
.ParseNumeric<int>(buffer.Slice(FieldLocations.DevMinor, FieldLengths.DevMinor));
581
long time =
TarHelpers
.ParseNumeric<long>(buffer);
582
return
TarHelpers
.GetDateTimeOffsetFromSecondsSinceEpoch(time);
589
_prefix =
TarHelpers
.ParseUtf8String(buffer.Slice(FieldLocations.Prefix, FieldLengths.Prefix));
723
string longPath =
TarHelpers
.ParseUtf8String(buffer);
System\Formats\Tar\TarHeader.Write.cs (13)
175
TarEntryType actualEntryType =
TarHelpers
.GetCorrectTypeFlagForFormat(TarEntryFormat.V7, _typeFlag);
185
TarEntryType actualEntryType =
TarHelpers
.GetCorrectTypeFlagForFormat(TarEntryFormat.Ustar, _typeFlag);
470
_mode =
TarHelpers
.GetDefaultMode(entryType),
487
tmpChecksum += WriteCommonFields(buffer,
TarHelpers
.GetCorrectTypeFlagForFormat(TarEntryFormat.Gnu, _typeFlag));
522
_mode =
TarHelpers
.GetDefaultMode(_typeFlag);
530
tmpChecksum += WriteCommonFields(buffer,
TarHelpers
.GetCorrectTypeFlagForFormat(TarEntryFormat.Pax, _typeFlag));
814
int paddingAfterData =
TarHelpers
.CalculatePadding(_size);
817
Debug.Assert(paddingAfterData <=
TarHelpers
.RecordSize);
819
Span<byte> zeros = stackalloc byte[
TarHelpers
.RecordSize];
830
int paddingAfterData =
TarHelpers
.CalculatePadding(_size);
833
Debug.Assert(paddingAfterData <=
TarHelpers
.RecordSize);
852
int paddingAfterData =
TarHelpers
.CalculatePadding(_size);
948
ExtendedAttributes[PaxEaMTime] =
TarHelpers
.GetTimestampStringFromDateTimeOffset(_mTime);
System\Formats\Tar\TarReader.cs (2)
226
TarHelpers
.SkipBlockAlignmentPadding(_archiveStream, _previouslyReadEntry._header._size);
259
await
TarHelpers
.SkipBlockAlignmentPaddingAsync(_archiveStream, _previouslyReadEntry._header._size, cancellationToken).ConfigureAwait(false);
System\Formats\Tar\TarWriter.cs (5)
296
Span<byte> buffer = stackalloc byte[
TarHelpers
.RecordSize];
337
byte[] rented = ArrayPool<byte>.Shared.Rent(minimumLength:
TarHelpers
.RecordSize);
338
Memory<byte> buffer = rented.AsMemory(0,
TarHelpers
.RecordSize); // minimumLength means the array could've been larger
361
Span<byte> emptyRecord = stackalloc byte[
TarHelpers
.RecordSize];
373
const int TwoRecordSize =
TarHelpers
.RecordSize * 2;
System\Formats\Tar\TarWriter.Unix.cs (2)
65
entry._header._mTime =
TarHelpers
.GetDateTimeOffsetFromSecondsSinceEpoch(status.MTime);
73
entry._header._mode = status.Mode & (int)
TarHelpers
.ValidUnixFileModes;