コード例 #1
0
        static void Main(string[] args)
        {
            try
            {
                /* 输入个人信息 */
                /* 开发者平台分配的appkey 和 appSecret */
                String appKey    = "";
                String appSecret = "";

                Credentials  credentials = new Credentials(appKey, appSecret);
                VcloudClient vclient     = new VcloudClient(credentials);
                // 上传加速节点地址
                string uploadHost = "";
                //存储对象的桶名
                string bucket = "";
                //生成的唯一对象名
                string objectName = "";
                //上传上下文
                string context = "";
                //上传token
                string xNosToken = "";

                QueryOffsetParam queryOffsetParam = vclient.getPartOffset(uploadHost, bucket, objectName, context, xNosToken);

                // 使用断点续传查询offset,文件全部上传之后,再通过getPartOffset()是无法查询到offset的 会报 404 对应context上传不存在

                long offset = queryOffsetParam.offset;

                Console.WriteLine("[QueryOffset] offset :" + offset);
            }
            catch (Exception e)
            {
                Console.WriteLine("查询失败:" + e.Message);
            }
        }
コード例 #2
0
ファイル: UploadUtil.cs プロジェクト: vcloud163/csharp-sdk
        /// <summary>
        /// 断点续传查询断点
        /// </summary>
        /// <returns>查询断点输出参数的封装类</returns>
        public QueryOffsetParam getPartOffset()
        {
            /* 接口 */
            string url = this.uploadHost + "/" + this.bucket + "/" + this.objectName + "?uploadContext&context=" + this.context + "&version=1.0";

            // Console.WriteLine(url);
            string responseJson = HttpClientBuilder.HttpGetWithXNosToken(url, this.xNosToken);
            /* 得到Json数据 */
            QueryOffsetParam queryOffsetParam = (QueryOffsetParam)JsonHelper.ToObject <QueryOffsetParam>(responseJson);

            return(queryOffsetParam);
        }