Exemplo n.º 1
0
        private void btnPackage_Click(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(AssetsFolderPath) && !AssetsFolderPath.StartsWith(ShareXImageEffectsFolderPath + "\\", StringComparison.OrdinalIgnoreCase))
                {
                    // TODO: Translate
                    MessageBox.Show("Assets folder must be inside ShareX image effects folder.", "ShareX - " + "Invalid assets folder path",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                } // TODO: Translate
                else if (!File.Exists(PackageFilePath) || MessageBox.Show("Package with this file name already exists.\r\nWould you like to overwrite it?", "ShareX",
                                                                          MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    string outputFilePath = ImageEffectPackager.Package(PackageFilePath, ImageEffectJson, AssetsFolderPath);

                    if (!string.IsNullOrEmpty(outputFilePath) && File.Exists(outputFilePath))
                    {
                        Helpers.OpenFolderWithFile(outputFilePath);
                    }
                }
            }
            catch (Exception ex)
            {
                ex.ShowError();
            }
        }
Exemplo n.º 2
0
        private void btnPackage_Click(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(AssetsFolderPath) && !AssetsFolderPath.StartsWith(ShareXImageEffectsFolderPath + "\\", StringComparison.OrdinalIgnoreCase))
                {
                    MessageBox.Show(Resources.AssetsFolderMustBeInsideShareXImageEffectsFolder, "ShareX - " + Resources.InvalidAssetsFolderPath,
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (!File.Exists(PackageFilePath) || MessageBox.Show(Resources.PackageWithThisFileNameAlreadyExistsRNWouldYouLikeToOverwriteIt, "ShareX",
                                                                          MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    string outputFilePath = ImageEffectPackager.Package(PackageFilePath, ImageEffectJson, AssetsFolderPath);

                    if (!string.IsNullOrEmpty(outputFilePath) && File.Exists(outputFilePath))
                    {
                        FileHelpers.OpenFolderWithFile(outputFilePath);
                    }
                }
            }
            catch (Exception ex)
            {
                ex.ShowError();
            }
        }
        private void btnPackage_Click(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(AssetsFolderPath) && !AssetsFolderPath.StartsWith(ShareXImageEffectsFolderPath + "\\", StringComparison.OrdinalIgnoreCase))
                {
                    // TODO: Translate
                    MessageBox.Show("Assets folder must be inside ShareX image effects folder.", "ShareX - " + "Invalid assets folder path",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    string outputFilePath = ImageEffectPackager.Package(PackageFilePath, ImageEffectJson, AssetsFolderPath);

                    if (!string.IsNullOrEmpty(outputFilePath) && File.Exists(outputFilePath))
                    {
                        Helpers.OpenFolderWithFile(outputFilePath);
                    }
                }
            }
            catch (Exception ex)
            {
                ex.ShowError();
            }
        }
Exemplo n.º 4
0
        public void ImportImageEffectFile(string filePath)
        {
            try
            {
                string configJson = ImageEffectPackager.ExtractPackage(filePath, HelpersOptions.ShareXSpecialFolders["ShareXImageEffects"]);

                if (!string.IsNullOrEmpty(configJson))
                {
                    ImportImageEffect(configJson);
                }
            }
            catch (Exception ex)
            {
                ex.ShowError(false);
            }
        }
        private void btnPackage_Click(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(AssetsFolderPath) &&
                    !AssetsFolderPath.StartsWith(ShareXImageEffectsFolderPath + "\\", StringComparison.OrdinalIgnoreCase))
                {
                    // TODO: Translate
                    MessageBox.Show("Assets folder must be inside ShareX image effects folder.", "ShareX - " + "Invalid assets folder path",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    using (SaveFileDialog sfd = new SaveFileDialog())
                    {
                        sfd.DefaultExt       = "sxie";
                        sfd.FileName         = ImageEffectName + ".sxie";
                        sfd.Filter           = "ShareX image effect (*.sxie)|*.sxie";
                        sfd.InitialDirectory = ShareXImageEffectsFolderPath;

                        if (sfd.ShowDialog() == DialogResult.OK)
                        {
                            string outputFilePath = ImageEffectPackager.Package(sfd.FileName, ImageEffectJson, AssetsFolderPath);

                            if (!string.IsNullOrEmpty(outputFilePath) && File.Exists(outputFilePath))
                            {
                                Helpers.OpenFolderWithFile(outputFilePath);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ex.ShowError();
            }
        }