291 references to TarEntryFormat
Microsoft.Build.Tasks.Core (19)
TarDirectory.cs (19)
89
/// This parameter is optional; when empty, <see cref="
TarEntryFormat
.Pax"/> is used.
92
/// This is deliberately typed as <see cref="string"/> rather than <see cref="
TarEntryFormat
"/>. When .NET
189
if (!TryGetEntryFormat(out
TarEntryFormat
format))
312
/// contents. This mirrors the entry naming of <see cref="TarFile.CreateFromDirectory(string, Stream, bool,
TarEntryFormat
)"/>
334
/// <see cref="TarFile.CreateFromDirectory(string, Stream, bool,
TarEntryFormat
)"/> and avoiding reparse-point cycles.
419
/// Resolves <see cref="Format"/> to a <see cref="
TarEntryFormat
"/>. An empty value selects the
420
/// <see cref="
TarEntryFormat
.Pax"/> default.
423
private bool TryGetEntryFormat(out
TarEntryFormat
format)
425
format =
TarEntryFormat
.Pax;
432
if (!Enum.TryParse(Format, ignoreCase: true, out
TarEntryFormat
parsed) || !Enum.IsDefined(typeof(
TarEntryFormat
), parsed))
439
format = parsed ==
TarEntryFormat
.Unknown ?
TarEntryFormat
.Pax : parsed;
474
private static async System.Threading.Tasks.Task WriteStampedEntryAsync(TarWriter writer,
TarEntryFormat
format, FileSystemInfo info, string entryName, DateTimeOffset timestamp, CancellationToken cancellationToken)
483
(_, _,
TarEntryFormat
.V7) => TarEntryType.V7RegularFile,
522
private static TarEntry CreateEntry(
TarEntryFormat
format, TarEntryType entryType, string entryName) => format switch
524
TarEntryFormat
.V7 => new V7TarEntry(entryType, entryName),
525
TarEntryFormat
.Ustar => new UstarTarEntry(entryType, entryName),
526
TarEntryFormat
.Gnu => new GnuTarEntry(entryType, entryName),
Microsoft.NET.Build.Containers (7)
Layer.cs (1)
106
using (TarWriter writer = new(layerStream,
TarEntryFormat
.Pax, leaveOpen: true))
LocalDaemons\ContainerArchive.cs (3)
61
using TarWriter writer = new(imageStream,
TarEntryFormat
.Pax, leaveOpen: true);
81
using TarWriter writer = new(imageStream,
TarEntryFormat
.Pax, leaveOpen: true);
96
using TarWriter writer = new(imageStream,
TarEntryFormat
.Pax, leaveOpen: true);
LocalDaemons\DockerCli.cs (3)
312
using TarWriter writer = new(imageStream,
TarEntryFormat
.Pax, leaveOpen: true);
419
using TarWriter writer = new(imageStream,
TarEntryFormat
.Pax, leaveOpen: true);
515
using TarWriter writer = new(imageStream,
TarEntryFormat
.Pax, leaveOpen: true);
System.Formats.Tar (265)
System\Formats\Tar\GnuTarEntry.cs (14)
11
/// <remarks>Even though the <see cref="
TarEntryFormat
.Gnu"/> format is not POSIX compatible, it implements and supports the Unix-specific fields that were defined in the POSIX IEEE P1003.1 standard from 1988: <c>devmajor</c>, <c>devminor</c>, <c>gname</c> and <c>uname</c>.</remarks>
16
: base(header, readerOfOrigin,
TarEntryFormat
.Gnu)
26
/// <para>When creating an instance of <see cref="GnuTarEntry"/> using this constructor, the <see cref="AccessTime"/> and <see cref="ChangeTime"/> properties are set to <see langword="default" />, which in the entry header <c>atime</c> and <c>ctime</c> fields is written as null bytes. This ensures compatibility with other tools that are unable to read the <c>atime</c> and <c>ctime</c> in <see cref="
TarEntryFormat
.Gnu"/> entries, as these two fields are not POSIX compatible because other formats expect the <c>prefix</c> field in the same header location where <see cref="
TarEntryFormat
.Gnu"/> writes <c>atime</c> and <c>ctime</c>.</para>
38
: base(entryType, entryName,
TarEntryFormat
.Gnu, isGea: false)
45
/// <para>When creating an instance of <see cref="GnuTarEntry"/> using this constructor, if <paramref name="other"/> is <see cref="
TarEntryFormat
.Gnu"/> or <see cref="
TarEntryFormat
.Pax"/>, then the <see cref="AccessTime"/> and <see cref="ChangeTime"/> properties are set to the same values set in <paramref name="other"/>. But if <paramref name="other"/> is of any other format, then <see cref="AccessTime"/> and <see cref="ChangeTime"/> are set to <see langword="default" />, which in the entry header <c>atime</c> and <c>ctime</c> fields is written as null bytes. This ensures compatibility with other tools that are unable to read the <c>atime</c> and <c>ctime</c> in <see cref="
TarEntryFormat
.Gnu"/> entries, as these two fields are not POSIX compatible because other formats expect the <c>prefix</c> field in the same header location where <see cref="
TarEntryFormat
.Gnu"/> writes <c>atime</c> and <c>ctime</c>.</para>
51
: base(other,
TarEntryFormat
.Gnu)
72
/// <para>Setting the value of this property to a value other than <see langword="default"/> may cause problems with other tools that read TAR files, because the <see cref="
TarEntryFormat
.Gnu"/> format writes the <c>atime</c> field where other formats would normally read and write the <c>prefix</c> field in the header. You should only set this property to something other than <see langword="default"/> if this entry will be read by tools that know how to correctly interpret the <c>atime</c> field of the <see cref="
TarEntryFormat
.Gnu"/> format.</para>
88
/// <para>Setting the value of this property to a value other than <see langword="default"/> may cause problems with other tools that read TAR files, because the <see cref="
TarEntryFormat
.Gnu"/> format writes the <c>ctime</c> field where other formats would normally read and write the <c>prefix</c> field in the header. You should only set this property to something other than <see langword="default"/> if this entry will be read by tools that know how to correctly interpret the <c>ctime</c> field of the <see cref="
TarEntryFormat
.Gnu"/> format.</para>
System\Formats\Tar\PaxGlobalExtendedAttributesTarEntry.cs (2)
16
: base(header, readerOfOrigin,
TarEntryFormat
.Pax)
26
: base(TarEntryType.GlobalExtendedAttributes, nameof(PaxGlobalExtendedAttributesTarEntry),
TarEntryFormat
.Pax, isGea: true) // Name == name of type for lack of a better temporary name until the entry is written
System\Formats\Tar\PaxTarEntry.cs (6)
17
: base(header, readerOfOrigin,
TarEntryFormat
.Pax)
38
: base(entryType, entryName,
TarEntryFormat
.Pax, isGea: false)
67
: base(entryType, entryName,
TarEntryFormat
.Pax, isGea: false)
89
: base(other,
TarEntryFormat
.Pax)
91
if (other._header._format is
TarEntryFormat
.Ustar or
TarEntryFormat
.Pax)
System\Formats\Tar\PosixTarEntry.cs (11)
9
/// Abstract class that represents a tar entry from an archive of a format that is based on the POSIX IEEE P1003.1 standard from 1988. This includes the formats <see cref="
TarEntryFormat
.Ustar"/> (represented by the <see cref="UstarTarEntry"/> class), <see cref="
TarEntryFormat
.Pax"/> (represented by the <see cref="PaxTarEntry"/> class) and <see cref="
TarEntryFormat
.Gnu"/> (represented by the <see cref="GnuTarEntry"/> class).
12
/// Even though the <see cref="
TarEntryFormat
.Gnu"/> format is not POSIX compatible, it implements and supports the Unix-specific fields that were defined in that POSIX standard.</remarks>
16
internal PosixTarEntry(TarHeader header, TarReader readerOfOrigin,
TarEntryFormat
format)
22
internal PosixTarEntry(TarEntryType entryType, string entryName,
TarEntryFormat
format, bool isGea)
32
internal PosixTarEntry(TarEntry other,
TarEntryFormat
format)
53
/// <exception cref="ArgumentOutOfRangeException">The value is negative, or larger than 2097151 when using <see cref="
TarEntryFormat
.V7"/> or <see cref="
TarEntryFormat
.Ustar"/>.</exception>
80
/// <exception cref="ArgumentOutOfRangeException">The value is negative, or larger than 2097151 when using <see cref="
TarEntryFormat
.V7"/> or <see cref="
TarEntryFormat
.Ustar"/>.</exception>
System\Formats\Tar\TarEntry.cs (14)
15
/// <remarks>All the properties exposed by this class are supported by the <see cref="
TarEntryFormat
.V7"/>, <see cref="
TarEntryFormat
.Ustar"/>, <see cref="
TarEntryFormat
.Pax"/> and <see cref="
TarEntryFormat
.Gnu"/> formats.</remarks>
24
protected bool FormatIsOctalOnly => _header._format is
TarEntryFormat
.V7 or
TarEntryFormat
.Ustar;
27
internal TarEntry(TarHeader header, TarReader readerOfOrigin,
TarEntryFormat
format)
37
internal TarEntry(TarEntryType entryType, string entryName,
TarEntryFormat
format, bool isGea)
53
internal TarEntry(TarEntry other,
TarEntryFormat
format)
82
public
TarEntryFormat
Format => _header._format;
102
/// <exception cref="ArgumentOutOfRangeException">The specified value is larger than <see cref="DateTimeOffset.UnixEpoch"/> when using <see cref="
TarEntryFormat
.V7"/> or <see cref="
TarEntryFormat
.Ustar"/>.</exception>
120
/// <remarks>The entry type that commonly contains data is <see cref="TarEntryType.RegularFile"/> (or <see cref="TarEntryType.V7RegularFile"/> in the <see cref="
TarEntryFormat
.V7"/> format). Other uncommon entry types that can also contain data are: <see cref="TarEntryType.ContiguousFile"/>, <see cref="TarEntryType.DirectoryList"/>, <see cref="TarEntryType.MultiVolume"/> and <see cref="TarEntryType.SparseFile"/>.</remarks>
265
/// <exception cref="InvalidOperationException">Setting a data section is not supported because the <see cref="EntryType"/> is not <see cref="TarEntryType.RegularFile"/> (or <see cref="TarEntryType.V7RegularFile"/> for an archive of <see cref="
TarEntryFormat
.V7"/> format).</exception>
System\Formats\Tar\TarEntryType.cs (10)
14
/// <para>This entry type is specific to the <see cref="
TarEntryFormat
.Ustar"/>, <see cref="
TarEntryFormat
.Pax"/> and <see cref="
TarEntryFormat
.Gnu"/> formats.</para>
46
/// <para>This entry type is specific to the <see cref="
TarEntryFormat
.Gnu"/> format, and is treated as a <see cref="RegularFile"/> entry type.</para>
62
/// <para>This entry type is specific to the <see cref="
TarEntryFormat
.Gnu"/> format, and is treated as a <see cref="Directory"/> entry type that contains a data section.</para>
77
/// <para>This entry type is specific to the <see cref="
TarEntryFormat
.Gnu"/> format and is not supported for writing.</para>
82
/// <para>This entry type is specific to the <see cref="
TarEntryFormat
.V7"/> format.</para>
87
/// <para>This entry type is specific to the <see cref="
TarEntryFormat
.Gnu"/> format. It is considered unsafe and is ignored by other tools.</para>
92
/// <para>This entry type is specific to the <see cref="
TarEntryFormat
.Gnu"/> format and is not supported for writing.</para>
97
/// <para>This entry type is specific to the <see cref="
TarEntryFormat
.Gnu"/> format and is not supported for writing.</para>
System\Formats\Tar\TarFile.cs (23)
19
/// <inheritdoc cref="CreateFromDirectory(string, Stream, bool,
TarEntryFormat
)" />
21
=> CreateFromDirectory(sourceDirectoryName, destination, includeBaseDirectory,
TarEntryFormat
.Pax);
35
/// <exception cref="ArgumentOutOfRangeException"><paramref name="format"/> is either <see cref="
TarEntryFormat
.Unknown"/>, or not one of the other enum values.</exception>
37
public static void CreateFromDirectory(string sourceDirectoryName, Stream destination, bool includeBaseDirectory,
TarEntryFormat
format)
55
/// <exception cref="ArgumentOutOfRangeException"><see cref="TarWriterOptions.Format"/> is either <see cref="
TarEntryFormat
.Unknown"/>, or not one of the other enum values.</exception>
79
/// <inheritdoc cref="CreateFromDirectoryAsync(string, Stream, bool,
TarEntryFormat
, CancellationToken)" />
81
=> CreateFromDirectoryAsync(sourceDirectoryName, destination, includeBaseDirectory,
TarEntryFormat
.Pax, cancellationToken);
97
/// <exception cref="ArgumentOutOfRangeException"><paramref name="format"/> is either <see cref="
TarEntryFormat
.Unknown"/>, or not one of the other enum values.</exception>
99
public static Task CreateFromDirectoryAsync(string sourceDirectoryName, Stream destination, bool includeBaseDirectory,
TarEntryFormat
format, CancellationToken cancellationToken = default)
119
/// <exception cref="ArgumentOutOfRangeException"><see cref="TarWriterOptions.Format"/> is either <see cref="
TarEntryFormat
.Unknown"/>, or not one of the other enum values.</exception>
147
/// <inheritdoc cref="CreateFromDirectory(string, string, bool,
TarEntryFormat
)" />
149
=> CreateFromDirectory(sourceDirectoryName, destinationFileName, includeBaseDirectory,
TarEntryFormat
.Pax);
161
/// <exception cref="ArgumentOutOfRangeException"><paramref name="format"/> is either <see cref="
TarEntryFormat
.Unknown"/>, or not one of the other enum values.</exception>
163
public static void CreateFromDirectory(string sourceDirectoryName, string destinationFileName, bool includeBaseDirectory,
TarEntryFormat
format)
179
/// <exception cref="ArgumentOutOfRangeException"><see cref="TarWriterOptions.Format"/> is either <see cref="
TarEntryFormat
.Unknown"/>, or not one of the other enum values.</exception>
202
/// <inheritdoc cref="CreateFromDirectoryAsync(string, string, bool,
TarEntryFormat
, CancellationToken)" />
204
=> CreateFromDirectoryAsync(sourceDirectoryName, destinationFileName, includeBaseDirectory,
TarEntryFormat
.Pax, cancellationToken);
218
/// <exception cref="ArgumentOutOfRangeException"><paramref name="format"/> is either <see cref="
TarEntryFormat
.Unknown"/>, or not one of the other enum values.</exception>
220
public static Task CreateFromDirectoryAsync(string sourceDirectoryName, string destinationFileName, bool includeBaseDirectory,
TarEntryFormat
format, CancellationToken cancellationToken = default)
238
/// <exception cref="ArgumentOutOfRangeException"><see cref="TarWriterOptions.Format"/> is either <see cref="
TarEntryFormat
.Unknown"/>, or not one of the other enum values.</exception>
738
private static void ValidateFormat(
TarEntryFormat
format)
740
if (format is <
TarEntryFormat
.V7 or >
TarEntryFormat
.Gnu)
System\Formats\Tar\TarHeader.cs (14)
57
internal
TarEntryFormat
_format;
110
internal TarHeader(
TarEntryFormat
format, string name = "", int mode = 0, DateTimeOffset mTime = default, TarEntryType typeFlag = TarEntryType.RegularFile)
124
internal TarHeader(
TarEntryFormat
format, TarEntryType typeFlag, TarHeader other)
167
private static string GetMagicForFormat(
TarEntryFormat
format) => format switch
169
TarEntryFormat
.Ustar or
TarEntryFormat
.Pax => UstarMagic,
170
TarEntryFormat
.Gnu => GnuMagic,
174
private static string GetVersionForFormat(
TarEntryFormat
format) => format switch
176
TarEntryFormat
.Ustar or
TarEntryFormat
.Pax => UstarVersion,
177
TarEntryFormat
.Gnu => GnuVersion,
192
if (_format ==
TarEntryFormat
.Pax && _ea is not null)
209
if (_format ==
TarEntryFormat
.Pax && _ea is not null)
221
if (_format ==
TarEntryFormat
.Pax && _ea is not null)
System\Formats\Tar\TarHeader.Read.cs (24)
22
internal static async ValueTask<TarHeader?> TryGetNextHeaderCoreAsync<TAdapter>(Stream archiveStream, bool copyData,
TarEntryFormat
initialFormat, bool processDataBlock, CancellationToken cancellationToken)
46
private static TarHeader? TryReadAttributes(
TarEntryFormat
initialFormat, ReadOnlySpan<byte> buffer, Stream archiveStream)
55
if (header._format !=
TarEntryFormat
.V7)
63
Debug.Assert(header._format is
TarEntryFormat
.Ustar or
TarEntryFormat
.Pax or
TarEntryFormat
.Gnu);
64
if (header._format is
TarEntryFormat
.Ustar or
TarEntryFormat
.Pax)
74
else if (header._format ==
TarEntryFormat
.Gnu)
404
private static TarHeader? TryReadCommonAttributes(ReadOnlySpan<byte> buffer,
TarEntryFormat
initialFormat)
461
if (header._format ==
TarEntryFormat
.Unknown)
466
TarEntryType.GlobalExtendedAttributes =>
TarEntryFormat
.Pax,
473
TarEntryType.TapeVolume =>
TarEntryFormat
.Gnu,
476
TarEntryType.V7RegularFile =>
TarEntryFormat
.V7,
482
_ => (header._typeFlag == TarEntryType.RegularFile) ?
TarEntryFormat
.Ustar :
TarEntryFormat
.V7
516
_format =
TarEntryFormat
.V7;
524
_format =
TarEntryFormat
.Gnu;
529
if (_format ==
TarEntryFormat
.V7)
532
_format =
TarEntryFormat
.Ustar;
545
if (_format ==
TarEntryFormat
.V7)
553
case
TarEntryFormat
.Ustar or
TarEntryFormat
.Pax:
571
case
TarEntryFormat
.Gnu:
System\Formats\Tar\TarHeader.Write.cs (59)
36
private void WriteWithSeekableDataStream(
TarEntryFormat
format, Stream archiveStream, Span<byte> buffer)
38
Debug.Assert(format is >
TarEntryFormat
.Unknown and <=
TarEntryFormat
.Gnu);
52
private async ValueTask WriteWithSeekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
format, Stream archiveStream, Memory<byte> buffer, CancellationToken cancellationToken)
55
Debug.Assert(format is >
TarEntryFormat
.Unknown and <=
TarEntryFormat
.Gnu);
68
private void WriteWithUnseekableDataStream(
TarEntryFormat
format, Stream destinationStream, Span<byte> buffer, bool shouldAdvanceToEnd)
78
TarEntryFormat
.V7 => FieldLocations.V7Data,
79
TarEntryFormat
.Ustar or
TarEntryFormat
.Pax => FieldLocations.PosixData,
80
TarEntryFormat
.Gnu => FieldLocations.GnuData,
107
private async ValueTask WriteWithUnseekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
format, Stream destinationStream, Memory<byte> buffer, bool shouldAdvanceToEnd, CancellationToken cancellationToken)
120
TarEntryFormat
.V7 => FieldLocations.V7Data,
121
TarEntryFormat
.Ustar or
TarEntryFormat
.Pax => FieldLocations.PosixData,
122
TarEntryFormat
.Gnu => FieldLocations.GnuData,
162
TarEntryType actualEntryType = TarHelpers.GetCorrectTypeFlagForFormat(
TarEntryFormat
.V7, _typeFlag);
172
TarEntryType actualEntryType = TarHelpers.GetCorrectTypeFlagForFormat(
TarEntryFormat
.Ustar, _typeFlag);
209
WriteWithUnseekableDataStream(
TarEntryFormat
.V7, archiveStream, buffer, shouldAdvanceToEnd: true);
213
WriteWithSeekableDataStream(
TarEntryFormat
.V7, archiveStream, buffer);
224
return WriteWithUnseekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
.V7, archiveStream, buffer, shouldAdvanceToEnd: true, cancellationToken);
228
return WriteWithSeekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
.V7, archiveStream, buffer, cancellationToken);
237
WriteWithUnseekableDataStream(
TarEntryFormat
.Ustar, archiveStream, buffer, shouldAdvanceToEnd: true);
241
WriteWithSeekableDataStream(
TarEntryFormat
.Ustar, archiveStream, buffer);
252
return WriteWithUnseekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
.Ustar, archiveStream, buffer, shouldAdvanceToEnd: true, cancellationToken);
256
return WriteWithSeekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
.Ustar, archiveStream, buffer, cancellationToken);
266
TarHeader extendedAttributesHeader = new(
TarEntryFormat
.Pax);
271
WriteWithUnseekableDataStream(
TarEntryFormat
.Pax, tempStream, buffer, shouldAdvanceToEnd: false);
288
WriteWithSeekableDataStream(
TarEntryFormat
.Pax, archiveStream, buffer);
299
TarHeader extendedAttributesHeader = new(
TarEntryFormat
.Pax);
306
await WriteWithUnseekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
.Pax, tempStream, buffer, shouldAdvanceToEnd: false, cancellationToken).ConfigureAwait(false);
330
await WriteWithSeekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
.Pax, archiveStream, buffer, cancellationToken).ConfigureAwait(false);
351
longLinkHeader.WriteWithSeekableDataStream(
TarEntryFormat
.Gnu, archiveStream, buffer);
359
longPathHeader.WriteWithSeekableDataStream(
TarEntryFormat
.Gnu, archiveStream, buffer);
365
WriteWithUnseekableDataStream(
TarEntryFormat
.Gnu, archiveStream, buffer, shouldAdvanceToEnd: true);
369
WriteWithSeekableDataStream(
TarEntryFormat
.Gnu, archiveStream, buffer);
383
await longLinkHeader.WriteWithSeekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
.Gnu, archiveStream, buffer, cancellationToken).ConfigureAwait(false);
392
await longPathHeader.WriteWithSeekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
.Gnu, archiveStream, buffer, cancellationToken).ConfigureAwait(false);
399
await WriteWithUnseekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
.Gnu, archiveStream, buffer, shouldAdvanceToEnd: true, cancellationToken).ConfigureAwait(false);
403
await WriteWithSeekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
.Gnu, archiveStream, buffer, cancellationToken).ConfigureAwait(false);
432
return new(
TarEntryFormat
.Gnu)
452
tmpChecksum += WriteCommonFields(buffer, TarHelpers.GetCorrectTypeFlagForFormat(
TarEntryFormat
.Gnu, _typeFlag));
465
WriteWithSeekableDataStream(
TarEntryFormat
.Pax, archiveStream, buffer);
473
return WriteWithSeekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
.Pax, archiveStream, buffer, cancellationToken);
494
tmpChecksum += WriteCommonFields(buffer, TarHelpers.GetCorrectTypeFlagForFormat(
TarEntryFormat
.Pax, _typeFlag));
502
private void WriteFieldsToBuffer(
TarEntryFormat
format, Span<byte> buffer)
506
case
TarEntryFormat
.V7:
509
case
TarEntryFormat
.Ustar:
512
case
TarEntryFormat
.Pax:
515
case
TarEntryFormat
.Gnu:
530
if (_format is
TarEntryFormat
.V7)
650
if (_format is not
TarEntryFormat
.Pax and not
TarEntryFormat
.Gnu)
708
if (_format is not
TarEntryFormat
.Pax)
726
if (_format is not
TarEntryFormat
.Pax)
1039
if (isOctalRange || _format ==
TarEntryFormat
.Pax)
1043
else if (_format ==
TarEntryFormat
.Gnu)
1065
if (isOctalRange || _format ==
TarEntryFormat
.Pax)
1069
else if (_format ==
TarEntryFormat
.Gnu)
System\Formats\Tar\TarHelpers.cs (10)
198
internal static TarEntryType GetRegularFileEntryTypeForFormat(
TarEntryFormat
format) => format is
TarEntryFormat
.V7 ? TarEntryType.V7RegularFile : TarEntryType.RegularFile;
203
internal static TarEntryType GetCorrectTypeFlagForFormat(
TarEntryFormat
format, TarEntryType entryType)
205
if (format is
TarEntryFormat
.V7)
305
internal static void ThrowIfEntryTypeNotSupported(TarEntryType entryType,
TarEntryFormat
archiveFormat, [CallerArgumentExpression(nameof(entryType))] string? paramName = null)
309
case
TarEntryFormat
.V7:
320
case
TarEntryFormat
.Ustar:
334
case
TarEntryFormat
.Pax:
352
case
TarEntryFormat
.Gnu:
377
case
TarEntryFormat
.Unknown:
System\Formats\Tar\TarReader.cs (13)
99
/// <para>More than one Global Extended Attributes Entry was found in the current <see cref="
TarEntryFormat
.Pax"/> archive.</para>
101
/// <para>Two or more Extended Attributes entries were found consecutively in the current <see cref="
TarEntryFormat
.Pax"/> archive.</para></exception>
136
/// <para>More than one Global Extended Attributes Entry was found in the current <see cref="
TarEntryFormat
.Pax"/> archive.</para>
138
/// <para>Two or more Extended Attributes entries were found consecutively in the current <see cref="
TarEntryFormat
.Pax"/> archive.</para></exception>
218
TarEntryFormat
.Pax => header._typeFlag is TarEntryType.GlobalExtendedAttributes ?
220
TarEntryFormat
.Gnu => new GnuTarEntry(header, this),
221
TarEntryFormat
.Ustar => new UstarTarEntry(header, this),
222
TarEntryFormat
.V7 or
TarEntryFormat
.Unknown or _ => new V7TarEntry(header, this),
249
TarHeader? header = await TarHeader.TryGetNextHeaderCoreAsync<TAdapter>(_archiveStream, copyData,
TarEntryFormat
.Unknown, processDataBlock: true, cancellationToken).ConfigureAwait(false);
288
TarHeader? actualHeader = await TarHeader.TryGetNextHeaderCoreAsync<TAdapter>(_archiveStream, copyData,
TarEntryFormat
.Pax, processDataBlock: false, cancellationToken).ConfigureAwait(false);
318
TarHeader? secondHeader = await TarHeader.TryGetNextHeaderCoreAsync<TAdapter>(_archiveStream, copyData,
TarEntryFormat
.Gnu, processDataBlock: true, cancellationToken).ConfigureAwait(false);
337
TarHeader? thirdHeader = await TarHeader.TryGetNextHeaderCoreAsync<TAdapter>(_archiveStream, copyData,
TarEntryFormat
.Gnu, processDataBlock: true, cancellationToken).ConfigureAwait(false);
System\Formats\Tar\TarWriter.cs (45)
28
/// <remarks>When using this constructor, <see cref="
TarEntryFormat
.Pax"/> is used as the default format of the entries written to the archive using the <see cref="WriteEntry(string, string?)"/> method.</remarks>
31
/// <remarks>The <see cref="
TarEntryFormat
.Pax"/> format is the default format as it is the most flexible and POSIX compatible. This is the only format with which <see cref="TarWriter"/> reads and stores <c>atime</c> and <c>ctime</c> when creating entries from filesystem entries.</remarks>
33
: this(archiveStream,
TarEntryFormat
.Pax, leaveOpen: false)
38
/// Initializes a <see cref="TarWriter"/> instance that can write tar entries to the specified stream and optionally leaves the stream open upon disposal of this instance. When using this constructor, the format of the resulting archive is <see cref="
TarEntryFormat
.Pax"/>.
44
/// <remarks>The <see cref="
TarEntryFormat
.Pax"/> format is the default format as it is the most flexible and POSIX compatible. This is the only format with which <see cref="TarWriter"/> reads and stores <c>atime</c> and <c>ctime</c> when creating entries from filesystem entries.</remarks>
46
: this(archiveStream,
TarEntryFormat
.Pax, leaveOpen)
55
/// <param name="format">The format to use when calling <see cref="WriteEntry(string, string?)"/>. The default value is <see cref="
TarEntryFormat
.Pax"/>.</param>
58
/// <remarks>The recommended format is <see cref="
TarEntryFormat
.Pax"/> for its flexibility.</remarks>
61
/// <exception cref="ArgumentOutOfRangeException"><paramref name="format"/> is either <see cref="
TarEntryFormat
.Unknown"/>, or not one of the other enum values.</exception>
62
/// <remarks>The <see cref="
TarEntryFormat
.Pax"/> format is the default for the other <see cref="TarWriter"/> constructors. This is the recommended format as it is the most flexible and POSIX compatible. This is the only format with which <see cref="TarWriter"/> reads and stores <c>atime</c> and <c>ctime</c> when creating entries from filesystem entries.</remarks>
63
public TarWriter(Stream archiveStream,
TarEntryFormat
format =
TarEntryFormat
.Pax, bool leaveOpen = false)
68
private static TarWriterOptions CreateOptionsForFormat(
TarEntryFormat
format)
70
if (format is not
TarEntryFormat
.V7 and not
TarEntryFormat
.Ustar and not
TarEntryFormat
.Pax and not
TarEntryFormat
.Gnu)
110
public
TarEntryFormat
Format { get; }
155
/// <para>The entry will be created using the format specified in the <see cref="TarWriter(Stream,
TarEntryFormat
, bool)"/> constructor, or will use <see cref="
TarEntryFormat
.Pax"/> if other constructors are used.</para>
156
/// <para>If the format is <see cref="
TarEntryFormat
.Pax"/>, the <c>atime</c> and <c>ctime</c> from the file will be stored in the <see cref="PaxTarEntry.ExtendedAttributes"/> dictionary. If the format is <see cref="
TarEntryFormat
.Gnu"/>, this method will not set a value for <see cref="GnuTarEntry.AccessTime"/> and <see cref="GnuTarEntry.ChangeTime"/> because most TAR tools do not support these fields for this format.</para>
177
/// <para>The entry will be created using the format specified in the <see cref="TarWriter(Stream,
TarEntryFormat
, bool)"/> constructor, or will use <see cref="
TarEntryFormat
.Pax"/> if other constructors are used.</para>
178
/// <para>If the format is <see cref="
TarEntryFormat
.Pax"/>, the <c>atime</c> and <c>ctime</c> from the file will be stored in the <see cref="PaxTarEntry.ExtendedAttributes"/> dictionary. If the format is <see cref="
TarEntryFormat
.Gnu"/>, this method will not set a value for <see cref="GnuTarEntry.AccessTime"/> and <see cref="GnuTarEntry.ChangeTime"/> because most TAR tools do not support these fields for this format.</para>
214
/// <para><see cref="
TarEntryFormat
.V7"/></para>
223
/// <para><see cref="
TarEntryFormat
.Ustar"/>, <see cref="
TarEntryFormat
.Pax"/> and <see cref="
TarEntryFormat
.Gnu"/></para>
242
/// <para>To ensure an entry preserves the <c>atime</c> and <c>ctime</c> values and it is readable by other tools, it is recommended to convert the entry to <see cref="PaxTarEntry"/> instead. In that format, the two values get stored in the <see cref="PaxTarEntry.ExtendedAttributes"/>. The <see cref="
TarEntryFormat
.Pax"/> format is used as the default format by <see cref="TarWriter"/> as it is the most flexible and POSIX compatible.</para>
262
/// <para><see cref="
TarEntryFormat
.V7"/></para>
271
/// <para><see cref="
TarEntryFormat
.Ustar"/>, <see cref="
TarEntryFormat
.Pax"/> and <see cref="
TarEntryFormat
.Gnu"/></para>
309
case
TarEntryFormat
.V7:
313
case
TarEntryFormat
.Ustar:
317
case
TarEntryFormat
.Pax:
328
case
TarEntryFormat
.Gnu:
333
Debug.Assert(entry.Format ==
TarEntryFormat
.Unknown, "Missing format handler");
351
TarEntryFormat
.V7 => entry._header.WriteAsV7CoreAsync<TAdapter>(_archiveStream, buffer, cancellationToken),
352
TarEntryFormat
.Ustar => entry._header.WriteAsUstarCoreAsync<TAdapter>(_archiveStream, buffer, cancellationToken),
353
TarEntryFormat
.Pax when entry._header._typeFlag is TarEntryType.GlobalExtendedAttributes => entry._header.WriteAsPaxGlobalExtendedAttributesCoreAsync<TAdapter>(_archiveStream, buffer, _nextGlobalExtendedAttributesEntryNumber++, cancellationToken),
354
TarEntryFormat
.Pax => entry._header.WriteAsPaxCoreAsync<TAdapter>(_archiveStream, buffer, cancellationToken),
355
TarEntryFormat
.Gnu => entry._header.WriteAsGnuCoreAsync<TAdapter>(_archiveStream, buffer, cancellationToken),
System\Formats\Tar\TarWriter.Unix.cs (4)
67
TarEntryFormat
.V7 => new V7TarEntry(entryType, entryName),
68
TarEntryFormat
.Ustar => new UstarTarEntry(entryType, entryName),
69
TarEntryFormat
.Pax => new PaxTarEntry(entryType, entryName),
70
TarEntryFormat
.Gnu => new GnuTarEntry(entryType, entryName),
System\Formats\Tar\TarWriterOptions.cs (8)
14
/// <value>The default value is <see cref="
TarEntryFormat
.Pax"/>.</value>
15
/// <exception cref="ArgumentOutOfRangeException"><paramref name="value"/> is either <see cref="
TarEntryFormat
.Unknown"/>, or not one of the other enum values.</exception>
16
public
TarEntryFormat
Format
21
if (value is not
TarEntryFormat
.V7 and not
TarEntryFormat
.Ustar and not
TarEntryFormat
.Pax and not
TarEntryFormat
.Gnu)
27
} =
TarEntryFormat
.Pax;
System\Formats\Tar\UstarTarEntry.cs (5)
13
: base(header, readerOfOrigin,
TarEntryFormat
.Ustar)
33
: base(entryType, entryName,
TarEntryFormat
.Ustar, isGea: false)
45
: base(other,
TarEntryFormat
.Ustar)
47
if (other._header._format is
TarEntryFormat
.Ustar or
TarEntryFormat
.Pax)
System\Formats\Tar\V7TarEntry.cs (3)
13
: base(header, readerOfOrigin,
TarEntryFormat
.V7)
28
: base(entryType, entryName,
TarEntryFormat
.V7, isGea: false)
39
: base(other,
TarEntryFormat
.V7)