private async Task UploadImage(UploadImageTask uploadImageTask) { //Appid 为静态,有_appid 应用的appid //_secretId 九幽的 ResponseInfo responseInfo; if (uploadImageTask.Scale > 0) { responseInfo = await JyCloudTool.JyCloudTool.sendFileScale( AppId._appId, AppId._secretId, uploadImageTask.File, uploadImageTask.Scale); } else if ((uploadImageTask.Width > 0) && (uploadImageTask.Height > 0)) { responseInfo = await JyCloudTool.JyCloudTool.sendFileCustom( AppId._appId, AppId._secretId, uploadImageTask.File, (uint)uploadImageTask.Width, (uint)uploadImageTask.Height); } else { responseInfo = await JyCloudTool.JyCloudTool.sendFileOriginal( AppId._appId, AppId._secretId, uploadImageTask.File); } if (responseInfo.respose_Status == 0) { uploadImageTask.Url = responseInfo.ImgUrl; uploadImageTask.OnUploaded?.Invoke(uploadImageTask, true); } else { uploadImageTask.OnUploaded?.Invoke(uploadImageTask, false); } }
public UploadImageTask(UploadImageTask uploadImageTask) { File = uploadImageTask.File; Scale = uploadImageTask.Scale; Width = uploadImageTask.Width; Height = uploadImageTask.Height; Name = uploadImageTask.Name; Guid = uploadImageTask.Guid; }
private async Task UploadImage(UploadImageTask uploadImageTask) { //Appid 为静态,有_appid 应用的appid //_secretId 九幽的 var account = AccoutGoverment.AccountModel; if (!string.IsNullOrEmpty(account.Account.JiuYouId)) { AppId._appId = account.Account.JiuYouId; } if (!string.IsNullOrEmpty(account.Account.JiuYouSecretId)) { AppId._secretId = account.Account.JiuYouSecretId; } ResponseInfo responseInfo; if (uploadImageTask.Scale > 0) { responseInfo = await JyCloudTool.JyCloudTool.sendFileScale( AppId._appId, AppId._secretId, uploadImageTask.File, uploadImageTask.Scale); } else if ((uploadImageTask.Width > 0) && (uploadImageTask.Height > 0)) { responseInfo = await JyCloudTool.JyCloudTool.sendFileCustom( AppId._appId, AppId._secretId, uploadImageTask.File, (uint)uploadImageTask.Width, (uint)uploadImageTask.Height); } else { responseInfo = await JyCloudTool.JyCloudTool.sendFileOriginal( AppId._appId, AppId._secretId, uploadImageTask.File); } if (responseInfo.respose_Status == 0) { uploadImageTask.Url = responseInfo.ImgUrl; uploadImageTask.OnUploaded?.Invoke(uploadImageTask, true); } else { uploadImageTask.OnUploaded?.Invoke(uploadImageTask, false); } }
public async Task Jcloud(Action <bool> onUpload) { ImageShackEnum imageShack = Account.ImageShack; if (File.FileType == ".gif" && imageShack == ImageShackEnum.Jiuyou) { imageShack = ImageShackEnum.Qin; } var size = (await File.GetBasicPropertiesAsync()).Size; //1M //1024k //125000 if (size > 125000) { imageShack = ImageShackEnum.Smms; } //4326 24,447 imageShack = CheckShack(imageShack); #if DEBUG //imageShack = ImageShackEnum.Cimage; #endif UploadImageTask uploadImageTask = NewUploadImageTask( imageShack, File); uploadImageTask.OnUploaded += (s, e) => { if (!(s is UploadImageTask uploadImage)) { onUpload?.Invoke(false); return; } Url = uploadImage.Url; onUpload?.Invoke(e); }; uploadImageTask.UploadImage(); }
public SmmsUploadImage(UploadImageTask uploadImageTask) : base(uploadImageTask) { }
public JyUploadImage(UploadImageTask uploadImageTask) : base(uploadImageTask) { }