/// <summary> /// Function to serialize this file into an XML element. /// </summary> /// <returns>An XML element containing the serialized contents of the file object.</returns> internal XElement Serialize() { var result = new XElement(EditorFileNode, new XAttribute(EditorFilePathAttr, FilePath), new XAttribute(EditorFilePlugInTypeAttr, PlugInType ?? string.Empty)); if (DependsOn.Count > 0) { // Serialize any dependencies. result.Add(new XElement(EditorDependenciesNodeRoot, DependsOn.Serialize())); } if (Attributes.Count == 0) { return(result); } // Add custom attributes. var root = new XElement(EditorFileCustomNodeRoot); foreach (KeyValuePair <string, string> attr in Attributes.Where(attr => !string.IsNullOrWhiteSpace(attr.Key))) { root.Add(new XElement(EditorFileCustomNode, new XAttribute(EditorCustomNameAttr, attr.Key), attr.Value)); } result.Add(root); return(result); }