本文整理汇总了C#中Chummer.Character.PrintToStream方法的典型用法代码示例。如果您正苦于以下问题:C# Character.PrintToStream方法的具体用法?C# Character.PrintToStream怎么用?C# Character.PrintToStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chummer.Character
的用法示例。
在下文中一共展示了Character.PrintToStream方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: cmdPrint_Click
private void cmdPrint_Click(object sender, EventArgs e)
{
prgProgress.Value = 0;
prgProgress.Maximum = treCharacters.Nodes.Count;
// Write the Character information to a MemoryStream so we don't need to create any files.
MemoryStream objStream = new MemoryStream();
XmlTextWriter objWriter = new XmlTextWriter(objStream, Encoding.UTF8);
// Being the document.
objWriter.WriteStartDocument();
// <characters>
objWriter.WriteStartElement("characters");
// Fire the PrintToStream method for all of the characters in the list.
foreach (TreeNode objNode in treCharacters.Nodes)
{
Character objCharacter = new Character();
objCharacter.FileName = objNode.Tag.ToString();
objCharacter.Load();
objCharacter.PrintToStream(objStream, objWriter);
prgProgress.Value++;
Application.DoEvents();
}
// Finish the document and flush the Writer and Stream.
// </characters>
objWriter.WriteEndElement();
objWriter.WriteEndDocument();
objWriter.Flush();
objStream.Flush();
// Read the stream.
StreamReader objReader = new StreamReader(objStream);
objStream.Position = 0;
XmlDocument objCharacterXML = new XmlDocument();
// Put the stream into an XmlDocument and send it off to the Viewer.
string strXML = objReader.ReadToEnd();
objCharacterXML.LoadXml(strXML);
objWriter.Close();
// Set the ProgressBar back to 0.
prgProgress.Value = 0;
frmViewer frmViewCharacter = new frmViewer();
frmViewCharacter.CharacterXML = objCharacterXML;
frmViewCharacter.SelectedSheet = "Game Master Summary";
frmViewCharacter.ShowDialog();
}