77 references to TarHelpers
System.Formats.Tar (77)
System\Formats\Tar\GnuSparseStream.cs (5)
345
await
TarHelpers
.AdvanceStreamCoreAsync<TAdapter>(_rawStream, skipBytes, cancellationToken).ConfigureAwait(false);
447
int bufferSize = 2 *
TarHelpers
.RecordSize;
467
int newBytes = await TAdapter.ReadAtLeastAsync(rawStream, bytes.AsMemory(availableStart,
TarHelpers
.RecordSize),
TarHelpers
.RecordSize, throwOnEndOfStream: false, cancellationToken).ConfigureAwait(false);
491
if (availableStart +
TarHelpers
.RecordSize > bufferSize)
System\Formats\Tar\PaxTarEntry.cs (2)
104
_header.ExtendedAttributes[TarHeader.PaxEaATime] =
TarHelpers
.GetTimestampStringFromDateTimeOffset(gnuOther.AccessTime);
108
_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));
153
get => (UnixFileMode)(_header._mode & (int)
TarHelpers
.ValidUnixFileModes);
156
if ((value & ~
TarHelpers
.ValidUnixFileModes) != 0) // throw on invalid UnixFileModes
328
TarHelpers
.CreateDirectory(destinationFullPath, Mode, pendingModes);
329
TarHelpers
.UpdatePendingModificationTimes(directoryModificationTimes, destinationFullPath, ModificationTime);
334
TarHelpers
.CreateDirectory(Path.GetDirectoryName(destinationFullPath)!, mode: null, pendingModes);
351
TarHelpers
.CreateDirectory(destinationFullPath, Mode, pendingModes);
352
TarHelpers
.UpdatePendingModificationTimes(directoryModificationTimes, destinationFullPath, ModificationTime);
358
TarHelpers
.CreateDirectory(Path.GetDirectoryName(destinationFullPath)!, mode: null, pendingModes);
System\Formats\Tar\TarFile.cs (6)
657
SortedDictionary<string, UnixFileMode>? pendingModes =
TarHelpers
.CreatePendingModesDictionary();
667
TarHelpers
.SetPendingModes(pendingModes);
668
TarHelpers
.SetPendingModificationTimes(directoryModificationTimes);
702
SortedDictionary<string, UnixFileMode>? pendingModes =
TarHelpers
.CreatePendingModesDictionary();
716
TarHelpers
.SetPendingModes(pendingModes);
717
TarHelpers
.SetPendingModificationTimes(directoryModificationTimes);
System\Formats\Tar\TarHeader.cs (2)
211
_ea[key] =
TarHelpers
.GetTimestampStringFromDateTimeOffset(value);
255
ea[PaxEaMTime] =
TarHelpers
.GetTimestampStringFromDateTimeOffset(_mTime);
System\Formats\Tar\TarHeader.Read.cs (31)
26
byte[] rented = ArrayPool<byte>.Shared.Rent(minimumLength:
TarHelpers
.RecordSize);
27
Memory<byte> buffer = rented.AsMemory(0,
TarHelpers
.RecordSize); // minimumLength means the array could've been larger
182
if (
TarHelpers
.TryGetDateTimeOffsetFromTimestampString(values.MTime, out DateTimeOffset mTime))
188
if (
TarHelpers
.TryGetStringAsBaseTenInteger(values.Mode, out int mode))
194
if (
TarHelpers
.TryGetStringAsBaseTenLong(values.Size, out long size))
216
if (
TarHelpers
.TryGetStringAsBaseTenLong(values.GnuSparseRealSize, out long gnuSparseRealSize))
234
if (
TarHelpers
.TryGetStringAsBaseTenInteger(values.Uid, out int uid))
240
if (
TarHelpers
.TryGetStringAsBaseTenInteger(values.Gid, out int gid))
258
if (
TarHelpers
.TryGetStringAsBaseTenInteger(values.DevMajor, out int devMajor))
264
if (
TarHelpers
.TryGetStringAsBaseTenInteger(values.DevMinor, out int devMinor))
345
await
TarHelpers
.AdvanceStreamCoreAsync<TAdapter>(archiveStream, _size, cancellationToken).ConfigureAwait(false);
362
await
TarHelpers
.SkipBlockAlignmentPaddingCoreAsync<TAdapter>(archiveStream, _size, cancellationToken).ConfigureAwait(false);
392
await
TarHelpers
.CopyBytesCoreAsync<TAdapter>(archiveStream, copiedData, _size, cancellationToken).ConfigureAwait(false);
410
if (
TarHelpers
.IsAllNullBytes(spanChecksum))
418
checksum = (int)
TarHelpers
.ParseOctal<uint>(spanChecksum);
441
long size =
TarHelpers
.ParseNumeric<long>(buffer.Slice(FieldLocations.Size, FieldLengths.Size));
449
name:
TarHelpers
.ParseUtf8String(buffer.Slice(FieldLocations.Name, FieldLengths.Name)),
450
mode:
TarHelpers
.ParseNumeric<int>(buffer.Slice(FieldLocations.Mode, FieldLengths.Mode)),
456
_uid =
TarHelpers
.ParseNumeric<int>(buffer.Slice(FieldLocations.Uid, FieldLengths.Uid)),
457
_gid =
TarHelpers
.ParseNumeric<int>(buffer.Slice(FieldLocations.Gid, FieldLengths.Gid)),
458
_linkName =
TarHelpers
.ParseUtf8String(buffer.Slice(FieldLocations.LinkName, FieldLengths.LinkName))
502
calculatedChecksum += Checksum(buffer.Slice(FieldLocations.Checksum + FieldLengths.Checksum,
TarHelpers
.RecordSize - (FieldLocations.Checksum + FieldLengths.Checksum)));
514
if (
TarHelpers
.IsAllNullBytes(magic))
600
_uName =
TarHelpers
.ParseUtf8String(buffer.Slice(FieldLocations.UName, FieldLengths.UName));
601
_gName =
TarHelpers
.ParseUtf8String(buffer.Slice(FieldLocations.GName, FieldLengths.GName));
608
_devMajor =
TarHelpers
.ParseNumeric<int>(buffer.Slice(FieldLocations.DevMajor, FieldLengths.DevMajor));
611
_devMinor =
TarHelpers
.ParseNumeric<int>(buffer.Slice(FieldLocations.DevMinor, FieldLengths.DevMinor));
635
long time =
TarHelpers
.ParseNumeric<long>(buffer);
636
return
TarHelpers
.GetDateTimeOffsetFromSecondsSinceEpoch(time);
643
_prefix =
TarHelpers
.ParseUtf8String(buffer.Slice(FieldLocations.Prefix, FieldLengths.Prefix));
732
string longPath =
TarHelpers
.ParseUtf8String(buffer);
System\Formats\Tar\TarHeader.Write.cs (11)
162
TarEntryType actualEntryType =
TarHelpers
.GetCorrectTypeFlagForFormat(TarEntryFormat.V7, _typeFlag);
172
TarEntryType actualEntryType =
TarHelpers
.GetCorrectTypeFlagForFormat(TarEntryFormat.Ustar, _typeFlag);
435
_mode =
TarHelpers
.GetDefaultMode(entryType),
452
tmpChecksum += WriteCommonFields(buffer,
TarHelpers
.GetCorrectTypeFlagForFormat(TarEntryFormat.Gnu, _typeFlag));
486
_mode =
TarHelpers
.GetDefaultMode(_typeFlag);
494
tmpChecksum += WriteCommonFields(buffer,
TarHelpers
.GetCorrectTypeFlagForFormat(TarEntryFormat.Pax, _typeFlag));
786
int paddingAfterData =
TarHelpers
.CalculatePadding(_size);
789
Debug.Assert(paddingAfterData <=
TarHelpers
.RecordSize);
791
Span<byte> zeros = stackalloc byte[
TarHelpers
.RecordSize];
803
int paddingAfterData =
TarHelpers
.CalculatePadding(_size);
806
Debug.Assert(paddingAfterData <=
TarHelpers
.RecordSize);
System\Formats\Tar\TarReader.cs (1)
203
await
TarHelpers
.SkipBlockAlignmentPaddingCoreAsync<TAdapter>(_archiveStream, _previouslyReadEntry._header._size, cancellationToken).ConfigureAwait(false);
System\Formats\Tar\TarWriter.cs (4)
304
Span<byte> buffer = stackalloc byte[
TarHelpers
.RecordSize];
344
byte[] rented = ArrayPool<byte>.Shared.Rent(minimumLength:
TarHelpers
.RecordSize);
345
Memory<byte> buffer = rented.AsMemory(0,
TarHelpers
.RecordSize); // minimumLength means the array could've been larger
374
const int TwoRecordSize =
TarHelpers
.RecordSize * 2;
System\Formats\Tar\TarWriter.Unix.cs (3)
57
Interop.Sys.FileTypes.S_IFREG =>
TarHelpers
.GetRegularFileEntryTypeForFormat(Format),
87
entry._header._mTime =
TarHelpers
.GetDateTimeOffsetFromSecondsSinceEpoch(status.MTime);
95
entry._header._mode = status.Mode & (int)
TarHelpers
.ValidUnixFileModes;