Make sure preset name is not empty

This commit is contained in:
Jaex 2020-06-16 11:24:12 +03:00
parent b8579bc0a8
commit 41cf8ff133
2 changed files with 15 additions and 6 deletions

View file

@ -81,6 +81,7 @@ private void InitializeComponent()
this.Controls.Add(this.txtAssetsFolder);
this.Controls.Add(this.lblAssetsFolder);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "ImageEffectPackagerForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "ShareX - Image effect packager";

View file

@ -637,14 +637,22 @@ private void btnPackager_Click(object sender, EventArgs e)
if (preset != null)
{
string json = eiImageEffects.Serialize(preset);
if (!string.IsNullOrEmpty(json))
if (string.IsNullOrEmpty(preset.Name))
{
using (ImageEffectPackagerForm packagerForm = new ImageEffectPackagerForm(json, preset.Name,
HelpersOptions.ShareXSpecialFolders["ShareXImageEffects"]))
// TODO: Translate
MessageBox.Show("Preset name cannot be empty.", "ShareX - " + "Missing preset name", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
string json = eiImageEffects.Serialize(preset);
if (!string.IsNullOrEmpty(json))
{
packagerForm.ShowDialog();
using (ImageEffectPackagerForm packagerForm = new ImageEffectPackagerForm(json, preset.Name,
HelpersOptions.ShareXSpecialFolders["ShareXImageEffects"]))
{
packagerForm.ShowDialog();
}
}
}
}