3 writes to _header
System.Formats.Tar (3)
System\Formats\Tar\TarEntry.cs (3)
32_header = header; 49_header = new TarHeader(format, entryName, TarHelpers.GetDefaultMode(entryType), DateTimeOffset.UtcNow, entryType); 66_header = new TarHeader(format, compatibleEntryType, other._header);
146 references to _header
System.Formats.Tar (146)
System\Formats\Tar\GnuTarEntry.cs (18)
36_header._aTime = _header._mTime; // mtime was set in base constructor 37_header._cTime = _header._mTime; 51_header._aTime = gnuOther.AccessTime; 52_header._cTime = gnuOther.ChangeTime; 53_header._gnuUnusedBytes = other._header._gnuUnusedBytes; 62changedATime = TarHelpers.TryGetDateTimeOffsetFromTimestampString(paxOther._header.ExtendedAttributes, TarHeader.PaxEaATime, out DateTimeOffset aTime); 65_header._aTime = aTime; 68changedCTime = TarHelpers.TryGetDateTimeOffsetFromTimestampString(paxOther._header.ExtendedAttributes, TarHeader.PaxEaCTime, out DateTimeOffset cTime); 71_header._cTime = cTime; 82_header._aTime = now; 86_header._cTime = now; 98get => _header._aTime; 101_header._aTime = value; 111get => _header._cTime; 114_header._cTime = value;
System\Formats\Tar\PaxGlobalExtendedAttributesTarEntry.cs (2)
31_header.InitializeExtendedAttributesWithExisting(globalExtendedAttributes); 37public IReadOnlyDictionary<string, string> GlobalExtendedAttributes => _readOnlyGlobalExtendedAttributes ??= _header.ExtendedAttributes.AsReadOnly();
System\Formats\Tar\PaxTarEntry.cs (18)
55_header._prefix = string.Empty; 57Debug.Assert(_header._mTime != default); 96_header._prefix = string.Empty; 97_header.InitializeExtendedAttributesWithExisting(extendedAttributes); 99Debug.Assert(_header._mTime != default); 112if (other._header._format is TarEntryFormat.Ustar or TarEntryFormat.Pax) 114_header._prefix = other._header._prefix; 119_header.InitializeExtendedAttributesWithExisting(paxOther.ExtendedAttributes); 125_header.ExtendedAttributes[TarHeader.PaxEaATime] = TarHelpers.GetTimestampStringFromDateTimeOffset(gnuOther.AccessTime); 126_header.ExtendedAttributes[TarHeader.PaxEaCTime] = TarHelpers.GetTimestampStringFromDateTimeOffset(gnuOther.ChangeTime); 151public IReadOnlyDictionary<string, string> ExtendedAttributes => _readOnlyExtendedAttributes ??= _header.ExtendedAttributes.AsReadOnly(); 161Debug.Assert(!useMTime || (useMTime && _header._mTime != default)); 162bool containsATime = _header.ExtendedAttributes.ContainsKey(TarHeader.PaxEaATime); 163bool containsCTime = _header.ExtendedAttributes.ContainsKey(TarHeader.PaxEaCTime); 167string secondsFromEpochString = TarHelpers.GetTimestampStringFromDateTimeOffset(useMTime ? _header._mTime : DateTimeOffset.UtcNow); 171_header.ExtendedAttributes[TarHeader.PaxEaATime] = secondsFromEpochString; 176_header.ExtendedAttributes[TarHeader.PaxEaCTime] = secondsFromEpochString;
System\Formats\Tar\PosixTarEntry.cs (26)
25_header._uName = string.Empty; 26_header._gName = string.Empty; 27_header._devMajor = 0; 28_header._devMinor = 0; 37Debug.Assert(other._header._uName != null); 38Debug.Assert(other._header._gName != null); 39_header._uName = other._header._uName; 40_header._gName = other._header._gName; 41_header._devMajor = other._header._devMajor; 42_header._devMinor = other._header._devMinor; 44_header._uName ??= string.Empty; 45_header._gName ??= string.Empty; 56get => _header._devMajor; 59if (_header._typeFlag is not TarEntryType.BlockDevice and not TarEntryType.CharacterDevice) 70_header._devMajor = value; 82get => _header._devMinor; 85if (_header._typeFlag is not TarEntryType.BlockDevice and not TarEntryType.CharacterDevice) 96_header._devMinor = value; 107get => _header._gName ?? string.Empty; 111_header._gName = value; 122get => _header._uName ?? string.Empty; 126_header._uName = value;
System\Formats\Tar\TarEntry.cs (25)
24protected bool FormatIsOctalOnly => _header._format is TarEntryFormat.V7 or TarEntryFormat.Ustar; 66_header = new TarHeader(format, compatibleEntryType, other._header); 72public int Checksum => _header._checksum; 77public TarEntryType EntryType => _header._typeFlag; 82public TarEntryFormat Format => _header._format; 90get => _header._gid; 91set => _header._gid = value; 101get => _header._mTime; 108_header._mTime = value; 116public long Length => _header._dataStream != null ? _header._dataStream.Length : _header._size; 126get => _header._linkName ?? string.Empty; 129if (_header._typeFlag is not TarEntryType.HardLink and not TarEntryType.SymbolicLink) 134_header._linkName = value; 146get => (UnixFileMode)(_header._mode & (int)TarHelpers.ValidUnixFileModes); 153_header._mode = (int)value; 162get => _header._name; 166_header._name = value; 176get => _header._uid; 177set => _header._uid = value; 255get => _header._dataStream; 278_header._dataStream?.Dispose(); 280_header._dataStream = value; 291public long DataOffset => _header._dataOffset;
System\Formats\Tar\TarEntry.Unix.cs (4)
17Interop.CheckIo(Interop.Sys.CreateBlockDevice(destinationFileName, (uint)Mode, (uint)_header._devMajor, (uint)_header._devMinor), destinationFileName); 24Interop.CheckIo(Interop.Sys.CreateCharacterDevice(destinationFileName, (uint)Mode, (uint)_header._devMajor, (uint)_header._devMinor), destinationFileName);
System\Formats\Tar\TarReader.cs (15)
209Debug.Assert(_previouslyReadEntry._header._endOfHeaderAndDataAndBlockAlignment > 0); 210_archiveStream.Position = _previouslyReadEntry._header._endOfHeaderAndDataAndBlockAlignment; 212else if (_previouslyReadEntry._header._size > 0) 219if (_previouslyReadEntry._header._dataStream is not SubReadStream dataStream) 228if (dataStream.Position < (_previouslyReadEntry._header._size - 1)) 230long bytesToSkip = _previouslyReadEntry._header._size - dataStream.Position; 235TarHelpers.SkipBlockAlignmentPadding(_archiveStream, _previouslyReadEntry._header._size); 251Debug.Assert(_previouslyReadEntry._header._endOfHeaderAndDataAndBlockAlignment > 0); 252_archiveStream.Position = _previouslyReadEntry._header._endOfHeaderAndDataAndBlockAlignment; 254else if (_previouslyReadEntry._header._size > 0) 261if (_previouslyReadEntry._header._dataStream is not SubReadStream dataStream) 270if (dataStream.Position < (_previouslyReadEntry._header._size - 1)) 272long bytesToSkip = _previouslyReadEntry._header._size - dataStream.Position; 277await TarHelpers.SkipBlockAlignmentPaddingAsync(_archiveStream, _previouslyReadEntry._header._size, cancellationToken).ConfigureAwait(false); 622if (entry._header._dataStream is SubReadStream dataStream)
System\Formats\Tar\TarWriter.cs (21)
169entry._header._dataStream?.Dispose(); 180if (entry._header._dataStream != null) 182await entry._header._dataStream.DisposeAsync().ConfigureAwait(false); 224ValidateEntryLinkName(entry._header._typeFlag, entry._header._linkName); 273ValidateEntryLinkName(entry._header._typeFlag, entry._header._linkName); 287entry._header.WriteAsV7(_archiveStream, buffer); 291entry._header.WriteAsUstar(_archiveStream, buffer); 295if (entry._header._typeFlag is TarEntryType.GlobalExtendedAttributes) 297entry._header.WriteAsPaxGlobalExtendedAttributes(_archiveStream, buffer, _nextGlobalExtendedAttributesEntryNumber++); 301entry._header.WriteAsPax(_archiveStream, buffer); 306entry._header.WriteAsGnu(_archiveStream, buffer); 328TarEntryFormat.V7 => entry._header.WriteAsV7Async(_archiveStream, buffer, cancellationToken), 329TarEntryFormat.Ustar => entry._header.WriteAsUstarAsync(_archiveStream, buffer, cancellationToken), 330TarEntryFormat.Pax when entry._header._typeFlag is TarEntryType.GlobalExtendedAttributes => entry._header.WriteAsPaxGlobalExtendedAttributesAsync(_archiveStream, buffer, _nextGlobalExtendedAttributesEntryNumber++, cancellationToken), 331TarEntryFormat.Pax => entry._header.WriteAsPaxAsync(_archiveStream, buffer, cancellationToken), 332TarEntryFormat.Gnu => entry._header.WriteAsGnuAsync(_archiveStream, buffer, cancellationToken), 381if (!_archiveStream.CanSeek && entry._header._dataStream != null && !entry._header._dataStream.CanSeek)
System\Formats\Tar\TarWriter.Unix.cs (12)
61entry._header._devMajor = (int)major; 62entry._header._devMinor = (int)minor; 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; 73entry._header._uid = (int)status.Uid; 79entry._header._uName = uName; 82entry._header._gid = (int)status.Gid; 90entry._header._gName = gName; 99Debug.Assert(entry._header._dataStream == null); 100entry._header._dataStream = new FileStream(fullPath, FileMode.Open, FileAccess.Read, FileShare.Read, 4096, fileOptions);
System\Formats\Tar\UstarTarEntry.cs (5)
35_header._prefix = string.Empty; 47if (other._header._format is TarEntryFormat.Ustar or TarEntryFormat.Pax) 49_header._prefix = other._header._prefix; 53_header._prefix = string.Empty;