91 references to FieldLengths
System.Formats.Tar (91)
System\Formats\Tar\FieldLocations.cs (30)
12internal const ushort Mode = FieldLengths.Name; 13internal const ushort Uid = Mode + FieldLengths.Mode; 14internal const ushort Gid = Uid + FieldLengths.Uid; 15internal const ushort Size = Gid + FieldLengths.Gid; 16internal const ushort MTime = Size + FieldLengths.Size; 17internal const ushort Checksum = MTime + FieldLengths.MTime; 18internal const ushort TypeFlag = Checksum + FieldLengths.Checksum; 19internal const ushort LinkName = TypeFlag + FieldLengths.TypeFlag; 23internal const ushort Magic = LinkName + FieldLengths.LinkName; 24internal const ushort Version = Magic + FieldLengths.Magic; 25internal const ushort UName = Version + FieldLengths.Version; 26internal const ushort GName = UName + FieldLengths.UName; 27internal const ushort DevMajor = GName + FieldLengths.GName; 28internal const ushort DevMinor = DevMajor + FieldLengths.DevMajor; 32internal const ushort Prefix = DevMinor + FieldLengths.DevMinor; 36internal const ushort ATime = DevMinor + FieldLengths.DevMinor; 37internal const ushort CTime = ATime + FieldLengths.ATime; 38internal const ushort Offset = CTime + FieldLengths.CTime; 39internal const ushort LongNames = Offset + FieldLengths.Offset; 40internal const ushort Unused = LongNames + FieldLengths.LongNames; 41internal const ushort Sparse = Unused + FieldLengths.Unused; 42internal const ushort IsExtended = Sparse + FieldLengths.Sparse; 43internal const ushort RealSize = IsExtended + FieldLengths.IsExtended; 45internal const ushort GnuUnused = CTime + FieldLengths.CTime; 49internal const ushort V7Padding = LinkName + FieldLengths.LinkName; 50internal const ushort PosixPadding = Prefix + FieldLengths.Prefix; 51internal const ushort GnuPadding = RealSize + FieldLengths.RealSize; 53internal const ushort V7Data = V7Padding + FieldLengths.V7Padding; 54internal const ushort PosixData = PosixPadding + FieldLengths.PosixPadding; 55internal const ushort GnuData = GnuPadding + FieldLengths.GnuPadding;
System\Formats\Tar\TarHeader.Read.cs (17)
365Span<byte> spanChecksum = buffer.Slice(FieldLocations.Checksum, FieldLengths.Checksum); 377long size = (long)TarHelpers.ParseOctal<ulong>(buffer.Slice(FieldLocations.Size, FieldLengths.Size)); 386name: TarHelpers.GetTrimmedUtf8String(buffer.Slice(FieldLocations.Name, FieldLengths.Name)), 387mode: (int)TarHelpers.ParseOctal<uint>(buffer.Slice(FieldLocations.Mode, FieldLengths.Mode)), 388mTime: TarHelpers.GetDateTimeOffsetFromSecondsSinceEpoch((long)TarHelpers.ParseOctal<ulong>(buffer.Slice(FieldLocations.MTime, FieldLengths.MTime))), 393_uid = (int)TarHelpers.ParseOctal<uint>(buffer.Slice(FieldLocations.Uid, FieldLengths.Uid)), 394_gid = (int)TarHelpers.ParseOctal<uint>(buffer.Slice(FieldLocations.Gid, FieldLengths.Gid)), 395_linkName = TarHelpers.GetTrimmedUtf8String(buffer.Slice(FieldLocations.LinkName, FieldLengths.LinkName)) 430Span<byte> magic = buffer.Slice(FieldLocations.Magic, FieldLengths.Magic); 469Span<byte> version = buffer.Slice(FieldLocations.Version, FieldLengths.Version); 519_uName = TarHelpers.GetTrimmedUtf8String(buffer.Slice(FieldLocations.UName, FieldLengths.UName)); 520_gName = TarHelpers.GetTrimmedUtf8String(buffer.Slice(FieldLocations.GName, FieldLengths.GName)); 527_devMajor = (int)TarHelpers.ParseOctal<uint>(buffer.Slice(FieldLocations.DevMajor, FieldLengths.DevMajor)); 530_devMinor = (int)TarHelpers.ParseOctal<uint>(buffer.Slice(FieldLocations.DevMinor, FieldLengths.DevMinor)); 539long aTime = (long)TarHelpers.ParseOctal<ulong>(buffer.Slice(FieldLocations.ATime, FieldLengths.ATime)); 542long cTime = (long)TarHelpers.ParseOctal<ulong>(buffer.Slice(FieldLocations.CTime, FieldLengths.CTime)); 552_prefix = TarHelpers.GetTrimmedUtf8String(buffer.Slice(FieldLocations.Prefix, FieldLengths.Prefix));
System\Formats\Tar\TarHeader.Write.cs (44)
355if (_linkName != null && Encoding.UTF8.GetByteCount(_linkName) > FieldLengths.LinkName) 364if (Encoding.UTF8.GetByteCount(_name) > FieldLengths.Name) 391if (_linkName != null && Encoding.UTF8.GetByteCount(_linkName) > FieldLengths.LinkName) 400if (Encoding.UTF8.GetByteCount(_name) > FieldLengths.Name) 517if (encodedLength > FieldLengths.Name) 524int utf16NameTruncatedLength = GetUtf16TruncatedTextLength(name, FieldLengths.Name); 528return WriteAsUtf8String(name, buffer.Slice(FieldLocations.Name, FieldLengths.Name)); 538const int MaxPathName = FieldLengths.Prefix + 1 + FieldLengths.Name; 550if (pathNameBytes.Length <= FieldLengths.Name) 552return WriteLeftAlignedBytesAndGetChecksum(pathNameBytes, buffer.Slice(FieldLocations.Name, FieldLengths.Name)); 572while (prefix.Length - name.Length > FieldLengths.Prefix) 584if (prefix.Length <= FieldLengths.Prefix && name.Length <= FieldLengths.Name) 588int checksum = WriteLeftAlignedBytesAndGetChecksum(prefix, buffer.Slice(FieldLocations.Prefix, FieldLengths.Prefix)); 589checksum += WriteLeftAlignedBytesAndGetChecksum(name, buffer.Slice(FieldLocations.Name, FieldLengths.Name)); 609checksum += FormatOctal(_mode, buffer.Slice(FieldLocations.Mode, FieldLengths.Mode)); 614checksum += FormatOctal(_uid, buffer.Slice(FieldLocations.Uid, FieldLengths.Uid)); 619checksum += FormatOctal(_gid, buffer.Slice(FieldLocations.Gid, FieldLengths.Gid)); 626checksum += FormatOctal(_size, buffer.Slice(FieldLocations.Size, FieldLengths.Size)); 640checksum += WriteAsTimestamp(_mTime, buffer.Slice(FieldLocations.MTime, FieldLengths.MTime)); 650if (GetUtf8TextLength(linkName) > FieldLengths.LinkName) 657int truncatedLength = GetUtf16TruncatedTextLength(linkName, FieldLengths.LinkName); 661checksum += WriteAsUtf8String(linkName, buffer.Slice(FieldLocations.LinkName, FieldLengths.LinkName)); 686int checksum = WriteLeftAlignedBytesAndGetChecksum(UstarMagicBytes, buffer.Slice(FieldLocations.Magic, FieldLengths.Magic)); 687checksum += WriteLeftAlignedBytesAndGetChecksum(UstarVersionBytes, buffer.Slice(FieldLocations.Version, FieldLengths.Version)); 694int checksum = WriteLeftAlignedBytesAndGetChecksum(GnuMagicBytes, buffer.Slice(FieldLocations.Magic, FieldLengths.Magic)); 695checksum += WriteLeftAlignedBytesAndGetChecksum(GnuVersionBytes, buffer.Slice(FieldLocations.Version, FieldLengths.Version)); 708if (GetUtf8TextLength(uName) > FieldLengths.UName) 715int truncatedLength = GetUtf16TruncatedTextLength(uName, FieldLengths.UName); 719checksum += WriteAsUtf8String(uName, buffer.Slice(FieldLocations.UName, FieldLengths.UName)); 726if (GetUtf8TextLength(gName) > FieldLengths.GName) 733int truncatedLength = GetUtf16TruncatedTextLength(gName, FieldLengths.GName); 737checksum += WriteAsUtf8String(gName, buffer.Slice(FieldLocations.GName, FieldLengths.GName)); 742checksum += FormatOctal(_devMajor, buffer.Slice(FieldLocations.DevMajor, FieldLengths.DevMajor)); 747checksum += FormatOctal(_devMinor, buffer.Slice(FieldLocations.DevMinor, FieldLengths.DevMinor)); 756int checksum = WriteAsTimestamp(_aTime, buffer.Slice(FieldLocations.ATime, FieldLengths.ATime)); 757checksum += WriteAsTimestamp(_cTime, buffer.Slice(FieldLocations.CTime, FieldLengths.CTime)); 761checksum += WriteLeftAlignedBytesAndGetChecksum(_gnuUnusedBytes, buffer.Slice(FieldLocations.GnuUnused, FieldLengths.AllGnuUnused)); 910TryAddStringField(ExtendedAttributes, PaxEaGName, _gName, FieldLengths.GName); 911TryAddStringField(ExtendedAttributes, PaxEaUName, _uName, FieldLengths.UName); 951Span<byte> converted = stackalloc byte[FieldLengths.Checksum]; 955Span<byte> destination = buffer.Slice(FieldLocations.Checksum, FieldLengths.Checksum); 1089return result.Length >= FieldLengths.Name ?