internal static void Write(Stream stream, Dictionary<string, object> plist)
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.XmlResolver = null;
XmlDeclaration xmlDecl = xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", null);
xmlDoc.AppendChild(xmlDecl);
XmlDocumentType xmlDocType = xmlDoc.CreateDocumentType("plist", "-//Apple//DTD PLIST 1.0//EN", "http://www.apple.com/DTDs/PropertyList-1.0.dtd", null);
xmlDoc.AppendChild(xmlDocType);
XmlElement rootElement = xmlDoc.CreateElement("plist");
rootElement.SetAttribute("Version", "1.0");
xmlDoc.AppendChild(rootElement);
xmlDoc.DocumentElement.SetAttribute("Version", "1.0");
rootElement.AppendChild(CreateNode(xmlDoc, plist));
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.Encoding = Encoding.UTF8;
using (XmlWriter xw = XmlTextWriter.Create(stream, settings))
{
xmlDoc.Save(xw);
}
}