private object eiCustomUploaders_ExportRequested()
        {
            CustomUploaderItem uploader = CustomUploaderGetSelected();

            if (uploader != null)
            {
                if (string.IsNullOrEmpty(uploader.RequestURL))
                {
                    MessageBox.Show(Resources.UploadersConfigForm_eiCustomUploaders_ExportRequested_RequestURLMustBeConfigured, "ShareX - " + Resources.UploadersConfigForm_Error,
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(null);
                }

                if (uploader.DestinationType == CustomUploaderDestinationType.None)
                {
                    MessageBox.Show(Resources.UploadersConfigForm_eiCustomUploaders_ExportRequested_DestinationTypeMustBeConfigured, "ShareX - " + Resources.UploadersConfigForm_Error,
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(null);
                }

                eiCustomUploaders.DefaultFileName = uploader.GetFileName();
            }

            return(uploader);
        }
Example #2
0
 private void CustomUploaderSerialize(CustomUploaderItem cui, string folderPath)
 {
     try
     {
         string filePath = Path.Combine(folderPath, cui.GetFileName());
         JsonHelpers.SerializeToFile(cui, filePath, DefaultValueHandling.Ignore, NullValueHandling.Ignore);
     }
     catch (Exception e)
     {
         DebugHelper.WriteException(e);
         MessageBox.Show(Resources.ExportFailed + "\n\n" + e, "ShareX - " + "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }