当前位置: 首页>>代码示例>>C#>>正文


C# Character.PrintToStream方法代码示例

本文整理汇总了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();
		}
开发者ID:AMDX9,项目名称:chummer5a,代码行数:52,代码来源:frmPrintMultiple.cs


注:本文中的Chummer.Character.PrintToStream方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。