77 references to TarHelpers
System.Formats.Tar (77)
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 (33)
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);
380
long size =
TarHelpers
.ParseNumeric<long>(buffer.Slice(FieldLocations.Size, FieldLengths.Size));
388
name:
TarHelpers
.ParseUtf8String(buffer.Slice(FieldLocations.Name, FieldLengths.Name)),
389
mode:
TarHelpers
.ParseNumeric<int>(buffer.Slice(FieldLocations.Mode, FieldLengths.Mode)),
395
_uid =
TarHelpers
.ParseNumeric<int>(buffer.Slice(FieldLocations.Uid, FieldLengths.Uid)),
396
_gid =
TarHelpers
.ParseNumeric<int>(buffer.Slice(FieldLocations.Gid, FieldLengths.Gid)),
397
_linkName =
TarHelpers
.ParseUtf8String(buffer.Slice(FieldLocations.LinkName, FieldLengths.LinkName))
435
if (
TarHelpers
.IsAllNullBytes(magic))
521
_uName =
TarHelpers
.ParseUtf8String(buffer.Slice(FieldLocations.UName, FieldLengths.UName));
522
_gName =
TarHelpers
.ParseUtf8String(buffer.Slice(FieldLocations.GName, FieldLengths.GName));
529
_devMajor =
TarHelpers
.ParseNumeric<int>(buffer.Slice(FieldLocations.DevMajor, FieldLengths.DevMajor));
532
_devMinor =
TarHelpers
.ParseNumeric<int>(buffer.Slice(FieldLocations.DevMinor, FieldLengths.DevMinor));
556
long time =
TarHelpers
.ParseNumeric<long>(buffer);
557
return
TarHelpers
.GetDateTimeOffsetFromSecondsSinceEpoch(time);
564
_prefix =
TarHelpers
.ParseUtf8String(buffer.Slice(FieldLocations.Prefix, FieldLengths.Prefix));
698
string longPath =
TarHelpers
.ParseUtf8String(buffer);
System\Formats\Tar\TarHeader.Write.cs (13)
174
TarEntryType actualEntryType =
TarHelpers
.GetCorrectTypeFlagForFormat(TarEntryFormat.V7, _typeFlag);
184
TarEntryType actualEntryType =
TarHelpers
.GetCorrectTypeFlagForFormat(TarEntryFormat.Ustar, _typeFlag);
469
_mode =
TarHelpers
.GetDefaultMode(entryType),
486
tmpChecksum += WriteCommonFields(buffer,
TarHelpers
.GetCorrectTypeFlagForFormat(TarEntryFormat.Gnu, _typeFlag));
521
_mode =
TarHelpers
.GetDefaultMode(_typeFlag);
529
tmpChecksum += WriteCommonFields(buffer,
TarHelpers
.GetCorrectTypeFlagForFormat(TarEntryFormat.Pax, _typeFlag));
813
int paddingAfterData =
TarHelpers
.CalculatePadding(_size);
816
Debug.Assert(paddingAfterData <=
TarHelpers
.RecordSize);
818
Span<byte> zeros = stackalloc byte[
TarHelpers
.RecordSize];
829
int paddingAfterData =
TarHelpers
.CalculatePadding(_size);
832
Debug.Assert(paddingAfterData <=
TarHelpers
.RecordSize);
851
int paddingAfterData =
TarHelpers
.CalculatePadding(_size);
947
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;