/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ using System; using System.Collections.Generic; using System.Text; namespace Amazon.Runtime { public class StreamTransferProgressArgs : EventArgs { long _incrementTransferred; long _total; long _transferred; /// /// The constructor takes the number of /// currently transferred bytes and the /// total number of bytes to be transferred /// /// The number of bytes transferred since last event /// The number of bytes transferred /// The total number of bytes to be transferred public StreamTransferProgressArgs(long incrementTransferred, long transferred, long total) { this._incrementTransferred = incrementTransferred; this._transferred = transferred; this._total = total; } /// /// Gets the percentage of transfer completed /// public int PercentDone { get { return (int)((_transferred * 100) / _total); } } /// /// Gets the number of bytes transferred since last event /// public long IncrementTransferred { get { return this._incrementTransferred; } } /// /// Gets the number of bytes transferred /// public long TransferredBytes { get { return _transferred; } } /// /// Gets the total number of bytes to be transferred /// public long TotalBytes { get { return _total; } } /// /// Returns a string representation of this object /// /// public override string ToString() { return String.Concat( "Transfer Statistics. Percentage completed: ", PercentDone, ", Bytes transferred: ", _transferred, ", Total bytes to transfer: ", _total ); } } }