예제 #1
0
 /// <summary>
 ///     Called when bytes are read.
 /// </summary>
 /// <param name="bytesMoved">int with the number of bytes</param>
 protected virtual void OnBytesRead(int bytesMoved)
 {
     if (bytesMoved != 0 && BytesRead != null)
     {
         long length   = 0;
         long position = 0;
         if (_innerStream.CanSeek)
         {
             length   = _innerStream.Length;
             position = _innerStream.Position;
         }
         var args = new ProgressStreamReport(bytesMoved, length, position, true);
         BytesRead?.Invoke(this, args);
     }
 }
예제 #2
0
        /// <summary>
        ///     Called when bytes are moved
        /// </summary>
        /// <param name="bytesMoved">int with the number of bytes which are moved</param>
        /// <param name="isRead">true if the bytes were read, false if written</param>
        protected virtual void OnBytesMoved(int bytesMoved, bool isRead)
        {
            if (bytesMoved == 0 || BytesMoved is null)
            {
                return;
            }

            long length   = 0;
            long position = 0;

            if (_innerStream.CanSeek)
            {
                length   = _innerStream.Length;
                position = _innerStream.Position;
            }
            var args = new ProgressStreamReport(bytesMoved, length, position, isRead);

            BytesMoved?.Invoke(this, args);
        }
		/// <summary>
		///     Called when bytes are read.
		/// </summary>
		/// <param name="bytesMoved">int with the number of bytes</param>
		protected virtual void OnBytesRead(int bytesMoved)
		{
			if (bytesMoved != 0 && BytesRead != null)
			{
				long length = 0;
				long position = 0;
				if (_innerStream.CanSeek)
				{
					length = _innerStream.Length;
					position = _innerStream.Position;
				}
				var args = new ProgressStreamReport(bytesMoved, length, position, true);
				BytesRead?.Invoke(this, args);
			}
		}