87 references to TarHelpers
System.Formats.Tar (87)
System\Formats\Tar\GnuTarEntry.cs (2)
62changedATime = TarHelpers.TryGetDateTimeOffsetFromTimestampString(paxOther._header.ExtendedAttributes, TarHeader.PaxEaATime, out DateTimeOffset aTime); 68changedCTime = TarHelpers.TryGetDateTimeOffsetFromTimestampString(paxOther._header.ExtendedAttributes, TarHeader.PaxEaCTime, out DateTimeOffset cTime);
System\Formats\Tar\PaxTarEntry.cs (3)
125_header.ExtendedAttributes[TarHeader.PaxEaATime] = TarHelpers.GetTimestampStringFromDateTimeOffset(gnuOther.AccessTime); 126_header.ExtendedAttributes[TarHeader.PaxEaCTime] = TarHelpers.GetTimestampStringFromDateTimeOffset(gnuOther.ChangeTime); 167string secondsFromEpochString = TarHelpers.GetTimestampStringFromDateTimeOffset(useMTime ? _header._mTime : DateTimeOffset.UtcNow);
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)); 146get => (UnixFileMode)(_header._mode & (int)TarHelpers.ValidUnixFileModes); 149if ((value & ~TarHelpers.ValidUnixFileModes) != 0) // throw on invalid UnixFileModes 309TarHelpers.CreateDirectory(destinationFullPath, Mode, pendingModes); 310TarHelpers.UpdatePendingModificationTimes(directoryModificationTimes, destinationFullPath, ModificationTime); 315TarHelpers.CreateDirectory(Path.GetDirectoryName(destinationFullPath)!, mode: null, pendingModes); 332TarHelpers.CreateDirectory(destinationFullPath, Mode, pendingModes); 333TarHelpers.UpdatePendingModificationTimes(directoryModificationTimes, destinationFullPath, ModificationTime); 339TarHelpers.CreateDirectory(Path.GetDirectoryName(destinationFullPath)!, mode: null, pendingModes);
System\Formats\Tar\TarFile.cs (6)
460SortedDictionary<string, UnixFileMode>? pendingModes = TarHelpers.CreatePendingModesDictionary(); 470TarHelpers.SetPendingModes(pendingModes); 471TarHelpers.SetPendingModificationTimes(directoryModificationTimes); 502SortedDictionary<string, UnixFileMode>? pendingModes = TarHelpers.CreatePendingModesDictionary(); 516TarHelpers.SetPendingModes(pendingModes); 517TarHelpers.SetPendingModificationTimes(directoryModificationTimes);
System\Formats\Tar\TarHeader.Read.cs (38)
24Span<byte> buffer = stackalloc byte[TarHelpers.RecordSize]; 45byte[] rented = ArrayPool<byte>.Shared.Rent(minimumLength: TarHelpers.RecordSize); 46Memory<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)) 142if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaUid, out int uid)) 148if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaGid, out int gid)) 166if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaDevMajor, out int devMajor)) 172if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaDevMinor, out int devMinor)) 219TarHelpers.AdvanceStream(archiveStream, _size); 235TarHelpers.SkipBlockAlignmentPadding(archiveStream, _size); 281await TarHelpers.AdvanceStreamAsync(archiveStream, _size, cancellationToken).ConfigureAwait(false); 297await TarHelpers.SkipBlockAlignmentPaddingAsync(archiveStream, _size, cancellationToken).ConfigureAwait(false); 321TarHelpers.CopyBytes(archiveStream, copiedData, _size); 348await TarHelpers.CopyBytesAsync(archiveStream, copiedData, size, cancellationToken).ConfigureAwait(false); 368if (TarHelpers.IsAllNullBytes(spanChecksum)) 372int checksum = (int)TarHelpers.ParseOctal<uint>(spanChecksum); 379long size = TarHelpers.ParseNumeric<long>(buffer.Slice(FieldLocations.Size, FieldLengths.Size)); 387name: TarHelpers.GetTrimmedUtf8String(buffer.Slice(FieldLocations.Name, FieldLengths.Name)), 388mode: TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.Mode, FieldLengths.Mode)), 389mTime: TarHelpers.GetDateTimeOffsetFromSecondsSinceEpoch(TarHelpers.ParseNumeric<long>(buffer.Slice(FieldLocations.MTime, FieldLengths.MTime))), 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)) 434if (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)); 540long aTime = TarHelpers.ParseNumeric<long>(buffer.Slice(FieldLocations.ATime, FieldLengths.ATime)); 541_aTime = TarHelpers.GetDateTimeOffsetFromSecondsSinceEpoch(aTime); 543long cTime = TarHelpers.ParseNumeric<long>(buffer.Slice(FieldLocations.CTime, FieldLengths.CTime)); 544_cTime = TarHelpers.GetDateTimeOffsetFromSecondsSinceEpoch(cTime); 553_prefix = TarHelpers.GetTrimmedUtf8String(buffer.Slice(FieldLocations.Prefix, FieldLengths.Prefix)); 623buffer = TarHelpers.TrimEndingNullsAndSpaces(buffer); 682string longPath = TarHelpers.GetTrimmedUtf8String(buffer);
System\Formats\Tar\TarHeader.Write.cs (13)
171TarEntryType actualEntryType = TarHelpers.GetCorrectTypeFlagForFormat(TarEntryFormat.V7, _typeFlag); 181TarEntryType actualEntryType = TarHelpers.GetCorrectTypeFlagForFormat(TarEntryFormat.Ustar, _typeFlag); 437_mode = TarHelpers.GetDefaultMode(entryType), 450tmpChecksum += WriteCommonFields(buffer, TarHelpers.GetCorrectTypeFlagForFormat(TarEntryFormat.Gnu, _typeFlag)); 485_mode = TarHelpers.GetDefaultMode(_typeFlag); 493tmpChecksum += WriteCommonFields(buffer, TarHelpers.GetCorrectTypeFlagForFormat(TarEntryFormat.Pax, _typeFlag)); 777int paddingAfterData = TarHelpers.CalculatePadding(_size); 780Debug.Assert(paddingAfterData <= TarHelpers.RecordSize); 782Span<byte> zeros = stackalloc byte[TarHelpers.RecordSize]; 793int paddingAfterData = TarHelpers.CalculatePadding(_size); 796Debug.Assert(paddingAfterData <= TarHelpers.RecordSize); 815int paddingAfterData = TarHelpers.CalculatePadding(_size); 911ExtendedAttributes[PaxEaMTime] = TarHelpers.GetTimestampStringFromDateTimeOffset(_mTime);
System\Formats\Tar\TarReader.cs (4)
231TarHelpers.AdvanceStream(_archiveStream, bytesToSkip); 235TarHelpers.SkipBlockAlignmentPadding(_archiveStream, _previouslyReadEntry._header._size); 273await TarHelpers.AdvanceStreamAsync(_archiveStream, bytesToSkip, cancellationToken).ConfigureAwait(false); 277await TarHelpers.SkipBlockAlignmentPaddingAsync(_archiveStream, _previouslyReadEntry._header._size, cancellationToken).ConfigureAwait(false);
System\Formats\Tar\TarWriter.cs (5)
281Span<byte> buffer = stackalloc byte[TarHelpers.RecordSize]; 322byte[] rented = ArrayPool<byte>.Shared.Rent(minimumLength: TarHelpers.RecordSize); 323Memory<byte> buffer = rented.AsMemory(0, TarHelpers.RecordSize); // minimumLength means the array could've been larger 346Span<byte> emptyRecord = stackalloc byte[TarHelpers.RecordSize]; 358const int TwoRecordSize = TarHelpers.RecordSize * 2;
System\Formats\Tar\TarWriter.Unix.cs (4)
65entry._header._mTime = TarHelpers.GetDateTimeOffsetFromSecondsSinceEpoch(status.MTime); 66entry._header._aTime = TarHelpers.GetDateTimeOffsetFromSecondsSinceEpoch(status.ATime); 67entry._header._cTime = TarHelpers.GetDateTimeOffsetFromSecondsSinceEpoch(status.CTime); 70entry._header._mode = status.Mode & (int)TarHelpers.ValidUnixFileModes;