Пример #1
0
 /// <summary>
 /// Get the binary data representing this instance.
 /// </summary>
 /// <returns>The raw binary data representing this instance.</returns>
 public byte[] GetData()
 {
     using (var ms = new MemoryStream())
         using (var helperStream = new ZipHelperStream(ms))
         {
             helperStream.IsStreamOwner = false;
             helperStream.WriteByte((byte)_flags);     // Flags
             if ((_flags & Flags.ModificationTime) != 0)
             {
                 var span    = _modificationTime.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime();
                 var seconds = (int)span.TotalSeconds;
                 helperStream.WriteLEInt(seconds);
             }
             if ((_flags & Flags.AccessTime) != 0)
             {
                 var span    = _lastAccessTime.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime();
                 var seconds = (int)span.TotalSeconds;
                 helperStream.WriteLEInt(seconds);
             }
             if ((_flags & Flags.CreateTime) != 0)
             {
                 var span    = _createTime.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime();
                 var seconds = (int)span.TotalSeconds;
                 helperStream.WriteLEInt(seconds);
             }
             return(ms.ToArray());
         }
 }
Пример #2
0
 /// <summary>
 /// Get the binary data representing this instance.
 /// </summary>
 /// <returns>The raw binary data representing this instance.</returns>
 public byte[] GetData()
 {
     using (var ms = new MemoryStream())
         using (var helperStream = new ZipHelperStream(ms))
         {
             helperStream.IsStreamOwner = false;
             helperStream.WriteLEInt(0);                   // Reserved
             helperStream.WriteLEShort(1);                 // Tag
             helperStream.WriteLEShort(24);                // Length = 3 x 8.
             helperStream.WriteLELong(_lastModificationTime.ToFileTime());
             helperStream.WriteLELong(_lastAccessTime.ToFileTime());
             helperStream.WriteLELong(_createTime.ToFileTime());
             return(ms.ToArray());
         }
 }
Пример #3
0
		/// <summary>
		/// Get the binary data representing this instance.
		/// </summary>
		/// <returns>The raw binary data representing this instance.</returns>
		public byte[] GetData()
		{
			using (var ms = new MemoryStream())
			using (var helperStream = new ZipHelperStream(ms))
			{
				helperStream.IsStreamOwner = false;
				helperStream.WriteLEInt(0);       // Reserved
				helperStream.WriteLEShort(1);     // Tag
				helperStream.WriteLEShort(24);    // Length = 3 x 8.
				helperStream.WriteLELong(_lastModificationTime.ToFileTime());
				helperStream.WriteLELong(_lastAccessTime.ToFileTime());
				helperStream.WriteLELong(_createTime.ToFileTime());
				return ms.ToArray();
			}
		}
Пример #4
0
	    /// <summary>
	    /// Get the binary data representing this instance.
	    /// </summary>
	    /// <returns>The raw binary data representing this instance.</returns>
	    public byte[] GetData()
	    {
	        using (var ms = new MemoryStream())
	        using (var helperStream = new ZipHelperStream(ms))
	        {
	            helperStream.IsStreamOwner = false;
	            helperStream.WriteByte((byte)_flags);     // Flags
	            if ( (_flags & Flags.ModificationTime) != 0) {
	                var span = _modificationTime.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime();
	                var seconds = (int)span.TotalSeconds;
	                helperStream.WriteLEInt(seconds);
	            }
	            if ( (_flags & Flags.AccessTime) != 0) {
	                var span = _lastAccessTime.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime();
	                var seconds = (int)span.TotalSeconds;
	                helperStream.WriteLEInt(seconds);
	            }
	            if ( (_flags & Flags.CreateTime) != 0) {
	                var span = _createTime.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime();
	                var seconds = (int)span.TotalSeconds;
	                helperStream.WriteLEInt(seconds);
	            }
	            return ms.ToArray();
	        }
	    }