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