public static void Register(GeometryExportType type, string exporterAssembly, string exporterName) { if (m_listExporters == null) { m_listExporters = new ArrayList(); } bool found = false; if (m_listExporters.Count > 0) { for (int i = 0; i < m_listExporters.Count; i++) { ExporterInfo info = (ExporterInfo)m_listExporters[i]; if (info != null && info.ExportType == type) { found = true; m_listExporters[i] = new ExporterInfo(type, exporterAssembly, exporterName); break; } } } if (!found) { m_listExporters.Add(new ExporterInfo(type, exporterAssembly, exporterName)); } }
public static IGeometryExporter GetExporter(GeometryExportType exportType) { ExporterInfo info = GetExporterInfo(exportType); if (info != null) { return(CreateExporter(info.AssemblyName, info.TypeName)); } return(null); }
public Exporter MapInfoToExporter(AppModel appModel, ExporterInfo exporterInfo) { var exporter = new Exporter(appModel); var options = exporter.Options; options.ReviewsTitle = exporterInfo.ReviewsTitle ?? options.ReviewsTitle; options.ExportIncompleteRankings = exporterInfo.ExportIncompleteRankings ?? options.ExportIncompleteRankings; options.EntryCommentTemplate = exporterInfo.EntryCommentTemplate ?? options.EntryCommentTemplate; return(exporter); }
public ExportDialog(BehaviorTreeList behaviorTreeList, BehaviorNode node, bool ignoreErrors, TreeNode selectedTreeRoot, int formatIndex) { _initialized = false; InitializeComponent(); _behaviorTreeList = behaviorTreeList; _node = node; _ignoreErrors = ignoreErrors; _selectedTreeRoot = selectedTreeRoot; // add all valid exporters to the format combobox Debug.Check(Workspace.Current != null); int exportIndex = -1; for (int i = 0; i < Plugin.Exporters.Count; ++i) { ExporterInfo info = Plugin.Exporters[i]; if (node != null || info.MayExportAll) { int index = this.exportSettingGridView.Rows.Add(); DataGridViewRow row = this.exportSettingGridView.Rows[index]; row.Cells["Enable"].Value = Workspace.Current.ShouldBeExported(info.ID); row.Cells["Format"].Value = info.Description; row.Cells["Format"].ReadOnly = true; if (info.HasSettings) { int fileCount = Workspace.Current.GetExportFileCount(info.ID); row.Cells["Setting"].Value = fileCount.ToString(); row.Cells["Setting"].ReadOnly = false; } else { row.Cells["Setting"].Value = ""; row.Cells["Setting"].ReadOnly = true; } if (Workspace.Current.ShouldBeExported(info.ID) && (exportIndex == -1 || info.HasSettings)) { exportIndex = i; } } } changeExportFormat(exportIndex); _initialized = true; }
private void changeExportFormat(int exportIndex) { if (exportIndex < 0) { return; } _isCheckingByTypeChanged = true; this.treeView.Nodes.Clear(); CopyTreeNodes(_behaviorTreeList.GetBehaviorTreeNodes(), this.treeView.Nodes); TreeNode subTreeRoot = (_selectedTreeRoot != null) ? getNodeByTag(this.treeView.Nodes, _selectedTreeRoot.Tag) : null; ExporterInfo exporter = Plugin.Exporters[exportIndex]; //BehaviorNode node = exporter.HasSettings ? null : _node; BehaviorNode node = _node; bool ignoreErrors = exporter.HasSettings ? false : _ignoreErrors; List <string> referencedFiles = new List <string>(); if (node != null && node is Node) { ((Node)node).GetReferencedFiles(ref referencedFiles); } CheckExportTreeNodes(this.treeView, this.treeView.Nodes, node, ignoreErrors, subTreeRoot, referencedFiles); this.treeView.ExpandAll(); if (node != null) { TreeNode treeNode = getNodeByFilename(this.treeView.Nodes, node.Filename); if (treeNode != null) { treeNode.EnsureVisible(); } } else if (this.treeView.Nodes.Count > 0) { this.treeView.Nodes[0].EnsureVisible(); } this.treeView.Select(); SetFileCountLabel(); _isCheckingByTypeChanged = false; }
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; }
public static void Unregister(GeometryExportType type) { if (m_listExporters != null && m_listExporters.Count > 0) { for (int i = 0; i < m_listExporters.Count; i++) { ExporterInfo info = (ExporterInfo)m_listExporters[i]; if (info != null && info.ExportType == type) { m_listExporters.RemoveAt(i); break; } } } }
private void setExportSetting(int rowIndex, int columnIndex) { if (rowIndex < 0 || columnIndex < 0) { return; } DataGridViewRow row = this.exportSettingGridView.Rows[rowIndex]; int exportIndex = Plugin.GetExporterIndex("", (string)row.Cells["Format"].Value); ExporterInfo info = Plugin.Exporters[exportIndex]; if (columnIndex == 0) // Enable { Debug.Check(Workspace.Current != null); Workspace.Current.SetExportInfo(info.ID, (bool)row.Cells["Enable"].EditedFormattedValue, Workspace.Current.ExportFileCount(info.ID)); exportIndex = -1; for (int index = 0; index < Plugin.Exporters.Count; ++index) { info = Plugin.Exporters[index]; if (Workspace.Current.ShouldBeExported(info.ID) && (exportIndex == -1 || info.HasSettings)) { exportIndex = index; } } if (exportIndex != -1) { changeExportFormat(exportIndex); _isDirty = true; } } else if (columnIndex == 2) // Settings { if (info.HasSettings) { using (ExportSettingDialog dialog = new ExportSettingDialog(info)) { dialog.ShowDialog(); } } } }
private static ExporterInfo GetExporterInfo(GeometryExportType type) { if (m_listExporters != null && m_listExporters.Count > 0) { for (int i = 0; i < m_listExporters.Count; i++) { ExporterInfo info = (ExporterInfo)m_listExporters[i]; if (info != null && info.ExportType == type) { return(info); } } } return(null); }
private void exportSettingGridView_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (!_initialized || e.RowIndex < 0 || e.ColumnIndex != 2) // File Count { return; } DataGridViewRow row = this.exportSettingGridView.Rows[e.RowIndex]; int exportIndex = Plugin.GetExporterIndex("", (string)row.Cells["Format"].Value); ExporterInfo info = Plugin.Exporters[exportIndex]; int fileCount = 1; if (int.TryParse(row.Cells["Setting"].Value.ToString(), out fileCount) && fileCount > 0) { Workspace.Current.SetExportFileCount(info.ID, fileCount); } row.Cells["Setting"].Value = Workspace.Current.GetExportFileCount(info.ID).ToString(); }
private void changeExportFormat(int exportIndex) { if (exportIndex < 0) { return; } _isCheckingByTypeChanged = true; this.treeView.Hide(); this.treeView.Nodes.Clear(); TreeNode root = _behaviorTreeList.GetBehaviorGroup(); TreeNode newRoot = new TreeNode(root.Text, 0, 0); newRoot.Tag = root.Tag; this.treeView.Nodes.Add(newRoot); CopyTreeNodes(root.Nodes, newRoot.Nodes); TreeNode subTreeRoot = (_selectedTreeRoot != null) ? getNodeByTag(this.treeView.Nodes, _selectedTreeRoot.Tag) : null; ExporterInfo exporter = Plugin.Exporters[exportIndex]; //BehaviorNode node = exporter.HasSettings ? null : _node; BehaviorNode node = _node; bool ignoreErrors = exporter.HasSettings ? false : _ignoreErrors; List <string> referencedFiles = new List <string>(); if (node != null && node is Node) { ((Node)node).GetReferencedFiles(ref referencedFiles); } CheckExportTreeNodes(this.treeView, this.treeView.Nodes, node, ignoreErrors, subTreeRoot, referencedFiles); this.treeView.ExpandAll(); if (node != null) { TreeNode treeNode = getNodeByFilename(this.treeView.Nodes, node.Filename); if (treeNode != null) { treeNode.EnsureVisible(); } } else if (this.treeView.Nodes.Count > 0) { this.treeView.Nodes[0].EnsureVisible(); } this.treeView.Select(); int errorsFilesCount = SetFileCountLabel(); bool showFaultBehaviors = _initialized ? onlyShowErrorsCheckBox.Checked : (errorsFilesCount > 0); exportBehaviorsLabel.Text = showFaultBehaviors ? Resources.FaultBehaviors : Resources.ExportBehaviors; if (!_initialized && showFaultBehaviors) { onlyShowErrorsCheckBox.Checked = true; } ShowNodes(this.treeView.Nodes, showFaultBehaviors); RemoveEmptyNodes(this.treeView.Nodes); this.treeView.Show(); _isCheckingByTypeChanged = false; }