Exemplo n.º 1
0
        private void UploadCaptchaImage(CaptchaAnswerImage img)
        {
            string url = conf.UploadCaptchaTaskUrl;
            CaptchaImageUploadRequest req = new CaptchaImageUploadRequest();

            req.token     = "devJustTest";
            req.uid       = img.Uuid;
            req.timestamp = KK.CurrentMills();
            req.from      = "test";

            int httpStatus;
            DataResult <CaptchaImageUploadResponse> dr = HttpClients
                                                         .PostWithFiles <DataResult <CaptchaImageUploadResponse> >(url, req, new List <string> {
                img.ImagePath1, img.ImagePath2
            }, out httpStatus);

            logger.InfoFormat("upload catpcha task#{0}, result is {1}", img.Uuid, Jsons.ToJson(dr));
        }
Exemplo n.º 2
0
        public ScreenImageUploadResponse UploadFileToSaber(string filePath, int uploadType = 0)
        {
            string url = conf.UploadRobotScreenUrl;
            CaptchaImageUploadRequest req = new CaptchaImageUploadRequest();

            req.machineCode = robot.GetMachineCode();
            req.token       = "devJustTest";
            req.uid         = KK.GetFileNameNoSuffix(filePath);
            req.timestamp   = KK.CurrentMills();
            req.from        = "test";
            req.uploadType  = uploadType;

            int httpStatus;
            DataResult <ScreenImageUploadResponse> dr = HttpClients
                                                        .PostWithFiles <DataResult <ScreenImageUploadResponse> >(url, req, new List <string> {
                filePath
            }, out httpStatus);

            logger.InfoFormat("upload file#{0}, result is {1}", req.uid, Jsons.ToJson(dr));

            return(DataResults.IsOK(dr) ? dr.Data : null);
        }