93 references to FieldLengths
System.Formats.Tar (93)
System\Formats\Tar\FieldLocations.cs (30)
12
internal const ushort Mode =
FieldLengths
.Name;
13
internal const ushort Uid = Mode +
FieldLengths
.Mode;
14
internal const ushort Gid = Uid +
FieldLengths
.Uid;
15
internal const ushort Size = Gid +
FieldLengths
.Gid;
16
internal const ushort MTime = Size +
FieldLengths
.Size;
17
internal const ushort Checksum = MTime +
FieldLengths
.MTime;
18
internal const ushort TypeFlag = Checksum +
FieldLengths
.Checksum;
19
internal const ushort LinkName = TypeFlag +
FieldLengths
.TypeFlag;
23
internal const ushort Magic = LinkName +
FieldLengths
.LinkName;
24
internal const ushort Version = Magic +
FieldLengths
.Magic;
25
internal const ushort UName = Version +
FieldLengths
.Version;
26
internal const ushort GName = UName +
FieldLengths
.UName;
27
internal const ushort DevMajor = GName +
FieldLengths
.GName;
28
internal const ushort DevMinor = DevMajor +
FieldLengths
.DevMajor;
32
internal const ushort Prefix = DevMinor +
FieldLengths
.DevMinor;
36
internal const ushort ATime = DevMinor +
FieldLengths
.DevMinor;
37
internal const ushort CTime = ATime +
FieldLengths
.ATime;
38
internal const ushort Offset = CTime +
FieldLengths
.CTime;
39
internal const ushort LongNames = Offset +
FieldLengths
.Offset;
40
internal const ushort Unused = LongNames +
FieldLengths
.LongNames;
41
internal const ushort Sparse = Unused +
FieldLengths
.Unused;
42
internal const ushort IsExtended = Sparse +
FieldLengths
.Sparse;
43
internal const ushort RealSize = IsExtended +
FieldLengths
.IsExtended;
45
internal const ushort GnuUnused = CTime +
FieldLengths
.CTime;
49
internal const ushort V7Padding = LinkName +
FieldLengths
.LinkName;
50
internal const ushort PosixPadding = Prefix +
FieldLengths
.Prefix;
51
internal const ushort GnuPadding = RealSize +
FieldLengths
.RealSize;
53
internal const ushort V7Data = V7Padding +
FieldLengths
.V7Padding;
54
internal const ushort PosixData = PosixPadding +
FieldLengths
.PosixPadding;
55
internal const ushort GnuData = GnuPadding +
FieldLengths
.GnuPadding;
System\Formats\Tar\PosixTarEntry.cs (2)
114
_header.SyncStringExtendedAttribute(TarHeader.PaxEaGName, value,
FieldLengths
.GName);
130
_header.SyncStringExtendedAttribute(TarHeader.PaxEaUName, value,
FieldLengths
.UName);
System\Formats\Tar\TarHeader.cs (2)
260
AddOrRemoveStringField(ea, PaxEaGName, _gName,
FieldLengths
.GName, removeIfUnneeded);
261
AddOrRemoveStringField(ea, PaxEaUName, _uName,
FieldLengths
.UName, removeIfUnneeded);
System\Formats\Tar\TarHeader.Read.cs (20)
409
ReadOnlySpan<byte> spanChecksum = buffer.Slice(FieldLocations.Checksum,
FieldLengths
.Checksum);
441
long size = TarHelpers.ParseNumeric<long>(buffer.Slice(FieldLocations.Size,
FieldLengths
.Size));
449
name: TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.Name,
FieldLengths
.Name)),
450
mode: TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.Mode,
FieldLengths
.Mode)),
451
mTime: ParseAsTimestamp(buffer.Slice(FieldLocations.MTime,
FieldLengths
.MTime)),
456
_uid = TarHelpers.ParseUidGid(buffer.Slice(FieldLocations.Uid,
FieldLengths
.Uid)),
457
_gid = TarHelpers.ParseUidGid(buffer.Slice(FieldLocations.Gid,
FieldLengths
.Gid)),
458
_linkName = TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.LinkName,
FieldLengths
.LinkName))
499
calculatedChecksum += (byte)' ' *
FieldLengths
.Checksum;
502
calculatedChecksum += Checksum(buffer.Slice(FieldLocations.Checksum +
FieldLengths
.Checksum, TarHelpers.RecordSize - (FieldLocations.Checksum +
FieldLengths
.Checksum)));
511
ReadOnlySpan<byte> magic = buffer.Slice(FieldLocations.Magic,
FieldLengths
.Magic);
550
ReadOnlySpan<byte> version = buffer.Slice(FieldLocations.Version,
FieldLengths
.Version);
600
_uName = TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.UName,
FieldLengths
.UName));
601
_gName = TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.GName,
FieldLengths
.GName));
608
_devMajor = TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.DevMajor,
FieldLengths
.DevMajor));
611
_devMinor = TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.DevMinor,
FieldLengths
.DevMinor));
619
_aTime = ParseAsTimestamp(buffer.Slice(FieldLocations.ATime,
FieldLengths
.ATime));
621
_cTime = ParseAsTimestamp(buffer.Slice(FieldLocations.CTime,
FieldLengths
.CTime));
643
_prefix = TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.Prefix,
FieldLengths
.Prefix));
System\Formats\Tar\TarHeader.Write.cs (39)
336
private bool IsLinkNameTooLongForRegularField() => _linkName != null && (Encoding.UTF8.GetByteCount(_linkName) + 1) >
FieldLengths
.LinkName;
340
private bool IsNameTooLongForRegularField() => (Encoding.UTF8.GetByteCount(_name)) >
FieldLengths
.Name;
529
if (encodedLength >
FieldLengths
.Name)
536
int utf16NameTruncatedLength = GetUtf16TruncatedTextLength(name,
FieldLengths
.Name);
540
return WriteAsUtf8String(name, buffer.Slice(FieldLocations.Name,
FieldLengths
.Name));
550
const int MaxPathName =
FieldLengths
.Prefix + 1 +
FieldLengths
.Name;
562
if (pathNameBytes.Length <=
FieldLengths
.Name)
564
return WriteLeftAlignedBytesAndGetChecksum(pathNameBytes, buffer.Slice(FieldLocations.Name,
FieldLengths
.Name));
584
while (prefix.Length - name.Length >
FieldLengths
.Prefix)
596
if (prefix.Length <=
FieldLengths
.Prefix && name.Length <=
FieldLengths
.Name)
600
int checksum = WriteLeftAlignedBytesAndGetChecksum(prefix, buffer.Slice(FieldLocations.Prefix,
FieldLengths
.Prefix));
601
checksum += WriteLeftAlignedBytesAndGetChecksum(name, buffer.Slice(FieldLocations.Name,
FieldLengths
.Name));
621
checksum += FormatNumeric(_mode, buffer.Slice(FieldLocations.Mode,
FieldLengths
.Mode));
624
checksum += FormatUidGid(_uid, buffer.Slice(FieldLocations.Uid,
FieldLengths
.Uid));
625
checksum += FormatUidGid(_gid, buffer.Slice(FieldLocations.Gid,
FieldLengths
.Gid));
629
checksum += FormatNumeric(_size, buffer.Slice(FieldLocations.Size,
FieldLengths
.Size));
632
checksum += WriteAsTimestamp(_mTime, buffer.Slice(FieldLocations.MTime,
FieldLengths
.MTime));
642
if (GetUtf8TextLength(linkName) >
FieldLengths
.LinkName)
649
int truncatedLength = GetUtf16TruncatedTextLength(linkName,
FieldLengths
.LinkName);
653
checksum += WriteAsUtf8String(linkName, buffer.Slice(FieldLocations.LinkName,
FieldLengths
.LinkName));
678
int checksum = WriteLeftAlignedBytesAndGetChecksum(UstarMagicBytes, buffer.Slice(FieldLocations.Magic,
FieldLengths
.Magic));
679
checksum += WriteLeftAlignedBytesAndGetChecksum(UstarVersionBytes, buffer.Slice(FieldLocations.Version,
FieldLengths
.Version));
686
int checksum = WriteLeftAlignedBytesAndGetChecksum(GnuMagicBytes, buffer.Slice(FieldLocations.Magic,
FieldLengths
.Magic));
687
checksum += WriteLeftAlignedBytesAndGetChecksum(GnuVersionBytes, buffer.Slice(FieldLocations.Version,
FieldLengths
.Version));
700
if (GetUtf8TextLength(uName) >
FieldLengths
.UName)
707
int truncatedLength = GetUtf16TruncatedTextLength(uName,
FieldLengths
.UName);
711
checksum += WriteAsUtf8String(uName, buffer.Slice(FieldLocations.UName,
FieldLengths
.UName));
718
if (GetUtf8TextLength(gName) >
FieldLengths
.GName)
725
int truncatedLength = GetUtf16TruncatedTextLength(gName,
FieldLengths
.GName);
729
checksum += WriteAsUtf8String(gName, buffer.Slice(FieldLocations.GName,
FieldLengths
.GName));
734
checksum += FormatNumeric(_devMajor, buffer.Slice(FieldLocations.DevMajor,
FieldLengths
.DevMajor));
739
checksum += FormatNumeric(_devMinor, buffer.Slice(FieldLocations.DevMinor,
FieldLengths
.DevMinor));
752
checksum += WriteAsTimestamp(_aTime, buffer.Slice(FieldLocations.ATime,
FieldLengths
.ATime));
753
checksum += WriteAsTimestamp(_cTime, buffer.Slice(FieldLocations.CTime,
FieldLengths
.CTime));
922
Span<byte> converted = stackalloc byte[
FieldLengths
.Checksum];
926
Span<byte> destination = buffer.Slice(FieldLocations.Checksum,
FieldLengths
.Checksum);
1168
return result.Length >=
FieldLengths
.Name ?