Esempio n. 1
0
        private BlkputRet Mkblock(Client client, byte[] firstChunk, int blkSize)
        {
            string url = string.Format("{0}/mkblk/{1}", Config.UP_HOST, blkSize);

            CallRet callRet = client.CallWithBinary(url, "application/octet-stream", new MemoryStream(firstChunk, 0, blkSize), blkSize);

            if (callRet.OK)
            {
                return(QiniuJsonHelper.ToObject <BlkputRet>(callRet.Response));
            }
            return(null);
        }
Esempio n. 2
0
        private async Task <BlkputRet> Mkblock(Client client, byte[] firstChunk, int blkSize)
        {
            string url = string.Format("{0}/mkblk/{1}", Config.UP_HOST, blkSize);

            CallRet callRet = await client.CallWithBinary(url, new Windows.Web.Http.Headers.HttpMediaTypeHeaderValue("application/octet-stream"), new MemoryStream(firstChunk, 0, blkSize), blkSize);

            if (callRet.OK)
            {
                return(QiniuJsonHelper.ToObject <BlkputRet>(callRet.Response));
            }
            return(null);
        }
Esempio n. 3
0
        private async Task <BlkputRet> MkblockAsync(Client client, byte[] firstChunk, int blkSize)
        {
            string url = string.Format("{0}/mkblk/{1}", Config.UP_HOST, blkSize);

            var content = new ByteArrayContent(firstChunk, 0, blkSize);

            content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");

            CallRet callRet = await client.CallWithBinaryAsync(url, content);

            if (callRet.OK)
            {
                return(QiniuJsonHelper.ToObject <BlkputRet>(callRet.Response));
            }
            return(null);
        }