Esempio n. 1
0
        private async Task <ApplyUploadResponse> DoApplyRequest(VodClient client, VodUploadRequest req)
        {
            req.MediaType = System.IO.Path.GetExtension(req.MediaFilePath).Substring(1);
            req.MediaName = System.IO.Path.GetFileName(req.MediaFilePath);
            if (req.CoverFilePath != null && req.CoverFilePath != "")
            {
                req.CoverType = System.IO.Path.GetExtension(req.CoverFilePath).Substring(1);
            }

            TencentCloudSDKException err = null;

            for (int i = 0; i < retryTime; i++)
            {
                try
                {
                    ApplyUploadResponse rsp = await client.ApplyUpload(req);

                    return(rsp);
                }
                catch (TencentCloudSDKException exception)
                {
                    if (exception.RequestId == "")
                    {
                        err = exception;
                        continue;
                    }
                    throw exception;
                }
            }
            throw err;
        }
Esempio n. 2
0
        private async Task <CommitUploadResponse> DoCommitRequest(VodClient client, ApplyUploadResponse applyResp)
        {
            CommitUploadRequest commitReq = new CommitUploadRequest();

            commitReq.VodSessionKey = applyResp.VodSessionKey;
            TencentCloudSDKException err = null;

            for (int i = 0; i < retryTime; i++)
            {
                try
                {
                    return(await client.CommitUpload(commitReq));
                }
                catch (TencentCloudSDKException exception)
                {
                    if (exception.RequestId == "")
                    {
                        err = exception;
                        continue;
                    }
                    throw exception;
                }
            }
            throw err;
        }