/// <summary> /// Saves the specified data <paramref name="dataToSerialize"/>. /// </summary> /// <param name="dataToSerialize">Data to be serialized.</param> /// <exception cref="System.InvalidOperationException">An error occurred during serialization. The original exception is available using the System.Exception.InnerException property.</exception> /// <exception cref="System.UnauthorizedAccessException:">Access is denied.</exception> /// <exception cref="System.ArgumentException">path is an empty string(""). -or- path contains the name of a system device (com1, com2, and so on)</exception> /// <exception cref="System.ArgumentNullException">path is null.</exception> /// <exception cref="System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive.</exception> /// <exception cref="System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. /// For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. /// </exception> /// <exception cref="System.IO.IOException">path includes an incorrect or invalid syntax for file name, directory name, or volume label syntax.</exception> /// <exception cref="System.Security.SecurityException">The caller does not have the required permission.</exception> protected void Save(Type4Serialization modelDesign) { try { XmlFile.DataToSerialize <Type4Serialization> dataToSerialize = PrepareDataToSerialize(modelDesign); GraphicalUserInterface.UseWaitCursor = true; BeforeWrite?.Invoke(this, new StringEventArgs(DefaultFileName)); XmlFile.WriteXmlFile <Type4Serialization>(dataToSerialize.Data, DefaultFileName, FileMode.Create, dataToSerialize.StylesheetName, dataToSerialize.XmlNamespaces); ChangesArePresent = false; } catch (Exception ex) { GraphicalUserInterface.MessageBoxShowExclamation(ex.Message, Properties.Resources.SolutionFileSaveError); } finally { GraphicalUserInterface.UseWaitCursor = false; } }
private void Save(XmlFile.DataToSerialize <Type4Serialization> cd) { BeforeWrite?.Invoke(this, new StringEventArgs(DefaultFileName)); XmlFile.WriteXmlFile <Type4Serialization>(cd.Data, DefaultFileName, FileMode.Create, cd.StylesheetName, cd.XmlNamespaces); ChangesArePresent = false; }