internal Exception SaveInternal(string path = null) { Exception caught_exception = null; try { if (path == null) { path = Model.ProjectFilePath; } if (path.IsNullOrEmpty()) { throw new InvalidOperationException( "Tried to save project with a null-or-empty path."); } using (var s = XmlElementStream.CreateForWrite(PhxStudioProject.XmlRootName)) { s.InitializeAtRootElement(); Model.Serialize(s); s.Document.Save(path); } } catch (Exception ex) { caught_exception = ex; } return(caught_exception); }
internal Exception OpenInternal(string path) { Exception caught_exception = null; try { var opened_project_model = new PhxStudioProject(); using (var s = new XmlElementStream(path, FileAccess.Read)) { s.InitializeAtRootElement(); opened_project_model.Serialize(s); } this.Model = opened_project_model; } catch (Exception ex) { caught_exception = ex; } return(caught_exception); }