Ejemplo n.º 1
0
        public override Network.RequestBody GetRequestBody()
        {
            RequestBody body = null;

            if (srcPath != null)
            {
                FileInfo fileInfo = new FileInfo(srcPath);

                if (contentLength == -1 || contentLength + fileOffset > fileInfo.Length)
                {
                    contentLength = fileInfo.Length - fileOffset;
                }

                body = new FileRequestBody(srcPath, fileOffset, contentLength);
                body.ProgressCallback = progressCallback;
            }
            else
            if (data != null)
            {
                body = new ByteRequestBody(data);
                body.ProgressCallback = progressCallback;
            }

            return(body);
        }
Ejemplo n.º 2
0
        public override Network.RequestBody GetRequestBody()
        {
            string content = Transfer.XmlBuilder.BuildBucketLogging(bucketLoggingStatus);

            byte[]          data = Encoding.UTF8.GetBytes(content);
            ByteRequestBody body = new ByteRequestBody(data);

            return(body);
        }
        public override Network.RequestBody GetRequestBody()
        {
            string content = Transfer.XmlBuilder.BuildReplicationConfiguration(replicationConfiguration);

            byte[]          data = Encoding.UTF8.GetBytes(content);
            ByteRequestBody body = new ByteRequestBody(data);

            return(body);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 返回 xml 格式的 requestBody
        /// </summary>
        /// <param name="d"></param>
        /// <returns></returns>
        protected Network.RequestBody GetXmlRequestBody(object d)
        {
            string content = Transfer.XmlBuilder.Serialize(d);

            byte[]          data = Encoding.UTF8.GetBytes(content);
            ByteRequestBody body = new ByteRequestBody(data);

            return(body);
        }
Ejemplo n.º 5
0
        public override Network.RequestBody GetRequestBody()
        {
            string content = Transfer.XmlBuilder.BuildCompleteMultipartUpload(completeMultipartUpload);

            byte[]          data = Encoding.UTF8.GetBytes(content);
            ByteRequestBody body = new ByteRequestBody(data);

            return(body);
        }
        public override Network.RequestBody GetRequestBody()
        {
            string content = Transfer.XmlBuilder.BuildDomain(this.domain);

            byte[]          data = Encoding.UTF8.GetBytes(content);
            ByteRequestBody body = new ByteRequestBody(data);

            return(body);
        }
Ejemplo n.º 7
0
        public override Network.RequestBody GetRequestBody()
        {
            string content = Transfer.XmlBuilder.BuildSelection(expression, expressionType, inputFormat,
                                                                outputFormat, progressCallback != null);

            byte[]          data = Encoding.UTF8.GetBytes(content);
            ByteRequestBody body = new ByteRequestBody(data);

            return(body);
        }
Ejemplo n.º 8
0
        public override Network.RequestBody GetRequestBody()
        {
            RequestBody body = null;

            if (srcPath != null)
            {
                FileInfo fileInfo = new FileInfo(srcPath);

                if (contentLength == -1 || contentLength + fileOffset > fileInfo.Length)
                {
                    contentLength = fileInfo.Length - fileOffset;
                }

                body = new FileRequestBody(srcPath, fileOffset, contentLength);
                body.ProgressCallback = progressCallback;
            }
            else if (data != null)
            {
                body = new ByteRequestBody(data);
                body.ProgressCallback = progressCallback;
            }
            else if (stream != null)
            {
                if (fileOffset < 0)
                {
                    fileOffset = 0L;
                }
                if (contentLength == -1L)
                {
                    contentLength = stream.Length - fileOffset;
                }
                if (fileOffset + contentLength > stream.Length)
                {
                    throw new CosException.CosClientException(
                              (int)COSXML.Common.CosClientError.InvalidArgument,
                              "stream offset + contentLength greater than stream.Length");
                }
                body = new StreamRequestBody(stream, fileOffset, contentLength);
            }

            return(body);
        }