Пример #1
0
 /// <summary>
 /// Open a literal data packet for the passed in FileInfo object.
 /// </summary>
 /// <param name="writer">The writer we want the packet in.</param>
 /// <param name="format">The format we are using.</param>
 /// <param name="fileInfo">The FileInfo object containg the packet details.</param>
 public PgpLiteralMessageGenerator(
     IPacketWriter writer,
     PgpDataFormat format,
     FileInfo fileInfo)
     : this(writer, format, fileInfo.Name, fileInfo.LastWriteTime)
 {
 }
Пример #2
0
 public LiteralDataPacket(
     PgpDataFormat format,
     string fileName,
     DateTime modificationTime)
 {
     this.format           = format;
     this.fileName         = Encoding.UTF8.GetBytes(fileName);
     this.modificationTime = new DateTimeOffset(modificationTime, TimeSpan.Zero).ToUnixTimeSeconds();
 }
Пример #3
0
        /// <summary>
        /// Open a literal data packet.
        /// </summary>
        /// <param name="writer">The writer we want the packet in.</param>
        /// <param name="format">The format we are using.</param>
        /// <param name="name">The name of the 'file'.</param>
        /// <param name="modificationTime">The time of last modification we want stored.</param>
        public PgpLiteralMessageGenerator(
            IPacketWriter writer,
            PgpDataFormat format,
            string name,
            DateTime modificationTime)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            var packet = new LiteralDataPacket(format, name, modificationTime);

            this.outputStream = writer.GetPacketStream(packet);
            this.writer       = writer;
        }
Пример #4
0
        internal LiteralDataPacket(Stream bcpgIn)
        {
            format = (PgpDataFormat)bcpgIn.ReadByte();
            int len = bcpgIn.ReadByte();

            fileName = new byte[len];
            if (len > 0 && bcpgIn.ReadFully(fileName) != len)
            {
                throw new EndOfStreamException();
            }

            modificationTime =
                ((uint)bcpgIn.ReadByte() << 24) |
                ((uint)bcpgIn.ReadByte() << 16) |
                ((uint)bcpgIn.ReadByte() << 8) |
                (uint)bcpgIn.ReadByte();
        }
Пример #5
0
 public Stream CreateLiteral(PgpDataFormat format, FileInfo fileInfo)
 {
     return(new PgpLiteralMessageGenerator(Open(), format, fileInfo).GetStream());
 }
Пример #6
0
 public Stream CreateLiteral(PgpDataFormat format, string name, DateTime modificationTime)
 {
     return(new PgpLiteralMessageGenerator(Open(), format, name, modificationTime).GetStream());
 }