Exemple #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);
        }
Exemple #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);
        }
Exemple #3
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);

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

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

            return dfopResult;
        }
Exemple #4
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);

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

            mHttpManager.postFormRaw(dfopUrl, dfopHeaders, dfopRecvDataHandler);

            return dfopResult;
        }