87 references to TarHelpers
System.Formats.Tar (87)
System\Formats\Tar\GnuTarEntry.cs (2)
62
changedATime =
TarHelpers
.TryGetDateTimeOffsetFromTimestampString(paxOther._header.ExtendedAttributes, TarHeader.PaxEaATime, out DateTimeOffset aTime);
68
changedCTime =
TarHelpers
.TryGetDateTimeOffsetFromTimestampString(paxOther._header.ExtendedAttributes, TarHeader.PaxEaCTime, out DateTimeOffset cTime);
System\Formats\Tar\PaxTarEntry.cs (3)
125
_header.ExtendedAttributes[TarHeader.PaxEaATime] =
TarHelpers
.GetTimestampStringFromDateTimeOffset(gnuOther.AccessTime);
126
_header.ExtendedAttributes[TarHeader.PaxEaCTime] =
TarHelpers
.GetTimestampStringFromDateTimeOffset(gnuOther.ChangeTime);
167
string secondsFromEpochString =
TarHelpers
.GetTimestampStringFromDateTimeOffset(useMTime ? _header._mTime : DateTimeOffset.UtcNow);
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 (38)
24
Span<byte> buffer = stackalloc byte[
TarHelpers
.RecordSize];
45
byte[] rented = ArrayPool<byte>.Shared.Rent(minimumLength:
TarHelpers
.RecordSize);
46
Memory<byte> buffer = rented.AsMemory(0,
TarHelpers
.RecordSize); // minimumLength means the array could've been larger
124
if (
TarHelpers
.TryGetDateTimeOffsetFromTimestampString(ExtendedAttributes, PaxEaMTime, out DateTimeOffset mTime))
130
if (
TarHelpers
.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaMode, out int mode))
136
if (
TarHelpers
.TryGetStringAsBaseTenLong(ExtendedAttributes, PaxEaSize, out long size))
142
if (
TarHelpers
.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaUid, out int uid))
148
if (
TarHelpers
.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaGid, out int gid))
166
if (
TarHelpers
.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaDevMajor, out int devMajor))
172
if (
TarHelpers
.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaDevMinor, out int devMinor))
219
TarHelpers
.AdvanceStream(archiveStream, _size);
235
TarHelpers
.SkipBlockAlignmentPadding(archiveStream, _size);
281
await
TarHelpers
.AdvanceStreamAsync(archiveStream, _size, cancellationToken).ConfigureAwait(false);
297
await
TarHelpers
.SkipBlockAlignmentPaddingAsync(archiveStream, _size, cancellationToken).ConfigureAwait(false);
321
TarHelpers
.CopyBytes(archiveStream, copiedData, _size);
348
await
TarHelpers
.CopyBytesAsync(archiveStream, copiedData, size, cancellationToken).ConfigureAwait(false);
368
if (
TarHelpers
.IsAllNullBytes(spanChecksum))
372
int checksum = (int)
TarHelpers
.ParseOctal<uint>(spanChecksum);
379
long size =
TarHelpers
.ParseNumeric<long>(buffer.Slice(FieldLocations.Size, FieldLengths.Size));
387
name:
TarHelpers
.GetTrimmedUtf8String(buffer.Slice(FieldLocations.Name, FieldLengths.Name)),
388
mode:
TarHelpers
.ParseNumeric<int>(buffer.Slice(FieldLocations.Mode, FieldLengths.Mode)),
389
mTime:
TarHelpers
.GetDateTimeOffsetFromSecondsSinceEpoch(
TarHelpers
.ParseNumeric<long>(buffer.Slice(FieldLocations.MTime, FieldLengths.MTime))),
394
_uid =
TarHelpers
.ParseNumeric<int>(buffer.Slice(FieldLocations.Uid, FieldLengths.Uid)),
395
_gid =
TarHelpers
.ParseNumeric<int>(buffer.Slice(FieldLocations.Gid, FieldLengths.Gid)),
396
_linkName =
TarHelpers
.GetTrimmedUtf8String(buffer.Slice(FieldLocations.LinkName, FieldLengths.LinkName))
434
if (
TarHelpers
.IsAllNullBytes(magic))
520
_uName =
TarHelpers
.GetTrimmedUtf8String(buffer.Slice(FieldLocations.UName, FieldLengths.UName));
521
_gName =
TarHelpers
.GetTrimmedUtf8String(buffer.Slice(FieldLocations.GName, FieldLengths.GName));
528
_devMajor =
TarHelpers
.ParseNumeric<int>(buffer.Slice(FieldLocations.DevMajor, FieldLengths.DevMajor));
531
_devMinor =
TarHelpers
.ParseNumeric<int>(buffer.Slice(FieldLocations.DevMinor, FieldLengths.DevMinor));
540
long aTime =
TarHelpers
.ParseNumeric<long>(buffer.Slice(FieldLocations.ATime, FieldLengths.ATime));
541
_aTime =
TarHelpers
.GetDateTimeOffsetFromSecondsSinceEpoch(aTime);
543
long cTime =
TarHelpers
.ParseNumeric<long>(buffer.Slice(FieldLocations.CTime, FieldLengths.CTime));
544
_cTime =
TarHelpers
.GetDateTimeOffsetFromSecondsSinceEpoch(cTime);
553
_prefix =
TarHelpers
.GetTrimmedUtf8String(buffer.Slice(FieldLocations.Prefix, FieldLengths.Prefix));
623
buffer =
TarHelpers
.TrimEndingNullsAndSpaces(buffer);
682
string longPath =
TarHelpers
.GetTrimmedUtf8String(buffer);
System\Formats\Tar\TarHeader.Write.cs (13)
171
TarEntryType actualEntryType =
TarHelpers
.GetCorrectTypeFlagForFormat(TarEntryFormat.V7, _typeFlag);
181
TarEntryType actualEntryType =
TarHelpers
.GetCorrectTypeFlagForFormat(TarEntryFormat.Ustar, _typeFlag);
437
_mode =
TarHelpers
.GetDefaultMode(entryType),
450
tmpChecksum += WriteCommonFields(buffer,
TarHelpers
.GetCorrectTypeFlagForFormat(TarEntryFormat.Gnu, _typeFlag));
485
_mode =
TarHelpers
.GetDefaultMode(_typeFlag);
493
tmpChecksum += WriteCommonFields(buffer,
TarHelpers
.GetCorrectTypeFlagForFormat(TarEntryFormat.Pax, _typeFlag));
777
int paddingAfterData =
TarHelpers
.CalculatePadding(_size);
780
Debug.Assert(paddingAfterData <=
TarHelpers
.RecordSize);
782
Span<byte> zeros = stackalloc byte[
TarHelpers
.RecordSize];
793
int paddingAfterData =
TarHelpers
.CalculatePadding(_size);
796
Debug.Assert(paddingAfterData <=
TarHelpers
.RecordSize);
815
int paddingAfterData =
TarHelpers
.CalculatePadding(_size);
911
ExtendedAttributes[PaxEaMTime] =
TarHelpers
.GetTimestampStringFromDateTimeOffset(_mTime);
System\Formats\Tar\TarReader.cs (4)
231
TarHelpers
.AdvanceStream(_archiveStream, bytesToSkip);
235
TarHelpers
.SkipBlockAlignmentPadding(_archiveStream, _previouslyReadEntry._header._size);
273
await
TarHelpers
.AdvanceStreamAsync(_archiveStream, bytesToSkip, cancellationToken).ConfigureAwait(false);
277
await
TarHelpers
.SkipBlockAlignmentPaddingAsync(_archiveStream, _previouslyReadEntry._header._size, cancellationToken).ConfigureAwait(false);
System\Formats\Tar\TarWriter.cs (5)
281
Span<byte> buffer = stackalloc byte[
TarHelpers
.RecordSize];
322
byte[] rented = ArrayPool<byte>.Shared.Rent(minimumLength:
TarHelpers
.RecordSize);
323
Memory<byte> buffer = rented.AsMemory(0,
TarHelpers
.RecordSize); // minimumLength means the array could've been larger
346
Span<byte> emptyRecord = stackalloc byte[
TarHelpers
.RecordSize];
358
const int TwoRecordSize =
TarHelpers
.RecordSize * 2;
System\Formats\Tar\TarWriter.Unix.cs (4)
65
entry._header._mTime =
TarHelpers
.GetDateTimeOffsetFromSecondsSinceEpoch(status.MTime);
66
entry._header._aTime =
TarHelpers
.GetDateTimeOffsetFromSecondsSinceEpoch(status.ATime);
67
entry._header._cTime =
TarHelpers
.GetDateTimeOffsetFromSecondsSinceEpoch(status.CTime);
70
entry._header._mode = status.Mode & (int)
TarHelpers
.ValidUnixFileModes;