Пример #1
0
 public void PutNextEntry(TarEntry entry)
 {
     if (entry == null)
     {
         throw new ArgumentNullException(nameof(entry));
     }
     if (entry.TarHeader.Name.Length >= 100)
     {
         TarHeader header = new TarHeader
         {
             TypeFlag  = 0x4c,
             UserId    = 0, GroupId = 0,
             GroupName = "",
             UserName  = "",
             LinkName  = "",
             Size      = entry.TarHeader.Name.Length
         };
         header.Name += "././@LongLink";
         header.WriteHeader(_blockBuffer);
         _buffer.WriteBlock(_blockBuffer);
         int nameOffset = 0;
         while (nameOffset < entry.TarHeader.Name.Length)
         {
             Array.Clear(_blockBuffer, 0, _blockBuffer.Length);
             TarHeader.GetAsciiBytes(entry.TarHeader.Name, nameOffset, _blockBuffer, 0, 0x200);
             nameOffset += 0x200;
             _buffer.WriteBlock(_blockBuffer);
         }
     }
     entry.WriteEntryHeader(_blockBuffer);
     _buffer.WriteBlock(_blockBuffer);
     _currBytes = 0L;
     _currSize  = entry.IsDirectory ? 0L : entry.Size;
 }
Пример #2
0
 public void WriteEntryHeader(byte[] outBuffer)
 {
     _header.WriteHeader(outBuffer);
 }
Пример #3
0
 public void PutNextEntry(TarEntry entry)
 {
     if (entry == null)
     {
         throw new ArgumentNullException(nameof(entry));
     }
     if (entry.TarHeader.Name.Length >= 100)
     {
         TarHeader header = new TarHeader
         {
             TypeFlag = 0x4c,  
             UserId = 0, GroupId = 0, 
             GroupName = "", 
             UserName = "", 
             LinkName = "", 
             Size = entry.TarHeader.Name.Length
         };
         header.Name += "././@LongLink";
         header.WriteHeader(_blockBuffer);
         _buffer.WriteBlock(_blockBuffer);
         int nameOffset = 0;
         while (nameOffset < entry.TarHeader.Name.Length)
         {
             Array.Clear(_blockBuffer, 0, _blockBuffer.Length);
             TarHeader.GetAsciiBytes(entry.TarHeader.Name, nameOffset, _blockBuffer, 0, 0x200);
             nameOffset += 0x200;
             _buffer.WriteBlock(_blockBuffer);
         }
     }
     entry.WriteEntryHeader(_blockBuffer);
     _buffer.WriteBlock(_blockBuffer);
     _currBytes = 0L;
     _currSize = entry.IsDirectory ? 0L : entry.Size;
 }