void ImportExportImpl(bool bImporting, Type tRecord, Stream stm, ImportExportFormat fmt) { sTable tbl; if (!m_tables.TryGetValue(tRecord, out tbl)) { throw new ArgumentException("Table with records of type '" + tRecord.Name + "' doesn't exist in this session."); } ImportExport ie = null; if (fmt == ImportExportFormat.TSV) { ie = new ImportExportTSV(this, tbl.idTable, tbl.serializer); } // else if( fmt == ImportExportFormat.Binary ) // ie = new ImportExportBinary( this, tbl.idTable, tbl.serializer ); else { throw new NotSupportedException("The ImportExportFormat is not supported."); } if (bImporting) { ClearTable(tbl.idTable); ie.Import(stm); } else { ie.Export(stm); } }
void iSerializerSession.importTable(Stream stm, Type tRecord, ImportExportFormat fmt) { if (cooperativeLevel != eSessionCooperativeLevel.Exclusive) { throw new Exception("To call importTable API, this session must be opened with eSessionCooperativeLevel.Exclusive option"); } session.importTable(stm, tRecord, fmt); }
private void ExportCanvasCallback(string formatID) { IOFormat = ImportExportManager.ParseFormat(formatID); if (IOFormat.RequiresLocationGUI) { ExportLocationGUI = IOFormat.ExportLocationArgsGUI; modalPanelContent = ExportCanvasGUI; showModalPanel = true; } else if (IOFormat.ExportLocationArgsSelection(canvasCache.nodeCanvas.saveName, out IOLocationArgs)) { ImportExportManager.ExportCanvas(canvasCache.nodeCanvas, IOFormat, IOLocationArgs); } }
private void ImportCanvasCallback(string formatID) { IOFormat = ImportExportManager.ParseFormat(formatID); if (IOFormat.RequiresLocationGUI) { ImportLocationGUI = IOFormat.ImportLocationArgsGUI; modalPanelContent = ImportCanvasGUI; showModalPanel = true; } else if (IOFormat.ImportLocationArgsSelection(out IOLocationArgs)) { canvasCache.SetCanvas(ImportExportManager.ImportCanvas(IOFormat, IOLocationArgs)); } }
public void /* iSerializerSession. */ importTable(Stream stm, Type tRecord, ImportExportFormat fmt) { ImportExportImpl(true, tRecord, stm, fmt); }
void iSerializerSession.exportTable(Stream stm, Type tRecord, ImportExportFormat fmt) { session.exportTable(stm, tRecord, fmt); }
public void DrawToolbarGUI(Rect rect) { rect.height = toolbarHeight; rect.width = 280f; if (!showModalPanel) { GUILayout.BeginArea(rect, NodeEditorGUI.toolbar); GUILayout.BeginHorizontal(); //float curToolbarHeight = 0; if (GUILayout.Button("New", NodeEditorGUI.toolbarButton, GUILayout.Width(50))) { AutoSave(); switch (NodeEditorGUI.state) { case NodeEditorGUI.NodeEditorState.Mission: NewNodeCanvas(typeof(QuestCanvas)); break; case NodeEditorGUI.NodeEditorState.Dialogue: NewNodeCanvas(typeof(DialogueCanvas)); break; case NodeEditorGUI.NodeEditorState.Sector: NewNodeCanvas(typeof(SectorCanvas)); break; } IOLocationArgs = null; } if (GUILayout.Button("Import", NodeEditorGUI.toolbarButton, GUILayout.Width(50))) { IOFormat = ImportExportManager.ParseFormat("XML"); if (IOFormat.RequiresLocationGUI) { // Try to auto save AutoSave(); ImportLocationGUI = IOFormat.ImportLocationArgsGUI; modalPanelContent = ImportCanvasGUI; showModalPanel = true; } else if (IOFormat.ImportLocationArgsSelection(out IOLocationArgs)) { canvasCache.SetCanvas(ImportExportManager.ImportCanvas(IOFormat, IOLocationArgs)); } } if (GUILayout.Button("Export", NodeEditorGUI.toolbarButton, GUILayout.Width(50))) { IOFormat = ImportExportManager.ParseFormat("XML"); if (IOFormat.RequiresLocationGUI) { ExportLocationGUI = IOFormat.ExportLocationArgsGUI; modalPanelContent = ExportCanvasGUI; showModalPanel = true; } else if (IOFormat.ExportLocationArgsSelection(canvasCache.nodeCanvas.saveName, out IOLocationArgs)) { ImportExportManager.ExportCanvas(canvasCache.nodeCanvas, IOFormat, IOLocationArgs); } } string buttonText = "Mission"; switch (NodeEditorGUI.state) { case NodeEditorGUI.NodeEditorState.Mission: buttonText = "Mission"; break; case NodeEditorGUI.NodeEditorState.Dialogue: buttonText = "Dialogue"; break; case NodeEditorGUI.NodeEditorState.Sector: buttonText = "Sector"; break; default: break; } if (GUILayout.Button(buttonText, NodeEditorGUI.toolbarButton, GUILayout.Width(50))) { NodeEditorGUI.state = (NodeEditorGUI.NodeEditorState)(((int)NodeEditorGUI.state + 1) % 3); switch (NodeEditorGUI.state) { case NodeEditorGUI.NodeEditorState.Mission: NewNodeCanvas(typeof(QuestCanvas)); break; case NodeEditorGUI.NodeEditorState.Dialogue: NewNodeCanvas(typeof(DialogueCanvas)); break; case NodeEditorGUI.NodeEditorState.Sector: NewNodeCanvas(typeof(SectorCanvas)); break; default: break; } NodeEditorGUI.Init(); } bool autoSave = GUILayout.Toggle(autoSaveEnabled, "Auto Save"); if (autoSave != autoSaveEnabled) { autoSaveEnabled = autoSave; PlayerPrefs.SetInt("NEAutoSave", autoSave ? 1 : 0); PlayerPrefs.Save(); } GUI.backgroundColor = Color.white; GUILayout.EndHorizontal(); GUILayout.EndArea(); if (Event.current.type == EventType.Repaint) { toolbarHeight = 20; } } }
public void ExportData(string path) { IOFormat = ImportExportManager.ParseFormat("XML"); ImportExportManager.ExportCanvas(canvasCache.nodeCanvas, IOFormat, new string[] { path }); }