public static bool Save(string workspaceFile) { try { string filename = getDebugFile(workspaceFile); Stream stream = File.Open(filename, FileMode.Create); BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, _breakPoints); ExpandedNodePool.Serialize(stream, formatter); NetworkManager.Save(stream, formatter); stream.Close(); return(true); } catch (Exception) { return(false); } }
public static bool Load(string workspaceFile) { _breakPoints.Clear(); ExpandedNodePool.Clear(); bool loadSucceeded = false; string filename = getDebugFile(workspaceFile); if (File.Exists(filename)) { try { Stream stream = File.Open(filename, FileMode.Open); BinaryFormatter formatter = new BinaryFormatter(); _breakPoints = formatter.Deserialize(stream) as Dictionary <string, Dictionary <string, BreakPoint> >; ExpandedNodePool.Deserialize(stream, formatter); NetworkManager.ServerIP = formatter.Deserialize(stream) as string; NetworkManager.ServerPort = (int)formatter.Deserialize(stream); stream.Close(); loadSucceeded = true; } catch (Exception) { //string msgError = string.Format(Resources.LoadConfigureError, filename, ex.Message); //MessageBox.Show(msgError, Resources.LoadError, MessageBoxButtons.OK); } } if (LoadBreakPointsHandler != null) { LoadBreakPointsHandler(); } return(loadSucceeded); }