private void OpenStripMenuItem_Click(object sender, EventArgs e) { // fileID is the file format index that match with readers plugin list can be different for each Sdk version int fileID; string filter = ""; for (int i = 0; i < readers.Count; i++) { if (i > 0) { filter += "|"; } filter += string.Format("{0}|*.{1}", readers[i].Description, readers[i].Extension); } string path = MyFileDialog.GetOpenFileName(filter, out fileID); if (string.IsNullOrEmpty(path)) { return; } try { scene = Scene.Import(path, -1); Version version = scene.FileVersion; Debug.WriteLine(scene.FileVersion); Node root = scene.RootNode; treeView1.Nodes.Clear(); treeView1.Nodes.Add(GetTreeNodeRecursive(root)); treeView1.ExpandAll(); ExportStripMenuItem.Enabled = true; Debug.WriteLine("OK"); } catch (Exception exc) { Debug.WriteLine(exc.ToString()); } }
private void ExportStripMenuItem_Click(object sender, EventArgs e) { if (scene == null) { return; } string filter = ""; for (int i = 0; i < writers.Count; i++) { if (i > 0) { filter += "|"; } filter += string.Format("{0}|*.{1}", writers[i].Description, writers[i].Extension); } // fileID is the file format index that match with writers plugin list, can be different for each Sdk version int fileID; string path = MyFileDialog.GetSaveFileName(filter, out fileID); if (string.IsNullOrEmpty(path)) { return; } try { Scene.Export(scene, path, fileID - 1); Debug.WriteLine("OK"); } catch (Exception exc) { Debug.WriteLine(exc.ToString()); } }