93 references to FieldLengths
System.Formats.Tar (93)
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\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)
254AddOrRemoveStringField(ea, PaxEaGName, _gName, FieldLengths.GName, removeIfUnneeded); 255AddOrRemoveStringField(ea, PaxEaUName, _uName, FieldLengths.UName, removeIfUnneeded);
System\Formats\Tar\TarHeader.Read.cs (20)
328ReadOnlySpan<byte> spanChecksum = buffer.Slice(FieldLocations.Checksum, FieldLengths.Checksum); 360long size = TarHelpers.ParseNumeric<long>(buffer.Slice(FieldLocations.Size, FieldLengths.Size)); 368name: TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.Name, FieldLengths.Name)), 369mode: TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.Mode, FieldLengths.Mode)), 370mTime: ParseAsTimestamp(buffer.Slice(FieldLocations.MTime, FieldLengths.MTime)), 375_uid = TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.Uid, FieldLengths.Uid)), 376_gid = TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.Gid, FieldLengths.Gid)), 377_linkName = TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.LinkName, FieldLengths.LinkName)) 418calculatedChecksum += (byte)' ' * FieldLengths.Checksum; 421calculatedChecksum += Checksum(buffer.Slice(FieldLocations.Checksum + FieldLengths.Checksum, TarHelpers.RecordSize - (FieldLocations.Checksum + FieldLengths.Checksum))); 430ReadOnlySpan<byte> magic = buffer.Slice(FieldLocations.Magic, FieldLengths.Magic); 469ReadOnlySpan<byte> version = buffer.Slice(FieldLocations.Version, FieldLengths.Version); 519_uName = TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.UName, FieldLengths.UName)); 520_gName = TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.GName, FieldLengths.GName)); 527_devMajor = TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.DevMajor, FieldLengths.DevMajor)); 530_devMinor = TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.DevMinor, FieldLengths.DevMinor)); 538_aTime = ParseAsTimestamp(buffer.Slice(FieldLocations.ATime, FieldLengths.ATime)); 540_cTime = ParseAsTimestamp(buffer.Slice(FieldLocations.CTime, FieldLengths.CTime)); 562_prefix = TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.Prefix, FieldLengths.Prefix));
System\Formats\Tar\TarHeader.Write.cs (39)
217private bool IsLinkNameTooLongForRegularField() => _linkName != null && (Encoding.UTF8.GetByteCount(_linkName) + 1) > FieldLengths.LinkName; 221private bool IsNameTooLongForRegularField() => (Encoding.UTF8.GetByteCount(_name)) > FieldLengths.Name; 373if (encodedLength > FieldLengths.Name) 380int utf16NameTruncatedLength = GetUtf16TruncatedTextLength(name, FieldLengths.Name); 384return WriteAsUtf8String(name, buffer.Slice(FieldLocations.Name, FieldLengths.Name)); 394const int MaxPathName = FieldLengths.Prefix + 1 + FieldLengths.Name; 406if (pathNameBytes.Length <= FieldLengths.Name) 408return WriteLeftAlignedBytesAndGetChecksum(pathNameBytes, buffer.Slice(FieldLocations.Name, FieldLengths.Name)); 428while (prefix.Length - name.Length > FieldLengths.Prefix) 440if (prefix.Length <= FieldLengths.Prefix && name.Length <= FieldLengths.Name) 444int checksum = WriteLeftAlignedBytesAndGetChecksum(prefix, buffer.Slice(FieldLocations.Prefix, FieldLengths.Prefix)); 445checksum += WriteLeftAlignedBytesAndGetChecksum(name, buffer.Slice(FieldLocations.Name, FieldLengths.Name)); 465checksum += FormatNumeric(_mode, buffer.Slice(FieldLocations.Mode, FieldLengths.Mode)); 470checksum += FormatNumeric(_uid, buffer.Slice(FieldLocations.Uid, FieldLengths.Uid)); 475checksum += FormatNumeric(_gid, buffer.Slice(FieldLocations.Gid, FieldLengths.Gid)); 480checksum += FormatNumeric(_size, buffer.Slice(FieldLocations.Size, FieldLengths.Size)); 483checksum += WriteAsTimestamp(_mTime, buffer.Slice(FieldLocations.MTime, FieldLengths.MTime)); 493if (GetUtf8TextLength(linkName) > FieldLengths.LinkName) 500int truncatedLength = GetUtf16TruncatedTextLength(linkName, FieldLengths.LinkName); 504checksum += WriteAsUtf8String(linkName, buffer.Slice(FieldLocations.LinkName, FieldLengths.LinkName)); 529int checksum = WriteLeftAlignedBytesAndGetChecksum(UstarMagicBytes, buffer.Slice(FieldLocations.Magic, FieldLengths.Magic)); 530checksum += WriteLeftAlignedBytesAndGetChecksum(UstarVersionBytes, buffer.Slice(FieldLocations.Version, FieldLengths.Version)); 537int checksum = WriteLeftAlignedBytesAndGetChecksum(GnuMagicBytes, buffer.Slice(FieldLocations.Magic, FieldLengths.Magic)); 538checksum += WriteLeftAlignedBytesAndGetChecksum(GnuVersionBytes, buffer.Slice(FieldLocations.Version, FieldLengths.Version)); 551if (GetUtf8TextLength(uName) > FieldLengths.UName) 558int truncatedLength = GetUtf16TruncatedTextLength(uName, FieldLengths.UName); 562checksum += WriteAsUtf8String(uName, buffer.Slice(FieldLocations.UName, FieldLengths.UName)); 569if (GetUtf8TextLength(gName) > FieldLengths.GName) 576int truncatedLength = GetUtf16TruncatedTextLength(gName, FieldLengths.GName); 580checksum += WriteAsUtf8String(gName, buffer.Slice(FieldLocations.GName, FieldLengths.GName)); 585checksum += FormatNumeric(_devMajor, buffer.Slice(FieldLocations.DevMajor, FieldLengths.DevMajor)); 590checksum += FormatNumeric(_devMinor, buffer.Slice(FieldLocations.DevMinor, FieldLengths.DevMinor)); 603checksum += WriteAsTimestamp(_aTime, buffer.Slice(FieldLocations.ATime, FieldLengths.ATime)); 604checksum += WriteAsTimestamp(_cTime, buffer.Slice(FieldLocations.CTime, FieldLengths.CTime)); 750Span<byte> converted = stackalloc byte[FieldLengths.Checksum]; 754Span<byte> destination = buffer.Slice(FieldLocations.Checksum, FieldLengths.Checksum); 976return result.Length >= FieldLengths.Name ?