예제 #1
0
        public DfopResult dfop(string fop, byte[] data)
        {
            DfopResult   dfopResult = new DfopResult();
            HttpFormFile dfopData   = HttpFormFile.NewFileFromBytes("netFx.png", "application/octet-stream", data);

            string dfopUrl = string.Format("{0}/dfop?fop={1}", API_HOST, fop);
            string token   = Auth.createManageToken(dfopUrl, null, mac);

            Dictionary <string, string> dfopHeaders = new Dictionary <string, string>();

            dfopHeaders.Add("Authorization", token);

            CompletionHandler dfopCompletionHandler = new CompletionHandler(delegate(ResponseInfo respInfo, string response)
            {
                if (respInfo.isOk())
                {
                    dfopResult = StringUtils.jsonDecode <DfopResult>(response);
                }

                dfopResult.ResponseInfo = respInfo;
                dfopResult.Response     = response;
            });

            mHttpManager.postMultipartDataRaw(dfopUrl, dfopHeaders, dfopData, null, dfopCompletionHandler);

            return(dfopResult);
        }
예제 #2
0
        public DfopResult dfop(string fop, string url)
        {
            DfopResult dfopResult = new DfopResult();

            string encodedUrl = StringUtils.urlencode(url);

            string dfopUrl = string.Format("{0}/dfop?fop={1}&url={2}", API_HOST, fop, encodedUrl);
            string token   = Auth.createManageToken(dfopUrl, null, mac);

            Dictionary <string, string> dfopHeaders = new Dictionary <string, string>();

            dfopHeaders.Add("Authorization", token);

            CompletionHandler dfopCompletionHandler = new CompletionHandler(delegate(ResponseInfo respInfo, string response)
            {
                if (respInfo.isOk())
                {
                    dfopResult = StringUtils.jsonDecode <DfopResult>(response);
                }

                dfopResult.ResponseInfo = respInfo;
                dfopResult.Response     = response;
            });

            mHttpManager.postForm(dfopUrl, dfopHeaders, null, dfopCompletionHandler);

            return(dfopResult);
        }
예제 #3
0
파일: Dfop.cs 프로젝트: qiniu/csharp-sdk
        public DfopResult dfop(string fop,byte[] data)
        {
            DfopResult dfopResult = new DfopResult();
            HttpFormFile dfopData = HttpFormFile.NewFileFromBytes("netFx.png", "application/octet-stream", data);

            string dfopUrl = string.Format("{0}/dfop?fop={1}", API_HOST, fop);
            string token = Auth.createManageToken(dfopUrl, null, mac);

            Dictionary<string, string> dfopHeaders = new Dictionary<string, string>();
            dfopHeaders.Add("Authorization", token);

            RecvDataHandler dfopRecvDataHandler = new RecvDataHandler(delegate (ResponseInfo respInfo, byte[] respData)
            {
                dfopResult.ResponseInfo = respInfo;
                dfopResult.ResponseData = respData;
            });

            mHttpManager.postMultipartDataRaw(dfopUrl, dfopHeaders, dfopData, null, dfopRecvDataHandler);

            return dfopResult;
        }
예제 #4
0
파일: Dfop.cs 프로젝트: qiniu/csharp-sdk
        public DfopResult dfop(string fop,string url)
        {
            DfopResult dfopResult = new DfopResult();

            string encodedUrl = StringUtils.urlencode(url);

            string dfopUrl = string.Format("{0}/dfop?fop={1}&url={2}", API_HOST, fop, encodedUrl);
            string token = Auth.createManageToken(dfopUrl, null, mac);

            Dictionary<string, string> dfopHeaders = new Dictionary<string, string>();
            dfopHeaders.Add("Authorization", token);

            RecvDataHandler dfopRecvDataHandler = new RecvDataHandler(delegate (ResponseInfo respInfo, byte[] respData)
            {
                dfopResult.ResponseInfo = respInfo;
                dfopResult.ResponseData = respData;
            });

            mHttpManager.postFormRaw(dfopUrl, dfopHeaders, dfopRecvDataHandler);

            return dfopResult;
        }