コード例 #1
0
ファイル: Pomf.cs プロジェクト: CryogenicSteve/ShareX
        public override UploadResult Upload(Stream stream, string fileName)
        {
            if (Uploader == null || string.IsNullOrEmpty(Uploader.UploadURL)){
                Errors.Add("Default Pomf uploader automatically set to \"pomf.cat\". If you'd like to change the Pomf uploader, please select one of Pomf uploaders from \"Destination settings window -> Pomf tab\".");
                Uploader = Uploaders.get(10);
            }

            UploadResult result = UploadData(stream, Uploader.UploadURL, fileName, "files[]");

            if (result.IsSuccess)
            {
                PomfResponse response = JsonConvert.DeserializeObject<PomfResponse>(result.Response);

                if (response.success && response.files != null && response.files.Count > 0)
                {
                    string url = response.files[0].url;

                    if (!string.IsNullOrEmpty(Uploader.ResultURL))
                    {
                        url = URLHelpers.CombineURL(Uploader.ResultURL, url);
                    }

                    result.URL = url;
                }
            }

            return result;
        }
コード例 #2
0
 public Pomf(PomfUploader uploader)
 {
     Uploader = uploader;
 }
コード例 #3
0
ファイル: Pomf.cs プロジェクト: Guokr1991/ShareX
 public Pomf(PomfUploader uploader)
 {
     Uploader = uploader;
 }