Beispiel #1
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);
        }