73 references to TarHelpers
System.Formats.Tar (73)
System\Formats\Tar\GnuSparseStream.cs (5)
346await TarHelpers.AdvanceStreamCoreAsync<TAdapter>(_rawStream, skipBytes, cancellationToken).ConfigureAwait(false); 448int bufferSize = 2 * TarHelpers.RecordSize; 468int newBytes = await TAdapter.ReadAtLeastAsync(rawStream, bytes.AsMemory(availableStart, TarHelpers.RecordSize), TarHelpers.RecordSize, throwOnEndOfStream: false, cancellationToken).ConfigureAwait(false); 492if (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)
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 328TarHelpers.CreateDirectory(destinationFullPath, Mode, pendingModes); 329TarHelpers.UpdatePendingModificationTimes(directoryModificationTimes, destinationFullPath, ModificationTime); 334TarHelpers.CreateDirectory(Path.GetDirectoryName(destinationFullPath)!, mode: null, pendingModes); 351TarHelpers.CreateDirectory(destinationFullPath, Mode, pendingModes); 352TarHelpers.UpdatePendingModificationTimes(directoryModificationTimes, destinationFullPath, ModificationTime); 358TarHelpers.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)
208_ea[key] = TarHelpers.GetTimestampStringFromDateTimeOffset(value); 252ea[PaxEaMTime] = TarHelpers.GetTimestampStringFromDateTimeOffset(_mTime);
System\Formats\Tar\TarHeader.Read.cs (31)
26byte[] rented = ArrayPool<byte>.Shared.Rent(minimumLength: TarHelpers.RecordSize); 27Memory<byte> buffer = rented.AsMemory(0, TarHelpers.RecordSize); // minimumLength means the array could've been larger 124if (TarHelpers.TryGetDateTimeOffsetFromTimestampString(ExtendedAttributes, PaxEaMTime, out DateTimeOffset mTime)) 130if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaMode, out int mode)) 136if (TarHelpers.TryGetStringAsBaseTenLong(ExtendedAttributes, PaxEaSize, out long size)) 158if (TarHelpers.TryGetStringAsBaseTenLong(ExtendedAttributes, PaxEaGnuSparseRealSize, out long gnuSparseRealSize)) 177if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaUid, out int uid)) 183if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaGid, out int gid)) 201if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaDevMajor, out int devMajor)) 207if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaDevMinor, out int devMinor)) 269await TarHelpers.AdvanceStreamCoreAsync<TAdapter>(archiveStream, _size, cancellationToken).ConfigureAwait(false); 286await TarHelpers.SkipBlockAlignmentPaddingCoreAsync<TAdapter>(archiveStream, _size, cancellationToken).ConfigureAwait(false); 311await TarHelpers.CopyBytesCoreAsync<TAdapter>(archiveStream, copiedData, _size, cancellationToken).ConfigureAwait(false); 329if (TarHelpers.IsAllNullBytes(spanChecksum)) 337checksum = (int)TarHelpers.ParseOctal<uint>(spanChecksum); 360long size = TarHelpers.ParseNumeric<long>(buffer.Slice(FieldLocations.Size, FieldLengths.Size)); 368name: TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.Name, FieldLengths.Name)), 369mode: TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.Mode, FieldLengths.Mode)), 375_uid = TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.Uid, FieldLengths.Uid)), 376_gid = TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.Gid, FieldLengths.Gid)), 377_linkName = TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.LinkName, FieldLengths.LinkName)) 421calculatedChecksum += Checksum(buffer.Slice(FieldLocations.Checksum + FieldLengths.Checksum, TarHelpers.RecordSize - (FieldLocations.Checksum + FieldLengths.Checksum))); 433if (TarHelpers.IsAllNullBytes(magic)) 519_uName = TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.UName, FieldLengths.UName)); 520_gName = TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.GName, FieldLengths.GName)); 527_devMajor = TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.DevMajor, FieldLengths.DevMajor)); 530_devMinor = TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.DevMinor, FieldLengths.DevMinor)); 554long time = TarHelpers.ParseNumeric<long>(buffer); 555return TarHelpers.GetDateTimeOffsetFromSecondsSinceEpoch(time); 562_prefix = TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.Prefix, FieldLengths.Prefix)); 651string longPath = TarHelpers.ParseUtf8String(buffer);
System\Formats\Tar\TarHeader.Write.cs (8)
109TarEntryType actualEntryType = TarHelpers.GetCorrectTypeFlagForFormat(TarEntryFormat.V7, _typeFlag); 119TarEntryType actualEntryType = TarHelpers.GetCorrectTypeFlagForFormat(TarEntryFormat.Ustar, _typeFlag); 287_mode = TarHelpers.GetDefaultMode(entryType), 304tmpChecksum += WriteCommonFields(buffer, TarHelpers.GetCorrectTypeFlagForFormat(TarEntryFormat.Gnu, _typeFlag)); 331_mode = TarHelpers.GetDefaultMode(_typeFlag); 339tmpChecksum += WriteCommonFields(buffer, TarHelpers.GetCorrectTypeFlagForFormat(TarEntryFormat.Pax, _typeFlag)); 625int paddingAfterData = TarHelpers.CalculatePadding(_size); 628Debug.Assert(paddingAfterData <= TarHelpers.RecordSize);
System\Formats\Tar\TarReader.cs (1)
203await TarHelpers.SkipBlockAlignmentPaddingCoreAsync<TAdapter>(_archiveStream, _previouslyReadEntry._header._size, cancellationToken).ConfigureAwait(false);
System\Formats\Tar\TarWriter.cs (3)
309byte[] rented = ArrayPool<byte>.Shared.Rent(minimumLength: TarHelpers.RecordSize); 310Memory<byte> buffer = rented.AsMemory(0, TarHelpers.RecordSize); // minimumLength means the array could've been larger 339const 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;