78 references to TarHelpers
System.Formats.Tar (78)
System\Formats\Tar\PaxTarEntry.cs (2)
101
_header.ExtendedAttributes[TarHeader.PaxEaATime] =
TarHelpers
.GetTimestampStringFromDateTimeOffset(gnuOther.AccessTime);
105
_header.ExtendedAttributes[TarHeader.PaxEaCTime] =
TarHelpers
.GetTimestampStringFromDateTimeOffset(gnuOther.ChangeTime);
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)
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)),
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));
555
long time =
TarHelpers
.ParseNumeric<long>(buffer);
556
return
TarHelpers
.GetDateTimeOffsetFromSecondsSinceEpoch(time);
563
_prefix =
TarHelpers
.GetTrimmedUtf8String(buffer.Slice(FieldLocations.Prefix, FieldLengths.Prefix));
634
buffer =
TarHelpers
.TrimEndingNullsAndSpaces(buffer);
694
string longPath =
TarHelpers
.GetTrimmedUtf8String(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 (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)
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;