80 references to TarHelpers
System.Formats.Tar (80)
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\SubReadStream.cs (2)
77return TarHelpers.AdvanceStreamAsync(_superStream, remaining, cancellationToken); 86TarHelpers.AdvanceStream(_superStream, remaining);
System\Formats\Tar\TarEntry.cs (12)
45TarHelpers.ThrowIfEntryTypeNotSupported(entryType, format); 49_header = new TarHeader(format, entryName, TarHelpers.GetDefaultMode(entryType), DateTimeOffset.UtcNow, entryType); 60TarEntryType compatibleEntryType = TarHelpers.GetCorrectTypeFlagForFormat(format, other.EntryType); 62TarHelpers.ThrowIfEntryTypeNotSupported(compatibleEntryType, format, nameof(other)); 153get => (UnixFileMode)(_header._mode & (int)TarHelpers.ValidUnixFileModes); 156if ((value & ~TarHelpers.ValidUnixFileModes) != 0) // throw on invalid UnixFileModes 324TarHelpers.CreateDirectory(destinationFullPath, Mode, pendingModes); 325TarHelpers.UpdatePendingModificationTimes(directoryModificationTimes, destinationFullPath, ModificationTime); 330TarHelpers.CreateDirectory(Path.GetDirectoryName(destinationFullPath)!, mode: null, pendingModes); 347TarHelpers.CreateDirectory(destinationFullPath, Mode, pendingModes); 348TarHelpers.UpdatePendingModificationTimes(directoryModificationTimes, destinationFullPath, ModificationTime); 354TarHelpers.CreateDirectory(Path.GetDirectoryName(destinationFullPath)!, mode: null, pendingModes);
System\Formats\Tar\TarFile.cs (6)
657SortedDictionary<string, UnixFileMode>? pendingModes = TarHelpers.CreatePendingModesDictionary(); 667TarHelpers.SetPendingModes(pendingModes); 668TarHelpers.SetPendingModificationTimes(directoryModificationTimes); 702SortedDictionary<string, UnixFileMode>? pendingModes = TarHelpers.CreatePendingModesDictionary(); 716TarHelpers.SetPendingModes(pendingModes); 717TarHelpers.SetPendingModificationTimes(directoryModificationTimes);
System\Formats\Tar\TarHeader.cs (2)
181_ea[key] = TarHelpers.GetTimestampStringFromDateTimeOffset(value); 225ea[PaxEaMTime] = TarHelpers.GetTimestampStringFromDateTimeOffset(_mTime);
System\Formats\Tar\TarHeader.Read.cs (34)
25Span<byte> buffer = stackalloc byte[TarHelpers.RecordSize]; 46byte[] rented = ArrayPool<byte>.Shared.Rent(minimumLength: TarHelpers.RecordSize); 47Memory<byte> buffer = rented.AsMemory(0, TarHelpers.RecordSize); // minimumLength means the array could've been larger 140if (TarHelpers.TryGetDateTimeOffsetFromTimestampString(ExtendedAttributes, PaxEaMTime, out DateTimeOffset mTime)) 146if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaMode, out int mode)) 152if (TarHelpers.TryGetStringAsBaseTenLong(ExtendedAttributes, PaxEaSize, out long size)) 158if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaUid, out int uid)) 164if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaGid, out int gid)) 182if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaDevMajor, out int devMajor)) 188if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaDevMinor, out int devMinor)) 235TarHelpers.AdvanceStream(archiveStream, _size); 251TarHelpers.SkipBlockAlignmentPadding(archiveStream, _size); 297await TarHelpers.AdvanceStreamAsync(archiveStream, _size, cancellationToken).ConfigureAwait(false); 313await TarHelpers.SkipBlockAlignmentPaddingAsync(archiveStream, _size, cancellationToken).ConfigureAwait(false); 337TarHelpers.CopyBytes(archiveStream, copiedData, _size); 364await TarHelpers.CopyBytesAsync(archiveStream, copiedData, size, cancellationToken).ConfigureAwait(false); 384if (TarHelpers.IsAllNullBytes(spanChecksum)) 392checksum = (int)TarHelpers.ParseOctal<uint>(spanChecksum); 415long size = TarHelpers.ParseNumeric<long>(buffer.Slice(FieldLocations.Size, FieldLengths.Size)); 423name: TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.Name, FieldLengths.Name)), 424mode: TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.Mode, FieldLengths.Mode)), 430_uid = TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.Uid, FieldLengths.Uid)), 431_gid = TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.Gid, FieldLengths.Gid)), 432_linkName = TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.LinkName, FieldLengths.LinkName)) 476calculatedChecksum += Checksum(buffer.Slice(FieldLocations.Checksum + FieldLengths.Checksum, TarHelpers.RecordSize - (FieldLocations.Checksum + FieldLengths.Checksum))); 488if (TarHelpers.IsAllNullBytes(magic)) 574_uName = TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.UName, FieldLengths.UName)); 575_gName = TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.GName, FieldLengths.GName)); 582_devMajor = TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.DevMajor, FieldLengths.DevMajor)); 585_devMinor = TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.DevMinor, FieldLengths.DevMinor)); 609long time = TarHelpers.ParseNumeric<long>(buffer); 610return TarHelpers.GetDateTimeOffsetFromSecondsSinceEpoch(time); 617_prefix = TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.Prefix, FieldLengths.Prefix)); 751string longPath = TarHelpers.ParseUtf8String(buffer);
System\Formats\Tar\TarHeader.Write.cs (12)
175TarEntryType actualEntryType = TarHelpers.GetCorrectTypeFlagForFormat(TarEntryFormat.V7, _typeFlag); 185TarEntryType actualEntryType = TarHelpers.GetCorrectTypeFlagForFormat(TarEntryFormat.Ustar, _typeFlag); 468_mode = TarHelpers.GetDefaultMode(entryType), 485tmpChecksum += WriteCommonFields(buffer, TarHelpers.GetCorrectTypeFlagForFormat(TarEntryFormat.Gnu, _typeFlag)); 520_mode = TarHelpers.GetDefaultMode(_typeFlag); 528tmpChecksum += WriteCommonFields(buffer, TarHelpers.GetCorrectTypeFlagForFormat(TarEntryFormat.Pax, _typeFlag)); 812int paddingAfterData = TarHelpers.CalculatePadding(_size); 815Debug.Assert(paddingAfterData <= TarHelpers.RecordSize); 817Span<byte> zeros = stackalloc byte[TarHelpers.RecordSize]; 828int paddingAfterData = TarHelpers.CalculatePadding(_size); 831Debug.Assert(paddingAfterData <= TarHelpers.RecordSize); 850int paddingAfterData = TarHelpers.CalculatePadding(_size);
System\Formats\Tar\TarReader.cs (2)
226TarHelpers.SkipBlockAlignmentPadding(_archiveStream, _previouslyReadEntry._header._size); 259await TarHelpers.SkipBlockAlignmentPaddingAsync(_archiveStream, _previouslyReadEntry._header._size, cancellationToken).ConfigureAwait(false);
System\Formats\Tar\TarWriter.cs (5)
319Span<byte> buffer = stackalloc byte[TarHelpers.RecordSize]; 360byte[] rented = ArrayPool<byte>.Shared.Rent(minimumLength: TarHelpers.RecordSize); 361Memory<byte> buffer = rented.AsMemory(0, TarHelpers.RecordSize); // minimumLength means the array could've been larger 384Span<byte> emptyRecord = stackalloc byte[TarHelpers.RecordSize]; 396const int TwoRecordSize = TarHelpers.RecordSize * 2;
System\Formats\Tar\TarWriter.Unix.cs (3)
57Interop.Sys.FileTypes.S_IFREG => TarHelpers.GetRegularFileEntryTypeForFormat(Format), 87entry._header._mTime = TarHelpers.GetDateTimeOffsetFromSecondsSinceEpoch(status.MTime); 95entry._header._mode = status.Mode & (int)TarHelpers.ValidUnixFileModes;