Ejemplo n.º 1
0
        public ExportSettingDialog(ExporterInfo exporterInfo) {
            InitializeComponent();

            Debug.Check(exporterInfo != null);
            _exporterInfo = exporterInfo;

            bool enableIncludedFiles = (_exporterInfo.ID == "cpp");
            this.includedFilesGridView.Visible = enableIncludedFiles;
            this.addFilenameButton.Visible = enableIncludedFiles;
            this.removeFilenameButton.Visible = enableIncludedFiles;

            string[] tokens = _exporterInfo.Description.Split(' ');
            this.Text = tokens[0] + " " + this.Text;
        }
Ejemplo n.º 2
0
        private void GetExportBehaviors(TreeNodeCollection pool, bool exportNoGroups, ExporterInfo exporter, ref bool aborted, ref List<BehaviorNode> exportBehaviors)
        {
            if (aborted)
                return;

            // Export the behavior for each tree node.
            foreach (TreeNode tnode in pool)
            {
                NodeTag nodetag = (NodeTag)tnode.Tag;

                // If the tree node is selected and a behavior.
                if (nodetag.Type == NodeTagType.Behavior && tnode.Checked)
                {
                    // Get or load the behavior we want to export.
                    BehaviorNode node = GetBehavior(nodetag, tnode.Text);
                    Debug.Check(node != null);

                    FileManagers.SaveResult saveResult = FileManagers.SaveResult.Succeeded;

                    // Before exporting, we try to save this behavior if being modified.
                    if (node.IsModified)
                        saveResult = SaveBehavior(node, false, false);

                    if (FileManagers.SaveResult.Cancelled == saveResult)
                    {
                        // Abort the exporting all files process.
                        aborted = true;
                        return;
                    }

                    exportBehaviors.Add(node);
                }

                // Export the child tree nodes.
                GetExportBehaviors(tnode.Nodes, exportNoGroups, exporter, ref aborted, ref exportBehaviors);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Exports behaviors from the export dialogue. Internal use only.
        /// </summary>
        /// <param name="pool">The pool of tree nodes whose behaviors you want to export.</param>
        /// <param name="folder">The folder the behaviors are exported to.</param>
        /// <param name="exportNoGroups">Defines if the groups are exported as well.</param>
        /// <param name="exporter">The exporter which is used.</param>
        private void ExportBehavior(TreeNodeCollection pool, string folder, bool exportNoGroups, ExporterInfo exporter, ref bool aborted)
        {
            if (aborted)
                return;

            // Export the behavior for each tree node.
            foreach (TreeNode tnode in pool)
            {
                NodeTag nodetag = (NodeTag)tnode.Tag;

                // If the tree node is selected and a behavior.
                if (nodetag.Type == NodeTagType.Behavior && tnode.Checked)
                {
                    // Get or load the behavior we want to export.
                    BehaviorNode node = GetBehavior(nodetag, tnode.Text);
                    Debug.Check(node != null);

                    FileManagers.SaveResult saveResult = FileManagers.SaveResult.Succeeded;

                    //// Before exporting, we try to save this behavior if being modified.
                    //if (node.IsModified)
                    //    saveResult = SaveBehavior(node, false, false);

                    if (FileManagers.SaveResult.Succeeded == saveResult)
                    {
                        // Generate the new filename and the exporter.
                        Exporters.Exporter exp = exporter.Create(node, folder, exportNoGroups ? tnode.Text : tnode.FullPath);

                        // Export behavior.
                        saveResult = exp.Export();
                    }

                    if (FileManagers.SaveResult.Cancelled == saveResult)
                    {
                        // Abort the exporting all files process.
                        aborted = true;
                        return;
                    }
                }

                // Export the child tree nodes.
                ExportBehavior(tnode.Nodes, folder, exportNoGroups, exporter, ref aborted);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Exports behaviors from the export dialogue. Internal use only.
        /// </summary>
        /// <param name="pool">The pool of tree nodes whose behaviors you want to export.</param>
        /// <param name="folder">The folder the behaviors are exported to.</param>
        /// <param name="exportNoGroups">Defines if the groups are exported as well.</param>
        /// <param name="exporter">The exporter which is used.</param>
        private void ExportBehavior(TreeNodeCollection pool, string folder, bool exportNoGroups, ExporterInfo exporter, ref bool aborted)
        {
            if (aborted)
            {
                return;
            }

            // Export the behavior for each tree node.
            foreach (TreeNode tnode in pool)
            {
                if (aborted)
                {
                    break;
                }

                NodeTag nodetag = (NodeTag)tnode.Tag;

                // If the tree node is selected and a behavior.
                if (nodetag.Type == NodeTagType.Behavior && tnode.Checked)
                {
                    // Get or load the behavior we want to export.
                    BehaviorNode node = GetBehavior(nodetag, tnode.Text);
                    Debug.Check(node != null);

                    node.PreExport();

                    FileManagers.SaveResult saveResult = FileManagers.SaveResult.Succeeded;

                    if (FileManagers.SaveResult.Succeeded == saveResult)
                    {
                        string fullPath = tnode.FullPath;
                        if (fullPath.StartsWith("Behaviors\\") || fullPath.StartsWith("Behaviors/"))
                        {
                            fullPath = fullPath.Substring(10);
                        }

                        // Generate the new filename and the exporter.
                        Exporters.Exporter exp = exporter.Create(node, folder, exportNoGroups ? tnode.Text : fullPath);

                        // Export behavior.
                        saveResult = exp.Export();
                    }

                    node.PostExport();

                    if (FileManagers.SaveResult.Cancelled == saveResult)
                    {
                        // Abort the exporting all files process.
                        aborted = true;
                        return;
                    }
                }

                // Export the child tree nodes.
                ExportBehavior(tnode.Nodes, folder, exportNoGroups, exporter, ref aborted);
            }
        }