public void SaveProject(string filename) { try { if (filename != null) { _projectFilename = filename; } if (_projectFilename == null) { return; } // Save current item settings for windows. _windowManager.GetWindowItems(_project.Windows, _project.Items); if (_currentItem != null) { _project.ProjectItem = _currentItem.GetID(); } else { _project.ProjectItem = string.Empty; } // Save the favourites and ignores along with the project. _windowManager.Favourites.GetAll(_project.Favourites); _windowManager.SetCaption(_projectFilename); Hwd.Serialization.Encoder encoder = new Hwd.Serialization.Encoder(); string s = encoder.Encode(_project); File.WriteAllText(_projectFilename, s); SetCaption(); } catch (SerializationException exc) { _windowManager.Logger.LogExcStr(exc, "Deserializing project failed"); } catch (IOException exc) { _windowManager.Logger.LogExcStr(exc, "Save project failed"); } }
public void SaveProject(string filename) { try { if (filename != null) _projectFilename = filename; if (_projectFilename == null) return; // Save current item settings for windows. _windowManager.GetWindowItems(_project.Windows, _project.Items); if (_currentItem != null) _project.ProjectItem = _currentItem.GetID(); else _project.ProjectItem = string.Empty; // Save the favourites and ignores along with the project. _windowManager.Favourites.GetAll(_project.Favourites); _windowManager.SetCaption(_projectFilename); Hwd.Serialization.Encoder encoder = new Hwd.Serialization.Encoder(); string s = encoder.Encode(_project); File.WriteAllText(_projectFilename, s); SetCaption(); } catch (SerializationException exc) { _windowManager.Logger.LogExcStr(exc, "Deserializing project failed"); } catch (IOException exc) { _windowManager.Logger.LogExcStr(exc, "Save project failed"); } }