internal static void WriteToPS1XML(PSCmdlet cmdlet, List <ExtendedTypeDefinition> typeDefinitions, string filepath, bool force, bool noclobber, bool writeScritBlock, bool isLiteralPath) { StreamWriter writer; FileStream stream; FileInfo info; PathUtils.MasterStreamOpen(cmdlet, filepath, "ascii", true, false, force, noclobber, out stream, out writer, out info, isLiteralPath); XmlWriter writer2 = XmlWriter.Create(writer); FormatXMLHelper.WriteToXML(writer2, typeDefinitions, writeScritBlock); writer2.Close(); writer.Close(); stream.Close(); }
private void GenerateFormatFile(TextWriter writer, List <ExtendedTypeDefinition> listOfFormatData) { if (writer == null) { throw PSTraceSource.NewArgumentNullException("writer"); } if (listOfFormatData == null) { throw PSTraceSource.NewArgumentNullException("listOfFormatData"); } XmlWriterSettings settings = new XmlWriterSettings { CloseOutput = false, ConformanceLevel = ConformanceLevel.Document, Encoding = writer.Encoding, Indent = true }; using (XmlWriter writer2 = XmlWriter.Create(writer, settings)) { FormatXMLHelper.WriteToXML(writer2, listOfFormatData, false); } }