/// <summary> /// 生成上传Token /// </summary> /// <returns></returns> public string Token(Mac mac = null) { if (mac == null) { mac = new Mac(Config.ACCESS_KEY, Config.Encoding.GetBytes(Config.SECRET_KEY)); } string flag = QiniuJsonHelper.JsonEncode(this); return(mac.SignWithData(Config.Encoding.GetBytes(flag))); }
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); }
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); }
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); }
public override string ToString() { return(QiniuJsonHelper.JsonEncode(this)); }