/// <summary>
        /// Shows the export dialogue for the behaviors to be exported.
        /// </summary>
        /// <param name="node">The behavior you want to export. Use null to export all behaviors.</param>
        /// <returns>Returns true if the user did not abort and all behaviors could be exported.</returns>
        internal bool ExportBehavior(BehaviorNode node, string format = "", bool ignoreErrors = false, TreeNode selectedTreeRoot = null) {
            // get the exporter index
            int formatIndex = Plugin.GetExporterIndex(format);

            // create export dialogue
            using(ExportDialog dialog = new ExportDialog(this, node, ignoreErrors, selectedTreeRoot, formatIndex)) {
                //when format is not empty, it is for the command line exporting, don't show the gui
                if (string.IsNullOrEmpty(format)) {
                    // show the dialogue
                    if (dialog.ShowDialog() == DialogResult.Cancel) {
                        return false;
                    }
                }

                try {
                    string exportedPath = Workspace.Current.DefaultExportFolder;

                    if (!Directory.Exists(exportedPath)) {
                        Directory.CreateDirectory(exportedPath);
                    }

                    if (exportedPath.StartsWith(_behaviorFolder, StringComparison.CurrentCultureIgnoreCase)) {
                        throw new Exception("Behaviors cannot be exported into the behaviors source folder.");
                    }

                    bool aborted = false;

                    if (this.UpdateExportedSettting(exportedPath)) {
                        Debug.Check(Workspace.Current != null);

                        for (int i = 0; i < Plugin.Exporters.Count; ++i) {
                            ExporterInfo info = Plugin.Exporters[i];

                            if ((string.IsNullOrEmpty(format) && Workspace.Current.ShouldBeExported(info.ID)) || (info.ID == format)) {
                                exportBehavior(i, exportedPath, dialog.treeView.Nodes, ref aborted);

                                if (aborted) {
                                    break;
                                }
                            }
                        }

                        if (!aborted && dialog.ExportCustomizedMeta()) {
                            Workspace.ExportCustomMembers(Workspace.Current);
                        }
                    }

                } catch (Exception ex) {
                    MessageBox.Show(ex.Message, Resources.ExportError, MessageBoxButtons.OK);
                    return false;
                }
            }

            return true;
        }