Exemple #1
0
        public static bool IsCompleted(this HttpTransferState status)
        {
            switch (status)
            {
            case HttpTransferState.Completed:
            case HttpTransferState.Error:
            case HttpTransferState.Canceled:
                return(true);

            default:
                return(false);
            }
        }
Exemple #2
0
        public static bool IsPaused(this HttpTransferState status)
        {
            switch (status)
            {
            case HttpTransferState.Paused:
            case HttpTransferState.PausedByCostedNetwork:
            case HttpTransferState.PausedByNoNetwork:
                return(true);

            default:
                return(false);
            }
        }
Exemple #3
0
        public HttpTransfer(string identifier, string uri, string localFilePath, bool isUpload, bool useMeteredConnection, Exception?exception, long fileSize, long bytesTransferred, HttpTransferState status)
        {
            if (identifier == null)
            {
                throw new ArgumentNullException(nameof(identifier));
            }

            if (uri == null)
            {
                throw new ArgumentNullException(nameof(uri));
            }

            this.Identifier           = identifier;
            this.Uri                  = uri;
            this.LocalFilePath        = localFilePath;
            this.IsUpload             = isUpload;
            this.UseMeteredConnection = useMeteredConnection;
            this.Exception            = exception;
            this.FileSize             = fileSize;
            this.BytesTransferred     = bytesTransferred;

            this.Status = exception == null
                ? status
                : HttpTransferState.Error;
        }