/// <summary> /// Saves the image editors in the collection to the editors.xml file. /// </summary> public void SaveToXmlFile() { try { XmlWriterSettings xSettings = new XmlWriterSettings { Indent = true, CloseOutput = true, CheckCharacters = true, Encoding = Encoding.UTF8, NewLineChars = Environment.NewLine, IndentChars = XML_FILE_INDENT_CHARS, NewLineHandling = NewLineHandling.Entitize, ConformanceLevel = ConformanceLevel.Document }; if (string.IsNullOrEmpty(FileSystem.EditorsFile)) { FileSystem.EditorsFile = FileSystem.DefaultEditorsFile; if (FileSystem.FileExists(FileSystem.ConfigFile)) { FileSystem.AppendToFile(FileSystem.ConfigFile, "\nEditorsFile=" + FileSystem.EditorsFile); } } if (FileSystem.FileExists(FileSystem.EditorsFile)) { FileSystem.DeleteFile(FileSystem.EditorsFile); } using (XmlWriter xWriter = XmlWriter.Create(FileSystem.EditorsFile, xSettings)) { xWriter.WriteStartDocument(); xWriter.WriteStartElement(XML_FILE_ROOT_NODE); xWriter.WriteAttributeString("app", "version", XML_FILE_ROOT_NODE, Settings.ApplicationVersion); xWriter.WriteAttributeString("app", "codename", XML_FILE_ROOT_NODE, Settings.ApplicationCodename); xWriter.WriteStartElement(XML_FILE_EDITORS_NODE); foreach (Editor editor in base.Collection) { xWriter.WriteStartElement(XML_FILE_EDITOR_NODE); xWriter.WriteElementString(EDITOR_NAME, editor.Name); xWriter.WriteElementString(EDITOR_APPLICATION, editor.Application); xWriter.WriteElementString(EDITOR_ARGUMENTS, editor.Arguments); xWriter.WriteEndElement(); } xWriter.WriteEndElement(); xWriter.WriteEndElement(); xWriter.WriteEndDocument(); xWriter.Flush(); xWriter.Close(); } } catch (Exception ex) { Log.WriteExceptionMessage("EditorCollection::SaveToXmlFile", ex); } }