Example #1
0
        /// <summary>
        /// Called, when a process has been completed.
        /// </summary>
        protected virtual void OnProcessCompleted(long streamLength, TimeSpan elapsedTime, ChunkEventArgs.ProcessType type)
        {
            var args = new ChunkEventArgs();

            args.CompletedChunks = (int)(Math.Ceiling(streamLength / (float)_chunkSize));
            args.TotalChunks     = args.CompletedChunks;
            args.TotalTime       = elapsedTime;
            args.Type            = type;

            ProcessCompleted?.Invoke(this, args);
        }
Example #2
0
        /// <summary>
        /// Called, when a chunk was completed.
        /// </summary>
        protected virtual void OnChunkUpdate(long streamPosition, long streamLength, int chunkSize, TimeSpan totalTime, TimeSpan chunkTime, ChunkEventArgs.ProcessType type)
        {
            var args = new ChunkEventArgs();

            args.ChunkSize       = chunkSize;
            args.CompletedChunks = (int)(Math.Ceiling(streamPosition / (float)_chunkSize));
            args.TotalChunks     = (int)(Math.Ceiling(streamLength / (float)_chunkSize));
            args.TotalTime       = totalTime;
            args.ChunkTime       = chunkTime;
            args.Type            = type;

            ChunkUpdate?.Invoke(this, args);
        }